summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.fossil-settings/encoding-glob2
-rw-r--r--.fossil-settings/ignore-glob1
-rw-r--r--.github/workflows/linux-build.yml29
-rw-r--r--.github/workflows/linux-with-tcl8-build.yml186
-rw-r--r--.github/workflows/linux-with-tcl9-build.yml172
-rw-r--r--.github/workflows/mac-build.yml5
-rw-r--r--.github/workflows/onefiledist.yml213
-rw-r--r--.github/workflows/win-build.yml4
-rw-r--r--.project2
-rw-r--r--.travis.yml61
-rw-r--r--ChangeLog4
-rw-r--r--ChangeLog.20022
-rw-r--r--ChangeLog.20044
-rw-r--r--README.md10
-rw-r--r--changes151
-rw-r--r--compat/stdbool.h37
-rw-r--r--compat/stdint.h919
-rw-r--r--compat/stdlib.h40
-rw-r--r--compat/unistd.h80
-rw-r--r--doc/AddOption.32
-rw-r--r--doc/ConfigWidg.314
-rw-r--r--doc/CrtImgType.321
-rw-r--r--doc/CrtItemType.345
-rw-r--r--doc/CrtPhImgFmt.3294
-rw-r--r--doc/EventHndlr.317
-rw-r--r--doc/FreeXId.320
-rw-r--r--doc/GetFont.38
-rw-r--r--doc/GetHINSTANCE.32
-rw-r--r--doc/GetHWND.32
-rw-r--r--doc/GetPixels.38
-rw-r--r--doc/GetScroll.311
-rw-r--r--doc/Grab.32
-rw-r--r--doc/HWNDToWindow.32
-rw-r--r--doc/ImgChanged.38
-rw-r--r--doc/Inactive.32
-rw-r--r--doc/ManageGeom.314
-rw-r--r--doc/NameOfImg.310
-rw-r--r--doc/ParseArgv.312
-rw-r--r--doc/SetClassProcs.32
-rw-r--r--doc/SetOptions.319
-rw-r--r--doc/WindowId.312
-rw-r--r--doc/bind.n80
-rw-r--r--doc/bitmap.n2
-rw-r--r--doc/busy.n84
-rw-r--r--doc/button.n2
-rw-r--r--doc/canvas.n119
-rw-r--r--doc/checkbutton.n2
-rw-r--r--doc/chooseDirectory.n2
-rw-r--r--doc/clipboard.n2
-rw-r--r--doc/colors.n21
-rw-r--r--doc/console.n2
-rw-r--r--doc/cursors.n2
-rw-r--r--doc/entry.n18
-rw-r--r--doc/event.n28
-rw-r--r--doc/focus.n2
-rw-r--r--doc/font.n2
-rw-r--r--doc/fontchooser.n4
-rw-r--r--doc/frame.n23
-rw-r--r--doc/grab.n2
-rw-r--r--doc/grid.n30
-rw-r--r--doc/image.n2
-rw-r--r--doc/keysyms.n633
-rw-r--r--doc/label.n2
-rw-r--r--doc/labelframe.n2
-rw-r--r--doc/listbox.n23
-rw-r--r--doc/man.macros267
-rw-r--r--doc/menu.n16
-rw-r--r--doc/menubar.n2
-rw-r--r--doc/menubutton.n2
-rw-r--r--doc/message.n2
-rw-r--r--doc/options.n10
-rw-r--r--doc/pack.n16
-rw-r--r--doc/panedwindow.n2
-rw-r--r--doc/photo.n471
-rw-r--r--doc/place.n8
-rw-r--r--doc/popup.n2
-rw-r--r--doc/print.n63
-rw-r--r--doc/radiobutton.n2
-rw-r--r--doc/scale.n2
-rw-r--r--doc/scrollbar.n25
-rw-r--r--doc/selection.n2
-rw-r--r--doc/send.n2
-rw-r--r--doc/spinbox.n24
-rw-r--r--doc/sysnotify.n56
-rw-r--r--doc/systray.n65
-rw-r--r--doc/text.n58
-rw-r--r--doc/tk.n25
-rw-r--r--doc/tk4.0.ps556
-rw-r--r--doc/tkvars.n2
-rw-r--r--doc/toplevel.n24
-rw-r--r--doc/ttk_button.n8
-rw-r--r--doc/ttk_checkbutton.n7
-rw-r--r--doc/ttk_combobox.n39
-rw-r--r--doc/ttk_entry.n38
-rw-r--r--doc/ttk_frame.n7
-rw-r--r--doc/ttk_intro.n2
-rw-r--r--doc/ttk_label.n30
-rw-r--r--doc/ttk_labelframe.n7
-rw-r--r--doc/ttk_menubutton.n7
-rw-r--r--doc/ttk_notebook.n18
-rw-r--r--doc/ttk_panedwindow.n17
-rw-r--r--doc/ttk_progressbar.n35
-rw-r--r--doc/ttk_radiobutton.n7
-rw-r--r--doc/ttk_scale.n29
-rw-r--r--doc/ttk_scrollbar.n37
-rw-r--r--doc/ttk_separator.n7
-rw-r--r--doc/ttk_sizegrip.n7
-rw-r--r--doc/ttk_spinbox.n4
-rw-r--r--doc/ttk_style.n20
-rw-r--r--doc/ttk_treeview.n44
-rw-r--r--doc/ttk_widget.n58
-rw-r--r--doc/winfo.n2
-rw-r--r--doc/wish.12
-rw-r--r--generic/ks_names.h494
-rw-r--r--generic/nanosvg.h3122
-rw-r--r--generic/nanosvgrast.h1469
-rw-r--r--generic/tk.decls148
-rw-r--r--generic/tk.h314
-rw-r--r--generic/tk3d.c8
-rw-r--r--generic/tk3d.h6
-rw-r--r--generic/tkArgv.c16
-rw-r--r--generic/tkArray.h10
-rw-r--r--generic/tkAtom.c8
-rw-r--r--generic/tkBind.c323
-rw-r--r--generic/tkBitmap.c14
-rw-r--r--generic/tkBusy.c47
-rw-r--r--generic/tkButton.c401
-rw-r--r--generic/tkButton.h2
-rw-r--r--generic/tkCanvArc.c300
-rw-r--r--generic/tkCanvBmap.c87
-rw-r--r--generic/tkCanvImg.c63
-rw-r--r--generic/tkCanvLine.c254
-rw-r--r--generic/tkCanvPoly.c212
-rw-r--r--generic/tkCanvPs.c52
-rw-r--r--generic/tkCanvText.c225
-rw-r--r--generic/tkCanvUtil.c140
-rw-r--r--generic/tkCanvWind.c81
-rw-r--r--generic/tkCanvas.c1273
-rw-r--r--generic/tkCanvas.h10
-rw-r--r--generic/tkClipboard.c47
-rw-r--r--generic/tkCmds.c296
-rw-r--r--generic/tkColor.c8
-rw-r--r--generic/tkColor.h6
-rw-r--r--generic/tkConfig.c284
-rw-r--r--generic/tkConsole.c8
-rw-r--r--generic/tkCursor.c12
-rw-r--r--generic/tkDList.h22
-rw-r--r--generic/tkDecls.h251
-rw-r--r--generic/tkEntry.c836
-rw-r--r--generic/tkEntry.h31
-rw-r--r--generic/tkError.c13
-rw-r--r--generic/tkEvent.c55
-rw-r--r--generic/tkFileFilter.c28
-rw-r--r--generic/tkFileFilter.h10
-rw-r--r--generic/tkFocus.c12
-rw-r--r--generic/tkFont.c128
-rw-r--r--generic/tkFont.h14
-rw-r--r--generic/tkFrame.c452
-rw-r--r--generic/tkGC.c8
-rw-r--r--generic/tkGeometry.c14
-rw-r--r--generic/tkGet.c4
-rw-r--r--generic/tkGrab.c37
-rw-r--r--generic/tkGrid.c93
-rw-r--r--generic/tkImage.c8
-rw-r--r--generic/tkImgBmap.c53
-rw-r--r--generic/tkImgGIF.c395
-rw-r--r--generic/tkImgListFormat.c1146
-rw-r--r--generic/tkImgPNG.c463
-rw-r--r--generic/tkImgPPM.c23
-rw-r--r--generic/tkImgPhInstance.c105
-rw-r--r--generic/tkImgPhoto.c1280
-rw-r--r--generic/tkImgPhoto.h52
-rw-r--r--generic/tkImgSVGnano.c880
-rw-r--r--generic/tkImgUtil.c4
-rw-r--r--generic/tkInt.decls497
-rw-r--r--generic/tkInt.h226
-rw-r--r--generic/tkIntDecls.h211
-rw-r--r--generic/tkIntPlatDecls.h36
-rw-r--r--generic/tkIntXlibDecls.h542
-rw-r--r--generic/tkListbox.c244
-rw-r--r--generic/tkMacWinMenu.c8
-rw-r--r--generic/tkMain.c29
-rw-r--r--generic/tkMenu.c469
-rw-r--r--generic/tkMenu.h26
-rw-r--r--generic/tkMenuDraw.c35
-rw-r--r--generic/tkMenubutton.c128
-rw-r--r--generic/tkMenubutton.h2
-rw-r--r--generic/tkMessage.c101
-rw-r--r--generic/tkObj.c107
-rw-r--r--generic/tkOldConfig.c69
-rw-r--r--generic/tkOldTest.c38
-rw-r--r--generic/tkOption.c13
-rw-r--r--generic/tkPack.c66
-rw-r--r--generic/tkPanedWindow.c147
-rw-r--r--generic/tkPkgConfig.c172
-rw-r--r--generic/tkPlace.c115
-rw-r--r--generic/tkPlatDecls.h63
-rw-r--r--generic/tkPointer.c30
-rw-r--r--generic/tkRectOval.c139
-rw-r--r--generic/tkScale.c116
-rw-r--r--generic/tkScale.h6
-rw-r--r--generic/tkScrollbar.c89
-rw-r--r--generic/tkScrollbar.h28
-rw-r--r--generic/tkSelect.c40
-rw-r--r--generic/tkSelect.h16
-rw-r--r--generic/tkSquare.c56
-rw-r--r--generic/tkStubInit.c379
-rw-r--r--generic/tkStubLib.c30
-rw-r--r--generic/tkStyle.c82
-rw-r--r--generic/tkTest.c344
-rw-r--r--generic/tkText.c386
-rw-r--r--generic/tkText.h30
-rw-r--r--generic/tkTextBTree.c40
-rw-r--r--generic/tkTextDisp.c147
-rw-r--r--generic/tkTextImage.c51
-rw-r--r--generic/tkTextIndex.c51
-rw-r--r--generic/tkTextMark.c18
-rw-r--r--generic/tkTextTag.c75
-rw-r--r--generic/tkTextWind.c36
-rw-r--r--generic/tkTrig.c7
-rw-r--r--generic/tkUndo.c4
-rw-r--r--generic/tkUndo.h2
-rw-r--r--generic/tkUtil.c150
-rw-r--r--generic/tkVisual.c20
-rw-r--r--generic/tkWindow.c132
-rw-r--r--generic/ttk/ttk.decls8
-rw-r--r--generic/ttk/ttkBlink.c10
-rw-r--r--generic/ttk/ttkButton.c115
-rw-r--r--generic/ttk/ttkCache.c36
-rw-r--r--generic/ttk/ttkClamTheme.c152
-rw-r--r--generic/ttk/ttkClassicTheme.c86
-rw-r--r--generic/ttk/ttkDecls.h32
-rw-r--r--generic/ttk/ttkDefaultTheme.c327
-rw-r--r--generic/ttk/ttkElements.c486
-rw-r--r--generic/ttk/ttkEntry.c531
-rw-r--r--generic/ttk/ttkFrame.c37
-rw-r--r--generic/ttk/ttkGenStubs.tcl1009
-rw-r--r--generic/ttk/ttkImage.c51
-rw-r--r--generic/ttk/ttkInit.c80
-rw-r--r--generic/ttk/ttkLabel.c87
-rw-r--r--generic/ttk/ttkLayout.c22
-rw-r--r--generic/ttk/ttkManager.c72
-rw-r--r--generic/ttk/ttkManager.h58
-rw-r--r--generic/ttk/ttkNotebook.c206
-rw-r--r--generic/ttk/ttkPanedwindow.c83
-rw-r--r--generic/ttk/ttkProgress.c113
-rw-r--r--generic/ttk/ttkScale.c54
-rw-r--r--generic/ttk/ttkScroll.c10
-rw-r--r--generic/ttk/ttkScrollbar.c20
-rw-r--r--generic/ttk/ttkSeparator.c22
-rw-r--r--generic/ttk/ttkSquare.c60
-rw-r--r--generic/ttk/ttkState.c8
-rw-r--r--generic/ttk/ttkStubInit.c12
-rw-r--r--generic/ttk/ttkStubLib.c12
-rw-r--r--generic/ttk/ttkTagSet.c26
-rw-r--r--generic/ttk/ttkTheme.c68
-rw-r--r--generic/ttk/ttkTheme.h66
-rw-r--r--generic/ttk/ttkThemeInt.h4
-rw-r--r--generic/ttk/ttkTrace.c6
-rw-r--r--generic/ttk/ttkTrack.c10
-rw-r--r--generic/ttk/ttkTreeview.c323
-rw-r--r--generic/ttk/ttkWidget.c79
-rw-r--r--generic/ttk/ttkWidget.h29
-rw-r--r--library/bgerror.tcl8
-rw-r--r--library/button.tcl24
-rw-r--r--library/choosedir.tcl2
-rw-r--r--library/clrpick.tcl4
-rw-r--r--library/comdlg.tcl2
-rw-r--r--library/console.tcl97
-rw-r--r--library/demos/combo.tcl3
-rw-r--r--library/demos/entry1.tcl2
-rw-r--r--library/demos/entry2.tcl1
-rw-r--r--library/demos/entry3.tcl8
-rw-r--r--library/demos/goldberg.tcl8
-rw-r--r--library/demos/knightstour.tcl6
-rw-r--r--library/demos/menu.tcl9
-rw-r--r--library/demos/pendulum.tcl4
-rw-r--r--library/demos/print.tcl53
-rw-r--r--library/demos/spin.tcl2
-rw-r--r--library/demos/square4
-rw-r--r--library/demos/systray.tcl89
-rw-r--r--library/demos/tclIndex2
-rw-r--r--library/demos/toolbar.tcl2
-rw-r--r--library/demos/ttkbut.tcl2
-rw-r--r--library/demos/ttkprogress.tcl2
-rw-r--r--library/demos/unicodeout.tcl49
-rw-r--r--library/demos/widget89
-rw-r--r--library/dialog.tcl4
-rw-r--r--library/entry.tcl33
-rw-r--r--library/focus.tcl2
-rw-r--r--library/fontchooser.tcl4
-rw-r--r--library/iconlist.tcl39
-rw-r--r--library/icons.tcl2
-rw-r--r--library/images/logo.eps10
-rw-r--r--library/images/pwrdLogo.eps10
-rw-r--r--library/listbox.tcl84
-rw-r--r--library/megawidget.tcl4
-rw-r--r--library/menu.tcl36
-rw-r--r--library/msgbox.tcl2
-rw-r--r--library/msgs/cs.msg100
-rw-r--r--library/msgs/da.msg48
-rw-r--r--library/msgs/de.msg54
-rw-r--r--library/msgs/el.msg154
-rw-r--r--library/msgs/en.msg19
-rw-r--r--library/msgs/eo.msg40
-rw-r--r--library/msgs/es.msg36
-rw-r--r--library/msgs/fr.msg44
-rw-r--r--library/msgs/hu.msg142
-rw-r--r--library/msgs/it.msg26
-rw-r--r--library/msgs/nl.msg24
-rw-r--r--library/msgs/pl.msg74
-rw-r--r--library/msgs/pt.msg46
-rw-r--r--library/msgs/ru.msg156
-rw-r--r--library/msgs/sv.msg64
-rw-r--r--library/obsolete.tcl6
-rw-r--r--library/optMenu.tcl4
-rw-r--r--library/palette.tcl2
-rw-r--r--library/print.tcl995
-rw-r--r--library/safetk.tcl2
-rw-r--r--library/scale.tcl18
-rw-r--r--library/scrlbar.tcl60
-rw-r--r--library/spinbox.tcl65
-rw-r--r--library/systray.tcl328
-rw-r--r--library/tclIndex2
-rw-r--r--library/tearoff.tcl4
-rw-r--r--library/text.tcl231
-rw-r--r--library/tk.tcl119
-rw-r--r--library/tkfbox.tcl4
-rw-r--r--library/ttk/button.tcl2
-rw-r--r--library/ttk/combobox.tcl29
-rw-r--r--library/ttk/cursors.tcl33
-rw-r--r--library/ttk/entry.tcl30
-rw-r--r--library/ttk/fonts.tcl12
-rw-r--r--library/ttk/notebook.tcl19
-rw-r--r--library/ttk/scale.tcl2
-rw-r--r--library/ttk/scrollbar.tcl18
-rw-r--r--library/ttk/spinbox.tcl18
-rw-r--r--library/ttk/utils.tcl57
-rw-r--r--library/ttk/vistaTheme.tcl1
-rw-r--r--library/xmfbox.tcl15
-rw-r--r--macosx/GNUmakefile4
-rw-r--r--macosx/README36
-rw-r--r--macosx/Tk-Common.xcconfig8
-rw-r--r--macosx/Tk.xcode/project.pbxproj41
-rw-r--r--macosx/Tk.xcodeproj/project.pbxproj42
-rw-r--r--macosx/configure.ac2
-rw-r--r--macosx/tkMacOSXBitmap.c6
-rw-r--r--macosx/tkMacOSXButton.c12
-rw-r--r--macosx/tkMacOSXClipboard.c7
-rw-r--r--macosx/tkMacOSXColor.c56
-rw-r--r--macosx/tkMacOSXColor.h69
-rw-r--r--macosx/tkMacOSXConfig.c8
-rw-r--r--macosx/tkMacOSXConstants.h2
-rw-r--r--macosx/tkMacOSXCursor.c52
-rw-r--r--macosx/tkMacOSXCursors.h6
-rw-r--r--macosx/tkMacOSXDebug.c4
-rw-r--r--macosx/tkMacOSXDebug.h4
-rw-r--r--macosx/tkMacOSXDefault.h22
-rw-r--r--macosx/tkMacOSXDialog.c22
-rw-r--r--macosx/tkMacOSXDraw.c98
-rw-r--r--macosx/tkMacOSXEmbed.c73
-rw-r--r--macosx/tkMacOSXEntry.c6
-rw-r--r--macosx/tkMacOSXEvent.c28
-rw-r--r--macosx/tkMacOSXEvent.h25
-rw-r--r--macosx/tkMacOSXFont.c11
-rw-r--r--macosx/tkMacOSXFont.h8
-rw-r--r--macosx/tkMacOSXHLEvents.c102
-rw-r--r--macosx/tkMacOSXImage.c37
-rw-r--r--macosx/tkMacOSXInit.c11
-rw-r--r--macosx/tkMacOSXInt.h22
-rw-r--r--macosx/tkMacOSXKeyEvent.c35
-rw-r--r--macosx/tkMacOSXKeyboard.c14
-rw-r--r--macosx/tkMacOSXKeysyms.h10
-rw-r--r--macosx/tkMacOSXMenu.c81
-rw-r--r--macosx/tkMacOSXMenubutton.c10
-rw-r--r--macosx/tkMacOSXMenus.c58
-rw-r--r--macosx/tkMacOSXMouseEvent.c101
-rw-r--r--macosx/tkMacOSXNotify.c36
-rw-r--r--macosx/tkMacOSXPort.h47
-rw-r--r--macosx/tkMacOSXPrint.c353
-rw-r--r--macosx/tkMacOSXPrivate.h28
-rw-r--r--macosx/tkMacOSXRegion.c86
-rw-r--r--macosx/tkMacOSXScale.c19
-rw-r--r--macosx/tkMacOSXScrlbr.c13
-rw-r--r--macosx/tkMacOSXSend.c21
-rw-r--r--macosx/tkMacOSXServices.c7
-rw-r--r--macosx/tkMacOSXSubwindows.c56
-rw-r--r--macosx/tkMacOSXSysTray.c497
-rw-r--r--macosx/tkMacOSXTest.c8
-rw-r--r--macosx/tkMacOSXWindowEvent.c16
-rw-r--r--macosx/tkMacOSXWm.c130
-rw-r--r--macosx/tkMacOSXWm.h5
-rw-r--r--macosx/tkMacOSXXCursors.h6
-rw-r--r--macosx/tkMacOSXXStubs.c361
-rw-r--r--macosx/ttkMacOSXTheme.c64
-rw-r--r--tests/all.tcl4
-rw-r--r--tests/arc.tcl6
-rw-r--r--tests/bell.test4
-rw-r--r--tests/bgerror.test4
-rw-r--r--tests/bind.test1082
-rw-r--r--tests/bitmap.test4
-rw-r--r--tests/border.test5
-rw-r--r--tests/busy.test80
-rw-r--r--tests/button.test86
-rw-r--r--tests/canvImg.test6
-rw-r--r--tests/canvMoveto.test6
-rw-r--r--tests/canvPs.test8
-rw-r--r--tests/canvRect.test4
-rw-r--r--tests/canvText.test20
-rw-r--r--tests/canvWind.test4
-rw-r--r--tests/canvas.test335
-rw-r--r--tests/choosedir.test8
-rw-r--r--tests/clipboard.test4
-rw-r--r--tests/clrpick.test8
-rw-r--r--tests/cmds.test4
-rw-r--r--tests/color.test4
-rw-r--r--tests/config.test54
-rw-r--r--tests/constraints.tcl2
-rw-r--r--tests/cursor.test4
-rw-r--r--tests/dialog.test10
-rw-r--r--tests/earth.gifbin51712 -> 51559 bytes
-rw-r--r--tests/embed.test4
-rw-r--r--tests/entry.test69
-rw-r--r--tests/event.test120
-rw-r--r--tests/filebox.test8
-rw-r--r--tests/focus.test10
-rw-r--r--tests/focusTcl.test4
-rw-r--r--tests/font.test88
-rw-r--r--tests/fontchooser.test14
-rw-r--r--tests/frame.test862
-rw-r--r--tests/geometry.test8
-rw-r--r--tests/get.test4
-rw-r--r--tests/grab.test4
-rw-r--r--tests/grid.test162
-rw-r--r--tests/image.test12
-rw-r--r--tests/imgBmap.test8
-rw-r--r--tests/imgListFormat.test661
-rw-r--r--tests/imgPNG.test62
-rw-r--r--tests/imgPPM.test4
-rw-r--r--tests/imgPhoto.test1212
-rw-r--r--tests/imgSVGnano.test262
-rw-r--r--tests/listbox.test22
-rw-r--r--tests/main.test13
-rw-r--r--tests/menu.test610
-rw-r--r--tests/menuDraw.test6
-rw-r--r--tests/menubut.test30
-rw-r--r--tests/message.test20
-rw-r--r--tests/msgbox.test8
-rw-r--r--tests/obj.test4
-rw-r--r--tests/oldpack.test20
-rw-r--r--tests/option.test8
-rw-r--r--tests/pack.test140
-rw-r--r--tests/packgrid.test18
-rw-r--r--tests/panedwindow.test10
-rw-r--r--tests/pkgconfig.test69
-rw-r--r--tests/place.test51
-rw-r--r--tests/raise.test6
-rw-r--r--tests/safe.test6
-rw-r--r--tests/safePrimarySelection.test40
-rw-r--r--tests/scale.test80
-rw-r--r--tests/scrollbar.test81
-rw-r--r--tests/select.test4
-rw-r--r--tests/send.test12
-rw-r--r--tests/spinbox.test78
-rw-r--r--tests/systray.test223
-rw-r--r--tests/teapotTransparent.pngbin0 -> 45519 bytes
-rw-r--r--tests/text.test396
-rw-r--r--tests/textBTree.test6
-rw-r--r--tests/textDisp.test130
-rw-r--r--tests/textImage.test2
-rw-r--r--tests/textIndex.test38
-rw-r--r--tests/textMark.test10
-rw-r--r--tests/textTag.test681
-rw-r--r--tests/textWind.test10
-rw-r--r--tests/tk.test26
-rw-r--r--tests/ttk/all.tcl4
-rw-r--r--tests/ttk/checkbutton.test18
-rw-r--r--tests/ttk/combobox.test16
-rw-r--r--tests/ttk/entry.test58
-rw-r--r--tests/ttk/image.test2
-rw-r--r--tests/ttk/labelframe.test16
-rw-r--r--tests/ttk/layout.test2
-rw-r--r--tests/ttk/notebook.test16
-rw-r--r--tests/ttk/panedwindow.test20
-rw-r--r--tests/ttk/progressbar.test57
-rw-r--r--tests/ttk/radiobutton.test16
-rw-r--r--tests/ttk/scale.test53
-rw-r--r--tests/ttk/scrollbar.test88
-rw-r--r--tests/ttk/spinbox.test18
-rw-r--r--tests/ttk/treetags.test27
-rw-r--r--tests/ttk/treeview.test26
-rw-r--r--tests/ttk/ttk.test21
-rw-r--r--tests/ttk/validate.test2
-rw-r--r--tests/ttk/vsapi.test2
-rw-r--r--tests/unixButton.test6
-rw-r--r--tests/unixEmbed.test40
-rw-r--r--tests/unixFont.test16
-rw-r--r--tests/unixMenu.test4
-rw-r--r--tests/unixSelect.test72
-rw-r--r--tests/unixWm.test28
-rw-r--r--tests/util.test22
-rw-r--r--tests/visual.test14
-rw-r--r--tests/visual_bb.test6
-rw-r--r--tests/winButton.test6
-rw-r--r--tests/winClipboard.test13
-rwxr-xr-xtests/winDialog.test42
-rw-r--r--tests/winFont.test22
-rw-r--r--tests/winMenu.test4
-rw-r--r--tests/winMsgbox.test12
-rw-r--r--tests/winSend.test16
-rw-r--r--tests/winWm.test13
-rw-r--r--tests/window.test4
-rw-r--r--tests/winfo.test28
-rw-r--r--tests/wm.test36
-rw-r--r--tests/xmfbox.test4
-rw-r--r--unix/Makefile.in314
-rwxr-xr-xunix/configure13617
-rw-r--r--unix/configure.ac (renamed from unix/configure.in)254
-rw-r--r--unix/tcl.m4619
-rw-r--r--unix/tk.pc.in1
-rw-r--r--unix/tk.spec6
-rw-r--r--unix/tkAppInit.c3
-rw-r--r--unix/tkConfig.h.in92
-rw-r--r--unix/tkConfig.sh.in3
-rw-r--r--unix/tkUnix.c7
-rw-r--r--unix/tkUnix3d.c4
-rw-r--r--unix/tkUnixButton.c2
-rw-r--r--unix/tkUnixColor.c16
-rw-r--r--unix/tkUnixConfig.c6
-rw-r--r--unix/tkUnixCursor.c6
-rw-r--r--unix/tkUnixDefault.h64
-rw-r--r--unix/tkUnixDialog.c4
-rw-r--r--unix/tkUnixDraw.c29
-rw-r--r--unix/tkUnixEmbed.c47
-rw-r--r--unix/tkUnixEvent.c48
-rw-r--r--unix/tkUnixFocus.c2
-rw-r--r--unix/tkUnixFont.c36
-rw-r--r--unix/tkUnixInit.c15
-rw-r--r--unix/tkUnixInt.h4
-rw-r--r--unix/tkUnixKey.c57
-rw-r--r--unix/tkUnixMenu.c32
-rw-r--r--unix/tkUnixMenubu.c3
-rw-r--r--unix/tkUnixPort.h65
-rw-r--r--unix/tkUnixRFont.c55
-rw-r--r--unix/tkUnixScale.c4
-rw-r--r--unix/tkUnixScrlbr.c2
-rw-r--r--unix/tkUnixSelect.c2
-rw-r--r--unix/tkUnixSend.c8
-rwxr-xr-xunix/tkUnixSysNotify.c221
-rw-r--r--unix/tkUnixSysTray.c1724
-rw-r--r--unix/tkUnixWm.c110
-rw-r--r--unix/tkUnixXId.c37
-rw-r--r--win/Makefile.in142
-rw-r--r--win/README2
-rwxr-xr-xwin/configure8214
-rw-r--r--win/configure.ac (renamed from win/configure.in)122
-rw-r--r--win/makefile.vc132
-rw-r--r--win/mkd.bat12
-rw-r--r--win/nmakehlp.c4
-rw-r--r--win/rc/tk.rc10
-rw-r--r--win/rc/wish.rc10
-rw-r--r--win/rmd.bat20
-rw-r--r--win/tcl.m4335
-rw-r--r--win/tkConfig.sh.in5
-rw-r--r--win/tkWin.h12
-rw-r--r--win/tkWin32Dll.c3
-rw-r--r--win/tkWin3d.c4
-rw-r--r--win/tkWinButton.c7
-rw-r--r--win/tkWinClipboard.c32
-rw-r--r--win/tkWinColor.c37
-rw-r--r--win/tkWinConfig.c2
-rw-r--r--win/tkWinCursor.c17
-rw-r--r--win/tkWinDefault.h62
-rw-r--r--win/tkWinDialog.c144
-rw-r--r--win/tkWinDraw.c64
-rw-r--r--win/tkWinEmbed.c24
-rw-r--r--win/tkWinFont.c22
-rw-r--r--win/tkWinGDI.c3893
-rw-r--r--win/tkWinIco.c227
-rw-r--r--win/tkWinIco.h102
-rw-r--r--win/tkWinImage.c28
-rw-r--r--win/tkWinInit.c9
-rw-r--r--win/tkWinInt.h31
-rw-r--r--win/tkWinKey.c46
-rw-r--r--win/tkWinMenu.c76
-rw-r--r--win/tkWinPixmap.c10
-rw-r--r--win/tkWinPointer.c40
-rw-r--r--win/tkWinRegion.c9
-rw-r--r--win/tkWinScrlbr.c9
-rw-r--r--win/tkWinSend.c4
-rw-r--r--win/tkWinSendCom.c6
-rw-r--r--win/tkWinSendCom.h2
-rw-r--r--win/tkWinSysTray.c1193
-rw-r--r--win/tkWinTest.c37
-rw-r--r--win/tkWinWindow.c41
-rw-r--r--win/tkWinWm.c604
-rw-r--r--win/tkWinX.c267
-rw-r--r--win/ttkWinMonitor.c6
-rw-r--r--win/ttkWinTheme.c215
-rw-r--r--win/ttkWinXPTheme.c82
-rw-r--r--win/winMain.c6
-rw-r--r--win/wish.exe.manifest.in2
-rw-r--r--xlib/X11/X.h68
-rw-r--r--xlib/X11/Xfuncproto.h195
-rw-r--r--xlib/X11/Xlib.h3037
-rw-r--r--xlib/X11/Xutil.h467
-rw-r--r--xlib/X11/cursorfont.h34
-rw-r--r--xlib/X11/keysym.h12
-rw-r--r--xlib/X11/keysymdef.h457
-rw-r--r--xlib/xcolors.c161
-rw-r--r--xlib/xgc.c7
-rw-r--r--xlib/xutil.c4
612 files changed, 57071 insertions, 29115 deletions
diff --git a/.fossil-settings/encoding-glob b/.fossil-settings/encoding-glob
index d0ad4b9..23f106b 100644
--- a/.fossil-settings/encoding-glob
+++ b/.fossil-settings/encoding-glob
@@ -1,7 +1,5 @@
win/buildall.vc.bat
win/makefile.vc
-win/mkd.bat
-win/rmd.bat
win/rules-ext.vc
win/rules.vc
win/targets.vc
diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob
index 8100756..a1d9b34 100644
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -25,7 +25,6 @@
*/version.vc
*/libtk.vfs
*/libtk*.zip
-doc/man.macros
html
macosx/configure
win/Debug*
diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml
index ce382a1..191d477 100644
--- a/.github/workflows/linux-build.yml
+++ b/.github/workflows/linux-build.yml
@@ -14,14 +14,13 @@ jobs:
compiler:
- "gcc"
- "clang"
- symbols:
- - "no"
- - "mem"
- disables:
+ cfgopt:
- ""
+ - "CFLAGS=-DTK_NO_DEPRECATED=1"
- "--disable-shared"
- "--disable-xft"
- "--disable-xss"
+ - "--enable-symbols"
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -38,16 +37,16 @@ jobs:
sudo apt-get install tcl8.6-dev libxss-dev
mkdir "$HOME/install dir"
touch tk/doc/man.macros tk/generic/tkStubInit.c
- echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" >> $GITHUB_ENV
+ echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" --disable-zipfs >> $GITHUB_ENV
echo "CC=$COMPILER" >> $GITHUB_ENV
echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV
echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV
working-directory: "."
env:
- CFGOPT: --enable-symbols=${{ matrix.symbols }} ${{ matrix.disables }}
+ CFGOPT: ${{ matrix.cfgopt }}
COMPILER: ${{ matrix.compiler }}
- OPTS: ${{ matrix.compiler }}-${{ matrix.symbols }}${{ matrix.disables }}
- - name: Configure (symbols=${{ matrix.symbols }} opts=${{ matrix.disables }})
+ OPTS: ${{ matrix.compiler }}${{ matrix.cfgopt }}
+ - name: Configure (opts=${{ matrix.cfgopt }})
run: |
./configure $CFGOPT "--prefix=$HOME/install dir" || {
cat config.log
@@ -85,7 +84,7 @@ jobs:
exit 1
}
- name: Discover Version ID
- if: ${{ env.BUILD_CONFIG_ID == 'gcc-no' }}
+ if: ${{ env.BUILD_CONFIG_ID == 'gcc' }}
run: |
cd /tmp/dist
echo "VERSION=`ls -d tk* | sed 's/tk//'`" >> $GITHUB_ENV
@@ -109,9 +108,9 @@ jobs:
matrix:
compiler:
- "gcc"
- symbols:
- - "no"
- - "mem"
+ cfgopt:
+ - ""
+ - "--enable-symbols"
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -122,13 +121,13 @@ jobs:
sudo apt-get install tcl8.6-dev libxss-dev xvfb
mkdir "$HOME/install dir"
touch tk/doc/man.macros tk/generic/tkStubInit.c
- echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" >> $GITHUB_ENV
+ echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6 --disable-zipfs" >> $GITHUB_ENV
echo "CC=$COMPILER" >> $GITHUB_ENV
working-directory: "."
env:
- CFGOPT: --enable-symbols=${{ matrix.symbols }}
+ CFGOPT: ${{ matrix.cfgopt }}
COMPILER: ${{ matrix.compiler }}
- - name: Configure (symbols=${{ matrix.symbols }})
+ - name: Configure ${{ matrix.cfgopt }}
run: |
./configure $CFGOPT "--prefix=$HOME/install dir" || {
cat config.log
diff --git a/.github/workflows/linux-with-tcl8-build.yml b/.github/workflows/linux-with-tcl8-build.yml
new file mode 100644
index 0000000..0ceae80
--- /dev/null
+++ b/.github/workflows/linux-with-tcl8-build.yml
@@ -0,0 +1,186 @@
+name: Linux (with Tcl 8.7)
+on: [push]
+defaults:
+ run:
+ shell: bash
+ working-directory: tk/unix
+env:
+ ERROR_ON_FAILURES: 1
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ strategy:
+ matrix:
+ compiler:
+ - "gcc"
+ - "clang"
+ cfgopt:
+ - ""
+ - "CFLAGS=-DTK_NO_DEPRECATED=1"
+ - "--disable-shared"
+ - "--disable-xft"
+ - "--disable-xss"
+ - "--enable-symbols"
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ path: tk
+ - name: Checkout Tcl
+ uses: actions/checkout@v2
+ with:
+ repository: tcltk/tcl
+ ref: core-8-branch
+ path: tcl
+ - name: Setup Environment (compiler=${{ matrix.compiler }})
+ run: |
+ sudo apt-get install libxss-dev
+ mkdir "$HOME/install dir"
+ touch tk/doc/man.macros tk/generic/tkStubInit.c
+ echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV
+ echo "CC=$COMPILER" >> $GITHUB_ENV
+ echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV
+ echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV
+ working-directory: "."
+ env:
+ CFGOPT: ${{ matrix.cfgopt }}
+ COMPILER: ${{ matrix.compiler }}
+ OPTS: ${{ matrix.compiler }}${{ matrix.cfgopt }}
+ - name: Configure and Build Tcl
+ run: |
+ ./configure ${CFGOPT} "--prefix=$HOME/install dir" || {
+ cat config.log
+ echo "::warning::Failure during Tcl Configure"
+ exit 1
+ }
+ make all install || {
+ echo "::warning::Failure during Tcl Build"
+ exit 1
+ }
+ echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV
+ working-directory: tcl/unix
+ - name: Configure (opts=${{ matrix.cfgopt }})
+ run: |
+ ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || {
+ cat config.log
+ echo "::error::Failure during Configure"
+ exit 1
+ }
+ - name: Build
+ run: |
+ make binaries libraries || {
+ echo "::error::Failure during Build"
+ exit 1
+ }
+ - name: Build Test Harness
+ run: |
+ make tktest || {
+ echo "::error::Failure during Build"
+ exit 1
+ }
+ - name: Test-Drive Installation
+ run: |
+ make install || {
+ echo "::error::Failure during Install"
+ exit 1
+ }
+ - name: Create Distribution Package
+ run: |
+ make dist || {
+ echo "::error::Failure during Distribute"
+ exit 1
+ }
+ - name: Convert Documentation to HTML
+ run: |
+ make html-tk TOOL_DIR=$TOOL_DIR || {
+ echo "::error::Failure during Distribute"
+ exit 1
+ }
+ - name: Discover Version ID
+ if: ${{ env.BUILD_CONFIG_ID == 'gcc' }}
+ run: |
+ cd /tmp/dist
+ echo "VERSION=`ls -d tk* | sed 's/tk//'`" >> $GITHUB_ENV
+ - name: Upload Source Distribution
+ if: ${{ env.BUILD_CONFIG_ID == 'gcc' }}
+ uses: actions/upload-artifact@v2
+ with:
+ name: Tk ${{ env.VERSION }} Source distribution (snapshot)
+ path: |
+ /tmp/dist/tk*
+ !/tmp/dist/tk*/html/**
+ - name: Upload Documentation Distribution
+ if: ${{ env.BUILD_CONFIG_ID == 'gcc' }}
+ uses: actions/upload-artifact@v2
+ with:
+ name: Tk ${{ env.VERSION }} HTML documentation (snapshot)
+ path: /tmp/dist/tk*/html
+ test:
+ runs-on: ubuntu-20.04
+ strategy:
+ matrix:
+ compiler:
+ - "gcc"
+ cfgopt:
+ - ""
+ - "--enable-symbols"
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ path: tk
+ - name: Checkout Tcl
+ uses: actions/checkout@v2
+ with:
+ repository: tcltk/tcl
+ ref: core-8-branch
+ path: tcl
+ - name: Setup Environment (compiler=${{ matrix.compiler }})
+ run: |
+ sudo apt-get install libxss-dev xvfb
+ mkdir "$HOME/install dir"
+ touch tk/doc/man.macros tk/generic/tkStubInit.c
+ echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV
+ echo "CC=$COMPILER" >> $GITHUB_ENV
+ working-directory: "."
+ env:
+ CFGOPT: ${{ matrix.cfgopt }}
+ COMPILER: ${{ matrix.compiler }}
+ - name: Configure and Build Tcl
+ run: |
+ ./configure ${CFGOPT} "--prefix=$HOME/install dir" || {
+ cat config.log
+ echo "::warning::Failure during Tcl Configure"
+ exit 1
+ }
+ make all install || {
+ echo "::warning::Failure during Tcl Build"
+ exit 1
+ }
+ echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV
+ working-directory: tcl/unix
+ - name: Configure ${{ matrix.cfgopt }}
+ run: |
+ ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || {
+ cat config.log
+ echo "::error::Failure during Configure"
+ exit 1
+ }
+ - name: Build
+ run: |
+ make binaries libraries tktest || {
+ echo "::error::Failure during Build"
+ exit 1
+ }
+ - name: Run Tests
+ run: |
+ xvfb-run --auto-servernum make test-classic | tee out-classic.txt
+ xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt
+ grep -q "Failed 0" out-classic.txt || {
+ echo "::error::Failure during Test"
+ exit 1
+ }
+ grep -q "Failed 0" out-ttk.txt || {
+ echo "::error::Failure during Test"
+ exit 1
+ }
diff --git a/.github/workflows/linux-with-tcl9-build.yml b/.github/workflows/linux-with-tcl9-build.yml
new file mode 100644
index 0000000..3ae4b28
--- /dev/null
+++ b/.github/workflows/linux-with-tcl9-build.yml
@@ -0,0 +1,172 @@
+name: Linux (with Tcl 9.0)
+on: [push]
+defaults:
+ run:
+ shell: bash
+ working-directory: tk/unix
+env:
+ ERROR_ON_FAILURES: 1
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ strategy:
+ matrix:
+ compiler:
+ - "gcc"
+ - "clang"
+ cfgopt:
+ - ""
+ - "CFLAGS=-DTK_NO_DEPRECATED=1"
+ - "--disable-shared"
+ - "--disable-xft"
+ - "--disable-xss"
+ - "--enable-symbols"
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ path: tk
+ - name: Checkout Tcl
+ uses: actions/checkout@v2
+ with:
+ repository: tcltk/tcl
+ ref: main
+ path: tcl
+ - name: Setup Environment (compiler=${{ matrix.compiler }})
+ run: |
+ sudo apt-get install libxss-dev
+ mkdir "$HOME/install dir"
+ touch tk/doc/man.macros tk/generic/tkStubInit.c
+ echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV
+ echo "CC=$COMPILER" >> $GITHUB_ENV
+ echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV
+ echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV
+ working-directory: "."
+ env:
+ CFGOPT: ${{ matrix.cfgopt }}
+ COMPILER: ${{ matrix.compiler }}
+ OPTS: ${{ matrix.compiler }}${{ matrix.cfgopt }}
+ - name: Configure and Build Tcl
+ run: |
+ ./configure ${CFGOPT} "--prefix=$HOME/install dir" || {
+ cat config.log
+ echo "::warning::Failure during Tcl Configure"
+ exit 1
+ }
+ make all install || {
+ echo "::warning::Failure during Tcl Build"
+ exit 1
+ }
+ echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV
+ working-directory: tcl/unix
+ - name: Configure (opts=${{ matrix.cfgopt }})
+ run: |
+ ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || {
+ cat config.log
+ echo "::error::Failure during Configure"
+ exit 1
+ }
+ - name: Build
+ run: |
+ make binaries libraries || {
+ echo "::error::Failure during Build"
+ exit 1
+ }
+ - name: Build Test Harness
+ run: |
+ make tktest || {
+ echo "::error::Failure during Build"
+ exit 1
+ }
+ - name: Test-Drive Installation
+ run: |
+ make install || {
+ echo "::error::Failure during Install"
+ exit 1
+ }
+ - name: Create Distribution Package
+ run: |
+ make dist || {
+ echo "::error::Failure during Distribute"
+ exit 1
+ }
+ - name: Convert Documentation to HTML
+ run: |
+ make html-tk TOOL_DIR=$TOOL_DIR || {
+ echo "::error::Failure during Distribute"
+ exit 1
+ }
+ - name: Discover Version ID
+ if: ${{ env.BUILD_CONFIG_ID == 'gcc' }}
+ run: |
+ cd /tmp/dist
+ echo "VERSION=`ls -d tk* | sed 's/tk//'`" >> $GITHUB_ENV
+ test:
+ runs-on: ubuntu-20.04
+ strategy:
+ matrix:
+ compiler:
+ - "gcc"
+ cfgopt:
+ - ""
+ - "--enable-symbols"
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ path: tk
+ - name: Checkout Tcl
+ uses: actions/checkout@v2
+ with:
+ repository: tcltk/tcl
+ ref: main
+ path: tcl
+ - name: Setup Environment (compiler=${{ matrix.compiler }})
+ run: |
+ sudo apt-get install libxss-dev xvfb
+ mkdir "$HOME/install dir"
+ touch tk/doc/man.macros tk/generic/tkStubInit.c
+ echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV
+ echo "CC=$COMPILER" >> $GITHUB_ENV
+ working-directory: "."
+ env:
+ CFGOPT: ${{ matrix.cfgopt }}
+ COMPILER: ${{ matrix.compiler }}
+ - name: Configure and Build Tcl
+ run: |
+ ./configure ${CFGOPT} "--prefix=$HOME/install dir" || {
+ cat config.log
+ echo "::warning::Failure during Tcl Configure"
+ exit 1
+ }
+ make all install || {
+ echo "::warning::Failure during Tcl Build"
+ exit 1
+ }
+ echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV
+ working-directory: tcl/unix
+ - name: Configure ${{ matrix.cfgopt }}
+ run: |
+ ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || {
+ cat config.log
+ echo "::error::Failure during Configure"
+ exit 1
+ }
+ - name: Build
+ run: |
+ make binaries libraries tktest || {
+ echo "::error::Failure during Build"
+ exit 1
+ }
+ - name: Run Tests
+ run: |
+ xvfb-run --auto-servernum make test-classic | tee out-classic.txt
+ xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt
+ grep -q "Failed 0" out-classic.txt || {
+ echo "::error::Failure during Test"
+ exit 1
+ }
+ grep -q "Failed 0" out-ttk.txt || {
+ echo "::error::Failure during Test"
+ exit 1
+ }
diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml
index 2600858..a5fbf59 100644
--- a/.github/workflows/mac-build.yml
+++ b/.github/workflows/mac-build.yml
@@ -75,9 +75,10 @@ jobs:
env:
SET_DISPLAY: ${{ contains(matrix.options, '--disable-aqua') }}
run: |
- touch ../generic/tkStubInit.c ../doc/man.macros
+ touch tkStubInit.c
mkdir "$HOME/install dir"
echo "USE_XVFB=$SET_DISPLAY" >> $GITHUB_ENV
+ working-directory: tk/generic
- name: Add X11 (if required)
if: ${{ env.USE_XVFB == 'true' }}
run: |
@@ -115,7 +116,7 @@ jobs:
CFGOPT: --enable-symbols=${{ matrix.symbols }} ${{matrix.options }}
- name: Build
run: |
- make binaries libraries tktest || {
+ make all tktest || {
echo "::error::Failure during Build"
exit 1
}
diff --git a/.github/workflows/onefiledist.yml b/.github/workflows/onefiledist.yml
new file mode 100644
index 0000000..70e9379
--- /dev/null
+++ b/.github/workflows/onefiledist.yml
@@ -0,0 +1,213 @@
+name: Build Binaries
+on: [push]
+jobs:
+ linux:
+ name: Linux
+ runs-on: ubuntu-18.04
+ defaults:
+ run:
+ shell: bash
+ env:
+ CC: gcc
+ CFGOPT: --disable-symbols --disable-shared
+ steps:
+ - name: Checkout Tk
+ uses: actions/checkout@v2
+ with:
+ path: tk
+ - name: Checkout Tcl 8.7
+ uses: actions/checkout@v2
+ with:
+ repository: tcltk/tcl
+ ref: core-8-branch
+ path: tcl
+ - name: Setup Environment
+ run: |
+ sudo apt-get install libxss-dev
+ touch tcl/generic/tclStubInit.c tcl/generic/tclOOStubInit.c
+ touch tk/generic/tkStubInit.c
+ echo "INST_DIR=$(cd install;pwd)" >> $GITHUB_ENV
+ echo "VER_PATH=$(cd tcl/tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV
+ working-directory: "."
+ - name: Configure Tcl
+ run: |
+ ./configure $CFGOPT --enable-zipfs --prefix=$INST_DIR
+ working-directory: tcl/unix
+ - name: Build & Install Tcl
+ run: |
+ make binaries libraries install
+ make shell SCRIPT="$VER_PATH $GITHUB_ENV"
+ working-directory: tcl/unix
+ - name: Configure Tk
+ run: |
+ ./configure $CFGOPT --with-tcl=$INST_DIR/lib --prefix=$INST_DIR
+ working-directory: tk/unix
+ - name: Build & Install Tk
+ run: |
+ make binaries libraries install
+ working-directory: tk/unix
+ # TODO: need the Tk version separately for distro naming below
+ - name: Package
+ run: |
+ cp bin/wish8.7 ${BUILD_NAME}
+ chmod +x ${BUILD_NAME}
+ tar -cf ${BUILD_NAME}.tar ${BUILD_NAME}
+ working-directory: ${{ env.INST_DIR }}
+ env:
+ BUILD_NAME: wish${{ env.TCL_PATCHLEVEL }}_snapshot
+ - name: Upload
+ uses: actions/upload-artifact@v2
+ with:
+ name: Wish ${{ env.TCL_PATCHLEVEL }} Linux single-file build (snapshot)
+ path: ${{ env.INST_DIR }}/*.tar
+ - name: Describe Installation Zip Contents
+ if: ${{ always() }}
+ run: |
+ unzip -l wish${{ env.TCL_PATCHLEVEL }}_snapshot || true
+ working-directory: ${{ env.INST_DIR }}
+ macos:
+ name: macOS
+ runs-on: macos-11
+ defaults:
+ run:
+ shell: bash
+ env:
+ CC: gcc
+ CFGOPT: --disable-symbols --disable-shared --enable-64bit
+ steps:
+ - name: Checkout Tk
+ uses: actions/checkout@v2
+ with:
+ path: tk
+ - name: Checkout Tcl 8.7
+ uses: actions/checkout@v2
+ with:
+ repository: tcltk/tcl
+ ref: core-8-branch
+ path: tcl
+ - name: Checkout create-dmg
+ uses: actions/checkout@v2
+ with:
+ repository: create-dmg/create-dmg
+ ref: v1.0.8
+ path: create-dmg
+ - name: Setup Environment
+ run: |
+ mkdir -p install/contents
+ touch tcl/generic/tclStubInit.c tcl/generic/tclOOStubInit.c
+ touch tk/generic/tkStubInit.c
+ echo "INST_DIR=$(cd install;pwd)" >> $GITHUB_ENV
+ echo "VER_PATH=$(cd tcl/tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV
+ echo "CREATE_DMG=$(cd create-dmg;pwd)/create-dmg" >> $GITHUB_ENV
+ echo "CFLAGS=-arch x86_64 -arch arm64e" >> $GITHUB_ENV
+ working-directory: "."
+ - name: Configure Tcl
+ run: |
+ ./configure $CFGOPT --enable-zipfs --prefix=$INST_DIR
+ working-directory: tcl/unix
+ - name: Build & Install Tcl
+ run: |
+ make binaries libraries install
+ make shell SCRIPT="$VER_PATH $GITHUB_ENV"
+ working-directory: tcl/unix
+ - name: Configure Tk
+ run: |
+ ./configure $CFGOPT --with-tcl=$INST_DIR/lib --prefix=$INST_DIR \
+ --enable-aqua
+ working-directory: tk/unix
+ - name: Build & Install Tk
+ run: |
+ make binaries libraries install
+ working-directory: tk/unix
+ # TODO: need the Tk version separately for distro naming below
+ - name: Package
+ run: |
+ cp ../tk/unix/wish contents/${BUILD_NAME}
+ chmod +x contents/${BUILD_NAME}
+ cat > contents/README.txt <<EOF
+ This is a single-file executable developer preview of Tcl/Tk $TCL_PATCHLEVEL
+
+ It is not intended as an official release at all, so it is unsigned and unnotarized.
+ Use strictly at your own risk.
+
+ To run it, you need to copy the executable out and run:
+ xattr -d com.apple.quarantine ${BUILD_NAME}
+ to mark the executable as runnable on your machine.
+ EOF
+ $CREATE_DMG \
+ --volname "TclTk $TCL_PATCHLEVEL (snapshot)" \
+ --window-pos 200 120 \
+ --window-size 800 400 \
+ "TclTk-$TCL_PATCHLEVEL-(snapshot).dmg" \
+ "contents/"
+ working-directory: ${{ env.INST_DIR }}
+ env:
+ BUILD_NAME: wish${{ env.TCL_PATCHLEVEL }}_snapshot
+ - name: Upload
+ uses: actions/upload-artifact@v2
+ with:
+ name: Wish ${{ env.TCL_PATCHLEVEL }} macOS single-file build (snapshot)
+ path: ${{ env.INST_DIR }}/*.dmg
+ win:
+ name: Windows
+ runs-on: windows-latest
+ defaults:
+ run:
+ shell: msys2 {0}
+ env:
+ CC: gcc
+ CFGOPT: --disable-symbols --disable-shared
+ steps:
+ - name: Install MSYS2
+ uses: msys2/setup-msys2@v2
+ with:
+ msystem: MINGW64
+ install: git mingw-w64-x86_64-toolchain make zip
+ - name: Checkout Tk
+ uses: actions/checkout@v2
+ with:
+ path: tk
+ - name: Checkout Tcl 8.7
+ uses: actions/checkout@v2
+ with:
+ repository: tcltk/tcl
+ ref: core-8-branch
+ path: tcl
+ - name: Setup Environment
+ run: |
+ mkdir -p install/combined
+ touch tcl/generic/tclStubInit.c tcl/generic/tclOOStubInit.c
+ touch tk/generic/tkStubInit.c
+ echo "INST_DIR=$(cd install;pwd)" >> $GITHUB_ENV
+ echo "VER_PATH=$(cd tcl/tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV
+ working-directory: "."
+ - name: Configure Tcl
+ run: |
+ ./configure $CFGOPT --enable-zipfs --prefix=$INST_DIR
+ working-directory: tcl/win
+ - name: Build & Install Tcl
+ run: |
+ make binaries libraries install
+ $INST_DIR/bin/tclsh* $VER_PATH $GITHUB_ENV
+ working-directory: tcl/win
+ - name: Configure Tk
+ run: |
+ ./configure $CFGOPT --with-tcl=$INST_DIR/lib --prefix=$INST_DIR
+ working-directory: tk/win
+ - name: Build & Install Tk
+ run: |
+ make all install
+ echo "TK_BIN=`pwd`/`echo wish*.exe`" >> $GITHUB_ENV
+ working-directory: tk/win
+ # TODO: need the Tk version separately for distro naming below
+ - name: Package
+ run: |
+ cp ${TK_BIN} combined/${BUILD_NAME}.exe
+ working-directory: install
+ env:
+ BUILD_NAME: wish${{ env.TCL_PATCHLEVEL }}_snapshot
+ - name: Upload
+ uses: actions/upload-artifact@v2
+ with:
+ name: Wish ${{ env.TCL_PATCHLEVEL }} Windows single-file build (snapshot)
+ path: install/combined/wish${{ env.TCL_PATCHLEVEL }}_snapshot.exe
diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml
index 70de8f8..8968f5d 100644
--- a/.github/workflows/win-build.yml
+++ b/.github/workflows/win-build.yml
@@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: tcltk/tcl
- ref: core-8-6-branch
+ ref: core-8-branch
path: tcl
- name: Init MSVC
uses: ilammy/msvc-dev-cmd@v1
@@ -100,7 +100,7 @@ jobs:
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
- install: git mingw-w64-x86_64-toolchain make
+ install: git mingw-w64-x86_64-toolchain make zip
- name: Checkout
uses: actions/checkout@v2
- name: Checkout
diff --git a/.project b/.project
index 1a176fb..cc5f605 100644
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>tk8.6</name>
+ <name>tk8.7</name>
<comment></comment>
<projects>
</projects>
diff --git a/.travis.yml b/.travis.yml
index 77a8d27..1767ecb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,11 +13,15 @@ addons:
- gcc-multilib
- tcl8.6-dev
- libx11-dev
+ - libnotify-dev
+ - libglib2.0-dev
- libxss-dev
- xvfb
homebrew:
packages:
- tcl-tk
+ - libnotify
+ - glib
# casks:
# - xquartz
jobs:
@@ -40,6 +44,16 @@ jobs:
- make test-ttk >out-ttk.txt
- cat out-ttk.txt
- grep -q "Failed 0" out-ttk.txt
+ - name: "Linux/GCC/Shared: NO_DEPRECATED"
+ os: linux
+ dist: focal
+ services:
+ - xvfb
+ compiler: gcc
+ env:
+ - BUILD_DIR=unix
+ - CFGOPT="CFLAGS=-DTK_NO_DEPRECATED=1"
+ script: *x11gui
- name: "Linux/GCC/Shared/no-xft"
os: linux
dist: focal
@@ -50,6 +64,16 @@ jobs:
- BUILD_DIR=unix
- CFGOPT="--disable-xft"
script: *x11gui
+ - name: "Linux/GCC/Shared/no-libnotify"
+ os: linux
+ dist: focal
+ services:
+ - xvfb
+ compiler: gcc
+ env:
+ - BUILD_DIR=unix
+ - CFGOPT="--disable-libnotify"
+ script: *x11gui
- name: "Linux/GCC/Shared/bionic"
os: linux
dist: bionic
@@ -82,6 +106,27 @@ jobs:
env:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols"
+ - name: "Linux/G++/Shared"
+ os: linux
+ dist: focal
+ compiler: g++
+ env:
+ - BUILD_DIR=unix
+ - CFGOPT="CC=g++ CFLAGS=-Dregister=dont+use+register"
+ - name: "Linux/G++/Shared UTF_MAX=4"
+ os: linux
+ dist: focal
+ compiler: g++
+ env:
+ - BUILD_DIR=unix
+ - CFGOPT="CC=g++ CFLAGS=-DTCL_UTF_MAX=4"
+ - name: "Linux/G++/Shared UTF_MAX=6"
+ os: linux
+ dist: focal
+ compiler: g++
+ env:
+ - BUILD_DIR=unix
+ - CFGOPT="CC=g++ CFLAGS=-DTCL_UTF_MAX=6"
# Newer/Older versions of GCC
- name: "Linux/GCC 10/Shared"
os: linux
@@ -110,6 +155,13 @@ jobs:
compiler: clang
env:
- BUILD_DIR=unix
+ - name: "Linux/Clang/Shared: NO_DEPRECATED"
+ os: linux
+ dist: focal
+ compiler: clang
+ env:
+ - BUILD_DIR=unix
+ - CFGOPT="CFLAGS=-DTK_NO_DEPRECATED=1"
- name: "Linux/Clang/Shared/no-xft"
os: linux
dist: focal
@@ -138,6 +190,12 @@ jobs:
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include"
+ - name: "macOS/Clang++/Xcode 12/Shared"
+ os: osx
+ osx_image: xcode12
+ env:
+ - BUILD_DIR=unix
+ - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib CC=clang++ --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-D__private_extern__=extern"
- name: "macOS/Xcode 12/Static"
os: osx
osx_image: xcode12
@@ -206,7 +264,6 @@ jobs:
env:
- BUILD_DIR=unix
script:
- - touch ../doc/man.macros
- make dist
before_install:
- |-
@@ -220,7 +277,7 @@ install:
- mkdir "$HOME/install dir"
- ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1)
script:
- - make binaries libraries tktest
+ - make all tktest
- make install
before_cache:
- |-
diff --git a/ChangeLog b/ChangeLog
index 941c509..3d9de2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -714,7 +714,7 @@ a better first place to look now.
2011-10-27 Kevin B. Kenny <kennykb@acm.org>
* generic/tkInt.h: [Bug 3410609]: Change the event mechanism
- * unix/tkUnixEvent.c: for <KeyPress> events to use the keysym
+ * unix/tkUnixEvent.c: for <Key> events to use the keysym
* unix/tkUnixKey.c: returned by XLookupString in preference to
the one that appears in the raw X event at any level. This change
allows binding to ISO_Level3_Shift-ed characters, composed characters,
@@ -5213,7 +5213,7 @@ a better first place to look now.
2008-01-29 Joe English <jenglish@users.sourceforge.net>
- * library/treeview.tcl: Fix bug in Shift-ButtonPress-1 binding (error
+ * library/treeview.tcl: Fix bug in Shift-Button-1 binding (error
if no current focus item; reported on c.l.t.)
2008-01-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
diff --git a/ChangeLog.2002 b/ChangeLog.2002
index b27b92b..5bfc4f7 100644
--- a/ChangeLog.2002
+++ b/ChangeLog.2002
@@ -2238,7 +2238,7 @@
inputContext to null.
* win/Makefile.in: changed gdb and shell targets to properly build
- all binaries before running (otherwise an error often occured).
+ all binaries before running (otherwise an error often occurred).
2002-03-28 David Gravereaux <davygrvy@pobox.com>
diff --git a/ChangeLog.2004 b/ChangeLog.2004
index bf86629..9afaa75 100644
--- a/ChangeLog.2004
+++ b/ChangeLog.2004
@@ -811,7 +811,7 @@
2004-07-05 George Peter Staplin <GeorgePS@XMission.com>
* generic/tkEvent.c: TK_XIM_SPOT preprocessor usage was modified
- slightly to fix a bug that occured when TK_XIM_SPOT was defined as 0.
+ slightly to fix a bug that occurred when TK_XIM_SPOT was defined as 0.
Thanks to Joe Mistachkin for reporting this bug.
2004-07-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
@@ -3521,7 +3521,7 @@
2003-02-13 Kevin Kenny <kennykb@users.sourceforge.net>
* doc/wish.n: Added language to describe the handling of the
- end-of-file character \u001a in script files. [Bug 685505]
+ end-of-file character \x1A in script files. [Bug 685505]
2003-02-10 Jim Ingham <jingham@apple.com>
diff --git a/README.md b/README.md
index 38d026a..f9fceb6 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,19 @@
# README: Tk
-This is the **Tk 8.6.11** source distribution.
+This is the **Tk 8.7a6** source distribution.
You can get any source release of Tk from [our distribution
site](https://sourceforge.net/projects/tcl/files/Tcl/).
+8.6 (production release, daily build)
[![Build Status](https://github.com/tcltk/tk/workflows/Linux/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Acore-8-6-branch)
[![Build Status](https://github.com/tcltk/tk/workflows/Windows/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Acore-8-6-branch)
[![Build Status](https://github.com/tcltk/tk/workflows/macOS/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Acore-8-6-branch)
+<br>
+8.7 (in development, daily build))
+[![Build Status](https://github.com/tcltk/tk/workflows/Linux/badge.svg?branch=main)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Amain)
+[![Build Status](https://github.com/tcltk/tk/workflows/Windows/badge.svg?branch=main)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Amain)
+[![Build Status](https://github.com/tcltk/tk/workflows/macOS/badge.svg?branch=main)](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Amain)
## <a id="intro">1.</a> Introduction
@@ -15,7 +21,7 @@ This directory contains the sources and documentation for Tk, a
cross-platform GUI toolkit implemented with the Tcl scripting language.
For details on features, incompatibilities, and potential problems with
-this release, see [the Tcl/Tk 8.6 Web page](https://www.tcl-lang.org/software/tcltk/8.6.html)
+this release, see [the Tcl/Tk 8.7 Web page](https://www.tcl-lang.org/software/tcltk/8.7.html)
or refer to the "changes" file in this directory, which contains a
historical record of all changes to Tk.
diff --git a/changes b/changes
index f8163aa..144dee7 100644
--- a/changes
+++ b/changes
@@ -333,7 +333,7 @@ same menu.
4/12/92 (bug fix) Fixed core dump that occurred in tkError.c when
removing the first error record from the error list.
-4/15/92 (bug fix) Fixed bug in tkBind.c that prevented <KeyPress-1>
+4/15/92 (bug fix) Fixed bug in tkBind.c that prevented <Key-1>
event specifications from being processed correctly: the "1" was
treated as a button name rather than a keysym.
@@ -3488,7 +3488,7 @@ Macintosh, the menubar is displayed accross the top of the main monitor,
just like with other applications. Under Windows and Unix, the menu is
attached to the toplevel window. Also, changed some semantics.
Tearoff menus will now reflect changes to the menu it was
-torn off from, and are deleted when the master menu is
+torn off from, and are deleted when the main menu is
deleted. Tearoffs also reflect more look-and-feel of the
platforms they are running on. (SRP)
@@ -3998,7 +3998,7 @@ into account the "-displayof" option. This problem also existed for the
command to the Mac. Also fixed "resource write" when the resource
was specified by id and already existed. (JI)
-9/16/97 (bug fix) Added null bindings to <Command-KeyPress> for the
+9/16/97 (bug fix) Added null bindings to <Command-Key> for the
text and entry widget on the Macintosh. This prevents unbound command
key sequences from having the character echoed to the widget. Also
fixed Cut & Copy bindings. (JI) (RJ)
@@ -5099,7 +5099,7 @@ correctly. (hobbs)
2001-08-28 (bug fix) removed 2 second 'raise' delay seen by some Unix
window managers. (hobbs, baker)
-2001-09-14 (bug fix) fixed memory leaks that occured if errors were
+2001-09-14 (bug fix) fixed memory leaks that occurred if errors were
thrown while initializing the channel for an image. (darley)
2001-09-20 (new feature) --enable-64bit support was added for HP 11 when
@@ -7416,6 +7416,29 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
--- Released 8.6.7, August 9, 2017 --- https://core.tcl-lang.org/tk/ for details
+Changes to 8.7a1 include all changes to the 8.6 line through 8.6.7,
+plus the following, which focuses on the high-level feature changes
+in this changeset (new minor version) rather than bug fixes:
+
+2016-03-07 (feature)[841280] spinbox autoswap -to/-from to get ordering (vogel)
+
+2016-03-27 (feature)[38dc27] Support <Button-6> & <Button-7> (nijtmans)
+
+2016-08-29 (TIP 449) [text] undo/redo return character range (vogel)
+
+2016-11-02 (feature) Removed undocumented command [tk_getFileType] (vogel)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2017-02-05 (bug)[c0dbdd] Compatibility fonts shadowed system fonts (vogel)
+
+2017-03-21 (TIP 442) display text in a progressbar (zaumseil)
+
+2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans)
+
+2017-08-28 (TIP 166) Extended color notation for alpha channel (bachmann)
+
+--- Released 8.7a1, September 8, 2017 --- https://core.tcl-lang.org/tk/ for details
+
2017-08-24 (bug)[f1a3ca] Memory leak in [text] B-tree (edhume3)
2017-08-24 (bug)[ee40fd] Report [console] init errors (the)
@@ -7504,7 +7527,7 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2018-01-07 (bug)[fa8de7] Crash [ttk::checkbutton .x -variable {}] (werner)
-2018-01-16 (bug)[382712] Crash in [event generate . <KeyPress>] (werner)
+2018-01-16 (bug)[382712] Crash in [event generate . <Key>] (werner)
2018-01-19 (bug)[657c38] Crash in menu destroy with checkbutton entry (werner)
@@ -7540,7 +7563,7 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2018-07-17 (bug)[1088825] fix frame-2.17,3.9,3.10 on Mac (vogel)
-2018-07-27 (bug)[fabed1] GIF photo support for "deferred clear code" (vogel)
+2018-07-27 (bug)[fbaed1] GIF photo support for "deferred clear code" (vogel)
2018-08-08 (feature) Modern full-screen support on Mac OSX (walzer)
@@ -7783,7 +7806,7 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2020-07-02 (bug)[2d2459] default style for combobox (bll)
-2020-07-06 (bug)[40c4bf] double free, entry-19.21 (vogel)
+2020-07-06 (bug)[40e4bf] double free, entry-19.21 (vogel)
2020-07-06 (bug)[e3888d] grab & warp, bind-36.1 (vogel)
@@ -7842,3 +7865,117 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2020-12-24 (bug)[6157a8] Aqua: file dialog -filetypes (davis,culler)
- Released 8.6.11, Dec 31, 2020 - https://core.tcl-lang.org/tk/ for details
+
+Changes to 8.7a3 include all changes to the 8.6 line through 8.6.10,
+plus the following, which focuses on the high-level feature changes
+in this changeset (new minor version) rather than bug fixes:
+
+2017-11-25 [TIP 161] $menu -tearoff default changed to false (roseman,vogel)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2017-12-07 [TIP 487] End support for pre-XP Windows (nijtmans)
+
+2018-03-04 [TIP 489] New subcommand [$canvas image] (pitcher,vogel)
+
+2018-05-13 [TIP 496] New options -placeholder* for entries (zaumseil,vogel)
+
+2018-09-23 [TIP 517] New option -activerelief for menus (vogel)
+
+2018-11-03 [TIP 512] Deprecate stub for Tk_MainEx() (nijtmans)
+
+2018-11-06 [TIP 415] New option -height for [$canvas create arc] (geard)
+
+2018-11-06 [TIP 518] New event <<NoManagedChild>> (oehlmann)
+
+2019-04-14 [TIP 164] New subcommand [$canvas rotate] (fellows)
+
+2019-04-14 [TIP 507] New photo image format 'svg' (zaumseil)
+
+2019-04-14 [TIP 483] Record more configuration items (cassoff)
+
+2019-04-14 [TIP 482] Record configured directory for demos (cassoff)
+
+2019-05-25 [TIP 262] New frame options -backgroundimage, -tile (fellows)
+
+2019-06-15 [TIP 528] Deprecate Tk_Offset() (nijtmans)
+
+2019-08-19 [TIP 545] Revised options for photo image format 'svg' (oehlmann)
+
+--- Released 8.7a3, November 25, 2019 --- https://core.tcl-lang.org/tk/ for details
+
+Changes to 8.7a5 include all changes to the 8.6 line through 8.6.11,
+plus the following, which focuses on the high-level feature changes
+in this changeset (new minor version) rather than bug fixes:
+
+2020-02-22 [TIP 565] Gracefully ignore non-existent tags in canvas raise/lower
+
+2020-02-22 [TIP 564] Specify ttk font sizes in points on X11
+
+2020-02-24 [TIP 563] Scrollwheel on Horizontal Scrollbar Scrolls Without Shift too
+
+2020-02-28 [TIP 557] C++ support
+
+2020-03-12 (bug)[355180] solve XKeycodeToKeysym deprecation
+ *** POTENTIAL INCOMPATIBILITY -- Tk 8.7 now requires X11R6 ***
+
+2020-03-18 [TIP 569] Eliminate comments that serve lint
+
+2020-05-17 [d87dc2] Remove TkMacOSXGetStringObjFromCFString()
+
+2020-05-24 [TIP 574] Add a 'tag delete' command to the ttk::treeview widget
+
+2020-06-27 (bug)[50ed1e] spinbox with duplicate values
+
+2020-07-03 [TIP 578] Death to TCL_DBGX
+
+2020-08-23 (bug)[bb85d2] valgrind on TIP 489
+
+2020-08024 (bug)[d30c21] default colors for TIP 496
+
+2020-09-02 [TIP 580] Export Tk_GetDoublePixelsFromObj and 5 more
+
+2020-10-21 [TIP 474] Uniform mouse wheel events
+
+2020-11-15 [TIP 584] Better introspection for ttk
+
+2020-11-16 [TIP 588] Unicode for (X11) keysyms
+
+2020-12-03 [TIP 590] Recommend lowercase package names
+
+2020-12-09 (bug)[d6e9b4] SVG memory overflow
+
+2020-12-11 [TIP 591] Rotate ttk::notebook window with mousewheel on tab
+
+2020-12-12 [TIP 325] System tray and system notification
+
+2021-01-08 [TIP 592] End support: Windows XP, Server 2003, Vista, Server 2008
+
+2021-01-08 (bug)[822330] Prevent buffer overflow in SVG image.
+
+2021-01-28 (bug)[237971] 'end' argument to [$canvas insert]
+
+2021-02-25 (bug)[be9cad] crash in [tkwait]
+
+2021-02-27 [TIP 529] Add metadata dictionary property to tk photo image
+
+2021-03-02 (bug)[1626ed] Aqua crash: dead keys as meny accelerator
+
+2021-03-29 (bug)[9b6065] Restore Tcl [update] when Tk is destroyed
+
+2021-04-08 (bug)[58222c] background colors
+
+2021-04-09 [TIP 595] Unicode-aware/case-sensitive Loadable Library handling
+
+2021-04-21 (bug)[cde766] update scrollbars on treeview
+
+2021-04-26 (bug)[c97464] memleak in aqua fonts
+
+2021-05-02 (bug)[2ecb09] Follow Mac OSX Key-repeat setting
+
+2021-05-03 (bug)[8a5086] ttk::entry issue
+
+2021-05-22 (bug)[3e3360] bind substitution %S
+
+2021-05-25 (bug)[7bda98] aqua: double click bind with changing focus
+
+- Released 8.7a5, Jun 18, 2021 --- https://core.tcl-lang.org/tcl/ for details -
diff --git a/compat/stdbool.h b/compat/stdbool.h
new file mode 100644
index 0000000..6e74c58
--- /dev/null
+++ b/compat/stdbool.h
@@ -0,0 +1,37 @@
+/*===---- stdbool.h - Standard header for booleans -------------------------===
+*
+* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+* See https://llvm.org/LICENSE.txt for license information.
+* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+*
+* Modified for use by pre-C99 compilers. (c) Jan Nijtmans.
+*
+*===-----------------------------------------------------------------------===
+*/
+
+#ifndef __STDBOOL_H
+#define __STDBOOL_H
+
+/* Don't define bool, true, and false in C++, except as a GNU extension. */
+#ifndef __cplusplus
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+#define bool _Bool
+#else
+#define bool unsigned char
+#endif
+#define true 1
+#define false 0
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
+/* Define _Bool as a GNU extension. */
+#define _Bool bool
+#if __cplusplus < 201103L
+/* For C++98, define bool, false, true as a GNU extension. */
+#define bool bool
+#define false false
+#define true true
+#endif
+#endif
+
+#define __bool_true_false_are_defined 1
+
+#endif /* __STDBOOL_H */
diff --git a/compat/stdint.h b/compat/stdint.h
new file mode 100644
index 0000000..88383b0
--- /dev/null
+++ b/compat/stdint.h
@@ -0,0 +1,919 @@
+/* A portable stdint.h
+ ****************************************************************************
+ * BSD License:
+ ****************************************************************************
+ *
+ * Copyright (c) 2005-2016 Paul Hsieh
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Version 0.1.16.0
+ *
+ * The ANSI C standard committee, for the C99 standard, specified the
+ * inclusion of a new standard include file called stdint.h. This is
+ * a very useful and long desired include file which contains several
+ * very precise definitions for integer scalar types that is critically
+ * important for making several classes of applications portable
+ * including cryptography, hashing, variable length integer libraries
+ * and so on. But for most developers its likely useful just for
+ * programming sanity.
+ *
+ * The problem is that some compiler vendors chose to ignore the C99
+ * standard and some older compilers have no opportunity to be updated.
+ * Because of this situation, simply including stdint.h in your code
+ * makes it unportable.
+ *
+ * So that's what this file is all about. It's an attempt to build a
+ * single universal include file that works on as many platforms as
+ * possible to deliver what stdint.h is supposed to. Even compilers
+ * that already come with stdint.h can use this file instead without
+ * any loss of functionality. A few things that should be noted about
+ * this file:
+ *
+ * 1) It is not guaranteed to be portable and/or present an identical
+ * interface on all platforms. The extreme variability of the
+ * ANSI C standard makes this an impossibility right from the
+ * very get go. Its really only meant to be useful for the vast
+ * majority of platforms that possess the capability of
+ * implementing usefully and precisely defined, standard sized
+ * integer scalars. Systems which are not intrinsically 2s
+ * complement may produce invalid constants.
+ *
+ * 2) There is an unavoidable use of non-reserved symbols.
+ *
+ * 3) Other standard include files are invoked.
+ *
+ * 4) This file may come in conflict with future platforms that do
+ * include stdint.h. The hope is that one or the other can be
+ * used with no real difference.
+ *
+ * 5) In the current version, if your platform can't represent
+ * int32_t, int16_t and int8_t, it just dumps out with a compiler
+ * error.
+ *
+ * 6) 64 bit integers may or may not be defined. Test for their
+ * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
+ * Note that this is different from the C99 specification which
+ * requires the existence of 64 bit support in the compiler. If
+ * this is not defined for your platform, yet it is capable of
+ * dealing with 64 bits then it is because this file has not yet
+ * been extended to cover all of your system's capabilities.
+ *
+ * 7) (u)intptr_t may or may not be defined. Test for its presence
+ * with the test: #ifdef PTRDIFF_MAX. If this is not defined
+ * for your platform, then it is because this file has not yet
+ * been extended to cover all of your system's capabilities, not
+ * because its optional.
+ *
+ * 8) The following might not been defined even if your platform is
+ * capable of defining it:
+ *
+ * WCHAR_MIN
+ * WCHAR_MAX
+ * (u)int64_t
+ * PTRDIFF_MIN
+ * PTRDIFF_MAX
+ * (u)intptr_t
+ *
+ * 9) The following have not been defined:
+ *
+ * WINT_MIN
+ * WINT_MAX
+ *
+ * 10) The criteria for defining (u)int_least(*)_t isn't clear,
+ * except for systems which don't have a type that precisely
+ * defined 8, 16, or 32 bit types (which this include file does
+ * not support anyways). Default definitions have been given.
+ *
+ * 11) The criteria for defining (u)int_fast(*)_t isn't something I
+ * would trust to any particular compiler vendor or the ANSI C
+ * committee. It is well known that "compatible systems" are
+ * commonly created that have very different performance
+ * characteristics from the systems they are compatible with,
+ * especially those whose vendors make both the compiler and the
+ * system. Default definitions have been given, but its strongly
+ * recommended that users never use these definitions for any
+ * reason (they do *NOT* deliver any serious guarantee of
+ * improved performance -- not in this file, nor any vendor's
+ * stdint.h).
+ *
+ * 12) The following macros:
+ *
+ * PRINTF_INTMAX_MODIFIER
+ * PRINTF_INT64_MODIFIER
+ * PRINTF_INT32_MODIFIER
+ * PRINTF_INT16_MODIFIER
+ * PRINTF_LEAST64_MODIFIER
+ * PRINTF_LEAST32_MODIFIER
+ * PRINTF_LEAST16_MODIFIER
+ * PRINTF_INTPTR_MODIFIER
+ *
+ * are strings which have been defined as the modifiers required
+ * for the "d", "u" and "x" printf formats to correctly output
+ * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
+ * (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
+ * PRINTF_INTPTR_MODIFIER is not defined for some systems which
+ * provide their own stdint.h. PRINTF_INT64_MODIFIER is not
+ * defined if INT64_MAX is not defined. These are an extension
+ * beyond what C99 specifies must be in stdint.h.
+ *
+ * In addition, the following macros are defined:
+ *
+ * PRINTF_INTMAX_HEX_WIDTH
+ * PRINTF_INT64_HEX_WIDTH
+ * PRINTF_INT32_HEX_WIDTH
+ * PRINTF_INT16_HEX_WIDTH
+ * PRINTF_INT8_HEX_WIDTH
+ * PRINTF_INTMAX_DEC_WIDTH
+ * PRINTF_INT64_DEC_WIDTH
+ * PRINTF_INT32_DEC_WIDTH
+ * PRINTF_INT16_DEC_WIDTH
+ * PRINTF_UINT8_DEC_WIDTH
+ * PRINTF_UINTMAX_DEC_WIDTH
+ * PRINTF_UINT64_DEC_WIDTH
+ * PRINTF_UINT32_DEC_WIDTH
+ * PRINTF_UINT16_DEC_WIDTH
+ * PRINTF_UINT8_DEC_WIDTH
+ *
+ * Which specifies the maximum number of characters required to
+ * print the number of that type in either hexadecimal or decimal.
+ * These are an extension beyond what C99 specifies must be in
+ * stdint.h.
+ *
+ * Compilers tested (all with 0 warnings at their highest respective
+ * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
+ * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
+ * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
+ *
+ * This file should be considered a work in progress. Suggestions for
+ * improvements, especially those which increase coverage are strongly
+ * encouraged.
+ *
+ * Acknowledgements
+ *
+ * The following people have made significant contributions to the
+ * development and testing of this file:
+ *
+ * Chris Howie
+ * John Steele Scott
+ * Dave Thorup
+ * John Dill
+ * Florian Wobbe
+ * Christopher Sean Morrison
+ * Mikkel Fahnoe Jorgensen
+ *
+ */
+
+#include <stddef.h>
+#include <limits.h>
+#include <signal.h>
+
+/*
+ * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
+ * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.
+ */
+
+#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
+#include <stdint.h>
+#define _PSTDINT_H_INCLUDED
+# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__))
+# ifndef PRINTF_INT64_MODIFIER
+# define PRINTF_INT64_MODIFIER "l"
+# endif
+# ifndef PRINTF_INT32_MODIFIER
+# define PRINTF_INT32_MODIFIER ""
+# endif
+# else
+# ifndef PRINTF_INT64_MODIFIER
+# define PRINTF_INT64_MODIFIER "ll"
+# endif
+# ifndef PRINTF_INT32_MODIFIER
+# if (UINT_MAX == UINT32_MAX)
+# define PRINTF_INT32_MODIFIER ""
+# else
+# define PRINTF_INT32_MODIFIER "l"
+# endif
+# endif
+# endif
+# ifndef PRINTF_INT16_MODIFIER
+# define PRINTF_INT16_MODIFIER "h"
+# endif
+# ifndef PRINTF_INTMAX_MODIFIER
+# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
+# endif
+# ifndef PRINTF_INT64_HEX_WIDTH
+# define PRINTF_INT64_HEX_WIDTH "16"
+# endif
+# ifndef PRINTF_UINT64_HEX_WIDTH
+# define PRINTF_UINT64_HEX_WIDTH "16"
+# endif
+# ifndef PRINTF_INT32_HEX_WIDTH
+# define PRINTF_INT32_HEX_WIDTH "8"
+# endif
+# ifndef PRINTF_UINT32_HEX_WIDTH
+# define PRINTF_UINT32_HEX_WIDTH "8"
+# endif
+# ifndef PRINTF_INT16_HEX_WIDTH
+# define PRINTF_INT16_HEX_WIDTH "4"
+# endif
+# ifndef PRINTF_UINT16_HEX_WIDTH
+# define PRINTF_UINT16_HEX_WIDTH "4"
+# endif
+# ifndef PRINTF_INT8_HEX_WIDTH
+# define PRINTF_INT8_HEX_WIDTH "2"
+# endif
+# ifndef PRINTF_UINT8_HEX_WIDTH
+# define PRINTF_UINT8_HEX_WIDTH "2"
+# endif
+# ifndef PRINTF_INT64_DEC_WIDTH
+# define PRINTF_INT64_DEC_WIDTH "19"
+# endif
+# ifndef PRINTF_UINT64_DEC_WIDTH
+# define PRINTF_UINT64_DEC_WIDTH "20"
+# endif
+# ifndef PRINTF_INT32_DEC_WIDTH
+# define PRINTF_INT32_DEC_WIDTH "10"
+# endif
+# ifndef PRINTF_UINT32_DEC_WIDTH
+# define PRINTF_UINT32_DEC_WIDTH "10"
+# endif
+# ifndef PRINTF_INT16_DEC_WIDTH
+# define PRINTF_INT16_DEC_WIDTH "5"
+# endif
+# ifndef PRINTF_UINT16_DEC_WIDTH
+# define PRINTF_UINT16_DEC_WIDTH "5"
+# endif
+# ifndef PRINTF_INT8_DEC_WIDTH
+# define PRINTF_INT8_DEC_WIDTH "3"
+# endif
+# ifndef PRINTF_UINT8_DEC_WIDTH
+# define PRINTF_UINT8_DEC_WIDTH "3"
+# endif
+# ifndef PRINTF_INTMAX_HEX_WIDTH
+# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
+# endif
+# ifndef PRINTF_UINTMAX_HEX_WIDTH
+# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
+# endif
+# ifndef PRINTF_INTMAX_DEC_WIDTH
+# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
+# endif
+# ifndef PRINTF_UINTMAX_DEC_WIDTH
+# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
+# endif
+
+/*
+ * Something really weird is going on with Open Watcom. Just pull some of
+ * these duplicated definitions from Open Watcom's stdint.h file for now.
+ */
+
+# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
+# if !defined (INT64_C)
+# define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
+# endif
+# if !defined (UINT64_C)
+# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
+# endif
+# if !defined (INT32_C)
+# define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
+# endif
+# if !defined (UINT32_C)
+# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
+# endif
+# if !defined (INT16_C)
+# define INT16_C(x) (x)
+# endif
+# if !defined (UINT16_C)
+# define UINT16_C(x) (x)
+# endif
+# if !defined (INT8_C)
+# define INT8_C(x) (x)
+# endif
+# if !defined (UINT8_C)
+# define UINT8_C(x) (x)
+# endif
+# if !defined (UINT64_MAX)
+# define UINT64_MAX 18446744073709551615ULL
+# endif
+# if !defined (INT64_MAX)
+# define INT64_MAX 9223372036854775807LL
+# endif
+# if !defined (UINT32_MAX)
+# define UINT32_MAX 4294967295UL
+# endif
+# if !defined (INT32_MAX)
+# define INT32_MAX 2147483647L
+# endif
+# if !defined (INTMAX_MAX)
+# define INTMAX_MAX INT64_MAX
+# endif
+# if !defined (INTMAX_MIN)
+# define INTMAX_MIN INT64_MIN
+# endif
+# endif
+#endif
+
+/*
+ * I have no idea what is the truly correct thing to do on older Solaris.
+ * From some online discussions, this seems to be what is being
+ * recommended. For people who actually are developing on older Solaris,
+ * what I would like to know is, does this define all of the relevant
+ * macros of a complete stdint.h? Remember, in pstdint.h 64 bit is
+ * considered optional.
+ */
+
+#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED)
+#include <sys/inttypes.h>
+#define _PSTDINT_H_INCLUDED
+#endif
+
+#ifndef _PSTDINT_H_INCLUDED
+#define _PSTDINT_H_INCLUDED
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t)-1)
+#endif
+
+/*
+ * Deduce the type assignments from limits.h under the assumption that
+ * integer sizes in bits are powers of 2, and follow the ANSI
+ * definitions.
+ */
+
+#ifndef UINT8_MAX
+# define UINT8_MAX 0xff
+#endif
+#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks)
+# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
+ typedef unsigned char uint8_t;
+# define UINT8_C(v) ((uint8_t) v)
+# else
+# error "Platform not supported"
+# endif
+#endif
+
+#ifndef INT8_MAX
+# define INT8_MAX 0x7f
+#endif
+#ifndef INT8_MIN
+# define INT8_MIN INT8_C(0x80)
+#endif
+#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks)
+# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
+ typedef signed char int8_t;
+# define INT8_C(v) ((int8_t) v)
+# else
+# error "Platform not supported"
+# endif
+#endif
+
+#ifndef UINT16_MAX
+# define UINT16_MAX 0xffff
+#endif
+#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks)
+#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
+ typedef unsigned int uint16_t;
+# ifndef PRINTF_INT16_MODIFIER
+# define PRINTF_INT16_MODIFIER ""
+# endif
+# define UINT16_C(v) ((uint16_t) (v))
+#elif (USHRT_MAX == UINT16_MAX)
+ typedef unsigned short uint16_t;
+# define UINT16_C(v) ((uint16_t) (v))
+# ifndef PRINTF_INT16_MODIFIER
+# define PRINTF_INT16_MODIFIER "h"
+# endif
+#else
+#error "Platform not supported"
+#endif
+#endif
+
+#ifndef INT16_MAX
+# define INT16_MAX 0x7fff
+#endif
+#ifndef INT16_MIN
+# define INT16_MIN INT16_C(0x8000)
+#endif
+#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks)
+#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
+ typedef signed int int16_t;
+# define INT16_C(v) ((int16_t) (v))
+# ifndef PRINTF_INT16_MODIFIER
+# define PRINTF_INT16_MODIFIER ""
+# endif
+#elif (SHRT_MAX == INT16_MAX)
+ typedef signed short int16_t;
+# define INT16_C(v) ((int16_t) (v))
+# ifndef PRINTF_INT16_MODIFIER
+# define PRINTF_INT16_MODIFIER "h"
+# endif
+#else
+#error "Platform not supported"
+#endif
+#endif
+
+#ifndef UINT32_MAX
+# define UINT32_MAX (0xffffffffUL)
+#endif
+#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks)
+#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
+ typedef unsigned long uint32_t;
+# define UINT32_C(v) v ## UL
+# ifndef PRINTF_INT32_MODIFIER
+# define PRINTF_INT32_MODIFIER "l"
+# endif
+#elif (UINT_MAX == UINT32_MAX)
+ typedef unsigned int uint32_t;
+# ifndef PRINTF_INT32_MODIFIER
+# define PRINTF_INT32_MODIFIER ""
+# endif
+# define UINT32_C(v) v ## U
+#elif (USHRT_MAX == UINT32_MAX)
+ typedef unsigned short uint32_t;
+# define UINT32_C(v) ((unsigned short) (v))
+# ifndef PRINTF_INT32_MODIFIER
+# define PRINTF_INT32_MODIFIER ""
+# endif
+#else
+#error "Platform not supported"
+#endif
+#endif
+
+#ifndef INT32_MAX
+# define INT32_MAX (0x7fffffffL)
+#endif
+#ifndef INT32_MIN
+# define INT32_MIN INT32_C(0x80000000)
+#endif
+#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks)
+#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
+ typedef signed long int32_t;
+# define INT32_C(v) v ## L
+# ifndef PRINTF_INT32_MODIFIER
+# define PRINTF_INT32_MODIFIER "l"
+# endif
+#elif (INT_MAX == INT32_MAX)
+ typedef signed int int32_t;
+# define INT32_C(v) v
+# ifndef PRINTF_INT32_MODIFIER
+# define PRINTF_INT32_MODIFIER ""
+# endif
+#elif (SHRT_MAX == INT32_MAX)
+ typedef signed short int32_t;
+# define INT32_C(v) ((short) (v))
+# ifndef PRINTF_INT32_MODIFIER
+# define PRINTF_INT32_MODIFIER ""
+# endif
+#else
+#error "Platform not supported"
+#endif
+#endif
+
+/*
+ * The macro stdint_int64_defined is temporarily used to record
+ * whether or not 64 integer support is available. It must be
+ * defined for any 64 integer extensions for new platforms that are
+ * added.
+ */
+
+#undef stdint_int64_defined
+#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
+# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
+# define stdint_int64_defined
+ typedef long long int64_t;
+ typedef unsigned long long uint64_t;
+# define UINT64_C(v) v ## ULL
+# define INT64_C(v) v ## LL
+# ifndef PRINTF_INT64_MODIFIER
+# define PRINTF_INT64_MODIFIER "ll"
+# endif
+# endif
+#endif
+
+#if !defined (stdint_int64_defined)
+# if defined(__GNUC__) && !defined(vxWorks)
+# define stdint_int64_defined
+ __extension__ typedef long long int64_t;
+ __extension__ typedef unsigned long long uint64_t;
+# define UINT64_C(v) v ## ULL
+# define INT64_C(v) v ## LL
+# ifndef PRINTF_INT64_MODIFIER
+# define PRINTF_INT64_MODIFIER "ll"
+# endif
+# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
+# define stdint_int64_defined
+ typedef long long int64_t;
+ typedef unsigned long long uint64_t;
+# define UINT64_C(v) v ## ULL
+# define INT64_C(v) v ## LL
+# ifndef PRINTF_INT64_MODIFIER
+# define PRINTF_INT64_MODIFIER "ll"
+# endif
+# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
+# define stdint_int64_defined
+ typedef __int64 int64_t;
+ typedef unsigned __int64 uint64_t;
+# define UINT64_C(v) v ## UI64
+# define INT64_C(v) v ## I64
+# ifndef PRINTF_INT64_MODIFIER
+# define PRINTF_INT64_MODIFIER "I64"
+# endif
+# endif
+#endif
+
+#if !defined (LONG_LONG_MAX) && defined (INT64_C)
+# define LONG_LONG_MAX INT64_C (9223372036854775807)
+#endif
+#ifndef ULONG_LONG_MAX
+# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
+#endif
+
+#if !defined (INT64_MAX) && defined (INT64_C)
+# define INT64_MAX INT64_C (9223372036854775807)
+#endif
+#if !defined (INT64_MIN) && defined (INT64_C)
+# define INT64_MIN INT64_C (-9223372036854775808)
+#endif
+#if !defined (UINT64_MAX) && defined (INT64_C)
+# define UINT64_MAX UINT64_C (18446744073709551615)
+#endif
+
+/*
+ * Width of hexadecimal for number field.
+ */
+
+#ifndef PRINTF_INT64_HEX_WIDTH
+# define PRINTF_INT64_HEX_WIDTH "16"
+#endif
+#ifndef PRINTF_INT32_HEX_WIDTH
+# define PRINTF_INT32_HEX_WIDTH "8"
+#endif
+#ifndef PRINTF_INT16_HEX_WIDTH
+# define PRINTF_INT16_HEX_WIDTH "4"
+#endif
+#ifndef PRINTF_INT8_HEX_WIDTH
+# define PRINTF_INT8_HEX_WIDTH "2"
+#endif
+#ifndef PRINTF_INT64_DEC_WIDTH
+# define PRINTF_INT64_DEC_WIDTH "19"
+#endif
+#ifndef PRINTF_INT32_DEC_WIDTH
+# define PRINTF_INT32_DEC_WIDTH "10"
+#endif
+#ifndef PRINTF_INT16_DEC_WIDTH
+# define PRINTF_INT16_DEC_WIDTH "5"
+#endif
+#ifndef PRINTF_INT8_DEC_WIDTH
+# define PRINTF_INT8_DEC_WIDTH "3"
+#endif
+#ifndef PRINTF_UINT64_DEC_WIDTH
+# define PRINTF_UINT64_DEC_WIDTH "20"
+#endif
+#ifndef PRINTF_UINT32_DEC_WIDTH
+# define PRINTF_UINT32_DEC_WIDTH "10"
+#endif
+#ifndef PRINTF_UINT16_DEC_WIDTH
+# define PRINTF_UINT16_DEC_WIDTH "5"
+#endif
+#ifndef PRINTF_UINT8_DEC_WIDTH
+# define PRINTF_UINT8_DEC_WIDTH "3"
+#endif
+
+/*
+ * Ok, lets not worry about 128 bit integers for now. Moore's law says
+ * we don't need to worry about that until about 2040 at which point
+ * we'll have bigger things to worry about.
+ */
+
+#ifdef stdint_int64_defined
+ typedef int64_t intmax_t;
+ typedef uint64_t uintmax_t;
+# define INTMAX_MAX INT64_MAX
+# define INTMAX_MIN INT64_MIN
+# define UINTMAX_MAX UINT64_MAX
+# define UINTMAX_C(v) UINT64_C(v)
+# define INTMAX_C(v) INT64_C(v)
+# ifndef PRINTF_INTMAX_MODIFIER
+# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
+# endif
+# ifndef PRINTF_INTMAX_HEX_WIDTH
+# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
+# endif
+# ifndef PRINTF_INTMAX_DEC_WIDTH
+# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
+# endif
+#else
+ typedef int32_t intmax_t;
+ typedef uint32_t uintmax_t;
+# define INTMAX_MAX INT32_MAX
+# define UINTMAX_MAX UINT32_MAX
+# define UINTMAX_C(v) UINT32_C(v)
+# define INTMAX_C(v) INT32_C(v)
+# ifndef PRINTF_INTMAX_MODIFIER
+# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
+# endif
+# ifndef PRINTF_INTMAX_HEX_WIDTH
+# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
+# endif
+# ifndef PRINTF_INTMAX_DEC_WIDTH
+# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
+# endif
+#endif
+
+/*
+ * Because this file currently only supports platforms which have
+ * precise powers of 2 as bit sizes for the default integers, the
+ * least definitions are all trivial. Its possible that a future
+ * version of this file could have different definitions.
+ */
+
+#ifndef stdint_least_defined
+ typedef int8_t int_least8_t;
+ typedef uint8_t uint_least8_t;
+ typedef int16_t int_least16_t;
+ typedef uint16_t uint_least16_t;
+ typedef int32_t int_least32_t;
+ typedef uint32_t uint_least32_t;
+# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
+# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
+# define UINT_LEAST8_MAX UINT8_MAX
+# define INT_LEAST8_MAX INT8_MAX
+# define UINT_LEAST16_MAX UINT16_MAX
+# define INT_LEAST16_MAX INT16_MAX
+# define UINT_LEAST32_MAX UINT32_MAX
+# define INT_LEAST32_MAX INT32_MAX
+# define INT_LEAST8_MIN INT8_MIN
+# define INT_LEAST16_MIN INT16_MIN
+# define INT_LEAST32_MIN INT32_MIN
+# ifdef stdint_int64_defined
+ typedef int64_t int_least64_t;
+ typedef uint64_t uint_least64_t;
+# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
+# define UINT_LEAST64_MAX UINT64_MAX
+# define INT_LEAST64_MAX INT64_MAX
+# define INT_LEAST64_MIN INT64_MIN
+# endif
+#endif
+#undef stdint_least_defined
+
+/*
+ * The ANSI C committee has defined *int*_fast*_t types as well. This,
+ * of course, defies rationality -- you can't know what will be fast
+ * just from the type itself. Even for a given architecture, compatible
+ * implementations might have different performance characteristics.
+ * Developers are warned to stay away from these types when using this
+ * or any other stdint.h.
+ */
+
+typedef int_least8_t int_fast8_t;
+typedef uint_least8_t uint_fast8_t;
+typedef int_least16_t int_fast16_t;
+typedef uint_least16_t uint_fast16_t;
+typedef int_least32_t int_fast32_t;
+typedef uint_least32_t uint_fast32_t;
+#define UINT_FAST8_MAX UINT_LEAST8_MAX
+#define INT_FAST8_MAX INT_LEAST8_MAX
+#define UINT_FAST16_MAX UINT_LEAST16_MAX
+#define INT_FAST16_MAX INT_LEAST16_MAX
+#define UINT_FAST32_MAX UINT_LEAST32_MAX
+#define INT_FAST32_MAX INT_LEAST32_MAX
+#define INT_FAST8_MIN INT_LEAST8_MIN
+#define INT_FAST16_MIN INT_LEAST16_MIN
+#define INT_FAST32_MIN INT_LEAST32_MIN
+#ifdef stdint_int64_defined
+ typedef int_least64_t int_fast64_t;
+ typedef uint_least64_t uint_fast64_t;
+# define UINT_FAST64_MAX UINT_LEAST64_MAX
+# define INT_FAST64_MAX INT_LEAST64_MAX
+# define INT_FAST64_MIN INT_LEAST64_MIN
+#endif
+
+#undef stdint_int64_defined
+
+/*
+ * Whatever piecemeal, per compiler thing we can do about the wchar_t
+ * type limits.
+ */
+
+#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks)
+# include <wchar.h>
+# ifndef WCHAR_MIN
+# define WCHAR_MIN 0
+# endif
+# ifndef WCHAR_MAX
+# define WCHAR_MAX ((wchar_t)-1)
+# endif
+#endif
+
+/*
+ * Whatever piecemeal, per compiler/platform thing we can do about the
+ * (u)intptr_t types and limits.
+ */
+
+#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T)
+# define STDINT_H_UINTPTR_T_DEFINED
+#endif
+
+#ifndef STDINT_H_UINTPTR_T_DEFINED
+# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__)
+# define stdint_intptr_bits 64
+# elif defined (__WATCOMC__) || defined (__TURBOC__)
+# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
+# define stdint_intptr_bits 16
+# else
+# define stdint_intptr_bits 32
+# endif
+# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__)
+# define stdint_intptr_bits 32
+# elif defined (__INTEL_COMPILER)
+/* TODO -- what did Intel do about x86-64? */
+# else
+/* #error "This platform might not be supported yet" */
+# endif
+
+# ifdef stdint_intptr_bits
+# define stdint_intptr_glue3_i(a,b,c) a##b##c
+# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
+# ifndef PRINTF_INTPTR_MODIFIER
+# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
+# endif
+# ifndef PTRDIFF_MAX
+# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
+# endif
+# ifndef PTRDIFF_MIN
+# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
+# endif
+# ifndef UINTPTR_MAX
+# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
+# endif
+# ifndef INTPTR_MAX
+# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
+# endif
+# ifndef INTPTR_MIN
+# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
+# endif
+# ifndef INTPTR_C
+# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
+# endif
+# ifndef UINTPTR_C
+# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
+# endif
+ typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
+ typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
+# else
+/* TODO -- This following is likely wrong for some platforms, and does
+ nothing for the definition of uintptr_t. */
+ typedef ptrdiff_t intptr_t;
+# endif
+# define STDINT_H_UINTPTR_T_DEFINED
+#endif
+
+/*
+ * Assumes sig_atomic_t is signed and we have a 2s complement machine.
+ */
+
+#ifndef SIG_ATOMIC_MAX
+# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
+#endif
+
+#endif
+
+#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
+
+/*
+ * Please compile with the maximum warning settings to make sure macros are
+ * not defined more than once.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#define glue3_aux(x,y,z) x ## y ## z
+#define glue3(x,y,z) glue3_aux(x,y,z)
+
+#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0);
+#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0);
+
+#define DECL(us,bits) glue3(DECL,us,) (bits)
+
+#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf ("Something wrong with UINT%d_MAX\n", bits)
+
+#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; }
+
+#define X_SIZE_MAX ((size_t)-1)
+
+int main () {
+ int err_n = 0;
+ int err_first = 0;
+ DECL(I,8)
+ DECL(U,8)
+ DECL(I,16)
+ DECL(U,16)
+ DECL(I,32)
+ DECL(U,32)
+#ifdef INT64_MAX
+ DECL(I,64)
+ DECL(U,64)
+#endif
+ intmax_t imax = INTMAX_C(0);
+ uintmax_t umax = UINTMAX_C(0);
+ char str0[256], str1[256];
+
+ sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647));
+ if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
+ if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH));
+ sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295));
+ if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
+ if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH));
+#ifdef INT64_MAX
+ sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807));
+ if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
+ if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1)));
+ sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591));
+ if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
+ if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1)));
+#endif
+
+ sprintf (str0, "%d %x\n", 0, ~0);
+
+ sprintf (str1, "%d %x\n", i8, ~0);
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1));
+ sprintf (str1, "%u %x\n", u8, ~0);
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1));
+ sprintf (str1, "%d %x\n", i16, ~0);
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1));
+ sprintf (str1, "%u %x\n", u16, ~0);
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1));
+ sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1));
+ sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1));
+#ifdef INT64_MAX
+ sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1));
+#endif
+ sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1));
+ sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1));
+
+ TESTUMAX(8);
+ TESTUMAX(16);
+ TESTUMAX(32);
+#ifdef INT64_MAX
+ TESTUMAX(64);
+#endif
+
+#define STR(v) #v
+#define Q(v) printf ("sizeof " STR(v) " = %u\n", (unsigned) sizeof (v));
+ if (err_n) {
+ printf ("pstdint.h is not correct. Please use sizes below to correct it:\n");
+ }
+
+ Q(int)
+ Q(unsigned)
+ Q(long int)
+ Q(short int)
+ Q(int8_t)
+ Q(int16_t)
+ Q(int32_t)
+#ifdef INT64_MAX
+ Q(int64_t)
+#endif
+
+#if UINT_MAX < X_SIZE_MAX
+ printf ("UINT_MAX < X_SIZE_MAX\n");
+#else
+ printf ("UINT_MAX >= X_SIZE_MAX\n");
+#endif
+ printf ("%" PRINTF_INT64_MODIFIER "u vs %" PRINTF_INT64_MODIFIER "u\n", UINT_MAX, X_SIZE_MAX);
+
+ return EXIT_SUCCESS;
+}
+
+#endif
diff --git a/compat/stdlib.h b/compat/stdlib.h
deleted file mode 100644
index 2c64890..0000000
--- a/compat/stdlib.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * stdlib.h --
- *
- * Declares facilities exported by the "stdlib" portion of the C library.
- * This file isn't complete in the ANSI-C sense; it only declares things
- * that are needed by Tk. This file is needed even on many systems with
- * their own stdlib.h (e.g. SunOS) because not all stdlib.h files declare
- * all the procedures needed here (such as strtod).
- *
- * Copyright (c) 1991 The Regents of the University of California.
- * Copyright (c) 1994-1998 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution of
- * this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#ifndef _STDLIB
-#define _STDLIB
-
-#ifndef _TCL
-# include <tcl.h>
-#endif
-
-extern void abort(void);
-extern double atof(const char *string);
-extern int atoi(const char *string);
-extern long atol(const char *string);
-extern char * calloc(unsigned int numElements, unsigned int size);
-extern void exit(int status);
-extern int free(char *blockPtr);
-extern char * getenv(const char *name);
-extern char * malloc(unsigned int numBytes);
-extern void qsort(void *base, int n, int size, int (*compar)(
- const void *element1, const void *element2));
-extern char * realloc(char *ptr, unsigned int numBytes);
-extern double strtod(const char *string, char **endPtr);
-extern long strtol(const char *string, char **endPtr, int base);
-extern unsigned long strtoul(const char *string, char **endPtr, int base);
-
-#endif /* _STDLIB */
diff --git a/compat/unistd.h b/compat/unistd.h
deleted file mode 100644
index be966cc..0000000
--- a/compat/unistd.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * unistd.h --
- *
- * Macros, constants and prototypes for Posix conformance.
- *
- * Copyright 1989 Regents of the University of California Permission to use,
- * copy, modify, and distribute this software and its documentation for any
- * purpose and without fee is hereby granted, provided that the above
- * copyright notice appear in all copies. The University of California makes
- * no representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- */
-
-#ifndef _UNISTD
-#define _UNISTD
-
-#include <sys/types.h>
-#ifndef _TCL
-# include <tcl.h>
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/*
- * Strict POSIX stuff goes here. Extensions go down below, in the ifndef
- * _POSIX_SOURCE section.
- */
-
-extern void _exit(int status);
-extern int access(const char *path, int mode);
-extern int chdir(const char *path);
-extern int chown(const char *path, uid_t owner, gid_t group);
-extern int close(int fd);
-extern int dup(int oldfd);
-extern int dup2(int oldfd, int newfd);
-extern int execl(const char *path, ...);
-extern int execle(const char *path, ...);
-extern int execlp(const char *file, ...);
-extern int execv(const char *path, char **argv);
-extern int execve(const char *path, char **argv, char **envp);
-extern int execvp(const char *file, char **argv);
-extern pid_t fork(void);
-extern char * getcwd(char *buf, size_t size);
-extern gid_t getegid(void);
-extern uid_t geteuid(void);
-extern gid_t getgid(void);
-extern int getgroups(int bufSize, int *buffer);
-extern pid_t getpid(void);
-extern uid_t getuid(void);
-extern int isatty(int fd);
-extern long lseek(int fd, long offset, int whence);
-extern int pipe(int *fildes);
-extern int read(int fd, char *buf, size_t size);
-extern int setgid(gid_t group);
-extern int setuid(uid_t user);
-extern unsigned sleep(unsigned seconds);
-extern char * ttyname(int fd);
-extern int unlink(const char *path);
-extern int write(int fd, const char *buf, size_t size);
-
-#ifndef _POSIX_SOURCE
-extern char * crypt(const char *, const char *);
-extern int fchown(int fd, uid_t owner, gid_t group);
-extern int flock(int fd, int operation);
-extern int ftruncate(int fd, unsigned long length);
-extern int ioctl(int fd, int request, ...);
-extern int readlink(const char *path, char *buf, int bufsize);
-extern int setegid(gid_t group);
-extern int seteuid(uid_t user);
-extern int setreuid(int ruid, int euid);
-extern int symlink(const char *, const char *);
-extern int ttyslot(void);
-extern int truncate(const char *path, unsigned long length);
-extern int vfork(void);
-#endif /* _POSIX_SOURCE */
-
-#endif /* _UNISTD */
-
diff --git a/doc/AddOption.3 b/doc/AddOption.3
index 2368f09..c1c116a 100644
--- a/doc/AddOption.3
+++ b/doc/AddOption.3
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
'\" All rights reserved.
'\"
.TH Tk_AddOption 3 "" Tk "Tk Library Procedures"
diff --git a/doc/ConfigWidg.3 b/doc/ConfigWidg.3
index 92be073..927925c 100644
--- a/doc/ConfigWidg.3
+++ b/doc/ConfigWidg.3
@@ -107,7 +107,7 @@ typedef struct {
const char *\fIdbName\fR;
const char *\fIdbClass\fR;
const char *\fIdefValue\fR;
- int \fIoffset\fR;
+ size_t \fIoffset\fR;
int \fIspecFlags\fR;
const Tk_CustomOption *\fIcustomPtr\fR;
} \fBTk_ConfigSpec\fR;
@@ -161,9 +161,8 @@ contain information relevant to the manager of the widget; its exact
type is unknown to \fBTk_ConfigureWidget\fR. The \fIoffset\fR field
of each \fIspecs\fR entry indicates where in \fIwidgRec\fR to store
the information about this configuration option. You should use the
-\fBTk_Offset\fR macro to generate \fIoffset\fR values (see below for
-a description of \fBTk_Offset\fR). The location indicated by
-\fIwidgRec\fR and \fIoffset\fR will be referred to as the
+\fBoffsetof\fR macro to generate \fIoffset\fR values. The location
+indicated by \fIwidgRec\fR and \fIoffset\fR will be referred to as the
.QW target
in the descriptions below.
.PP
@@ -469,13 +468,6 @@ for which this entry is valid. When calling \fBTk_ConfigureWidget\fR,
\fIflags\fR will have a single one of these bits set to select the
entries for the desired widget type. For a working example of
this feature, see the code in tkButton.c.
-.SH TK_OFFSET
-.PP
-The \fBTk_Offset\fR macro is provided as a safe way of generating
-the \fIoffset\fR values for entries in Tk_ConfigSpec structures.
-It takes two arguments: the name of a type of record, and the
-name of a field in that record. It returns the byte offset of
-the named field in records of the given type.
.SH TK_CONFIGUREINFO
.PP
The \fBTk_ConfigureInfo\fR procedure may be used to obtain
diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3
index 250f537..b0a14fc 100644
--- a/doc/CrtImgType.3
+++ b/doc/CrtImgType.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_CreateImageType, Tk_GetImageMasterData, Tk_GetImageModelData, Tk_InitImageArgs \- define new kind of image
+Tk_CreateImageType, Tk_GetImageModelData, Tk_InitImageArgs \- define new kind of image
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -17,12 +17,7 @@ Tk_CreateImageType, Tk_GetImageMasterData, Tk_GetImageModelData, Tk_InitImageArg
\fBTk_CreateImageType\fR(\fItypePtr\fR)
.sp
ClientData
-\fBTk_GetImageMasterData\fR(\fIinterp, name, typePtrPtr\fR)
-.sp
-.VS "TIP 581"
-ClientData
\fBTk_GetImageModelData\fR(\fIinterp, name, typePtrPtr\fR)
-.VE "TIP 581"
.sp
\fBTk_InitImageArgs\fR(\fIinterp, argc, argvPtr\fR)
.SH ARGUMENTS
@@ -118,7 +113,7 @@ typedef int \fBTk_ImageCreateProc\fR(
int \fIobjc\fR,
Tcl_Obj *const \fIobjv\fR[],
const Tk_ImageType *\fItypePtr\fR,
- Tk_ImageMaster \fImodel\fR,
+ Tk_ImageModel \fImodel\fR,
ClientData *\fImodelDataPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the \fBimage\fR
@@ -235,7 +230,7 @@ image was created.
the image.
.SH TK_GETIMAGEMODELDATA
.PP
-The procedure \fBTk_GetImageMasterData\fR may be invoked to retrieve
+The procedure \fBTk_GetImageModelData\fR may be invoked to retrieve
information about an image. For example, an image manager can use this
procedure to locate its image model data for an image.
If there exists an image named \fIname\fR
@@ -246,10 +241,6 @@ and the return value is the ClientData value returned by the
\fIcreateProc\fR when the image was created (this is typically a
pointer to the image model data structure). If no such image exists
then NULL is returned and NULL is stored at \fI*typePtrPtr\fR.
-.PP
-.VS "TIP 581"
-\fBTk_GetImageModelData\fR is synonym for \fBTk_GetImageMasterData\fR
-.VE "TIP 581"
.SH "LEGACY INTERFACE SUPPORT"
.PP
In Tk 8.2 and earlier, the definition of \fBTk_ImageCreateProc\fR
@@ -261,7 +252,7 @@ typedef int \fBTk_ImageCreateProc\fR(
int \fIargc\fR,
char **\fIargv\fR,
Tk_ImageType *\fItypePtr\fR,
- Tk_ImageMaster \fImodel\fR,
+ Tk_ImageModel \fImodel\fR,
ClientData *\fImodelDataPtr\fR);
.CE
Legacy programs and libraries dating from those days may still
@@ -270,10 +261,6 @@ interface. The Tk header file will still support this legacy
interface if the code is compiled with the macro \fBUSE_OLD_IMAGE\fR
defined.
.PP
-.VS "TIP 581"
-\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR
-.VE "TIP 581"
-.PP
When the \fBUSE_OLD_IMAGE\fR legacy support is enabled, you may
see the routine \fBTk_InitImageArgs\fR in use. This was a migration
tool used to create stub-enabled extensions that could be loaded
diff --git a/doc/CrtItemType.3 b/doc/CrtItemType.3
index f9198f3..cd270f4 100644
--- a/doc/CrtItemType.3
+++ b/doc/CrtItemType.3
@@ -64,7 +64,7 @@ the standard procedures implemented by the type manager:
.CS
typedef struct Tk_ItemType {
const char *\fIname\fR;
- int \fIitemSize\fR;
+ size_t \fIitemSize\fR;
Tk_ItemCreateProc *\fIcreateProc\fR;
const Tk_ConfigSpec *\fIconfigSpecs\fR;
Tk_ItemConfigureProc *\fIconfigProc\fR;
@@ -83,6 +83,9 @@ typedef struct Tk_ItemType {
Tk_ItemInsertProc *\fIinsertProc\fR;
Tk_ItemDCharsProc *\fIdCharsProc\fR;
Tk_ItemType *\fInextPtr\fR;
+.VS "8.7, TIP164"
+ Tk_ItemRotateProc *\fIrotateProc\fR;
+.VE "8.7, TIP164"
} \fBTk_ItemType\fR;
.CE
.PP
@@ -549,6 +552,46 @@ and \fIdeltaX\fR and \fIdeltaY\fR give the amounts that should be
added to each x and y coordinate within the item.
The type manager should adjust the item's coordinates and
update the bounding box in the item's header.
+.SS ROTATEPROC
+.VS "8.7, TIP164"
+.PP
+\fItypePtr\->rotateProc\fR is invoked by Tk to rotate a canvas item
+during the \fBrotate\fR widget command.
+The procedure must match the following prototype:
+.PP
+.CS
+typedef void \fBTk_ItemRotateProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ double \fIoriginX\fR,
+ double \fIoriginY\fR,
+ double \fIangleRad\fR);
+.CE
+.PP
+The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning.
+\fIoriginX\fR and \fIoriginY\fR specify an origin relative to which
+the item is to be rotated, and \fIangleRad\fR gives the anticlockwise
+rotation to be applied in radians.
+The item should adjust the coordinates of its control points so that where
+they used to have coordinates \fIx\fR and \fIy\fR, they will have new
+coordinates \fIx\(fm\fR and \fIy\(fm\fR, where
+.PP
+.CS
+\fIrelX\fR = \fIx\fR - \fIoriginX\fR
+\fIrelY\fR = \fIy\fR - \fIoriginY\fR
+\fIx\(fm\fR = \fIoriginX\fR + \fIrelX\fR \(mu cos(\fIangleRad\fR) + \fIrelY\fR \(mu sin(\fIangleRad\fR)
+\fIy\(fm\fR = \fIoriginY\fR \(mi \fIrelX\fR \(mu sin(\fIangleRad\fR) + \fIrelY\fR \(mu cos(\fIangleRad\fR)
+.CE
+.PP
+The control points for an item are not necessarily the coordinates provided to
+the item when it is created (or via the \fItypePtr\->coordProc\fR), but could
+instead be derived from them.
+\fIrotateProc\fR must also update the bounding box in the item's header.
+.PP
+Item types do not need to provide a \fItypePtr\->rotateProc\fR. If the
+\fItypePtr\->rotateProc\fR is NULL, the \fItypePtr\->coordProc\fR will be
+used instead to retrieve and update the list of coordinates.
+.VE "8.7, TIP164"
.SS INDEXPROC
.PP
\fItypePtr\->indexProc\fR is invoked by Tk to translate a string
diff --git a/doc/CrtPhImgFmt.3 b/doc/CrtPhImgFmt.3
index 92f2441..c7accdb 100644
--- a/doc/CrtPhImgFmt.3
+++ b/doc/CrtPhImgFmt.3
@@ -9,7 +9,7 @@
'\" Department of Computer Science,
'\" Australian National University.
'\"
-.TH Tk_CreatePhotoImageFormat 3 8.5 Tk "Tk Library Procedures"
+.TH Tk_CreatePhotoImageFormat 3 8.7 Tk "Tk Library Procedures"
.so man.macros
.BS
.SH NAME
@@ -18,15 +18,23 @@ Tk_CreatePhotoImageFormat \- define new file format for photo images
.nf
\fB#include <tk.h>\fR
.sp
+.VS 8.7
+\fBTk_CreatePhotoImageFormatVersion3\fR(\fIformatVersion3Ptr\fR)
+.VE 8.7
+.sp
\fBTk_CreatePhotoImageFormat\fR(\fIformatPtr\fR)
.SH ARGUMENTS
-.AS "const Tk_PhotoImageFormat" *formatPtr
+.AS "const Tk_PhotoImageFormatVersion3" *formatVersion3Ptr
+.VS 8.7
+.AP "const Tk_PhotoImageFormatVersion3" *formatVersion3Ptr in
+Structure that defines the new file format including metadata functionality.
+.VE 8.7
.AP "const Tk_PhotoImageFormat" *formatPtr in
Structure that defines the new file format.
.BE
.SH DESCRIPTION
.PP
-\fBTk_CreatePhotoImageFormat\fR is invoked to define a new file format
+\fBTk_CreatePhotoImageFormatVersion3\fR is invoked to define a new file format
for image data for use with photo images. The code that implements an
image file format is called an image file format handler, or
handler for short. The photo image code
@@ -38,22 +46,29 @@ The user can specify which handler to use with the \fB\-format\fR
image configuration option or the \fB\-format\fR option to the
\fBread\fR and \fBwrite\fR photo image subcommands.
.PP
+The alternate version 2 function \fBTk_CreatePhotoImageFormat\fR has
+identical functionality, but does not allow the handler to get or return
+the metadata dictionary of the image.
+It is described in section \fBVERSION 2 INTERFACE\fR below.
+.PP
An image file format handler consists of a collection of procedures
-plus a Tk_PhotoImageFormat structure, which contains the name of the
-image file format and pointers to six procedures provided by the
-handler to deal with files and strings in this format. The
-Tk_PhotoImageFormat structure contains the following fields:
+plus a \fBTk_PhotoImageFormatVersion3\fR structure, which contains the
+name of the image file format and pointers to six procedures provided
+by the handler to deal with files and strings in this format. The
+Tk_PhotoImageFormatVersion3 structure contains the following fields:
+.VS 8.7
.CS
-typedef struct Tk_PhotoImageFormat {
+typedef struct Tk_PhotoImageFormatVersion3 {
const char *\fIname\fR;
- Tk_ImageFileMatchProc *\fIfileMatchProc\fR;
- Tk_ImageStringMatchProc *\fIstringMatchProc\fR;
- Tk_ImageFileReadProc *\fIfileReadProc\fR;
- Tk_ImageStringReadProc *\fIstringReadProc\fR;
- Tk_ImageFileWriteProc *\fIfileWriteProc\fR;
- Tk_ImageStringWriteProc *\fIstringWriteProc\fR;
-} \fBTk_PhotoImageFormat\fR;
+ Tk_ImageFileMatchProcVersion3 *\fIfileMatchProc\fR;
+ Tk_ImageStringMatchProcVersion3 *\fIstringMatchProc\fR;
+ Tk_ImageFileReadProcVersion3 *\fIfileReadProc\fR;
+ Tk_ImageStringReadProcVersion3 *\fIstringReadProc\fR;
+ Tk_ImageFileWriteProcVersion3 *\fIfileWriteProc\fR;
+ Tk_ImageStringWriteProcVersion3 *\fIstringWriteProc\fR;
+} \fBTk_PhotoImageFormatVersion3\fR;
.CE
+.VE 8.7
.PP
The handler need not provide implementations of all six procedures.
For example, the procedures that handle string data would not be
@@ -67,14 +82,16 @@ procedure, and the \fIstringMatchProc\fR procedure if it provides the
.SS NAME
.PP
\fIformatPtr->name\fR provides a name for the image type.
-Once \fBTk_CreatePhotoImageFormat\fR returns, this name may be used
-in the \fB\-format\fR photo image configuration and subcommand option.
+Once \fBTk_CreatePhotoImageFormatVersion3\fR returns, this name may be
+used in the \fB\-format\fR photo image configuration and subcommand
+option.
The manual page for the photo image (photo(n)) describes how image
file formats are chosen based on their names and the value given to
the \fB\-format\fR option. The first character of \fIformatPtr->name\fR
must not be an uppercase character from the ASCII character set
(that is, one of the characters \fBA\fR-\fBZ\fR). Such names are used
only for legacy interface support (see below).
+.VS 8.7
.SS FILEMATCHPROC
.PP
\fIformatPtr->fileMatchProc\fR provides the address of a procedure for
@@ -82,39 +99,47 @@ Tk to call when it is searching for an image file format handler
suitable for reading data in a given file.
\fIformatPtr->fileMatchProc\fR must match the following prototype:
.CS
-typedef int \fBTk_ImageFileMatchProc\fR(
+typedef int \fBTk_ImageFileMatchProcVersion3\fR(
+ Tcl_Interp *\fIinterp\fR,
Tcl_Channel \fIchan\fR,
const char *\fIfileName\fR,
Tcl_Obj *\fIformat\fR,
+ Tcl_Obj *\fImetadataIn\fR,
int *\fIwidthPtr\fR,
int *\fIheightPtr\fR,
- Tcl_Interp *\fIinterp\fR);
+ Tcl_Obj *\fImetadataOut\fR);
.CE
The \fIfileName\fR argument is the name of the file containing the
image data, which is open for reading as \fIchan\fR. The
\fIformat\fR argument contains the value given for the
\fB\-format\fR option, or NULL if the option was not specified.
+\fBmetadataIn\fR and \fBmetadataOut\fR inputs and returns a metadata
+dictionary as described in section \fBMETADATA INTERFACE\fR below.
If the data in the file appears to be in the format supported by this
handler, the \fIformatPtr->fileMatchProc\fR procedure should store the
width and height of the image in *\fIwidthPtr\fR and *\fIheightPtr\fR
respectively, and return 1. Otherwise it should return 0.
.SS STRINGMATCHPROC
.PP
-\fIformatPtr->stringMatchProc\fR provides the address of a procedure for
-Tk to call when it is searching for an image file format handler for
+\fIformatPtr->stringMatchProc\fR provides the address of a procedure
+for Tk to call when it is searching for an image file format handler
suitable for reading data from a given string.
\fIformatPtr->stringMatchProc\fR must match the following prototype:
.CS
-typedef int \fBTk_ImageStringMatchProc\fR(
+typedef int \fBTk_ImageStringMatchProcVersion3\fR(
+ Tcl_Interp *\fIinterp\fR,
Tcl_Obj *\fIdata\fR,
Tcl_Obj *\fIformat\fR,
+ Tcl_Obj *\fImetadataIn\fR,
int *\fIwidthPtr\fR,
int *\fIheightPtr\fR,
- Tcl_Interp *\fIinterp\fR);
+ Tcl_Obj *\fImetadataOut\fR);
.CE
The \fIdata\fR argument points to the object containing the image
data. The \fIformat\fR argument contains the value given for
the \fB\-format\fR option, or NULL if the option was not specified.
+\fBmetadataIn\fR and \fBmetadataOut\fR inputs and returns a metadata
+dictionary as described in section \fBMETADATA INTERFACE\fR below.
If the data in the string appears to be in the format supported by
this handler, the \fIformatPtr->stringMatchProc\fR procedure should
store the width and height of the image in *\fIwidthPtr\fR and
@@ -131,10 +156,12 @@ typedef int \fBTk_ImageFileReadProc\fR(
Tcl_Channel \fIchan\fR,
const char *\fIfileName\fR,
Tcl_Obj *\fIformat\fR,
+ Tcl_Obj *\fImetadataIn\fR,
PhotoHandle \fIimageHandle\fR,
int \fIdestX\fR, int \fIdestY\fR,
int \fIwidth\fR, int \fIheight\fR,
- int \fIsrcX\fR, int \fIsrcY\fR);
+ int \fIsrcX\fR, int \fIsrcY\fR,
+ Tcl_Obj *\fImetadataOut\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to read the image; it should be used for reporting errors.
@@ -148,34 +175,40 @@ dimensions \fIwidth\fR x \fIheight\fR and has its top-left corner at
coordinates (\fIsrcX\fR,\fIsrcY\fR). It is to be stored in the photo
image with its top-left corner at coordinates
(\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.
+\fBmetadataIn\fR and \fBmetadataOut\fR inputs and returns a metadata
+dictionary as described in section \fBMETADATA INTERFACE\fR below.
The return value is a standard Tcl return value.
.SS STRINGREADPROC
.PP
-\fIformatPtr->stringReadProc\fR provides the address of a procedure for
-Tk to call to read data from a string into a photo image.
+\fIformatPtr->stringReadProc\fR provides the address of a procedure
+for Tk to call to read data from a string into a photo image.
\fIformatPtr->stringReadProc\fR must match the following prototype:
.CS
typedef int \fBTk_ImageStringReadProc\fR(
Tcl_Interp *\fIinterp\fR,
Tcl_Obj *\fIdata\fR,
Tcl_Obj *\fIformat\fR,
+ Tcl_Obj *\fImetadataIn\fR,
PhotoHandle \fIimageHandle\fR,
int \fIdestX\fR, int \fIdestY\fR,
int \fIwidth\fR, int \fIheight\fR,
- int \fIsrcX\fR, int \fIsrcY\fR);
+ int \fIsrcX\fR, int \fIsrcY\fR,
+ Tcl_Obj *\fImetadataOut\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to read the image; it should be used for reporting errors.
The \fIdata\fR argument points to the image data in object form.
The \fIformat\fR argument contains the
value given for the \fB\-format\fR option, or NULL if the option was
-not specified. The image data in the string, or a subimage of it, is to
-be read into the photo image identified by the handle
+not specified. The image data in the string, or a subimage of it, is
+to be read into the photo image identified by the handle
\fIimageHandle\fR. The subimage of the data in the string is of
dimensions \fIwidth\fR x \fIheight\fR and has its top-left corner at
coordinates (\fIsrcX\fR,\fIsrcY\fR). It is to be stored in the photo
image with its top-left corner at coordinates
(\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.
+\fBmetadataIn\fR and \fBmetadataOut\fR inputs and returns a metadata
+dictionary as described in section \fBMETADATA INTERFACE\fR below.
The return value is a standard Tcl return value.
.SS FILEWRITEPROC
.PP
@@ -187,6 +220,7 @@ typedef int \fBTk_ImageFileWriteProc\fR(
Tcl_Interp *\fIinterp\fR,
const char *\fIfileName\fR,
Tcl_Obj *\fIformat\fR,
+ Tcl_Obj *\fImetadataIn\fR,
Tk_PhotoImageBlock *\fIblockPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
@@ -201,16 +235,20 @@ not specified. The format string can contain extra characters
after the name of the format. If appropriate, the
\fIformatPtr->fileWriteProc\fR procedure may interpret these
characters to specify further details about the image file.
+\fBmetadataIn\fR may contain metadata keys that a driver may include
+into the output data.
The return value is a standard Tcl return value.
.SS STRINGWRITEPROC
.PP
-\fIformatPtr->stringWriteProc\fR provides the address of a procedure for
-Tk to call to translate image data from a photo image into a string.
+\fIformatPtr->stringWriteProc\fR provides the address of a procedure
+for Tk to call to translate image data from a photo image into a
+string.
\fIformatPtr->stringWriteProc\fR must match the following prototype:
.CS
typedef int \fBTk_ImageStringWriteProc\fR(
Tcl_Interp *\fIinterp\fR,
Tcl_Obj *\fIformat\fR,
+ Tcl_Obj *\fImetadataIn\fR,
Tk_PhotoImageBlock *\fIblockPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
@@ -225,7 +263,201 @@ not specified. The format string can contain extra characters
after the name of the format. If appropriate, the
\fIformatPtr->stringWriteProc\fR procedure may interpret these
characters to specify further details about the image file.
+\fBmetadataIn\fR may contain metadata keys that a driver may include
+into the output data.
The return value is a standard Tcl return value.
+.PP
+.SH "METADATA INTERFACE"
+.PP
+Image formats contain a description of the image bitmap and may
+contain additional information like image resolution or comments.
+Image metadata may be read from image files and passed to the script
+level by including dictionary keys into the metadata property of the
+image. Image metadata may be written to image data on file write or
+image data output.
+.PP
+.PP
+.SS "METADATA KEYS"
+.PP
+The metadata may contain any key.
+A driver will handle only a set of dictionary keys documented in the
+documentation. See the photo image manual page for currently defined
+keys for the system drivers.
+.PP
+The following rules may give guidance to name metadata keys:
+.RS
+Abreviation are in upper case
+.RE
+.RS
+Words are in US English in small case (except proper nouns)
+.RE
+.RS
+Vertical DPI is expressed as DPI/aspect. The reason is, that some
+image formats may feature aspect and no resolution value.
+.RE
+.SS "METADATA INPUT"
+.PP
+Each driver function gets a Tcl object pointer \fBmetadataIn\fR as
+parameter. This parameter serves to input a metadata dict to the
+driver function.
+It may be NULL to flag that the metadata dict is empty.
+.PP
+A typical driver code snipped to check for a metadata key is:
+.CS
+if (NULL != metadataIn) {
+ Tcl_Obj *itemData;
+ Tcl_DictObjGet(interp, metadataIn, Tcl_NewStringObj("Comment",-1), &itemData));
+.CE
+.PP
+The \-metadata command option data of the following commands is passed
+to the driver: \fBimage create\fR, \fBconfigure\fR, \fBput\fR,
+\fBread\fR, \fBdata\fR and \fBwrite\fR.
+If no \-metadata command option available or not given, the metadata
+property of the image is passed to the driver using the following
+commands: \fBcget\fR, \fBconfigure\fR, \fBdata\fR and \fBwrite\fR.
+.PP
+Note that setting the \-metadata property of an image using
+\fBconfigure\fR without any other option does not invoke any driver
+function.
+.PP
+The metadata dictionary is not suited to pass options to the driver
+related to the bitmap representation, as the image bitmap is not
+recreated on a metadata change. The format string should be used for
+this purpose.
+.PP
+.SS "METADATA OUTPUT"
+.PP
+The image match and read driver functions may set keys in a prepared
+matadata dict to return them.
+Those functions get a Tcl object pointer \fBmetadataOut\fR as
+parameter.
+metadataOut may be NULL to indicate, that no metadata return is
+attended(\fBput\fR, \fBread\fR subcommands).
+\fBmetadataOut\fR is initialized to an empty unshared dict object if
+metadata return is attended (\fBimage create\fR command, \fBconfigure\fR
+subcommand). The driver may set dict keys in this object to return
+metadata.
+If a match function succeeds, the metadataOut pointer is passed to the
+corresponding read function.
+.PP
+A sample driver code snippet is:
+.CS
+if (NULL != metadataOut) {
+ Tcl_DictObjPut(NULL, metadataOut, Tcl_NewStringObj("XMP",-1), Tcl_NewStringObj(xmpMetadata);
+.CE
+.PP
+The metadata keys returned by the driver are merged into the present
+metadata property of the image or into the metadata dict given by the
+\fB\-metadata\fR command line option.
+At the script level, the command \fBimage create\fR and the
+\fBconfigure\fR method may return metadata from the driver.
+.PP
+Format string options or metadata keys may influence the creation of
+metadata within the driver.
+For example, the creation of an expensive metadata key may depend on a
+format string option or on a metadata input key.
+.PP
+.VE 8.7
+.SH "VERSION 2 INTERFACE"
+.PP
+Version 2 Interface does not include the possibility for the driver to
+use the metadata dict for input or output.
+.SS SYNOPSIS
+\fB#include <tk.h>\fR
+.sp
+\fBTk_CreatePhotoImageFormat\fR(\fIformatPtr\fR)
+.SS ARGUMENTS
+.AS "const Tk_PhotoImageFormat" *formatPtr
+.AP "const Tk_PhotoImageFormat" *formatPtr in
+Structure that defines the new file format.
+.BE
+.SS DESCRIPTION
+A driver using the version 2 interface invokes \fBTk_CreatePhotoImageFormat\fR
+for driver registration. The Tk_PhotoImageFormat structure
+contains the following fields:
+.CS
+typedef struct Tk_PhotoImageFormat {
+ const char *\fIname\fR;
+ Tk_ImageFileMatchProc *\fIfileMatchProc\fR;
+ Tk_ImageStringMatchProc *\fIstringMatchProc\fR;
+ Tk_ImageFileReadProc *\fIfileReadProc\fR;
+ Tk_ImageStringReadProc *\fIstringReadProc\fR;
+ Tk_ImageFileWriteProc *\fIfileWriteProc\fR;
+ Tk_ImageStringWriteProc *\fIstringWriteProc\fR;
+} \fBTk_PhotoImageFormat\fR;
+.CE
+.PP
+.SS FILEMATCHPROC
+.PP
+\fIformatPtr->fileMatchProc\fR must match the following prototype:
+.CS
+typedef int \fBTk_ImageFileMatchProc\fR(
+ Tcl_Channel \fIchan\fR,
+ const char *\fIfileName\fR,
+ Tcl_Obj *\fIformat\fR,
+ int *\fIwidthPtr\fR,
+ int *\fIheightPtr\fR,
+ Tcl_Interp *\fIinterp\fR);
+.CE
+.PP
+.SS STRINGMATCHPROC
+.PP
+\fIformatPtr->stringMatchProc\fR must match the following prototype:
+.CS
+typedef int \fBTk_ImageStringMatchProc\fR(
+ Tcl_Obj *\fIdata\fR,
+ Tcl_Obj *\fIformat\fR,
+ int *\fIwidthPtr\fR,
+ int *\fIheightPtr\fR,
+ Tcl_Interp *\fIinterp\fR);
+.CE
+.SS FILEREADPROC
+.PP
+\fIformatPtr->fileReadProc\fR must match the following prototype:
+.CS
+typedef int \fBTk_ImageFileReadProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_Channel \fIchan\fR,
+ const char *\fIfileName\fR,
+ Tcl_Obj *\fIformat\fR,
+ PhotoHandle \fIimageHandle\fR,
+ int \fIdestX\fR, int \fIdestY\fR,
+ int \fIwidth\fR, int \fIheight\fR,
+ int \fIsrcX\fR, int \fIsrcY\fR);
+.CE
+.SS STRINGREADPROC
+.PP
+\fIformatPtr->stringReadProc\fR must match the following prototype:
+.CS
+typedef int \fBTk_ImageStringReadProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_Obj *\fIdata\fR,
+ Tcl_Obj *\fIformat\fR,
+ PhotoHandle \fIimageHandle\fR,
+ int \fIdestX\fR, int \fIdestY\fR,
+ int \fIwidth\fR, int \fIheight\fR,
+ int \fIsrcX\fR, int \fIsrcY\fR);
+.CE
+.SS FILEWRITEPROC
+.PP
+\fIformatPtr->fileWriteProc\fR must match the following prototype:
+.CS
+typedef int \fBTk_ImageFileWriteProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ const char *\fIfileName\fR,
+ Tcl_Obj *\fIformat\fR,
+ Tk_PhotoImageBlock *\fIblockPtr\fR);
+.CE
+.SS STRINGWRITEPROC
+.PP
+\fIformatPtr->stringWriteProc\fR must match the following prototype:
+.CS
+typedef int \fBTk_ImageStringWriteProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_Obj *\fIformat\fR,
+ Tk_PhotoImageBlock *\fIblockPtr\fR);
+.CE
+.PP
.SH "LEGACY INTERFACE SUPPORT"
.PP
In Tk 8.2 and earlier, the definition of all the function pointer
diff --git a/doc/EventHndlr.3 b/doc/EventHndlr.3
index a2cbf8d..cbc5b79 100644
--- a/doc/EventHndlr.3
+++ b/doc/EventHndlr.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_CreateEventHandler, Tk_DeleteEventHandler \- associate procedure callback with an X event
+Tk_CreateEventHandler, Tk_DeleteEventHandler, Tk_GetButtonMask, Tk_SendVirtualEvent \- associate procedure callback with an X event
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -17,8 +17,18 @@ Tk_CreateEventHandler, Tk_DeleteEventHandler \- associate procedure callback wit
\fBTk_CreateEventHandler\fR(\fItkwin, mask, proc, clientData\fR)
.sp
\fBTk_DeleteEventHandler\fR(\fItkwin, mask, proc, clientData\fR)
+.sp
+\fBTk_GetButtonMask\fR(\fIbutton\fR)
+.sp
+\fBTk_SendVirtualEvent\fR(\fItkwin, eventName, detail\fR)
.SH ARGUMENTS
.AS "unsigned long" clientData
+.AP unsigned button in
+Button number.
+.AP "const char" *eventName in
+The name of the virtual event.
+.AP Tcl_Obj *detail in
+Detail information for the virtual event.
.AP Tk_Window tkwin in
Token for window in which events may occur.
.AP "unsigned long" mask in
@@ -71,5 +81,10 @@ automatically; in this case there is no need to call
If multiple handlers are declared for the same type of X event
on the same window, then the handlers will be invoked in the
order they were created.
+.PP
+\fBTk_GetButtonMask\fR returns the button mask corresponding to
+the button. E.g it will return \fIButton1Mask\fR for button \fIButton1\fR.
+.PP
+\fBTk_SendVirtualEvent\fR sends a virtual event to Tk's event queue.
.SH KEYWORDS
bind, callback, event, handler
diff --git a/doc/FreeXId.3 b/doc/FreeXId.3
index 56c7804..84fef26 100644
--- a/doc/FreeXId.3
+++ b/doc/FreeXId.3
@@ -25,24 +25,6 @@ context, or colormap) that is no longer in use.
.BE
.SH DESCRIPTION
.PP
-The default allocator for resource identifiers provided by Xlib is very
-simple-minded and does not allow resource identifiers to be re-used.
-If a long-running application reaches the end of the resource id
-space, it will generate an X protocol error and crash.
-Tk replaces the default id allocator with its own allocator, which
-allows identifiers to be reused.
-In order for this to work, \fBTk_FreeXId\fR must be called to
-tell the allocator about resources that have been freed.
-Tk automatically calls \fBTk_FreeXId\fR whenever it frees a
-resource, so if you use procedures like \fBTk_GetFont\fR,
-\fBTk_GetGC\fR, and \fBTk_GetPixmap\fR then you need not call
-\fBTk_FreeXId\fR.
-However, if you allocate resources directly from Xlib, for example
-by calling \fBXCreatePixmap\fR, then you should call \fBTk_FreeXId\fR
-when you call the corresponding Xlib free procedure, such as
-\fBXFreePixmap\fR.
-If you do not call \fBTk_FreeXId\fR then the resource identifier will
-be lost, which could cause problems if the application runs long enough
-to lose all of the available identifiers.
+This function is deprecated, it doesn't do anything since 2008-08-19.
.SH KEYWORDS
resource identifier
diff --git a/doc/GetFont.3 b/doc/GetFont.3
index 0504916..9497556 100644
--- a/doc/GetFont.3
+++ b/doc/GetFont.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FreeFontFromObj, Tk_FreeFont \- maintain database of fonts
+Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FontGetDescription, Tk_FreeFontFromObj, Tk_FreeFont \- maintain database of fonts
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -23,6 +23,9 @@ Tk_Font
Tk_Font
\fBTk_GetFontFromObj(\fItkwin, objPtr\fB)\fR
.sp
+Tcl_Obj *
+\fBTk_FontGetDescription(\fItkfont\fB)\fR
+.sp
const char *
\fBTk_NameOfFont(\fItkfont\fB)\fR
.sp
@@ -88,6 +91,9 @@ windows or for different purposes), then a single Tk_Font will be
shared for all uses. The underlying resources will be freed automatically
when no-one is using the font anymore.
.PP
+The procedure \fBTk_FontGetDescription\fR returns information about the font
+description as a Tcl list. One possible result is "{{DejaVu Sans} -16 bold underline}".
+.PP
The procedure \fBTk_NameOfFont\fR is roughly the inverse of
\fBTk_GetFont\fR. Given a \fItkfont\fR that was created by
\fBTk_GetFont\fR (or \fBTk_AllocFontFromObj\fR), the return value is
diff --git a/doc/GetHINSTANCE.3 b/doc/GetHINSTANCE.3
index 980b374..8f82ee9 100644
--- a/doc/GetHINSTANCE.3
+++ b/doc/GetHINSTANCE.3
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
'\" All rights reserved.
'\"
.TH Tk_GetHISTANCE 3 "" Tk "Tk Library Procedures"
diff --git a/doc/GetHWND.3 b/doc/GetHWND.3
index 15d2ff0..1e8cdc9 100644
--- a/doc/GetHWND.3
+++ b/doc/GetHWND.3
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
'\" All rights reserved.
'\"
.TH HWND 3 8.0 Tk "Tk Library Procedures"
diff --git a/doc/GetPixels.3 b/doc/GetPixels.3
index 6c31af9..568c601 100644
--- a/doc/GetPixels.3
+++ b/doc/GetPixels.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM \- translate between strings and screen units
+Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM, Tk_GetDoublePixelsFromObj \- translate between strings and screen units
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -18,6 +18,9 @@ int
\fBTk_GetPixelsFromObj(\fIinterp, tkwin, objPtr, intPtr\fB)\fR
.sp
int
+\fBTk_GetDoublePixelsFromObj(\fIinterp, tkwin, objPtr, doublePtr\fB)\fR
+.sp
+int
\fBTk_GetPixels(\fIinterp, tkwin, string, intPtr\fB)\fR
.sp
int
@@ -81,6 +84,9 @@ in \fIinterp\fR's result if \fIinterp\fR is not NULL.
value in \fIobjPtr\fR, which speeds up future calls to
\fBTk_GetPixelsFromObj\fR with the same \fIobjPtr\fR.
.PP
+\fBTk_GetDoublePixelsFromObj\fR is identical to \fBTk_GetPixelsFromObj\fR
+except it returns a double not rounded to the nearest integer.
+.PP
\fBTk_GetPixels\fR is identical to \fBTk_GetPixelsFromObj\fR except
that the screen distance is specified with a string instead
of an object. This prevents \fBTk_GetPixels\fR from caching the
diff --git a/doc/GetScroll.3 b/doc/GetScroll.3
index 43aaa48..91a2585 100644
--- a/doc/GetScroll.3
+++ b/doc/GetScroll.3
@@ -50,19 +50,20 @@ and parses the words starting with \fIobjv\fR[2].
The words starting with \fIobjv\fR[2] must have one of the following forms:
.CS
\fBmoveto \fIfraction\fR
-\fBscroll \fInumber\fB units\fR
\fBscroll \fInumber\fB pages\fR
+\fBscroll \fInumber\fB units\fR
.CE
.LP
-Any of the \fBmoveto\fR, \fBscroll\fR, \fBunits\fR, and \fBpages\fR
+Any of the \fBmoveto\fR, \fBscroll\fR, \fBpages\fR, and \fBunits\fR
keywords may be abbreviated.
If \fIobjv\fR has the \fBmoveto\fR form, \fBTK_SCROLL_MOVETO\fR
is returned as result and \fI*fractionPtr\fR is filled in with the
\fIfraction\fR argument to the command, which must be a proper real
value.
-If \fIobjv\fR has the \fBscroll\fR form, \fBTK_SCROLL_UNITS\fR
-or \fBTK_SCROLL_PAGES\fR is returned and \fI*stepsPtr\fR is filled
-in with the \fInumber\fR value, which must be a proper integer.
+If \fIobjv\fR has the \fBscroll\fR form, \fBTK_SCROLL_PAGES\fR
+or \fBTK_SCROLL_UNITS\fR is returned and \fI*stepsPtr\fR is filled
+in with the \fInumber\fR value, which must be a integer or a float,
+but if it is a float then it is converted to an integer, rounded away from 0.
If an error occurs in parsing the arguments, \fBTK_SCROLL_ERROR\fR
is returned and an error message is left in interpreter
\fIinterp\fR's result.
diff --git a/doc/Grab.3 b/doc/Grab.3
index 2741220..4966edb 100644
--- a/doc/Grab.3
+++ b/doc/Grab.3
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
'\" All rights reserved.
'\"
.TH Tk_Grab 3 "" Tk "Tk Library Procedures"
diff --git a/doc/HWNDToWindow.3 b/doc/HWNDToWindow.3
index a2e5a6c..c5dafdd 100644
--- a/doc/HWNDToWindow.3
+++ b/doc/HWNDToWindow.3
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
'\" All rights reserved.
'\"
.TH Tk_HWNDToWindow 3 "" Tk "Tk Library Procedures"
diff --git a/doc/ImgChanged.3 b/doc/ImgChanged.3
index 69ba43c..ed47d26 100644
--- a/doc/ImgChanged.3
+++ b/doc/ImgChanged.3
@@ -16,8 +16,8 @@ Tk_ImageChanged \- notify widgets that image needs to be redrawn
.sp
\fBTk_ImageChanged\fR(\fImodel, x, y, width, height, imageWidth, imageHeight\fR)
.SH ARGUMENTS
-.AS Tk_ImageMaster imageHeight
-.AP Tk_ImageMaster model in
+.AS Tk_ImageModel imageHeight
+.AP Tk_ImageModel model in
Token for image, which was passed to image's \fIcreateProc\fR when
the image was created.
.AP int x in
@@ -48,10 +48,6 @@ specify a rectangular region within the image that needs to
be redrawn.
\fIimageWidth\fR and \fIimageHeight\fR specify the image's (new) size.
.PP
-.VS "TIP 581"
-\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR
-.VE "TIP 581"
-.PP
An image manager should call \fBTk_ImageChanged\fR during
its \fIcreateProc\fR to specify the image's initial size and to
force redisplay if there are existing instances for the image.
diff --git a/doc/Inactive.3 b/doc/Inactive.3
index 42ae5b8..ea8d735 100644
--- a/doc/Inactive.3
+++ b/doc/Inactive.3
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
'\" All rights reserved.
'\"
.TH Tk_GetUserInactiveTime 3 8.5 Tk "Tk Library Procedures"
diff --git a/doc/ManageGeom.3 b/doc/ManageGeom.3
index 4d7ac53..0c72d69 100644
--- a/doc/ManageGeom.3
+++ b/doc/ManageGeom.3
@@ -44,7 +44,7 @@ the geometry manager:
typedef struct {
const char *\fIname\fR;
Tk_GeomRequestProc *\fIrequestProc\fR;
- Tk_GeomLostSlaveProc *\fIlostSlaveProc\fR;
+ Tk_GeomLostContentProc *\fIlostContentProc\fR;
} \fBTk_GeomMgr\fR;
.CE
The \fIname\fR field is the textual name for the geometry manager,
@@ -67,24 +67,24 @@ corresponding parameters passed to \fBTk_ManageGeometry\fR.
structure containing application-specific information about
how to manage \fItkwin\fR's geometry.
.PP
-The \fIlostSlaveProc\fR field of \fImgrPtr\fR points to another
+The \fIlostContentProc\fR field of \fImgrPtr\fR points to another
procedure in the geometry manager.
-Tk will invoke \fIlostSlaveProc\fR if some other manager
+Tk will invoke \fIlostContentProc\fR if some other manager
calls \fBTk_ManageGeometry\fR to claim
\fItkwin\fR away from the current geometry manager.
-\fIlostSlaveProc\fR is not invoked if \fBTk_ManageGeometry\fR is
+\fIlostContentProc\fR is not invoked if \fBTk_ManageGeometry\fR is
called with a NULL value for \fImgrPtr\fR (presumably the current
geometry manager has made this call, so it already knows that the
window is no longer managed), nor is it called if \fImgrPtr\fR
is the same as the window's current geometry manager.
-\fIlostSlaveProc\fR should have
+\fIlostContentProc\fR should have
arguments and results that match the following prototype:
.CS
-typedef void \fBTk_GeomLostSlaveProc\fR(
+typedef void \fBTk_GeomLostContentProc\fR(
ClientData \fIclientData\fR,
Tk_Window \fItkwin\fR);
.CE
-The parameters to \fIlostSlaveProc\fR will be identical to the
+The parameters to \fIlostContentProc\fR will be identical to the
corresponding parameters passed to \fBTk_ManageGeometry\fR.
.SH KEYWORDS
callback, geometry, managed, request, unmanaged
diff --git a/doc/NameOfImg.3 b/doc/NameOfImg.3
index 484e479..781650f 100644
--- a/doc/NameOfImg.3
+++ b/doc/NameOfImg.3
@@ -14,10 +14,10 @@ Tk_NameOfImage \- Return name of image.
\fB#include <tk.h>\fR
.sp
const char *
-\fBTk_NameOfImage\fR(\fIimageMaster\fR)
+\fBTk_NameOfImage\fR(\fIimageModel\fR)
.SH ARGUMENTS
-.AS Tk_ImageMaster imageMaster
-.AP Tk_ImageMaster imageMaster in
+.AS Tk_ImageModel imageModel
+.AP Tk_ImageModel imageModel in
Token for image, which was passed to image manager's \fIcreateProc\fR when
the image was created.
.BE
@@ -26,9 +26,5 @@ the image was created.
This procedure is invoked by image managers to find out the name
of an image. Given the token for the image, it returns the
string name for the image.
-.PP
-.VS "TIP 581"
-\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR
-.VE "TIP 581"
.SH KEYWORDS
image manager, image name
diff --git a/doc/ParseArgv.3 b/doc/ParseArgv.3
index 4d85d15..727dcfa 100644
--- a/doc/ParseArgv.3
+++ b/doc/ParseArgv.3
@@ -72,8 +72,8 @@ expected; each of its entries has the following structure:
typedef struct {
const char *\fIkey\fR;
int \fItype\fR;
- char *\fIsrc\fR;
- char *\fIdst\fR;
+ void *\fIsrc\fR;
+ void *\fIdst\fR;
const char *\fIhelp\fR;
} \fBTk_ArgvInfo\fR;
.CE
@@ -312,13 +312,13 @@ Boolean exec = FALSE;
* Define option descriptions.
*/
Tk_ArgvInfo argTable[] = {
- {"\-X", TK_ARGV_CONSTANT, (char *) 1, (char *) &debugFlag,
+ {"\-X", TK_ARGV_CONSTANT, (char *) 1, &debugFlag,
"Turn on debugging printfs"},
- {"\-N", TK_ARGV_INT, NULL, (char *) &numReps,
+ {"\-N", TK_ARGV_INT, NULL, &numReps,
"Number of repetitions"},
- {"\-of", TK_ARGV_STRING, NULL, (char *) &fileName,
+ {"\-of", TK_ARGV_STRING, NULL, &fileName,
"Name of file for output"},
- {"x", TK_ARGV_REST, NULL, (char *) &exec,
+ {"x", TK_ARGV_REST, NULL, &exec,
"File to exec, followed by any arguments (must be last argument)."},
{NULL, TK_ARGV_END, NULL, NULL,
NULL}
diff --git a/doc/SetClassProcs.3 b/doc/SetClassProcs.3
index 389d21b..53f7cce 100644
--- a/doc/SetClassProcs.3
+++ b/doc/SetClassProcs.3
@@ -33,7 +33,7 @@ are used as callbacks in different places.
The structure pointed to by \fIprocs\fR contains the following:
.CS
typedef struct Tk_ClassProcs {
- unsigned int \fIsize\fR;
+ size_t \fIsize\fR;
Tk_ClassWorldChangedProc *\fIworldChangedProc\fR;
Tk_ClassCreateProc *\fIcreateProc\fR;
Tk_ClassModalProc *\fImodalProc\fR;
diff --git a/doc/SetOptions.3 b/doc/SetOptions.3
index a35522f..65fe8cd 100644
--- a/doc/SetOptions.3
+++ b/doc/SetOptions.3
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
-Tk_CreateOptionTable, Tk_DeleteOptionTable, Tk_InitOptions, Tk_SetOptions, Tk_FreeSavedOptions, Tk_RestoreSavedOptions, Tk_GetOptionValue, Tk_GetOptionInfo, Tk_FreeConfigOptions, Tk_Offset \- process configuration options
+Tk_CreateOptionTable, Tk_DeleteOptionTable, Tk_InitOptions, Tk_SetOptions, Tk_FreeSavedOptions, Tk_RestoreSavedOptions, Tk_GetOptionValue, Tk_GetOptionInfo, Tk_FreeConfigOptions \- process configuration options
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -35,9 +35,6 @@ Tcl_Obj *
\fBTk_GetOptionInfo(\fIinterp, recordPtr, optionTable, namePtr, tkwin\fB)\fR
.sp
\fBTk_FreeConfigOptions(\fIrecordPtr, optionTable, tkwin\fB)\fR
-.sp
-int
-\fBTk_Offset(\fItype, field\fB)\fR
.SH ARGUMENTS
.AS Tk_SavedOptions "*const objv[]" in/out
.AP Tcl_Interp *interp in
@@ -52,7 +49,7 @@ pointed to by this argument must exist for the lifetime of the Tk_OptionTable.
.AP Tk_OptionTable optionTable in
Token for an option table. Must have been returned by a previous call
to \fBTk_CreateOptionTable\fR.
-.AP char *recordPtr in/out
+.AP void *recordPtr in/out
Points to structure in which values of configuration options are stored;
fields of this record are modified by procedures such as \fBTk_SetOptions\fR
and read by procedures such as \fBTk_GetOptionValue\fR.
@@ -239,12 +236,6 @@ is returned and an error message is left in \fIinterp\fR's result unless
\fBTk_FreeConfigOptions\fR must be invoked when a widget is deleted.
It frees all of the resources associated with any of the configuration
options defined in \fIrecordPtr\fR by \fIoptionTable\fR.
-.PP
-The \fBTk_Offset\fR macro is provided as a safe way of generating the
-\fIobjOffset\fR and \fIinternalOffset\fR values for entries in
-Tk_OptionSpec structures. It takes two arguments: the name of a type
-of record, and the name of a field in that record. It returns the byte
-offset of the named field in records of the given type.
.SH "TEMPLATES"
.PP
The array of Tk_OptionSpec structures passed to \fBTk_CreateOptionTable\fR
@@ -258,8 +249,8 @@ typedef struct {
const char *\fIdbName\fR;
const char *\fIdbClass\fR;
const char *\fIdefValue\fR;
- int \fIobjOffset\fR;
- int \fIinternalOffset\fR;
+ size_t \fIobjOffset\fR;
+ size_t \fIinternalOffset\fR;
int \fIflags\fR;
const void *\fIclientData\fR;
int \fItypeMask\fR;
@@ -281,7 +272,7 @@ value is specified in the option database. The \fIobjOffset\fR and
\fIinternalOffset\fR fields indicate where to store the value of this
option in widget records (more on this below); values for the \fIobjOffset\fR
and \fIinternalOffset\fR fields should always be generated with the
-\fBTk_Offset\fR macro.
+\fBoffsetof\fR macro.
The \fIflags\fR field contains additional information
to control the processing of this configuration option (see below
for details).
diff --git a/doc/WindowId.3 b/doc/WindowId.3
index f937963..477efe1 100644
--- a/doc/WindowId.3
+++ b/doc/WindowId.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_WindowId, Tk_Parent, Tk_Display, Tk_DisplayName, Tk_ScreenNumber, Tk_Screen, Tk_X, Tk_Y, Tk_Width, Tk_Height, Tk_Changes, Tk_Attributes, Tk_IsContainer, Tk_IsEmbedded, Tk_IsMapped, Tk_IsTopLevel, Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop, Tk_InternalBorderBottom, Tk_Visual, Tk_Depth, Tk_Colormap, Tk_Interp \- retrieve information from Tk's local data structure
+Tk_WindowId, Tk_Parent, Tk_Display, Tk_DisplayName, Tk_ScreenNumber, Tk_AlwaysShowSelection, Tk_Screen, Tk_X, Tk_Y, Tk_Width, Tk_Height, Tk_Changes, Tk_Attributes, Tk_IsContainer, Tk_IsEmbedded, Tk_IsMapped, Tk_IsTopLevel, Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop, Tk_InternalBorderBottom, Tk_Visual, Tk_Depth, Tk_Colormap, Tk_Interp, Tk_NewWindowObj \- retrieve information from Tk's local data structure
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -29,6 +29,9 @@ const char *
int
\fBTk_ScreenNumber\fR(\fItkwin\fR)
.sp
+int
+\fBTk_AlwaysShowSelection\fR(\fItkwin\fR)
+.sp
Screen *
\fBTk_Screen\fR(\fItkwin\fR)
.sp
@@ -97,6 +100,9 @@ Colormap
.sp
Tcl_Interp *
\fBTk_Interp\fR(\fItkwin\fR)
+.sp
+Tcl_Obj *
+\fBTk_NewWindowObj\fR(\fItkwin\fR)
.SH ARGUMENTS
.AS Tk_Window tkwin
.AP Tk_Window tkwin in
@@ -127,6 +133,8 @@ ASCII string identifying \fItkwin\fR's display. \fBTk_ScreenNumber\fR
returns the index of \fItkwin\fR's screen among all the screens
of \fItkwin\fR's display. \fBTk_Screen\fR returns a pointer to
the Xlib structure corresponding to \fItkwin\fR's screen.
+\fBTk_AlwaysShowSelection\fR indicates whether text/entry widgets
+should always display their selection, regardless of window focus.
.PP
\fBTk_X\fR, \fBTk_Y\fR, \fBTk_Width\fR, and \fBTk_Height\fR
return information about \fItkwin's\fR location within its
@@ -182,6 +190,8 @@ and \fBTk_Colormap\fR returns the current
colormap for the window. The visual characteristics are
normally set from the defaults for the window's screen, but
they may be overridden by calling \fBTk_SetWindowVisual\fR.
+.PP
+\fBTk_NewWindowObj\fR creates a new \fBTcl_Obj\fR from the window.
.SH KEYWORDS
attributes, colormap, depth, display, height, geometry manager,
identifier, mapped, requested size, screen, top-level,
diff --git a/doc/bind.n b/doc/bind.n
index 6ba115c..fc1427e 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -1,7 +1,7 @@
'\"
'\" Copyright (c) 1990 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
-'\" Copyright (c) 1998 by Scriptics Corporation.
+'\" Copyright (c) 1998 Scriptics Corporation.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -70,7 +70,7 @@ event pattern may
take one of three forms. In the simplest case it is a single
printing ASCII character, such as \fBa\fR or \fB[\fR. The character
may not be a space character or the character \fB<\fR. This form of
-pattern matches a \fBKeyPress\fR event for the particular
+pattern matches a \fBKey\fR event for the particular
character. The second form of pattern is longer but more general.
It has the following syntax:
.CS
@@ -168,14 +168,14 @@ couple non-standard X event types that were added to better support
the Macintosh and Windows platforms. Below is a list of all the valid
types; where two names appear together, they are synonyms.
.DS
-.ta \w'\fBButtonPress, Button\0\0\0\fR'u +\w'\fBKeyPress, Key\0\0\0\fR'u
+.ta \w'\fBButton, ButtonPress\0\0\0\fR'u +\w'\fBKey, KeyPress\0\0\0\fR'u
\fBActivate\fR \fBDestroy\fR \fBMap\fR
-\fBButtonPress\fR, \fBButton\fR \fBEnter\fR \fBMapRequest\fR
+\fBButton\fR, \fBButtonPress\fR \fBEnter\fR \fBMapRequest\fR
\fBButtonRelease\fR \fBExpose\fR \fBMotion\fR
\fBCirculate\fR \fBFocusIn\fR \fBMouseWheel\fR
\fBCirculateRequest\fR \fBFocusOut\fR \fBProperty\fR
\fBColormap\fR \fBGravity\fR \fBReparent\fR
-\fBConfigure\fR \fBKeyPress\fR, \fBKey\fR \fBResizeRequest\fR
+\fBConfigure\fR \fBKey\fR, \fBKeyPress\fR \fBResizeRequest\fR
\fBConfigureRequest\fR \fBKeyRelease\fR \fBUnmap\fR
\fBCreate\fR \fBLeave\fR \fBVisibility\fR
\fBDeactivate\fR
@@ -214,29 +214,28 @@ values should scroll up and negative values should scroll down.
Horizontal scrolling uses \fBShift-MouseWheel\fR events, with positive
\fB%D\fR \fIdelta\fR substitution indicating left scrolling and negative
right scrolling.
-Only Windows and macOS Aqua typically fire \fBMouseWheel\fR and
-\fBShift-MouseWheel\fR events. On
-X11 vertical scrolling is rather supported through \fBButton-4\fR and
-\fBButton-5\fR events, and horizontal scrolling through \fBShift-Button-4\fR
-and \fBShift-Button-5\fR events. Horizontal scrolling events may fire from
+Horizontal scrolling events may fire from
many different hardware units such as tilt wheels or touchpads. Horizontal
scrolling can also be emulated by holding Shift and scrolling vertically.
.RE
.IP "\fBKeyPress\fR, \fBKeyRelease\fR" 5
The \fBKeyPress\fR and \fBKeyRelease\fR events are generated
whenever a key is pressed or released. \fBKeyPress\fR and \fBKeyRelease\fR
+.IP "\fBKey\fR, \fBKeyRelease\fR" 5
+The \fBKey\fR and \fBKeyRelease\fR events are generated
+whenever a key is pressed or released. \fBKey\fR and \fBKeyRelease\fR
events are sent to the window which currently has the keyboard focus.
-.IP "\fBButtonPress\fR, \fBButtonRelease\fR, \fBMotion\fR" 5
-The \fBButtonPress\fR and \fBButtonRelease\fR events
+.IP "\fBButton\fR, \fBButtonRelease\fR, \fBMotion\fR" 5
+The \fBButton\fR and \fBButtonRelease\fR events
are generated when the user presses or releases a mouse button.
\fBMotion\fR events are generated whenever the pointer is moved.
-\fBButtonPress\fR, \fBButtonRelease\fR, and \fBMotion\fR events are
+\fBButton\fR, \fBButtonRelease\fR, and \fBMotion\fR events are
normally sent to the window containing the pointer.
.RS
.PP
When a mouse button is pressed, the window containing the pointer
automatically obtains a temporary pointer grab.
-Subsequent \fBButtonPress\fR, \fBButtonRelease\fR, and \fBMotion\fR
+Subsequent \fBButton\fR, \fBButtonRelease\fR, and \fBMotion\fR
events will be sent to that window,
regardless of which window contains the pointer,
until all buttons have been released.
@@ -365,8 +364,8 @@ position in the stacking order.
.SS "EVENT DETAILS"
.PP
The last part of a long event specification is \fIdetail\fR. In the
-case of a \fBButtonPress\fR or \fBButtonRelease\fR event, it is the
-number of a button (1\-5). If a button number is given, then only an
+case of a \fBButton\fR or \fBButtonRelease\fR event, it is the
+number of a button (1\-9). If a button number is given, then only an
event on that particular button will match; if no button number is
given, then an event on any button will match. Note: giving a
specific button number is different than specifying a button modifier;
@@ -374,10 +373,10 @@ in the first case, it refers to a button being pressed or released,
while in the second it refers to some other button that is already
depressed when the matching event occurs. If a button
number is given then \fItype\fR may be omitted: if will default
-to \fBButtonPress\fR. For example, the specifier \fB<1>\fR
-is equivalent to \fB<ButtonPress\-1>\fR.
+to \fBButton\fR. For example, the specifier \fB<1>\fR
+is equivalent to \fB<Button\-1>\fR.
.PP
-If the event type is \fBKeyPress\fR or \fBKeyRelease\fR, then
+If the event type is \fBKey\fR or \fBKeyRelease\fR, then
\fIdetail\fR may be specified in the form of an X keysym. Keysyms
are textual specifications for particular keys on the keyboard;
they include all the alphanumeric ASCII characters (e.g.
@@ -397,9 +396,9 @@ system.
If necessary, you can use the \fB%K\fR notation described below
to print out the keysym name for a particular key.
If a keysym \fIdetail\fR is given, then the
-\fItype\fR field may be omitted; it will default to \fBKeyPress\fR.
+\fItype\fR field may be omitted; it will default to \fBKey\fR.
For example, \fB<Control\-comma>\fR is equivalent to
-\fB<Control\-KeyPress\-comma>\fR.
+\fB<Control\-Key\-comma>\fR.
.SH "BINDING SCRIPTS AND SUBSTITUTIONS"
.PP
The \fIscript\fR argument to \fBbind\fR is a Tcl script, called the
@@ -435,7 +434,7 @@ in the stacking order, or \fB0\fR if the receiving window is at the
bottom.
.IP \fB%b\fR 5
The number of the button that was pressed or released. Valid only
-for \fBButtonPress\fR and \fBButtonRelease\fR events.
+for \fBButton\fR and \fBButtonRelease\fR events.
.IP \fB%c\fR 5
The \fIcount\fR field from the event. Valid only for \fBExpose\fR events.
Indicates that there are \fIcount\fR pending \fBExpose\fR events which have not
@@ -482,7 +481,7 @@ Indicates the new or requested height of the window.
The \fIwindow\fR field from the event, represented as a hexadecimal
integer. Valid for all event types.
.IP \fB%k\fR 5
-The \fIkeycode\fR field from the event. Valid only for \fBKeyPress\fR
+The \fIkeycode\fR field from the event. Valid only for \fBKey\fR
and \fBKeyRelease\fR events.
.IP \fB%m\fR 5
The \fImode\fR field from the event. The substituted string is one of
@@ -497,8 +496,8 @@ The \fIplace\fR field from the event, substituted as one of the
strings \fBPlaceOnTop\fR or \fBPlaceOnBottom\fR. Valid only
for \fBCirculate\fR and \fBCirculateRequest\fR events.
.IP \fB%s\fR 5
-The \fIstate\fR field from the event. For \fBButtonPress\fR,
-\fBButtonRelease\fR, \fBEnter\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
+The \fIstate\fR field from the event. For \fBButton\fR,
+\fBButtonRelease\fR, \fBEnter\fR, \fBKey\fR, \fBKeyRelease\fR,
\fBLeave\fR, and \fBMotion\fR events, a decimal string
is substituted. For \fBVisibility\fR, one of the strings
\fBVisibilityUnobscured\fR, \fBVisibilityPartiallyObscured\fR,
@@ -520,8 +519,8 @@ Valid only for
\fBResizeRequest\fR, and \fBExpose\fR events.
.IP "\fB%x\fR, \fB%y\fR" 5
The \fIx\fR and \fIy\fR fields from the event.
-For \fBButtonPress\fR, \fBButtonRelease\fR, \fBMotion\fR,
-\fBKeyPress\fR, \fBKeyRelease\fR, and \fBMouseWheel\fR events,
+For \fBButton\fR, \fBButtonRelease\fR, \fBMotion\fR,
+\fBKey\fR, \fBKeyRelease\fR, and \fBMouseWheel\fR events,
\fB%x\fR and \fB%y\fR indicate the position of the mouse pointer
relative to the receiving window.
For key events on the Macintosh these are the coordinates of the
@@ -537,8 +536,8 @@ the empty string if the event does not correspond to a UNICODE character
(e.g. the shift key was pressed). On X11, \fBXmbLookupString\fR (or
\fBXLookupString\fR when input method support is turned off) does all
the work of translating from the event to a UNICODE character.
-On X11, valid only for \fBKeyPress\fR event. On Windows and macOS/aqua,
-valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
+On X11, valid only for \fBKey\fR event. On Windows and macOS/aqua,
+valid only for \fBKey\fR and \fBKeyRelease\fR events.
.IP \fB%B\fR 5
The \fIborder_width\fR field from the event. Valid only for
\fBConfigure\fR, \fBConfigureRequest\fR, and \fBCreate\fR events.
@@ -556,13 +555,13 @@ event, \fB1\fR indicates that it is a
event generated by \fBSendEvent\fR.
.IP \fB%K\fR 5
The keysym corresponding to the event, substituted as a textual
-string. Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
+string. Valid only for \fBKey\fR and \fBKeyRelease\fR events.
.IP \fB%M\fR 5
The number of script-based binding patterns matched so far for the
event. Valid for all event types.
.IP \fB%N\fR 5
The keysym corresponding to the event, substituted as a decimal
-number. Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
+number. Valid only for \fBKey\fR and \fBKeyRelease\fR events.
.IP \fB%P\fR 5
The name of the property being updated or deleted (which
may be converted to an XAtom using \fBwinfo atom\fR.) Valid
@@ -584,7 +583,7 @@ The \fIx_root\fR and \fIy_root\fR fields from the event.
If a virtual-root window manager is being used then the substituted
values are the corresponding x-coordinate and y-coordinate in the virtual root.
Valid only for
-\fBButtonPress\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBKeyPress\fR,
+\fBButton\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBKey\fR,
\fBKeyRelease\fR, \fBLeave\fR and \fBMotion\fR events.
Same meaning as \fB%x\fR and \fB%y\fR, except relative to the (virtual) root
window.
@@ -651,8 +650,9 @@ several matching sequences is more specific:
an event pattern that specifies a specific button or key is more specific
than one that does not;
.IP (b)
-a longer sequence (in terms of number
-of events matched) is more specific than a shorter sequence;
+a sequence with the most highest-ordered patterns (in term of highest
+repetition count) is more specific than a sequence with less
+highest-ordered patterns;
.IP (c)
if the modifiers specified in one pattern are a subset of the
modifiers in another pattern, then the pattern with more modifiers
@@ -696,17 +696,17 @@ When a \fIsequence\fR specified in a \fBbind\fR command contains
more than one event pattern, then its script is executed whenever
the recent events (leading up to and including the current event)
match the given sequence. This means, for example, that if button 1 is
-clicked repeatedly the sequence \fB<Double\-ButtonPress\-1>\fR will match
+clicked repeatedly the sequence \fB<Double\-Button\-1>\fR will match
each button press but the first.
If extraneous events that would prevent a match occur in the middle
of an event sequence then the extraneous events are
-ignored unless they are \fBKeyPress\fR or \fBButtonPress\fR events.
-For example, \fB<Double\-ButtonPress\-1>\fR will match a sequence of
+ignored unless they are \fBKey\fR or \fBButton\fR events.
+For example, \fB<Double\-Button\-1>\fR will match a sequence of
presses of button 1, even though there will be \fBButtonRelease\fR
events (and possibly \fBMotion\fR events) between the
-\fBButtonPress\fR events.
-Furthermore, a \fBKeyPress\fR event may be preceded by any number
-of other \fBKeyPress\fR events for modifier keys without the
+\fBButton\fR events.
+Furthermore, a \fBKey\fR event may be preceded by any number
+of other \fBKey\fR events for modifier keys without the
modifier keys preventing a match.
For example, the event sequence \fBaB\fR will match a press of the
\fBa\fR key, a release of the \fBa\fR key, a press of the \fBShift\fR
diff --git a/doc/bitmap.n b/doc/bitmap.n
index 1751913..19716e1 100644
--- a/doc/bitmap.n
+++ b/doc/bitmap.n
@@ -90,7 +90,7 @@ This command may be used to invoke various operations
on the image.
It has the following general form:
.CS
-\fIimageName option \fR?\fIarg arg ...\fR?
+\fIimageName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/busy.n b/doc/busy.n
index ab2fd8a..3274524 100644
--- a/doc/busy.n
+++ b/doc/busy.n
@@ -28,10 +28,12 @@
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
-busy \- confine pointer events to a window sub-tree
+busy \- Make Tk widgets busy, temporarily blocking user interactions
.SH SYNOPSIS
\fBtk busy\fR \fIwindow \fR?\fIoptions\fR?
.sp
+\fBtk busy busywindow \fIwindow\fR
+.sp
\fBtk busy hold\fR \fIwindow \fR?\fIoptions\fR?
.sp
\fBtk busy configure \fIwindow\fR ?\fIoption value\fR?...
@@ -44,8 +46,8 @@ busy \- confine pointer events to a window sub-tree
.BE
.SH DESCRIPTION
.PP
-The \fBtk busy\fR command provides a simple means to block pointer events from
-Tk widgets, while overriding the widget's cursor with a configurable busy
+The \fBtk busy\fR command provides a simple means to block mouse pointer events
+from Tk widgets, while overriding the widget's cursor with a configurable busy
cursor. Note this command does not prevent keyboard events from being sent to
the widgets made busy.
.SH INTRODUCTION
@@ -128,24 +130,11 @@ The following operations are available for the \fBtk busy\fR command:
.
Shortcut for \fBtk busy hold\fR command.
.TP
-\fBtk busy hold \fIwindow\fR ?\fIoption value\fR?...
+\fBtk busy busywindow \fIwindow\fR
.
-Makes the specified \fIwindow\fR (and its descendants in the Tk window
-hierarchy) appear busy. \fIWindow\fR must be a valid path name of a Tk widget.
-A transparent window is put in front of the specified window. This transparent
-window is mapped the next time idle tasks are processed, and the specified
-window and its descendants will be blocked from user interactions. Normally
-\fBupdate\fR should be called immediately afterward to insure that the hold
-operation is in effect before the application starts its processing. The
-following configuration options are valid:
-.RS
-.TP
-\fB\-cursor \fIcursorName\fR
-.
-Specifies the cursor to be displayed when the widget is made busy.
-\fICursorName\fR can be in any form accepted by \fBTk_GetCursor\fR. The
-default cursor is \fBwait\fR on Windows and \fBwatch\fR on other platforms.
-.RE
+Returns the pathname of the busy window (i.e. the transparent window
+shielding the window appearing busy) created by the \fBtk busy hold\fR
+command for \fIwindow\fR, or the empty string if \fIwindow\fR is not busy.
.TP
\fBtk busy cget \fIwindow\fR \fIoption\fR
.
@@ -181,6 +170,12 @@ option add *Frame.BusyCursor gumby
.CE
.RE
.TP
+\fBtk busy current \fR?\fIpattern\fR?
+.
+Returns the pathnames of all widgets that are currently busy. If a
+\fIpattern\fR is given, only the path names of busy widgets matching
+\fIpattern\fR are returned.
+.TP
\fBtk busy forget \fIwindow\fR ?\fIwindow\fR?...
.
Releases resources allocated by the \fBtk busy\fR command for \fIwindow\fR,
@@ -189,11 +184,26 @@ including the transparent window. User events will again be received by
\fIWindow\fR must be the name of a widget specified in the \fBhold\fR
operation, otherwise an error is reported.
.TP
-\fBtk busy current \fR?\fIpattern\fR?
+\fBtk busy hold \fIwindow\fR ?\fIoption value\fR?...
.
-Returns the pathnames of all widgets that are currently busy. If a
-\fIpattern\fR is given, only the path names of busy widgets matching
-\fIpattern\fR are returned.
+Makes the specified \fIwindow\fR (and its descendants in the Tk window
+hierarchy) appear busy. \fIWindow\fR must be a valid path name of a Tk widget.
+A transparent window is put in front of the specified window. This transparent
+window is mapped the next time idle tasks are processed, and the specified
+window and its descendants will be blocked from user interactions. Normally
+\fBupdate\fR should be called immediately afterward to insure that the hold
+operation is in effect before the application starts its processing. The
+command returns the pathname of the busy window that was created (i.e. the
+transparent window shielding the window appearing busy). The following
+configuration options are valid:
+.RS
+.TP
+\fB\-cursor \fIcursorName\fR
+.
+Specifies the cursor to be displayed when the widget is made busy.
+\fICursorName\fR can be in any form accepted by \fBTk_GetCursor\fR. The
+default cursor is \fBwait\fR on Windows and \fBwatch\fR on other platforms.
+.RE
.TP
\fBtk busy status \fIwindow\fR
.
@@ -206,32 +216,18 @@ The event blocking feature is implemented by creating and mapping a
transparent window that completely covers the widget. When the busy window is
mapped, it invisibly shields the widget and its hierarchy from all events that
may be sent. Like Tk widgets, busy windows have widget names in the Tk window
-hierarchy. This means that you can use the \fBbind\fR command, to handle
-events in the busy window.
+hierarchy. This means that you can use the \fBbind\fR command to handle
+events in the busy window:
.PP
.CS
\fBtk busy\fR hold .frame.canvas
-bind .frame.canvas_Busy <Enter> { ... }
+bind [\fBtk busy\fR busywindow .frame.canvas] <Enter> { ... }
.CE
.PP
-Normally the busy window is a sibling of the widget. The name of the busy
-window is
-.QW \fIwidget\fB_Busy\fR
-where \fIwidget\fR is the name of the widget to be made busy. In the previous
-example, the pathname of the busy window is
-.QW \fB.frame.canvas_Busy\fR .
-The exception is when the widget is a toplevel widget (such as
-.QW . )
-where the busy window can't be made a sibling. The busy window is then a child
-of the widget named
-.QW \fIwidget\fB._Busy\fR
-where \fIwidget\fR is the name of the toplevel widget. In the following
-example, the pathname of the busy window is
-.QW \fB._Busy\fR .
-.PP
+or
.CS
-\fBtk busy\fR hold .
-bind ._Busy <Enter> { ... }
+set busyWin [\fBtk busy\fR hold .frame.canvas]
+bind $busyWin <Enter> { ... }
.CE
.SS "ENTER/LEAVE EVENTS"
.PP
diff --git a/doc/button.n b/doc/button.n
index 233feb6..70e0e65 100644
--- a/doc/button.n
+++ b/doc/button.n
@@ -109,7 +109,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/canvas.n b/doc/canvas.n
index 4641c1c..2367e2e 100644
--- a/doc/canvas.n
+++ b/doc/canvas.n
@@ -220,8 +220,12 @@ for scrolling.
Canvases do not support scaling or rotation of the canvas coordinate
system relative to the window coordinate system.
.PP
-Individual items may be moved or scaled using widget commands
-described below, but they may not be rotated.
+Individual items may be moved, scaled
+.VS "8.7, TIP164"
+or rotated
+.VE "8.7, TIP164"
+using widget commands
+described below.
.PP
Note that the default origin of the canvas's visible area is
coincident with the origin for the whole window as that makes bindings
@@ -313,6 +317,7 @@ The second possible syntax is a character list containing only
The space can be used
to enlarge the space between other line elements, and cannot
occur as the first position in the string. Some examples:
+.PP
.CS
\-dash . \(-> \-dash {2 4}
\-dash - \(-> \-dash {6 4}
@@ -343,13 +348,13 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
The following widget commands are possible for canvas widgets:
.TP
-\fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg arg ...\fR?
+\fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg ...\fR?
.
For each item that meets the constraints specified by
\fIsearchSpec\fR and the \fIarg\fRs, add
@@ -465,7 +470,7 @@ defined for \fItagOrId\fR.
.PP
The only events for which bindings may be specified are those related to
the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
-\fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events.
+\fBButton\fR, \fBMotion\fR, and \fBKey\fR) or virtual events.
The handling of events in canvases uses the current item defined in
\fBITEM IDS AND TAGS\fR above. \fBEnter\fR and \fBLeave\fR events
trigger for an
@@ -597,7 +602,7 @@ the item is unaffected by the command.
If \fItagToDelete\fR is omitted then it defaults to \fItagOrId\fR.
This command returns an empty string.
.TP
-\fIpathName \fBfind \fIsearchCommand \fR?\fIarg arg ...\fR?
+\fIpathName \fBfind \fIsearchCommand \fR?\fIarg ...\fR?
.
This command returns a list consisting of all the items that
meet the constraints specified by \fIsearchCommand\fR and
@@ -658,14 +663,27 @@ command, above), but the cursor position may
be set even when the item does not have the focus.
This command returns an empty string.
.TP
+\fIpathName \fBimage \fIimagename\fR ?\fIsubsample\fR? ?\fIzoom\fR?
+.
+Draw the canvas into the Tk photo image named \fIimagename\fR. If a \fB-scrollregion\fR
+has been defined then this will be the boundaries of the canvas region drawn and the
+final size of the photo image. Otherwise the widget width and height with an origin
+of 0,0 will be the size of the canvas region drawn and the final size of the photo
+image. Optionally an integer \fIsubsample\fR factor may be given and the photo image
+will be reduced in size. In addition to the \fIsubsample\fR an integer \fIzoom\fR
+factor can also be given and the photo image will be enlarged. The image background
+will be filled with the canvas background colour. The canvas widget does not need to
+be mapped for this widget command to work, but at least one of it's ancestors must be
+mapped.
+This command returns an empty string.
+.TP
\fIpathName \fBimove \fItagOrId index x y\fR
-.VS 8.6
+.
This command causes the \fIindex\fR'th coordinate of each of the items
indicated by \fItagOrId\fR to be relocated to the location (\fIx\fR,\fIy\fR).
Each item interprets \fIindex\fR independently according to the rules
described in \fBINDICES\fR above. Out of the standard set of items, only line
and polygon items may have their coordinates relocated this way.
-.VE 8.6
.TP
\fIpathName \fBindex \fItagOrId index\fR
.
@@ -751,7 +769,7 @@ each point associated with the item.
This command returns an empty string.
.TP
\fIpathName \fBmoveto \fItagOrId xPos yPos\fR
-.VS 8.6
+.
Move the items given by \fItagOrId\fR in the canvas coordinate
space so that the first coordinate pair (the upper-left corner of the
bounding box) of the first item (the lowest in the display list) with
@@ -761,7 +779,6 @@ the empty string, in which case the corresponding coordinate
will be unchanged. All items matching
\fItagOrId\fR remain in the same positions relative to each other.
This command returns an empty string.
-.VE 8.6
.TP
\fIpathName \fBpostscript \fR?\fIoption value option value ...\fR?
.
@@ -947,7 +964,7 @@ determined by the \fBraise\fR command and \fBlower\fR command, not the
.RE
.TP
\fIpathName \fBrchars \fItagOrId first last string\fR
-.VS 8.6
+.
This command causes the text or coordinates between \fIfirst\fR and \fIlast\fR
for each of the items indicated by \fItagOrId\fR to be replaced by
\fIstring\fR. Each item interprets \fIfirst\fR and \fIlast\fR independently
@@ -956,7 +973,27 @@ set of items, text items support this operation by altering their text as
directed, and line and polygon items support this operation by altering their
coordinate list (in which case \fIstring\fR should be a list of coordinates to
use as a replacement). The other items ignore this operation.
-.VE 8.6
+.TP
+\fIpathName \fBrotate \fItagOrId xOrigin yOrigin angle\fR
+.VS "8.7, TIP164"
+Rotate the coordinates of all of the items given by \fItagOrId\fR in canvas
+coordinate space.
+\fIXOrigin\fR and \fIyOrigin\fR identify the origin for the rotation
+operation and \fIangle\fR identifies the amount to rotate the coordinates
+anticlockwise, in degrees. (Negative values rotate clockwise.)
+This command returns an empty string.
+.RS
+.PP
+Implementation note: not all item types work the same with rotations. In
+particular,\fB bitmap\fR,\fB image\fR,\fB text\fR and\fB window\fR items only
+rotate their anchor points and do not rotate the items themselves about those
+points, and the \fBarc\fR, \fBoval\fR and \fBrectangle\fR types rotate about a
+computed center point instead of moving the bounding box coordinates directly.
+.PP
+Some items (currently \fBarc\fR and\fB text\fR) have angles in their options;
+this command \fIdoes not\fR affect those options.
+.RE
+.VE "8.7, TIP164"
.TP
\fIpathName \fBscale \fItagOrId xOrigin yOrigin xScale yScale\fR
.
@@ -1110,17 +1147,18 @@ total width of the canvas is off-screen to the left.
.
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
-\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
+\fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation
of one of these.
-If \fIwhat\fR is \fBunits\fR, the view adjusts left or right in units
-of the \fBxScrollIncrement\fR option, if it is greater than zero,
-or in units of one-tenth the window's width otherwise.
If \fIwhat is \fBpages\fR then the view
adjusts in units of nine-tenths the window's width.
If \fInumber\fR is negative then information farther to the left
becomes visible; if it is positive then information farther to the right
becomes visible.
+If \fIwhat\fR is \fBunits\fR, the view adjusts left or right in units
+of the \fBxScrollIncrement\fR option, if it is greater than zero,
+or in units of one-tenth the window's width otherwise.
.RE
.TP
\fIpathName \fByview ?\fIargs\fR?
@@ -1152,15 +1190,15 @@ area is off-screen to the top.
This command adjusts the view in the window up or down according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
-If \fIwhat\fR is \fBunits\fR, the view adjusts up or down in units
-of the \fByScrollIncrement\fR option, if it is greater than zero,
-or in units of one-tenth the window's height otherwise.
+\fIWhat\fR must be either \fBpages\fR or \fBunits\fR.
If \fIwhat\fR is \fBpages\fR then
the view adjusts in units of nine-tenths the window's height.
If \fInumber\fR is negative then higher information becomes
visible; if it is positive then lower information
becomes visible.
+If \fIwhat\fR is \fBunits\fR, the view adjusts up or down in units
+of the \fByScrollIncrement\fR option, if it is greater than zero,
+or in units of one-tenth the window's height otherwise.
.RE
.SH "OVERVIEW OF ITEM TYPES"
.PP
@@ -1324,8 +1362,8 @@ arc's region.
.PP
Items of type \fBarc\fR appear on the display as arc-shaped regions.
An arc is a section of an oval delimited by two angles (specified
-by the \fB\-start\fR and \fB\-extent\fR options) and displayed in
-one of several ways (specified by the \fB\-style\fR option).
+by either the \fB\-start\fR and \fB\-extent\fR options or the \fB\-height\fR option)
+and displayed in one of several ways (specified by the \fB\-style\fR option).
Arcs are created with widget commands of the following form:
.CS
\fIpathName \fBcreate arc \fIx1 y1 x2 y2 \fR?\fIoption value ...\fR?
@@ -1333,7 +1371,9 @@ Arcs are created with widget commands of the following form:
.CE
The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give
the coordinates of two diagonally opposite corners of a
-rectangular region enclosing the oval that defines the arc.
+rectangular region enclosing the oval that defines the arc (except when
+\fB\-height\fR is specified - see below).
+.
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
@@ -1374,6 +1414,34 @@ arc.
\fIDegrees\fR is given in units of degrees measured counter-clockwise
from the 3-o'clock position; it may be either positive or negative.
.TP
+\fB\-height \fIdistance\fR
+Provides a shortcut for creating a circular arc segment by defining the
+distance of the mid-point of the arc from its chord. When this option
+is used the coordinates are interpreted as the start and end coordinates
+of the chord, and the options \fB\-start\fR and \fB-extent\fR are ignored.
+The value of \fIdistance\fR has the following meaning:
+.RS
+.PP
+.RS
+\fIdistance\fR > 0 creates a clockwise arc
+.br
+\fIdistance\fR < 0 creates an counter-clockwise arc
+.br
+\fIdistance\fR = 0 creates an arc as if this option had not been specified
+.RE
+.PP
+If you want the arc to have a specific radius, \fIr\fR, use the formula:
+.PP
+.RS
+\fIdistance\fR = \fIr\fR \(+- sqrt(\fIr\fR**2 - (chordLength / 2)**2)
+.RE
+.PP
+choosing the minus sign for the minor arc and the plus sign for the major arc.
+.PP
+Note that \fBitemcget \-height\fR always returns 0 so that introspection code
+can be kept simple.
+.RE
+.TP
\fB\-style \fItype\fR
Specifies how to draw the arc. If \fItype\fR is \fBpieslice\fR
(the default) then the arc's region is defined by a section
@@ -1795,13 +1863,12 @@ The following standard options are supported by text items:
The following extra options are supported for text items:
.TP
\fB\-angle \fIrotationDegrees\fR
-.VS 8.6
+.
\fIRotationDegrees\fR tells how many degrees to rotate the text anticlockwise
about the positioning point for the text; it may have any floating-point value
from 0.0 to 360.0. For example, if \fIrotationDegrees\fR is \fB90\fR, then the
text will be drawn vertically from bottom to top.
This option defaults to \fB0.0\fR.
-.VE 8.6
.TP
\fB\-font \fIfontName\fR
Specifies the font to use for the text item.
diff --git a/doc/checkbutton.n b/doc/checkbutton.n
index bfefca4..411045f 100644
--- a/doc/checkbutton.n
+++ b/doc/checkbutton.n
@@ -192,7 +192,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/chooseDirectory.n b/doc/chooseDirectory.n
index e441d78..a5b30f5 100644
--- a/doc/chooseDirectory.n
+++ b/doc/chooseDirectory.n
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
'\" All rights reserved.
'\"
.TH tk_chooseDirectory n 8.3 Tk "Tk Built-In Commands"
diff --git a/doc/clipboard.n b/doc/clipboard.n
index 6f047dd..ee964df 100644
--- a/doc/clipboard.n
+++ b/doc/clipboard.n
@@ -12,7 +12,7 @@
.SH NAME
clipboard \- Manipulate Tk clipboard
.SH SYNOPSIS
-\fBclipboard \fIoption\fR ?\fIarg arg ...\fR?
+\fBclipboard \fIoption\fR ?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/colors.n b/doc/colors.n
index 3747ee8..9c64b1d 100644
--- a/doc/colors.n
+++ b/doc/colors.n
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
'\" Copyright (c) 2003 ActiveState Corporation.
'\" Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
'\" Copyright (c) 2008 Donal K. Fellows
@@ -919,19 +919,20 @@ On Windows, the following additional system colors are available
.RS
.DS
.ta 6c
-system3dDarkShadow systemHighlight
-system3dLight systemHighlightText
-systemActiveBorder systemInactiveBorder
-systemActiveCaption systemInactiveCaption
-systemAppWorkspace systemInactiveCaptionText
-systemBackground systemInfoBackground
-systemButtonFace systemInfoText
-systemButtonHighlight systemMenu
-systemButtonShadow systemMenuText
+system3dDarkShadow systemHighlightText
+system3dLight systemInactiveBorder
+systemActiveBorder systemInactiveCaption
+systemActiveCaption systemInactiveCaptionText
+systemAppWorkspace systemInfoBackground
+systemBackground systemInfoText
+systemButtonFace systemMenu
+systemButtonHighlight systemMenuText
+systemButtonShadow systemPlaceholderText
systemButtonText systemScrollbar
systemCaptionText systemWindow
systemDisabledText systemWindowFrame
systemGrayText systemWindowText
+systemHighlight
.DE
.RE
.SH "SEE ALSO"
diff --git a/doc/console.n b/doc/console.n
index 40b7426..0a9a794 100644
--- a/doc/console.n
+++ b/doc/console.n
@@ -23,7 +23,7 @@ the \fBconsole\fR command. The behaviour of the console window is
defined mainly through the contents of the \fIconsole.tcl\fR file in
the Tk library. Except for TkAqua, this command is not available when
Tk is loaded into a tclsh interpreter with
-.QW "\fBpackage require Tk\fR" ,
+.QW "\fBpackage require tk\fR" ,
as a conventional terminal is expected to be present in that case.
In TkAqua, this command is disabled when there is a startup script
and stdin is \fB/dev/null\fR (as is the case e.g. when a bundled application
diff --git a/doc/cursors.n b/doc/cursors.n
index a728755..bf8a05e 100644
--- a/doc/cursors.n
+++ b/doc/cursors.n
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
'\" All rights reserved.
'\"
'\" Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
diff --git a/doc/entry.n b/doc/entry.n
index 713929b..23b8cab 100644
--- a/doc/entry.n
+++ b/doc/entry.n
@@ -23,6 +23,7 @@ entry \- Create and manipulate 'entry' one-line text entry widgets
\-foreground \-insertwidth \-xscrollcommand
\-highlightbackground \-justify
\-highlightcolor \-relief
+\-placeholder \-placeholderforeground
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-disabledbackground disabledBackground DisabledBackground
@@ -189,7 +190,7 @@ The \fBentry\fR command creates a new Tcl command whose
name is \fIpathName\fR. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName subcommand \fR?\fIarg arg ...\fR?
+\fIpathName subcommand \fR?\fIarg ...\fR?
.CE
\fISubcommand\fR and the \fIarg\fRs
determine the exact behavior of the command.
@@ -402,15 +403,16 @@ way through the text appears at the left edge of the window.
\fIpathName \fBxview scroll \fInumber what\fR
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
-\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
+\fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation
of one of these.
-If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
-\fInumber\fR average-width characters on the display; if it is
-\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
-If \fInumber\fR is negative then characters farther to the left
-become visible; if it is positive then characters farther to the right
+If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
+If \fInumber\fR is negative then characters farther to the left become
+visible; if it is positive then characters farther to the right
become visible.
+If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
+\fInumber\fR average-width characters on the display.
.RE
.SH "DEFAULT BINDINGS"
.PP
diff --git a/doc/event.n b/doc/event.n
index 9ab48e5..0160e26 100644
--- a/doc/event.n
+++ b/doc/event.n
@@ -12,7 +12,7 @@
.SH NAME
event \- Miscellaneous event facilities: define virtual events and generate events
.SH SYNOPSIS
-\fBevent\fI option \fR?\fIarg arg ...\fR?
+\fBevent\fI option \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
@@ -100,7 +100,7 @@ Corresponds to the \fB%B\fR substitution for binding scripts.
.TP
\fB\-button\fI number\fR
\fINumber\fR must be an integer; it specifies the \fIdetail\fR field
-for a \fBButtonPress\fR or \fBButtonRelease\fR event, overriding
+for a \fBButton\fR or \fBButtonRelease\fR event, overriding
any button number provided in the base \fIevent\fR argument.
Corresponds to the \fB%b\fR substitution for binding scripts.
.TP
@@ -155,7 +155,7 @@ Corresponds to the \fB%h\fR substitution for binding scripts.
\fB\-keycode\fI number\fR
\fINumber\fR must be an integer; it specifies the \fIkeycode\fR
field for the event.
-Valid for \fBKeyPress\fR and \fBKeyRelease\fR events.
+Valid for \fBKey\fR and \fBKeyRelease\fR events.
Corresponds to the \fB%k\fR substitution for binding scripts.
.TP
\fB\-keysym\fI name\fR
@@ -163,7 +163,7 @@ Corresponds to the \fB%k\fR substitution for binding scripts.
\fBspace\fR, or \fBReturn\fR; its corresponding
keycode value is used as the \fIkeycode\fR field for event, overriding
any detail specified in the base \fIevent\fR argument.
-Valid for \fBKeyPress\fR and \fBKeyRelease\fR events.
+Valid for \fBKey\fR and \fBKeyRelease\fR events.
Corresponds to the \fB%K\fR substitution for binding scripts.
.TP
\fB\-mode\fI notify\fR
@@ -189,7 +189,7 @@ Corresponds to the \fB%p\fR substitution for binding scripts.
\fB\-root\fI window\fR
\fIWindow\fR must be either a window path name or an integer window
identifier; it specifies the \fIroot\fR field for the event.
-Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
+Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR,
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR
events.
Corresponds to the \fB%R\fR substitution for binding scripts.
@@ -197,14 +197,14 @@ Corresponds to the \fB%R\fR substitution for binding scripts.
\fB\-rootx\fI coord\fR
\fICoord\fR must be a screen distance; it specifies the \fIx_root\fR
field for the event.
-Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
+Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR,
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR
events. Corresponds to the \fB%X\fR substitution for binding scripts.
.TP
\fB\-rooty\fI coord\fR
\fICoord\fR must be a screen distance; it specifies the \fIy_root\fR
field for the event.
-Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
+Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR,
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR
events.
Corresponds to the \fB%Y\fR substitution for binding scripts.
@@ -221,7 +221,7 @@ Corresponds to the \fB%#\fR substitution for binding scripts.
.TP
\fB\-state\fI state\fR
\fIState\fR specifies the \fIstate\fR field for the event.
-For \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
+For \fBKey\fR, \fBKeyRelease\fR, \fBButtons\fR,
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events
it must be an integer value.
For \fBVisibility\fR events it must be one of \fBVisibilityUnobscured\fR,
@@ -233,7 +233,7 @@ Corresponds to the \fB%s\fR substitution for binding scripts.
\fB\-subwindow\fI window\fR
\fIWindow\fR specifies the \fIsubwindow\fR field for the event, either
as a path name for a Tk widget or as an integer window identifier.
-Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
+Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR,
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events.
Similar to \fB%S\fR substitution for binding scripts.
.TP
@@ -241,7 +241,7 @@ Similar to \fB%S\fR substitution for binding scripts.
\fIInteger\fR must be an integer value; it specifies the \fItime\fR field
for the event. Additonally the special value \fBcurrent\fR is allowed,
this value will be substituted by the current event time.
-Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
+Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR,
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, \fBMotion\fR,
and \fBProperty\fR events.
Corresponds to the \fB%t\fR substitution for binding scripts.
@@ -249,7 +249,7 @@ Corresponds to the \fB%t\fR substitution for binding scripts.
\fB\-warp\fI boolean\fR
\fIboolean\fR must be a boolean value; it specifies whether
the screen pointer should be warped as well.
-Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
+Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR,
\fBButtonRelease\fR, and \fBMotion\fR events. The pointer will
only warp to a window if it is mapped.
.TP
@@ -282,7 +282,7 @@ be processed in order but at the front of the queue.
\fB\-x\fI coord\fR
\fICoord\fR must be a screen distance; it specifies the \fIx\fR field
for the event.
-Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
+Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR,
\fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR,
\fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR
events.
@@ -294,7 +294,7 @@ for binding scripts.
\fB\-y\fI coord\fR
\fICoord\fR must be a screen distance; it specifies the \fIy\fR
field for the event.
-Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
+Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR,
\fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR,
\fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR
events.
@@ -568,7 +568,7 @@ Starting from the preceding example, if the following code is executed:
.PP
.CS
bind Entry <Control-y> {}
-\fBevent add\fR <<Paste>> <Key-F6>
+\fBevent add\fR <<Paste>> <F6>
.CE
.PP
the behavior will change such in two ways. First, the shadowed
diff --git a/doc/focus.n b/doc/focus.n
index e3efcd3..a6b0575 100644
--- a/doc/focus.n
+++ b/doc/focus.n
@@ -15,7 +15,7 @@ focus \- Manage the input focus
.nf
\fBfocus\fR
\fBfocus \fIwindow\fR
-\fBfocus \fIoption\fR ?\fIarg arg ...\fR?
+\fBfocus \fIoption\fR ?\fIarg ...\fR?
.fi
.BE
.SH DESCRIPTION
diff --git a/doc/font.n b/doc/font.n
index 72f9270..4d2f5f4 100644
--- a/doc/font.n
+++ b/doc/font.n
@@ -12,7 +12,7 @@
.SH NAME
font \- Create and inspect fonts.
.SH SYNOPSIS
-\fBfont\fI option \fR?\fIarg arg ...\fR?
+\fBfont\fI option \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/fontchooser.n b/doc/fontchooser.n
index 65aa8e7..465af2e 100644
--- a/doc/fontchooser.n
+++ b/doc/fontchooser.n
@@ -11,7 +11,7 @@
.SH NAME
fontchooser \- control font selection dialog
.SH SYNOPSIS
-\fBtk fontchooser\fR \fBconfigure\fR ?\fI\-option value \-option value ...\fR?
+\fBtk fontchooser\fR \fBconfigure\fR ?\fI\-option value ...\fR?
.sp
\fBtk fontchooser\fR \fBshow\fR
.sp
@@ -31,7 +31,7 @@ caller via callbacks or virtual events.
.PP
The \fBtk fontchooser\fR command can have one of the following forms:
.TP
-\fBtk fontchooser\fR \fBconfigure \fR?\fI\-option value \-option value ...\fR?
+\fBtk fontchooser\fR \fBconfigure \fR?\fI\-option value ...\fR?
.
Set or query one or more of the configurations options below (analogous to Tk
widget configuration).
diff --git a/doc/frame.n b/doc/frame.n
index 4800461..5520f32 100644
--- a/doc/frame.n
+++ b/doc/frame.n
@@ -25,6 +25,16 @@ except that its value may also be specified as an empty string.
In this case, the widget will display no background or border, and
no colors will be consumed from its colormap for its background
and border.
+.VS "8.7, TIP262"
+An empty background will disable drawing the background image.
+.OP \-backgroundimage backgroundImage BackgroundImage
+This specifies an image to display on the frame's background within
+the border of the frame (i.e., the image will be clipped by the
+frame's highlight ring and border, if either are present); subwidgets
+of the frame will be drawn on top. The image must have been created
+with the \fBimage create\fR command. If specified as the empty string,
+no image will be displayed.
+.VE "8.7, TIP262"
.OP \-class class Class
Specifies a class for the window.
This class will be used when querying the option database for
@@ -62,6 +72,15 @@ sets the total height of the frame, any \fB\-borderwidth\fR or similar is
not added. Normally \fB\-height\fR should not be used if a propagating
geometry manager, such as \fBgrid\fR or \fBpack\fR, is used within the
frame since the geometry manager will override the height of the frame.
+.OP \-tile tile Tile
+.VS "8.7, TIP262"
+This specifies how to draw the background image (see
+\fB\-backgroundimage\fR) on the frame.
+If true (according to \fBTcl_GetBoolean\fR), the image will be tiled
+to fill the whole frame, with the origin of the first copy of the
+image being the top left of the interior of the frame.
+If false (the default), the image will be centered within the frame.
+.VE "8.7, TIP262"
.OP \-visual visual Visual
Specifies visual information for the new window in any of the
forms accepted by \fBTk_GetVisual\fR.
@@ -91,7 +110,7 @@ path name of the new window.
.PP
A frame is a simple widget. Its primary purpose is to act as a
spacer or container for complex window layouts. The only features
-of a frame are its background color and an optional 3-D border to make the
+of a frame are its background and an optional 3-D border to make the
frame appear raised or sunken.
.SH "WIDGET COMMAND"
.PP
@@ -101,7 +120,7 @@ command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
diff --git a/doc/grab.n b/doc/grab.n
index cee3ce7..259d68e 100644
--- a/doc/grab.n
+++ b/doc/grab.n
@@ -14,7 +14,7 @@ grab \- Confine pointer and keyboard events to a window sub-tree
.SH SYNOPSIS
\fBgrab \fR?\fB\-global\fR? \fIwindow\fR
.sp
-\fBgrab \fIoption \fR?\fIarg arg \fR...?
+\fBgrab \fIoption \fR?\fIarg \fR...?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/grid.n b/doc/grid.n
index dc69deb..90f80cd 100644
--- a/doc/grid.n
+++ b/doc/grid.n
@@ -177,7 +177,7 @@ If a content's cell is larger than its requested dimensions, this
option may be used to position (or stretch) the content within its cell.
\fIStyle\fR is a string that contains zero or more of the characters
\fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR.
-The string can optionally contains spaces or
+The string can optionally contain spaces or
commas, but they are ignored. Each letter refers to a side (north, south,
east, or west) that the content will
.QW stick
@@ -202,6 +202,14 @@ The content will no longer be managed by the grid geometry manager.
The configuration options for that window are forgotten, so that if the
window is managed once more by the grid geometry manager, the initial
default settings are used.
+.RS
+.PP
+.VS "TIP 518"
+If the last content window of the container becomes unmanaged, this will also send
+the virtual event \fB<<NoManagedChild>>\fR to the container; the container
+may choose to resize itself (or otherwise respond) to such a change.
+.VE "TIP 518"
+.RE
.TP
\fBgrid info \fIwindow\fR
.
@@ -235,7 +243,7 @@ Propagation is enabled by default.
\fBgrid rowconfigure \fIwindow index \fR?\fI\-option value...\fR?
.
Query or set the row properties of the \fIindex\fR row of the
-geometry window, \fIwindow\fR.
+geometry container, \fIwindow\fR.
The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR
and \fB\-pad\fR.
If one or more options are provided, then \fIindex\fR may be given as
@@ -277,6 +285,14 @@ The content will no longer be managed by the grid geometry manager.
However, the configuration options for that window are remembered,
so that if the content window is managed once more by the grid
geometry manager, the previous values are retained.
+.RS
+.PP
+.VS "TIP 518"
+If the last content window of the container becomes unmanaged, this will also send
+the virtual event \fB<<NoManagedChild>>\fR to the container; the container
+may choose to resize itself (or otherwise respond) to such a change.
+.VE "TIP 518"
+.RE
.TP
\fBgrid size \fIcontainer\fR
.
@@ -285,19 +301,17 @@ The size is determined either by the \fIcontent\fR occupying the largest
row or column, or the largest column or row with a \fB\-minsize\fR,
\fB\-weight\fR, or \fB\-pad\fR that is non-zero.
.TP
-\fBgrid slaves \fIwindow\fR ?\fI\-option value\fR?
+\fBgrid content \fIwindow\fR ?\fI\-option value\fR?
.
If no options are supplied, a list of all of the content in \fIwindow\fR
-are returned, most recently managed first.
+is returned, most recently managed first.
\fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which
causes only the content in the row (or column) specified by \fIvalue\fR
to be returned.
-.VS "TIP 581"
.TP
-\fBgrid content \fIwindow\fR ?\fI\-option value\fR?
+\fBgrid slaves \fIwindow\fR ?\fI\-option value\fR?
.
-Synonym for \fBgrid slaves \fIwindow\fR ?\fI\-option value\fR?.
-.VE "TIP 581"
+Synonym for \fBgrid content \fIwindow\fR ?\fI\-option value\fR?.
.SH "RELATIVE PLACEMENT"
.PP
The \fBgrid\fR command contains a limited set of capabilities that
diff --git a/doc/image.n b/doc/image.n
index 70f5acf..b620076 100644
--- a/doc/image.n
+++ b/doc/image.n
@@ -12,7 +12,7 @@
.SH NAME
image \- Create and manipulate images
.SH SYNOPSIS
-\fBimage\fR \fIoption \fR?\fIarg arg ...\fR?
+\fBimage\fR \fIoption \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/keysyms.n b/doc/keysyms.n
index 162fa90..7807ab9 100644
--- a/doc/keysyms.n
+++ b/doc/keysyms.n
@@ -12,7 +12,7 @@ keysyms \- keysyms recognized by Tk
.SH DESCRIPTION
.PP
Tk recognizes many keysyms when specifying key bindings (e.g.,
-.QW "\fBbind\fR \fB. <Key-\fR\fIkeysym\fR\fB>\fR" ).
+.QW "\fBbind\fR \fB. <\fR\fIkeysym\fR\fB>\fR" ).
The following list enumerates the
keysyms that will be recognized by Tk. Note that not all keysyms will
be valid on all platforms, and some keysyms are also available on
@@ -24,21 +24,21 @@ decimal and hexadecimal values.
.PP
.CS
space 32 0x20
-exclam 33 0x21
+! (exclam) 33 0x21
quotedbl 34 0x22
numbersign 35 0x23
dollar 36 0x24
-percent 37 0x25
-ampersand 38 0x26
-apostrophe 39 0x27
-parenleft 40 0x28
-parenright 41 0x29
-asterisk 42 0x2A
-plus 43 0x2B
-comma 44 0x2C
+% (percent) 37 0x25
+& (ampersand) 38 0x26
+' (apostrophe) 39 0x27
+( (parenleft) 40 0x28
+) (parenright) 41 0x29
+* (asterisk) 42 0x2A
++ (plus) 43 0x2B
+, (comma) 44 0x2C
minus 45 0x2D
-period 46 0x2E
-slash 47 0x2F
+. (period) 46 0x2E
+/ (slash) 47 0x2F
0 48 0x30
1 49 0x31
2 50 0x32
@@ -49,13 +49,13 @@ slash 47 0x2F
7 55 0x37
8 56 0x38
9 57 0x39
-colon 58 0x3A
+: (colon) 58 0x3A
semicolon 59 0x3B
less 60 0x3C
-equal 61 0x3D
+= (equal) 61 0x3D
greater 62 0x3E
-question 63 0x3F
-at 64 0x40
+? (question) 63 0x3F
+@ (at) 64 0x40
A 65 0x41
B 66 0x42
C 67 0x43
@@ -85,9 +85,9 @@ Z 90 0x5A
bracketleft 91 0x5B
backslash 92 0x5C
bracketright 93 0x5D
-asciicircum 94 0x5E
-underscore 95 0x5F
-grave 96 0x60
+^ (asciicircum) 94 0x5E
+_ (underscore) 95 0x5F
+` (grave) 96 0x60
a 97 0x61
b 98 0x62
c 99 0x63
@@ -115,105 +115,105 @@ x 120 0x78
y 121 0x79
z 122 0x7A
braceleft 123 0x7B
-bar 124 0x7C
+| (bar) 124 0x7C
braceright 125 0x7D
-asciitilde 126 0x7E
+~ (asciitilde) 126 0x7E
nobreakspace 160 0xA0
-exclamdown 161 0xA1
-cent 162 0xA2
-sterling 163 0xA3
-currency 164 0xA4
-yen 165 0xA5
-brokenbar 166 0xA6
-section 167 0xA7
-diaeresis 168 0xA8
-copyright 169 0xA9
-ordfeminine 170 0xAA
-guillemotleft 171 0xAB
-notsign 172 0xAC
+\(r! (exclamdown) 161 0xA1
+\(ct (cent) 162 0xA2
+\(Po (sterling) 163 0xA3
+\(Cs (currency) 164 0xA4
+\(Ye (yen) 165 0xA5
+\(bb (brokenbar) 166 0xA6
+\(sc (section) 167 0xA7
+\(ad (diaeresis) 168 0xA8
+\(co (copyright) 169 0xA9
+\(Of (ordfeminine) 170 0xAA
+\(Fo (guillemotleft) 171 0xAB
+\(no (notsign) 172 0xAC
hyphen 173 0xAD
-registered 174 0xAE
-macron 175 0xAF
-degree 176 0xB0
-plusminus 177 0xB1
-twosuperior 178 0xB2
-threesuperior 179 0xB3
-acute 180 0xB4
-mu 181 0xB5
-paragraph 182 0xB6
-periodcentered 183 0xB7
-cedilla 184 0xB8
-onesuperior 185 0xB9
-masculine 186 0xBA
-guillemotright 187 0xBB
-onequarter 188 0xBC
-onehalf 189 0xBD
-threequarters 190 0xBE
-questiondown 191 0xBF
-Agrave 192 0xC0
-Aacute 193 0xC1
-Acircumflex 194 0xC2
-Atilde 195 0xC3
-Adiaeresis 196 0xC4
-Aring 197 0xC5
-AE 198 0xC6
-Ccedilla 199 0xC7
-Egrave 200 0xC8
-Eacute 201 0xC9
-Ecircumflex 202 0xCA
-Ediaeresis 203 0xCB
-Igrave 204 0xCC
-Iacute 205 0xCD
-Icircumflex 206 0xCE
-Idiaeresis 207 0xCF
-ETH 208 0xD0
-Ntilde 209 0xD1
-Ograve 210 0xD2
-Oacute 211 0xD3
-Ocircumflex 212 0xD4
-Otilde 213 0xD5
-Odiaeresis 214 0xD6
-multiply 215 0xD7
-Oslash 216 0xD8
-Ugrave 217 0xD9
-Uacute 218 0xDA
-Ucircumflex 219 0xDB
-Udiaeresis 220 0xDC
-Yacute 221 0xDD
-THORN 222 0xDE
-ssharp 223 0xDF
-agrave 224 0xE0
-aacute 225 0xE1
-acircumflex 226 0xE2
-atilde 227 0xE3
-adiaeresis 228 0xE4
-aring 229 0xE5
-ae 230 0xE6
-ccedilla 231 0xE7
-egrave 232 0xE8
-eacute 233 0xE9
-ecircumflex 234 0xEA
-ediaeresis 235 0xEB
-igrave 236 0xEC
-iacute 237 0xED
-icircumflex 238 0xEE
-idiaeresis 239 0xEF
-eth 240 0xF0
-ntilde 241 0xF1
-ograve 242 0xF2
-oacute 243 0xF3
-ocircumflex 244 0xF4
-otilde 245 0xF5
-odiaeresis 246 0xF6
-division 247 0xF7
-oslash 248 0xF8
-ugrave 249 0xF9
-uacute 250 0xFA
-ucircumflex 251 0xFB
-udiaeresis 252 0xFC
-yacute 253 0xFD
-thorn 254 0xFE
-ydiaeresis 255 0xFF
+\(rg (registered) 174 0xAE
+\(a- (macron) 175 0xAF
+\(de (degree) 176 0xB0
+\(+- (plusminus) 177 0xB1
+\(S2 (twosuperior) 178 0xB2
+\(S3 (threesuperior) 179 0xB3
+\(aa (acute) 180 0xB4
+\(mc (mu) 181 0xB5
+\(ps (paragraph) 182 0xB6
+\(pc (periodcentered) 183 0xB7
+\(ac (cedilla) 184 0xB8
+\(S1 (onesuperior) 185 0xB9
+\(Om (masculine) 186 0xBA
+\(Fc (guillemotright) 187 0xBB
+\(14 (onequarter) 188 0xBC
+\(12 (onehalf) 189 0xBD
+\(34 (threequarters) 190 0xBE
+\(r? (questiondown) 191 0xBF
+\(`A (Agrave) 192 0xC0
+\('A (Aacute) 193 0xC1
+\(^A (Acircumflex) 194 0xC2
+\(~A (Atilde) 195 0xC3
+\(:A (Adiaeresis) 196 0xC4
+\(oA (Aring) 197 0xC5
+\(AE (AE) 198 0xC6
+\(,C (Ccedilla) 199 0xC7
+\(`E (Egrave) 200 0xC8
+\('E (Eacute) 201 0xC9
+\(^E (Ecircumflex) 202 0xCA
+\(:E (Ediaeresis) 203 0xCB
+\(`I (Igrave) 204 0xCC
+\('I (Iacute) 205 0xCD
+\(^I (Icircumflex) 206 0xCE
+\(:I (Idiaeresis) 207 0xCF
+\(-D (ETH) 208 0xD0
+\(~N (Ntilde) 209 0xD1
+\(`O (Ograve) 210 0xD2
+\('O (Oacute) 211 0xD3
+\(^O (Ocircumflex) 212 0xD4
+\(~O (Otilde) 213 0xD5
+\(:O (Odiaeresis) 214 0xD6
+\(mu (multiply) 215 0xD7
+\(/O (Oslash) 216 0xD8
+\(`U (Ugrave) 217 0xD9
+\('U (Uacute) 218 0xDA
+\(^U (Ucircumflex) 219 0xDB
+\(:U (Udiaeresis) 220 0xDC
+\('Y (Yacute) 221 0xDD
+\(TP (THORN) 222 0xDE
+\(ss (ssharp) 223 0xDF
+\(`a (agrave) 224 0xE0
+\('a (aacute) 225 0xE1
+\(^a (acircumflex) 226 0xE2
+\(~a (atilde) 227 0xE3
+\(:a (adiaeresis) 228 0xE4
+\(oa (aring) 229 0xE5
+\(ae (ae) 230 0xE6
+\(,c (ccedilla) 231 0xE7
+\(`e (egrave) 232 0xE8
+\('e (eacute) 233 0xE9
+\(^e (ecircumflex) 234 0xEA
+\(:e (ediaeresis) 235 0xEB
+\(`i (igrave) 236 0xEC
+\('i (iacute) 237 0xED
+\(^i (icircumflex) 238 0xEE
+\(:i (idiaeresis) 239 0xEF
+\(Sd (eth) 240 0xF0
+\(~n (ntilde) 241 0xF1
+\(`o (ograve) 242 0xF2
+\('o (oacute) 243 0xF3
+\(^o (ocircumflex) 244 0xF4
+\(~o (otilde) 245 0xF5
+\(:o (odiaeresis) 246 0xF6
+\(di (division) 247 0xF7
+\(/o (oslash) 248 0xF8
+\(`u (ugrave) 249 0xF9
+\('u (uacute) 250 0xFA
+\(^u (ucircumflex) 251 0xFB
+\(:u (udiaeresis) 252 0xFC
+\('y (yacute) 253 0xFD
+\(Tp (thorn) 254 0xFE
+\(:y (ydiaeresis) 255 0xFF
.CE
.CS
Aogonek 417 0x1A1
@@ -818,9 +818,359 @@ hebrew_qoph 3319 0xCF7
hebrew_resh 3320 0xCF8
hebrew_shin 3321 0xCF9
hebrew_taw 3322 0xCFA
+.CE
+.CS
+Thai_kokai 3489 0xDA1
+Thai_khokhai 3490 0xDA2
+Thai_khokhuat 3491 0xDA3
+Thai_khokhwai 3492 0xDA4
+Thai_khokhon 3493 0xDA5
+Thai_khorakhang 3494 0xDA6
+Thai_ngongu 3495 0xDA7
+Thai_chochan 3496 0xDA8
+Thai_choching 3497 0xDA9
+Thai_chochang 3498 0xDAA
+Thai_soso 3499 0xDAB
+Thai_chochoe 3500 0xDAC
+Thai_yoying 3501 0xDAD
+Thai_dochada 3502 0xDAE
+Thai_topatak 3503 0xDAF
+Thai_thothan 3504 0xDB0
+Thai_thonangmontho 3505 0xDB1
+Thai_thophuthao 3506 0xDB2
+Thai_nonen 3507 0xDB3
+Thai_dodek 3508 0xDB4
+Thai_totao 3509 0xDB5
+Thai_thothung 3510 0xDB6
+Thai_thothahan 3511 0xDB7
+Thai_thothong 3512 0xDB8
+Thai_nonu 3513 0xDB9
+Thai_bobaimai 3514 0xDBA
+Thai_popla 3515 0xDBB
+Thai_phophung 3516 0xDBC
+Thai_fofa 3517 0xDBD
+Thai_phophan 3518 0xDBE
+Thai_fofan 3519 0xDBF
+Thai_phosamphao 3520 0xDC0
+Thai_moma 3521 0xDC1
+Thai_yoyak 3522 0xDC2
+Thai_rorua 3523 0xDC3
+Thai_ru 3524 0xDC4
+Thai_loling 3525 0xDC5
+Thai_lu 3526 0xDC6
+Thai_wowaen 3527 0xDC7
+Thai_sosala 3528 0xDC8
+Thai_sorusi 3529 0xDC9
+Thai_sosua 3530 0xDCA
+Thai_hohip 3531 0xDCB
+Thai_lochula 3532 0xDCC
+Thai_oang 3533 0xDCD
+Thai_honokhuk 3534 0xDCE
+Thai_paiyannoi 3535 0xDCF
+Thai_saraa 3536 0xDD0
+Thai_maihanakat 3537 0xDD1
+Thai_saraaa 3538 0xDD2
+Thai_saraam 3539 0xDD3
+Thai_sarai 3540 0xDD4
+Thai_saraii 3541 0xDD5
+Thai_saraue 3542 0xDD6
+Thai_sarauee 3543 0xDD7
+Thai_sarau 3544 0xDD8
+Thai_sarauu 3545 0xDD9
+Thai_phinthu 3546 0xDDA
+Thai_maihanakat_maitho 3550 0xDDE
+Thai_baht 3551 0xDDF
+Thai_sarae 3552 0xDE0
+Thai_saraae 3553 0xDE1
+Thai_sarao 3554 0xDE2
+Thai_saraaimaimuan 3555 0xDE3
+Thai_saraaimaimalai 3556 0xDE4
+Thai_lakkhangyao 3557 0xDE5
+Thai_maiyamok 3558 0xDE6
+Thai_maitaikhu 3559 0xDE7
+Thai_maiek 3560 0xDE8
+Thai_maitho 3561 0xDE9
+Thai_maitri 3562 0xDEA
+Thai_maichattawa 3563 0xDEB
+Thai_thanthakhat 3564 0xDEC
+Thai_nikhahit 3565 0xDED
+Thai_leksun 3568 0xDF0
+Thai_leknung 3569 0xDF1
+Thai_leksong 3570 0xDF2
+Thai_leksam 3571 0xDF3
+Thai_leksi 3572 0xDF4
+Thai_lekha 3573 0xDF5
+Thai_lekhok 3574 0xDF6
+Thai_lekchet 3575 0xDF7
+Thai_lekpaet 3576 0xDF8
+Thai_lekkao 3577 0xDF9
+Hangul_Kiyeog 3745 0xEA1
+Hangul_SsangKiyeog 3746 0xEA2
+Hangul_KiyeogSios 3747 0xEA3
+Hangul_Nieun 3748 0xEA4
+Hangul_NieunJieuj 3749 0xEA5
+Hangul_NieunHieuh 3750 0xEA6
+Hangul_Dikeud 3751 0xEA7
+Hangul_SsangDikeud 3752 0xEA8
+Hangul_Rieul 3753 0xEA9
+Hangul_RieulKiyeog 3754 0xEAA
+Hangul_RieulMieum 3755 0xEAB
+Hangul_RieulPieub 3756 0xEAC
+Hangul_RieulSios 3757 0xEAD
+Hangul_RieulTieut 3758 0xEAE
+Hangul_RieulPhieuf 3759 0xEAF
+Hangul_RieulHieuh 3760 0xEB0
+Hangul_Mieum 3761 0xEB1
+Hangul_Pieub 3762 0xEB2
+Hangul_SsangPieub 3763 0xEB3
+Hangul_PieubSios 3764 0xEB4
+Hangul_Sios 3765 0xEB5
+Hangul_SsangSios 3766 0xEB6
+Hangul_Ieung 3767 0xEB7
+Hangul_Jieuj 3768 0xEB8
+Hangul_SsangJieuj 3769 0xEB9
+Hangul_Cieuc 3770 0xEBA
+Hangul_Khieuq 3771 0xEBB
+Hangul_Tieut 3772 0xEBC
+Hangul_Phieuf 3773 0xEBD
+Hangul_Hieuh 3774 0xEBE
+Hangul_A 3775 0xEBF
+Hangul_AE 3776 0xEC0
+Hangul_YA 3777 0xEC1
+Hangul_YAE 3778 0xEC2
+Hangul_EO 3779 0xEC3
+Hangul_E 3780 0xEC4
+Hangul_YEO 3781 0xEC5
+Hangul_YE 3782 0xEC6
+Hangul_O 3783 0xEC7
+Hangul_WA 3784 0xEC8
+Hangul_WAE 3785 0xEC9
+Hangul_OE 3786 0xECA
+Hangul_YO 3787 0xECB
+Hangul_U 3788 0xECC
+Hangul_WEO 3789 0xECD
+Hangul_WE 3790 0xECE
+Hangul_WI 3791 0xECF
+Hangul_YU 3792 0xED0
+Hangul_EU 3793 0xED1
+Hangul_YI 3794 0xED2
+Hangul_I 3795 0xED3
+Hangul_J_Kiyeog 3796 0xED4
+Hangul_J_SsangKiyeog 3797 0xED5
+Hangul_J_KiyeogSios 3798 0xED6
+Hangul_J_Nieun 3799 0xED7
+Hangul_J_NieunJieuj 3800 0xED8
+Hangul_J_NieunHieuh 3801 0xED9
+Hangul_J_Dikeud 3802 0xEDA
+Hangul_J_Rieul 3803 0xEDB
+Hangul_J_RieulKiyeog 3804 0xEDC
+Hangul_J_RieulMieum 3805 0xEDD
+Hangul_J_RieulPieub 3806 0xEDE
+Hangul_J_RieulSios 3807 0xEDF
+Hangul_J_RieulTieut 3808 0xEE0
+Hangul_J_RieulPhieuf 3809 0xEE1
+Hangul_J_RieulHieuh 3810 0xEE2
+Hangul_J_Mieum 3811 0xEE3
+Hangul_J_Pieub 3812 0xEE4
+Hangul_J_PieubSios 3813 0xEE5
+Hangul_J_Sios 3814 0xEE6
+Hangul_J_SsangSios 3815 0xEE7
+Hangul_J_Ieung 3816 0xEE8
+Hangul_J_Jieuj 3817 0xEE9
+Hangul_J_Cieuc 3818 0xEEA
+Hangul_J_Khieuq 3819 0xEEB
+Hangul_J_Tieut 3820 0xEEC
+Hangul_J_Phieuf 3821 0xEED
+Hangul_J_Hieuh 3822 0xEEE
+Hangul_RieulYeorinHieuh 3823 0xEEF
+Hangul_SunkyeongeumMieum 3824 0xEF0
+Hangul_SunkyeongeumPieub 3825 0xEF1
+Hangul_PanSios 3826 0xEF2
+Hangul_KkogjiDalrinIeung 3827 0xEF3
+Hangul_SunkyeongeumPhieuf 3828 0xEF4
+Hangul_YeorinHieuh 3829 0xEF5
+Hangul_AraeA 3830 0xEF6
+Hangul_AraeAE 3831 0xEF7
+Hangul_J_PanSios 3832 0xEF8
+Hangul_J_KkogjiDalrinIeung 3833 0xEF9
+Hangul_J_YeorinHieuh 3834 0xEFA
+Korean_Won 3839 0xEFF
OE 5052 0x13BC
oe 5053 0x13BD
Ydiaeresis 5054 0x13BE
+\(eu (EuroSign) 8364 0x20AC
+.CE
+.CS
+3270_Duplicate 64769 0xFD01
+3270_FieldMark 64770 0xFD02
+3270_Right2 64771 0xFD03
+3270_Left2 64772 0xFD04
+3270_BackTab 64773 0xFD05
+3270_EraseEOF 64774 0xFD06
+3270_EraseInput 64775 0xFD07
+3270_Reset 64776 0xFD08
+3270_Quit 64777 0xFD09
+3270_PA1 64778 0xFD0A
+3270_PA2 64779 0xFD0B
+3270_PA3 64780 0xFD0C
+3270_Test 64781 0xFD0D
+3270_Attn 64782 0xFD0E
+3270_CursorBlink 64783 0xFD0F
+3270_AltCursor 64784 0xFD10
+3270_KeyClick 64785 0xFD11
+3270_Jump 64786 0xFD12
+3270_Ident 64787 0xFD13
+3270_Rule 64788 0xFD14
+3270_Copy 64789 0xFD15
+3270_Play 64790 0xFD16
+3270_Setup 64791 0xFD17
+3270_Record 64792 0xFD18
+3270_ChangeScreen 64793 0xFD19
+3270_DeleteWord 64794 0xFD1A
+3270_ExSelect 64795 0xFD1B
+3270_CursorSelect 64796 0xFD1C
+3270_PrintScreen 64797 0xFD1D
+3270_Enter 64798 0xFD1E
+ISO_Lock 65025 0xFE01
+ISO_Level2_Latch 65026 0xFE02
+ISO_Level3_Shift 65027 0xFE03
+ISO_Level3_Latch 65028 0xFE04
+ISO_Level3_Lock 65029 0xFE05
+ISO_Group_Latch 65030 0xFE06
+ISO_Group_Lock 65031 0xFE07
+ISO_Next_Group 65032 0xFE08
+ISO_Next_Group_Lock 65033 0xFE09
+ISO_Prev_Group 65034 0xFE0A
+ISO_Prev_Group_Lock 65035 0xFE0B
+ISO_First_Group 65036 0xFE0C
+ISO_First_Group_Lock 65037 0xFE0D
+ISO_Last_Group 65038 0xFE0E
+ISO_Last_Group_Lock 65039 0xFE0F
+ISO_Level5_Shift 65041 0xFE11
+ISO_Level5_Latch 65042 0xFE12
+ISO_Level5_Lock 65043 0xFE13
+ISO_Left_Tab 65056 0xFE20
+ISO_Move_Line_Up 65057 0xFE21
+ISO_Move_Line_Down 65058 0xFE22
+ISO_Partial_Line_Up 65059 0xFE23
+ISO_Partial_Line_Down 65060 0xFE24
+ISO_Partial_Space_Left 65061 0xFE25
+ISO_Partial_Space_Right 65062 0xFE26
+ISO_Set_Margin_Left 65063 0xFE27
+ISO_Set_Margin_Right 65064 0xFE28
+ISO_Release_Margin_Left 65065 0xFE29
+ISO_Release_Margin_Right 65066 0xFE2A
+ISO_Release_Both_Margins 65067 0xFE2B
+ISO_Fast_Cursor_Left 65068 0xFE2C
+ISO_Fast_Cursor_Right 65069 0xFE2D
+ISO_Fast_Cursor_Up 65070 0xFE2E
+ISO_Fast_Cursor_Down 65071 0xFE2F
+ISO_Continuous_Underline 65072 0xFE30
+ISO_Discontinuous_Underline 65073 0xFE31
+ISO_Emphasize 65074 0xFE32
+ISO_Center_Object 65075 0xFE33
+ISO_Enter 65076 0xFE34
+dead_grave 65104 0xFE50
+dead_acute 65105 0xFE51
+dead_circumflex 65106 0xFE52
+dead_tilde 65107 0xFE53
+dead_macron 65108 0xFE54
+dead_breve 65109 0xFE55
+dead_abovedot 65110 0xFE56
+dead_diaeresis 65111 0xFE57
+dead_abovering 65112 0xFE58
+dead_doubleacute 65113 0xFE59
+dead_caron 65114 0xFE5A
+dead_cedilla 65115 0xFE5B
+dead_ogonek 65116 0xFE5C
+dead_iota 65117 0xFE5D
+dead_voiced_sound 65118 0xFE5E
+dead_semivoiced_sound 65119 0xFE5F
+dead_belowdot 65120 0xFE60
+dead_hook 65121 0xFE61
+dead_horn 65122 0xFE62
+dead_stroke 65123 0xFE63
+dead_abovecomma 65124 0xFE64
+dead_abovereversedcomma 65125 0xFE65
+dead_doublegrave 65126 0xFE66
+dead_belowring 65127 0xFE67
+dead_belowmacron 65128 0xFE68
+dead_belowcircumflex 65129 0xFE69
+dead_belowtilde 65130 0xFE6A
+dead_belowbreve 65131 0xFE6B
+dead_belowdiaeresis 65132 0xFE6C
+dead_invertedbreve 65133 0xFE6D
+dead_belowcomma 65134 0xFE6E
+dead_currency 65135 0xFE6F
+AccessX_Enable 65136 0xFE70
+AccessX_Feedback_Enable 65137 0xFE71
+RepeatKeys_Enable 65138 0xFE72
+SlowKeys_Enable 65139 0xFE73
+BounceKeys_Enable 65140 0xFE74
+StickyKeys_Enable 65141 0xFE75
+MouseKeys_Enable 65142 0xFE76
+MouseKeys_Accel_Enable 65143 0xFE77
+Overlay1_Enable 65144 0xFE78
+Overlay2_Enable 65145 0xFE79
+AudibleBell_Enable 65146 0xFE7A
+dead_a 65152 0xFE80
+dead_A 65153 0xFE81
+dead_e 65154 0xFE82
+dead_E 65155 0xFE83
+dead_i 65156 0xFE84
+dead_I 65157 0xFE85
+dead_o 65158 0xFE86
+dead_O 65159 0xFE87
+dead_u 65160 0xFE88
+dead_U 65161 0xFE89
+dead_small_schwa 65162 0xFE8A
+dead_capital_schwa 65163 0xFE8B
+dead_greek 65164 0xFE8C
+dead_lowline 65168 0xFE90
+dead_aboveverticalline 65169 0xFE91
+dead_belowverticalline 65170 0xFE92
+dead_longsolidusoverlay 65171 0xFE93
+ch 65184 0xFEA0
+Ch 65185 0xFEA1
+CH 65186 0xFEA2
+c_h 65187 0xFEA3
+C_h 65188 0xFEA4
+C_H 65189 0xFEA5
+First_Virtual_Screen 65232 0xFED0
+Prev_Virtual_Screen 65233 0xFED1
+Next_Virtual_Screen 65234 0xFED2
+Last_Virtual_Screen 65236 0xFED4
+Terminate_Server 65237 0xFED5
+Pointer_Left 65248 0xFEE0
+Pointer_Right 65249 0xFEE1
+Pointer_Up 65250 0xFEE2
+Pointer_Down 65251 0xFEE3
+Pointer_UpLeft 65252 0xFEE4
+Pointer_UpRight 65253 0xFEE5
+Pointer_DownLeft 65254 0xFEE6
+Pointer_DownRight 65255 0xFEE7
+Pointer_Button_Dflt 65256 0xFEE8
+Pointer_Button1 65257 0xFEE9
+Pointer_Button2 65258 0xFEEA
+Pointer_Button3 65259 0xFEEB
+Pointer_Button4 65260 0xFEEC
+Pointer_Button5 65261 0xFEED
+Pointer_DblClick_Dflt 65262 0xFEEE
+Pointer_DblClick1 65263 0xFEEF
+Pointer_DblClick2 65264 0xFEF0
+Pointer_DblClick3 65265 0xFEF1
+Pointer_DblClick4 65266 0xFEF2
+Pointer_DblClick5 65267 0xFEF3
+Pointer_Drag_Dflt 65268 0xFEF4
+Pointer_Drag1 65269 0xFEF5
+Pointer_Drag2 65270 0xFEF6
+Pointer_Drag3 65271 0xFEF7
+Pointer_Drag4 65272 0xFEF8
+Pointer_EnableKeys 65273 0xFEF9
+Pointer_Accelerate 65274 0xFEFA
+Pointer_DfltBtnNext 65275 0xFEFB
+Pointer_DfltBtnPrev 65276 0xFEFC
+Pointer_Drag5 65277 0xFEFD
.CE
.CS
BackSpace 65288 0xFF08
@@ -849,10 +1199,21 @@ Kana_Lock 65325 0xFF2D
Kana_Shift 65326 0xFF2E
Eisu_Shift 65327 0xFF2F
Eisu_toggle 65328 0xFF30
+Hangul 65329 0xFF31
+Hangul_Start 65330 0xFF32
+Hangul_End 65331 0xFF33
+Hangul_Hanja 65332 0xFF34
+Hangul_Jamo 65333 0xFF35
+Hangul_Romaja 65334 0xFF36
Codeinput 65335 0xFF37
+Hangul_Jeonja 65336 0xFF38
+Hangul_Banja 65337 0xFF39
+Hangul_PreHanja 65338 0xFF3A
+Hangul_PostHanja 65339 0xFF3B
SingleCandidate 65340 0xFF3C
MultipleCandidate 65341 0xFF3D
PreviousCandidate 65342 0xFF3E
+Hangul_Special 65343 0xFF3F
Home 65360 0xFF50
Left 65361 0xFF51
Up 65362 0xFF52
@@ -862,16 +1223,13 @@ Prior 65365 0xFF55
Next 65366 0xFF56
End 65367 0xFF57
Begin 65368 0xFF58
-Win_L 65371 0xFF5B
-Win_R 65372 0xFF5C
-App 65373 0xFF5D
Select 65376 0xFF60
Print 65377 0xFF61
Execute 65378 0xFF62
Insert 65379 0xFF63
Undo 65381 0xFF65
Redo 65382 0xFF66
-Menu 65383 0xFF67
+Menu (App) 65383 0xFF67
Find 65384 0xFF68
Cancel 65385 0xFF69
Help 65386 0xFF6A
@@ -958,13 +1316,46 @@ Meta_L 65511 0xFFE7
Meta_R 65512 0xFFE8
Alt_L 65513 0xFFE9
Alt_R 65514 0xFFEA
-Super_L 65515 0xFFEB
-Super_R 65516 0xFFEC
+Super_L (Win_L) 65515 0xFFEB
+Super_R (Win_R) 65516 0xFFEC
Hyper_L 65517 0xFFED
Hyper_R 65518 0xFFEE
+braille_dot_1 65521 0xFFF1
+braille_dot_2 65522 0xFFF2
+braille_dot_3 65523 0xFFF3
+braille_dot_4 65524 0xFFF4
+braille_dot_5 65525 0xFFF5
+braille_dot_6 65526 0xFFF6
+braille_dot_7 65527 0xFFF7
+braille_dot_8 65528 0xFFF8
+braille_dot_9 65529 0xFFF9
+braille_dot_10 65530 0xFFFA
Delete 65535 0xFFFF
.CE
.CS
+SunFA_Grave 268828416 0x1005FF00
+SunFA_Circum 268828417 0x1005FF01
+SunFA_Tilde 268828418 0x1005FF02
+SunFA_Acute 268828419 0x1005FF03
+SunFA_Diaeresis 268828420 0x1005FF04
+SunFA_Cedilla 268828421 0x1005FF05
+SunF36 268828432 0x1005FF10
+SunF37 268828433 0x1005FF11
+SunSys_Req 268828512 0x1005FF60
+SunProps 268828528 0x1005FF70
+SunFront 268828529 0x1005FF71
+SunCopy 268828530 0x1005FF72
+SunOpen 268828531 0x1005FF73
+SunPaste 268828532 0x1005FF74
+SunCut 268828533 0x1005FF75
+SunPowerSwitch 268828534 0x1005FF76
+SunAudioLowerVolume 268828535 0x1005FF77
+SunAudioMute 268828536 0x1005FF78
+SunAudioRaiseVolume 268828537 0x1005FF79
+SunVideoDegauss 268828538 0x1005FF7A
+SunVideoLowerBrightness 268828539 0x1005FF7B
+SunVideoRaiseBrightness 268828540 0x1005FF7C
+SunPowerSwitchShift 268828541 0x1005FF7D
XF86Switch_VT_1 269024769 0x1008FE01
XF86Switch_VT_2 269024770 0x1008FE02
XF86Switch_VT_3 269024771 0x1008FE03
diff --git a/doc/label.n b/doc/label.n
index 107175e..290ac8a 100644
--- a/doc/label.n
+++ b/doc/label.n
@@ -75,7 +75,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/labelframe.n b/doc/labelframe.n
index 5ca5ad7..89f56c4 100644
--- a/doc/labelframe.n
+++ b/doc/labelframe.n
@@ -95,7 +95,7 @@ name is the same as the path name of the labelframe's window. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as
the labelframe widget's path name. \fIOption\fR and the \fIarg\fRs
diff --git a/doc/listbox.n b/doc/listbox.n
index 66b75b9..aa87904 100644
--- a/doc/listbox.n
+++ b/doc/listbox.n
@@ -136,7 +136,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
@@ -383,16 +383,18 @@ total width of the listbox text is off-screen to the left.
.
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
-\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
+\fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation
of one of these.
-If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
-\fInumber\fR character units (the width of the \fB0\fR character)
-on the display; if it is \fBpages\fR then the view adjusts by
+If \fIwhat\fR is \fBpages\fR then the view adjusts by
\fInumber\fR screenfuls.
If \fInumber\fR is negative then characters farther to the left
become visible; if it is positive then characters farther to the right
become visible.
+If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
+\fInumber\fR character units (the width of the \fB0\fR character)
+on the display.
.RE
.TP
\fIpathName \fByview \fR?\fIargs\fR?
@@ -431,13 +433,14 @@ way through the listbox, and so on.
This command adjusts the view in the window up or down according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
-If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
-\fInumber\fR lines; if it is \fBpages\fR then
+\fIWhat\fR must be either \fBpages\fR or \fBunits\fR.
+If \fIwhat\fR is \fBpages\fR then
the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then earlier elements
become visible; if it is positive then later elements
become visible.
+If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
+\fInumber\fR lines.
.RE
.SH "DEFAULT BINDINGS"
.PP
@@ -560,7 +563,7 @@ In \fBextended\fR mode, the Escape key cancels the most recent
selection and restores all the elements in the selected range
to their previous selection state.
.IP [17]
-Control-slash selects everything in the widget, except in
+Control-/ selects everything in the widget, except in
\fBsingle\fR and \fBbrowse\fR modes, in which case it selects
the active element and deselects everything else.
.IP [18]
diff --git a/doc/man.macros b/doc/man.macros
new file mode 100644
index 0000000..ddd073d
--- /dev/null
+++ b/doc/man.macros
@@ -0,0 +1,267 @@
+.\" The -*- nroff -*- definitions below are for supplemental macros used
+.\" in Tcl/Tk manual entries.
+.\"
+.\" .AP type name in/out ?indent?
+.\" Start paragraph describing an argument to a library procedure.
+.\" type is type of argument (int, etc.), in/out is either "in", "out",
+.\" or "in/out" to describe whether procedure reads or modifies arg,
+.\" and indent is equivalent to second arg of .IP (shouldn't ever be
+.\" needed; use .AS below instead)
+.\"
+.\" .AS ?type? ?name?
+.\" Give maximum sizes of arguments for setting tab stops. Type and
+.\" name are examples of largest possible arguments that will be passed
+.\" to .AP later. If args are omitted, default tab stops are used.
+.\"
+.\" .BS
+.\" Start box enclosure. From here until next .BE, everything will be
+.\" enclosed in one large box.
+.\"
+.\" .BE
+.\" End of box enclosure.
+.\"
+.\" .CS
+.\" Begin code excerpt.
+.\"
+.\" .CE
+.\" End code excerpt.
+.\"
+.\" .VS ?version? ?br?
+.\" Begin vertical sidebar, for use in marking newly-changed parts
+.\" of man pages. The first argument is ignored and used for recording
+.\" the version when the .VS was added, so that the sidebars can be
+.\" found and removed when they reach a certain age. If another argument
+.\" is present, then a line break is forced before starting the sidebar.
+.\"
+.\" .VE
+.\" End of vertical sidebar.
+.\"
+.\" .DS
+.\" Begin an indented unfilled display.
+.\"
+.\" .DE
+.\" End of indented unfilled display.
+.\"
+.\" .SO ?manpage?
+.\" Start of list of standard options for a Tk widget. The manpage
+.\" argument defines where to look up the standard options; if
+.\" omitted, defaults to "options". The options follow on successive
+.\" lines, in three columns separated by tabs.
+.\"
+.\" .SE
+.\" End of list of standard options for a Tk widget.
+.\"
+.\" .OP cmdName dbName dbClass
+.\" Start of description of a specific option. cmdName gives the
+.\" option's name as specified in the class command, dbName gives
+.\" the option's name in the option database, and dbClass gives
+.\" the option's class in the option database.
+.\"
+.\" .UL arg1 arg2
+.\" Print arg1 underlined, then print arg2 normally.
+.\"
+.\" .QW arg1 ?arg2?
+.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation).
+.\"
+.\" .PQ arg1 ?arg2?
+.\" Print an open parenthesis, arg1 in quotes, then arg2 normally
+.\" (for trailing punctuation) and then a closing parenthesis.
+.\"
+.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
+.if t .wh -1.3i ^B
+.nr ^l \n(.l
+.ad b
+.\" # Start an argument description
+.de AP
+.ie !"\\$4"" .TP \\$4
+.el \{\
+. ie !"\\$2"" .TP \\n()Cu
+. el .TP 15
+.\}
+.ta \\n()Au \\n()Bu
+.ie !"\\$3"" \{\
+\&\\$1 \\fI\\$2\\fP (\\$3)
+.\".b
+.\}
+.el \{\
+.br
+.ie !"\\$2"" \{\
+\&\\$1 \\fI\\$2\\fP
+.\}
+.el \{\
+\&\\fI\\$1\\fP
+.\}
+.\}
+..
+.\" # define tabbing values for .AP
+.de AS
+.nr )A 10n
+.if !"\\$1"" .nr )A \\w'\\$1'u+3n
+.nr )B \\n()Au+15n
+.\"
+.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
+.nr )C \\n()Bu+\\w'(in/out)'u+2n
+..
+.AS Tcl_Interp Tcl_CreateInterp in/out
+.\" # BS - start boxed text
+.\" # ^y = starting y location
+.\" # ^b = 1
+.de BS
+.br
+.mk ^y
+.nr ^b 1u
+.if n .nf
+.if n .ti 0
+.if n \l'\\n(.lu\(ul'
+.if n .fi
+..
+.\" # BE - end boxed text (draw box now)
+.de BE
+.nf
+.ti 0
+.mk ^t
+.ie n \l'\\n(^lu\(ul'
+.el \{\
+.\" Draw four-sided box normally, but don't draw top of
+.\" box if the box started on an earlier page.
+.ie !\\n(^b-1 \{\
+\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
+.\}
+.el \}\
+\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
+.\}
+.\}
+.fi
+.br
+.nr ^b 0
+..
+.\" # VS - start vertical sidebar
+.\" # ^Y = starting y location
+.\" # ^v = 1 (for troff; for nroff this doesn't matter)
+.de VS
+.if !"\\$2"" .br
+.mk ^Y
+.ie n 'mc \s12\(br\s0
+.el .nr ^v 1u
+..
+.\" # VE - end of vertical sidebar
+.de VE
+.ie n 'mc
+.el \{\
+.ev 2
+.nf
+.ti 0
+.mk ^t
+\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
+.sp -1
+.fi
+.ev
+.\}
+.nr ^v 0
+..
+.\" # Special macro to handle page bottom: finish off current
+.\" # box/sidebar if in box/sidebar mode, then invoked standard
+.\" # page bottom macro.
+.de ^B
+.ev 2
+'ti 0
+'nf
+.mk ^t
+.if \\n(^b \{\
+.\" Draw three-sided box if this is the box's first page,
+.\" draw two sides but no top otherwise.
+.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
+.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
+.\}
+.if \\n(^v \{\
+.nr ^x \\n(^tu+1v-\\n(^Yu
+\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
+.\}
+.bp
+'fi
+.ev
+.if \\n(^b \{\
+.mk ^y
+.nr ^b 2
+.\}
+.if \\n(^v \{\
+.mk ^Y
+.\}
+..
+.\" # DS - begin display
+.de DS
+.RS
+.nf
+.sp
+..
+.\" # DE - end display
+.de DE
+.fi
+.RE
+.sp
+..
+.\" # SO - start of list of standard options
+.de SO
+'ie '\\$1'' .ds So \\fBoptions\\fR
+'el .ds So \\fB\\$1\\fR
+.SH "STANDARD OPTIONS"
+.LP
+.nf
+.ta 5.5c 11c
+.ft B
+..
+.\" # SE - end of list of standard options
+.de SE
+.fi
+.ft R
+.LP
+See the \\*(So manual entry for details on the standard options.
+..
+.\" # OP - start of full description for a single option
+.de OP
+.LP
+.nf
+.ta 4c
+Command-Line Name: \\fB\\$1\\fR
+Database Name: \\fB\\$2\\fR
+Database Class: \\fB\\$3\\fR
+.fi
+.IP
+..
+.\" # CS - begin code excerpt
+.de CS
+.RS
+.nf
+.ta .25i .5i .75i 1i
+..
+.\" # CE - end code excerpt
+.de CE
+.fi
+.RE
+..
+.\" # UL - underline word
+.de UL
+\\$1\l'|0\(ul'\\$2
+..
+.\" # QW - apply quotation marks to word
+.de QW
+.ie '\\*(lq'"' ``\\$1''\\$2
+.\"" fix emacs highlighting
+.el \\*(lq\\$1\\*(rq\\$2
+..
+.\" # PQ - apply parens and quotation marks to word
+.de PQ
+.ie '\\*(lq'"' (``\\$1''\\$2)\\$3
+.\"" fix emacs highlighting
+.el (\\*(lq\\$1\\*(rq\\$2)\\$3
+..
+.\" # QR - quoted range
+.de QR
+.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3
+.\"" fix emacs highlighting
+.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3
+..
+.\" # MT - "empty" string
+.de MT
+.QW ""
+..
diff --git a/doc/menu.n b/doc/menu.n
index ed0d33d..0af21b3 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -19,7 +19,7 @@ menu, tk_menuSetFocus \- Create and manipulate 'menu' widgets and menubars
\-activebackground \-borderwidth \-foreground
\-activeborderwidth \-cursor \-relief
\-activeforeground \-disabledforeground \-takefocus
-\-background \-font
+\-background \-font \-activerelief
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-postcommand postCommand Command
@@ -34,12 +34,12 @@ For menu entries that are check buttons or radio buttons, this option
specifies the color to display in the indicator when the check button
or radio button is selected.
.OP \-tearoff tearOff TearOff
-This option must have a proper boolean value, which specifies
-whether or not the menu should include a tear-off entry at the
-top. If so, it will exist as entry 0 of the menu and the other
-entries will number starting at 1. The default
-menu bindings arrange for the menu to be torn off when the tear-off
-entry is invoked.
+This option must have a proper boolean value (default is false),
+which specifies whether or not the menu should include a tear-off
+entry at the top. If so, it will exist as entry 0 of the menu and
+the other entries will number starting at 1. The default menu
+bindings arrange for the menu to be torn off when the tear-off entry
+is invoked.
This option is ignored under Aqua/MacOS, where menus cannot
be torn off.
.OP \-tearoffcommand tearOffCommand TearOffCommand
@@ -303,7 +303,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
diff --git a/doc/menubar.n b/doc/menubar.n
index c3be85d..eeeb208 100644
--- a/doc/menubar.n
+++ b/doc/menubar.n
@@ -14,7 +14,7 @@ tk_menuBar, tk_bindForTraversal \- Obsolete support for menu bars
.SH SYNOPSIS
\fBtk_menuBar \fIframe \fR?\fImenu menu ...\fR?
.sp
-\fBtk_bindForTraversal \fIarg arg ... \fR
+\fBtk_bindForTraversal \fIarg ... \fR
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/menubutton.n b/doc/menubutton.n
index 1f596ce..ba874d5 100644
--- a/doc/menubutton.n
+++ b/doc/menubutton.n
@@ -117,7 +117,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/message.n b/doc/message.n
index 280c072..eb83d2f 100644
--- a/doc/message.n
+++ b/doc/message.n
@@ -106,7 +106,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/options.n b/doc/options.n
index 738a1c6..b1af80d 100644
--- a/doc/options.n
+++ b/doc/options.n
@@ -58,6 +58,9 @@ than one element at a time (e.g. menus but not buttons).
.OP \-activeforeground activeForeground Background
Specifies foreground color to use when drawing active elements.
See above for definition of active elements.
+.OP \-activerelief activeRelief Relief
+Specifies the 3-D effect desired for the active item of the widget.
+See the \fB-relief\fR option for details.
.OP \-anchor anchor Anchor
Specifies how the information in a widget (e.g. text or a bitmap)
is to be displayed in the widget.
@@ -221,6 +224,13 @@ internal space above and/or below what it displays inside.
Most widgets only use this option for padding text: if they are
displaying a bitmap or image, then they usually ignore padding
options.
+.OP \-placeholder placeHolder PlaceHolder
+Specifies a help text string to display if no text is otherwise displayed,
+that is when the widget is empty. The placeholder text is displayed using
+the values of the \fB\-font\fR and \fB\-justify\fR options.
+.OP \-placeholderforeground placeholderForeground PlaceholderForeground
+Specifies the foreground color to use when the placeholder text is
+displayed. The default color is platform-specific.
.OP \-relief relief Relief
Specifies the 3-D effect desired for the widget. Acceptable
values are \fBraised\fR, \fBsunken\fR, \fBflat\fR, \fBridge\fR,
diff --git a/doc/pack.n b/doc/pack.n
index a82db6c..cdcfeb8 100644
--- a/doc/pack.n
+++ b/doc/pack.n
@@ -129,6 +129,14 @@ than receiving default values.
Removes each of the \fIwindow\fRs from the packing order for its
container and unmaps their windows.
The content will no longer be managed by the packer.
+.RS
+.PP
+.VS "TIP 518"
+If the last content window of the container becomes unmanaged, this will also send
+the virtual event \fB<<NoManagedChild>>\fR to the container; the container
+may choose to resize itself (or otherwise respond) to such a change.
+.VE "TIP 518"
+.RE
.TP
\fBpack info \fIwindow\fR
Returns a list whose elements are the current configuration state of
@@ -150,17 +158,15 @@ If \fIboolean\fR is omitted then the command returns \fB0\fR or
for \fIcontainer\fR.
Propagation is enabled by default.
.TP
-\fBpack slaves \fIwindow\fR
+\fBpack content \fIwindow\fR
Returns a list of all of the content windows in the packing order for \fIwindow\fR.
The order of the content windows in the list is the same as their order in
the packing order.
If \fIwindow\fR has no content then an empty string is returned.
-.VS "TIP 581"
.TP
-\fBpack content \fIwindow\fR
+\fBpack slaves \fIwindow\fR
.
-Synonym for \fBpack slaves \fIwindow\fR.
-.VE "TIP 581"
+Synonym for \fBpack content \fIwindow\fR.
.SH "THE PACKER ALGORITHM"
.PP
For each container the packer maintains an ordered list of content
diff --git a/doc/panedwindow.n b/doc/panedwindow.n
index 9fb89d0..cad256a 100644
--- a/doc/panedwindow.n
+++ b/doc/panedwindow.n
@@ -92,7 +92,7 @@ the same as the path name of the panedwindow's window. This command
may be used to invoke various operations on the widget. It has the
following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as
the panedwindow widget's path name. \fIOption\fR and the \fIarg\fRs
diff --git a/doc/photo.n b/doc/photo.n
index 84cf618..f30039d 100644
--- a/doc/photo.n
+++ b/doc/photo.n
@@ -24,31 +24,31 @@ photo \- Full-color images
\fIimageName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
\fIimageName \fBcopy \fIsourceImage\fR ?\fIoption value(s) ...\fR?
\fIimageName \fBdata\fR ?\fIoption value(s) ...\fR?
-\fIimageName \fBget \fIx y\fR
+\fIimageName \fBget \fIx y\fR ?\fIoption\fR?
\fIimageName \fBput \fIdata\fR ?\fIoption value(s) ...\fR?
\fIimageName \fBread \fIfilename\fR ?\fIoption value(s) ...\fR?
\fIimageName \fBredither\fR
-\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg arg ...\fR?
+\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg ...\fR?
\fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR?
.fi
.BE
.SH DESCRIPTION
.PP
-A photo is an image whose pixels can display any color or be
-transparent. A photo image is stored internally in full color (32
-bits per pixel), and is displayed using dithering if necessary. Image
-data for a photo image can be obtained from a file or a string, or it
-can be supplied from
-C code through a procedural interface. At present, only
+A photo is an image whose pixels can display any color with a varying
+degree of transparency (the alpha channel). A photo image is stored
+internally in full color (32 bits per pixel), and is displayed using
+dithering if necessary. Image data for a photo image can be obtained
+from a file or a string, or it can be supplied from C code through a
+procedural interface. At present, only
.VS 8.6
PNG,
.VE 8.6
-GIF and PPM/PGM
-formats are supported, but an interface exists to allow additional
-image file formats to be added easily. A photo image is transparent
-in regions where no image data has been supplied
-or where it has been set transparent by the \fBtransparency set\fR
-subcommand.
+GIF and PPM/PGM formats are supported, but an interface exists to
+allow additional image file formats to be added easily. A photo image
+is (semi)transparent if the image data it was obtained from had
+transparency informaton. In regions where no image data has been
+supplied, it is fully transparent. Transparency may also be modified
+with the \fBtransparency set\fR subcommand.
.SH "CREATING PHOTOS"
.PP
Like all images, photos are created using the \fBimage create\fR
@@ -57,19 +57,25 @@ Photos support the following \fIoptions\fR:
.TP
\fB\-data \fIstring\fR
.
-Specifies the contents of the image as a string. The string should
-contain binary data or, for some formats, base64-encoded data (this is
+Specifies the contents of the image as a string.
+.VS 8.7
+The string should
+contain data in the default list-of-lists form,
+.VE 8.7
+binary data or, for some formats, base64-encoded data (this is
currently guaranteed to be supported for PNG and GIF images). The
-format of the
-string must be one of those for which there is an image file format
-handler that will accept string data. If both the \fB\-data\fR
-and \fB\-file\fR options are specified, the \fB\-file\fR option takes
-precedence.
+format of the string must be one of those for which there is an image
+file format handler that will accept string data. If both the
+\fB\-data\fR and \fB\-file\fR options are specified, the \fB\-file\fR
+option takes precedence.
.TP
-\fB\-format \fIformat-name\fR
+\fB\-format\fR {\fIformat-name\fR ?\fIoption value ...\fR?}
.
Specifies the name of the file format for the data specified with the
-\fB\-data\fR or \fB\-file\fR option.
+\fB\-data\fR or \fB\-file\fR option and optional arguments passed to
+the format handler. Note: the value of this option must be a Tcl list.
+This means that the braces may be omitted if the argument has only one
+word. Also, instead of braces, double quotes may be used for quoting.
.TP
\fB\-file \fIname\fR
.
@@ -95,6 +101,16 @@ Specifies the height of the image, in pixels. This option is useful
primarily in situations where the user wishes to build up the contents
of the image piece by piece. A value of zero (the default) allows the
image to expand or shrink vertically to fit the data stored in it.
+.VS 8.7
+.TP
+\fB\-metadata \fImetadata\fR
+.
+Set the metadata dictionary of the image.
+Additional keys may be set within the metadata dictionary of the image,
+if image data is processed due to a \fB\-file\fR or \fB\-data\fR options
+and the driver outputs any metadata keys.
+See section \fBMETADATA DICTIONARY\fR below.
+.VE 8.7
.TP
\fB\-palette \fIpalette-spec\fR
.
@@ -122,7 +138,7 @@ This command may be used to invoke various operations
on the image.
It has the following general form:
.CS
-\fIimageName option \fR?\fIarg arg ...\fR?
+\fIimageName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
@@ -140,7 +156,7 @@ The following commands are possible for photo images:
.
Blank the image; that is, set the entire image to have no data, so it
will be displayed as transparent, and the background of whatever
-window it is displayed in will show through.
+window it is displayed in will show through. The metadata dict of the image is not changed.
.TP
\fIimageName \fBcget\fR \fIoption\fR
.
@@ -163,6 +179,10 @@ modifies the given option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the
\fBimage create\fR \fBphoto\fR command.
+.VS 8.7
+Note: setting the \fB\-metadata\fR option without any other option
+will not invoke the image format driver to recreate the bitmap.
+.VE 8.7
.TP
\fIimageName \fBcopy\fR \fIsourceImage\fR ?\fIoption value(s) ...\fR?
.
@@ -233,8 +253,14 @@ the source image is used as-is. The default compositing rule is
.TP
\fIimageName \fBdata\fR ?\fIoption value(s) ...\fR?
.
-Returns image data in the form of a string. The following options
-may be specified:
+Returns image data in the form of a string.
+.VS 8.7
+The format of the string depends on the format handler. By default, a
+human readable format as a list of lists of pixel data is used, other
+formats can be chosen with the \fB-format\fR option.
+See \fBIMAGE FORMATS\fR below for details.
+.VE 8.7
+The following options may be specified:
.RS
.TP
\fB\-background\fI color\fR
@@ -243,19 +269,23 @@ If the color is specified, the data will not contain any transparency
information. In all transparent pixels the color will be replaced by
the specified color.
.TP
-\fB\-format\fI format-name\fR
-.
-Specifies the name of the image file format handler to be used.
-Specifically, this subcommand searches
-for the first handler whose name matches an initial substring of
-\fIformat-name\fR and which has the capability to write a string
-containing this image data.
-If this option is not given, this subcommand uses a format that
-consists of a list (one element per row) of lists (one element per
-pixel/column) of colors in
+\fB\-format\fR {\fIformat-name\fR ?\fIoption value ...\fR?}
+.
+Specifies the name of the image file format handler to use and,
+optionally, arguments to the format handler. Specifically, this
+subcommand searches for the first handler whose name matches an
+initial substring of \fIformat-name\fR and which has the capability to
+write a string containing this image data.
+.VS 8.7
+If this option is not given, this subcommand uses the default format
+that consists of a list (one element per row) of lists (one element
+per pixel/column) of colors in
.QW \fB#\fIrrggbb\fR
-format (where \fIrr\fR is a pair of hexadecimal digits for the red
-channel, \fIgg\fR for green, and \fIbb\fR for blue).
+format (see \fBIMAGE FORMATS\fR below).
+.VE 8.7
+Note: the value of this option must be a Tcl list.
+This means that the braces may be omitted if the argument has only one
+word. Also, instead of braces, double quotes may be used for quoting.
.TP
\fB\-from \fIx1 y1 x2 y2\fR
.
@@ -271,35 +301,59 @@ whole image.
.
If this options is specified, the data will not contain color
information. All pixel data will be transformed into grayscale.
-.RE
+.VS 8.7
.TP
-\fIimageName \fBget\fR \fIx y\fR
+\fB\-metadata\fR \fImetadata\fR
+.
+Image format handler may use metadata to be included in the returned
+data string.
+The specified \fImetadata\fR is passed to the driver for inclusion in the
+data.
+If no \fB\-metadata\fR option is given, the current metadata of the
+image is used.
+.VE 8.7
+.RE
+\fIimageName \fBget\fR \fIx y\fR ?\fB-withalpha\fR?
.
Returns the color of the pixel at coordinates (\fIx\fR,\fIy\fR) in the
image as a list of three integers between 0 and 255, representing the
-red, green and blue components respectively.
+red, green and blue components respectively. If the \fB-withalpha\fR
+option is specified, the returned list will have a fourth element
+representing the alpha value of the pixel as an integer between 0 and
+255.
+.VE 8.7
.TP
\fIimageName \fBput\fR \fIdata\fR ?\fIoption value(s) ...\fR?
.
Sets pixels in \fI imageName\fR to the data specified in \fIdata\fR.
-This command first searches the list of image file format handlers for
+.VS 8.7
+This command searches the list of image file format handlers for
a handler that can interpret the data in \fIdata\fR, and then reads
the image encoded within into \fIimageName\fR (the destination image).
-If \fIdata\fR does not match any known format, an attempt to interpret
-it as a (top-to-bottom) list of scan-lines is made, with each
-scan-line being a (left-to-right) list of pixel colors (see
-\fBTk_GetColor\fR for a description of valid colors.) Every scan-line
-must be of the same length. Note that when \fIdata\fR is a single
-color name, you are instructing Tk to fill a rectangular region with
-that color. The following options may be specified:
+See \fBIMAGE FORMATS\fR below for details on formats for image data.
+.VE 8.7
+The following options may be specified:
.RS
.TP
-\fB\-format \fIformat-name\fR
+\fB\-format\fR {\fIformat-name\fR ?\fIoption value ..\fR?}
.
-Specifies the format of the image data in \fIdata\fR.
+Specifies the format of the image data in \fIdata\fR and, optionally,
+arguments to be passed to the format handler.
Specifically, only image file format handlers whose names begin with
\fIformat-name\fR will be used while searching for an image data
format handler to read the data.
+Note: the value of this option must be a Tcl list.
+This means that the braces may be omitted if the argument has only one
+word. Also, instead of braces, double quotes may be used for quoting.
+.VS 8.7
+.TP
+\fB\-metadata\fR \fImetadata\fR
+.
+A specified \fImetadata\fR is passed to the image format driver when interpreting
+the data.
+Note: The current metadata of the image is not passed to the format driver
+and is not changed by the command.
+.VE 8.7
.TP
\fB\-to \fIx1 y1\fR ?\fIx2 y2\fR?
.
@@ -308,7 +362,9 @@ of the region of \fIimageName\fR into which the image data will be
copied. The default position is (0,0). If \fIx2\fR,\fIy2\fR is given
and \fIdata\fR is not large enough to cover the rectangle specified by
this option, the image data extracted will be tiled so it covers the
-entire destination rectangle. Note that if \fIdata\fR specifies a
+entire destination rectangle. If the region specified with this opion
+is smaller than the supplied \fIdata\fR, the exceeding data is silently
+discarded. Note that if \fIdata\fR specifies a
single color value, then a region extending to the bottom-right corner
represented by (\fIx2\fR,\fIy2\fR) will be filled with that color.
.RE
@@ -323,12 +379,16 @@ in \fIfilename\fR, and then reads the image in \fIfilename\fR into
specified:
.RS
.TP
-\fB\-format \fIformat-name\fR
+\fB\-format {\fIformat-name\fR ?\fIoption value ..\fR?}
.
-Specifies the format of the image data in \fIfilename\fR.
+Specifies the format of the image data in \fIfilename\fR and,
+optionally, additional options to the format handler.
Specifically, only image file format handlers whose names begin with
\fIformat-name\fR will be used while searching for an image data
format handler to read the data.
+Note: the value of this option must be a Tcl list.
+This means that the braces may be omitted if the argument has only one
+word. Also, instead of braces, double quotes may be used for quoting.
.TP
\fB\-from \fIx1 y1 x2 y2\fR
.
@@ -339,6 +399,15 @@ corner of the image in the image file. If all four coordinates are
specified, they specify diagonally opposite corners or the region.
The default, if this option is not specified, is the whole of the
image in the image file.
+.VS 8.7
+.TP
+\fB\-metadata\fR \fImetadata\fR
+.
+A specified \fImetadata\fR is passed to the image format driver when interpreting
+the data.
+Note: The current metadata of the image is not passed to the format driver
+and is not changed by the command.
+.VE 8.7
.TP
\fB\-shrink\fR
.
@@ -366,21 +435,31 @@ not noticeable, but if it is a problem, this command can be used to
recalculate the dithered image in each window where the image is
displayed.
.TP
-\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg arg ...\fR?
+\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg ...\fR?
.
Allows examination and manipulation of the transparency information in
the photo image. Several subcommands are available:
.RS
+.VS 8.7
.TP
-\fIimageName \fBtransparency get \fIx y\fR
+\fIimageName \fBtransparency get \fIx y\fR ?\fB-alpha\fR?
.
-Returns a boolean indicating if the pixel at (\fIx\fR,\fIy\fR) is
-transparent.
+Returns true if the pixel at (\fIx\fR,\fIy\fR) is fully transparent,
+false otherwise. If the option \fB-alpha\fR is passed, returns the
+alpha value of the pixel instead, as an integer in the range 0 to 255.
+.VE 8.7
+
+.VS 8.7
.TP
-\fIimageName \fBtransparency set \fIx y boolean\fR
+\fIimageName \fBtransparency set \fIx y\fR \fInewVal\fR ?\fB-alpha\fR?
.
-Makes the pixel at (\fIx\fR,\fIy\fR) transparent if \fIboolean\fR is
-true, and makes that pixel opaque otherwise.
+Change the transparency of the pixel at (\fIx\fR,\fIy\fR) to
+\fInewVal.\fR If no additional option is passed, \fInewVal\fR is
+interpreted as a boolean and the pixel is made fully transparent if
+that value is true, fully opaque otherwise. If the \fB-alpha\fR
+option is passed, \fInewVal\fR is interpreted as an integral alpha
+value for the pixel, which must be in the range 0 to 255.
+.VE 8.7
.RE
.TP
\fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR?
@@ -395,15 +474,19 @@ If the color is specified, the data will not contain any transparency
information. In all transparent pixels the color will be replaced by
the specified color.
.TP
-\fB\-format\fI format-name\fR
+\fB\-format\fR {\fIformat-name\fR ?\fIoption value ...\fR?}
.
Specifies the name of the image file format handler to be used to
-write the data to the file. Specifically, this subcommand searches
-for the first handler whose name matches an initial substring of
-\fIformat-name\fR and which has the capability to write an image
-file. If this option is not given, the format is guessed from
-the file extension. If that cannot be determined, this subcommand
-uses the first handler that has the capability to write an image file.
+write the data to the file and, optionally, options to pass to the
+format handler. Specifically, this subcommand searches for the first
+handler whose name matches an initial substring of \fIformat-name\fR
+and which has the capability to write an image file. If this option
+is not given, the format is guessed from the file extension. If that
+cannot be determined, this subcommand uses the first handler that has
+the capability to write an image file.
+Note: the value of this option must be a Tcl list.
+This means that the braces may be omitted if the argument has only one
+word. Also, instead of braces, double quotes may be used for quoting.
.TP
\fB\-from \fIx1 y1 x2 y2\fR
.
@@ -418,6 +501,16 @@ if this option is not given, is the whole image.
.
If this options is specified, the data will not contain color
information. All pixel data will be transformed into grayscale.
+.VS 8.7
+.TP
+\fB\-metadata\fR \fBmetadata\fR
+.
+Image format handler may use metadata to be included in the written file.
+The specified \fImetadata\fR is passed to the driver for inclusion in the
+file.
+If no \fB\-metadata\fR option is given, the current metadata of the
+image is used.
+.VE 8.7
.RE
.SH "IMAGE FORMATS"
.PP
@@ -426,20 +519,24 @@ image file formats to be added easily. The photo image code maintains
a list of these handlers. Handlers are added to the list by
registering them with a call to \fBTk_CreatePhotoImageFormat\fR. The
standard Tk distribution comes with handlers for PPM/PGM, PNG and GIF
-formats, which are automatically registered on initialization.
-.PP
-When reading an image file or processing
-string data specified with the \fB\-data\fR configuration option, the
-photo image code invokes each handler in turn until one is
-found that claims to be able to read the data in the file or string.
-Usually this will find the correct handler, but if it does not, the
-user may give a format name with the \fB\-format\fR option to specify
-which handler to use. In fact the photo image code will try those
-handlers whose names begin with the string specified for the
-\fB\-format\fR option (the comparison is case-insensitive). For
-example, if the user specifies \fB\-format gif\fR, then a handler
-named GIF87 or GIF89 may be invoked, but a handler
-named JPEG may not (assuming that such handlers had been
+formats,
+.VS 8.7
+as well as the \fBdefault\fR handler to encode/decode image
+data in a human readable form.
+.VE 8.7
+These handlers are automatically registered on initialization.
+.PP
+When reading an image file or processing string data specified with
+the \fB\-data\fR configuration option, the photo image code invokes
+each handler in turn until one is found that claims to be able to read
+the data in the file or string. Usually this will find the correct
+handler, but if it does not, the user may give a format name with the
+\fB\-format\fR option to specify which handler to use. In this case,
+the photo image code will try those handlers whose names begin with
+the string specified for the \fB\-format\fR option (the comparison is
+case-insensitive). For example, if the user specifies \fB\-format
+gif\fR, then a handler named GIF87 or GIF89 may be invoked, but a
+handler named JPEG may not (assuming that such handlers had been
registered).
.PP
When writing image data to a file, the processing of the
@@ -450,27 +547,163 @@ that, which the handler can use, for example, to specify which variant
to use of the formats supported by the handler.
Note that not all image handlers may support writing transparency data
to a file, even where the target image format does.
+.VS 8.7
+.SS "THE DEFAULT IMAGE HANDLER"
+.PP
+The \fBdefault\fR image handler cannot be used to read or write data
+from/to a file. Its sole purpose is to encode and decode image data in
+string form in a clear text, human readable, form. The \fIimageName\fR
+\fBdata\fR subcommand uses this handler when no other format is
+specified. When reading image data from a string with \fIimageName\fR
+\fBput\fR or the \fB-data\fR option, the default handler is treated
+as the other handlers.
+.PP
+Image data in the \fBdefault\fR string format is a (top-to-bottom)
+list of scan-lines, with each scan-line being a (left-to-right) list
+of pixel data. Every scan-line has the same length. The color
+and, optionally, alpha value of each pixel is specified in any of
+the forms described in the \fBCOLOR FORMATS\fR section below.
+.VE 8.7
+
.SS "FORMAT SUBOPTIONS"
.PP
.VS 8.6
-Some image formats support sub-options, which are specified at the time that
-the image is loaded using additional words in the \fB\-format\fR option. At
-the time of writing, the following are supported:
+Image formats may support sub-options, wich ahre specified using
+additional words in the value to the \fB\-format\fR option. These
+suboptions can affect how image data is read or written to file or
+string. The nature and values of these options is up to the format
+handler.
+The built-in handlers support these suboptions:
+.VS 8.7
+.TP
+\fBdefault \-colorformat\fI formatType\fR
+.
+The option is allowed when writing image data to a string with
+\fIimageName\fR \fBdata\fR. Specifies the format to use for the color
+string of each pixel. \fIformatType\fR may be one of: \fBrgb\fR to
+encode pixel data in the form \fB#\fIRRGGBB\fR, \fBrgba\fR to encode
+pixel data in the form \fB#\fIRRGGBBAA\fR or \fBlist\fR to encode
+pixel data as a list with four elements. See \fBCOLOR FORMATS\fR
+below for details. The default is \fBrgb\fR.
+.VE 8.7
.TP
\fBgif \-index\fI indexValue\fR
.
-When parsing a multi-part GIF image, Tk normally only accesses the first
-image. By giving the \fB\-index\fR sub-option, the \fIindexValue\fR'th value
-may be used instead. The \fIindexValue\fR must be an integer from 0 up to the
-number of image parts in the GIF data.
+The option has effect when reading image data from a file. When
+parsing a multi-part GIF image, Tk normally only accesses the first
+image. By giving the \fB\-index\fR sub-option, the \fIindexValue\fR'th
+value may be used instead. The \fIindexValue\fR must be an integer
+from 0 up to the number of image parts in the GIF data.
.TP
\fBpng \-alpha\fI alphaValue\fR
.
-An additional alpha filtering for the overall image, which allows the
-background on which the image is displayed to show through. This usually also
-has the effect of desaturating the image. The \fIalphaValue\fR must be between
-0.0 and 1.0.
+The option has effect when reading image data from a file. Specifies
+an additional alpha filtering for the overall image, which allows the
+background on which the image is displayed to show through. This
+usually also has the effect of desaturating the image. The
+\fIalphaValue\fR must be between 0.0 and 1.0.
+.TP
+\fBsvg \-dpi\fI dpiValue\fB \-scale\fI scaleValue\fB \-scaletowidth \fI width\fB \-scaletoheight\fI height\fR
+.
+\fIdpiValue\fR is used in conversion between given coordinates and
+screen resolution. The value must be greater than 0 and the default
+value is 96.
+\fIscaleValue\fR is used to scale the resulting image. The value must
+be greater than 0 and the default value is 1.
+\fIwidth\fR and \fIheight\fR are the width or height that the image
+will be adjusted to. Only one parameter among \fB\-scale\fR,
+\fB\-scaletowidth\fR and \fB\-scaletoheight\fR can be given at a time
+and the aspect ratio of the original image is always preserved.
+The svg format supports a wide range of SVG features, but the
+full SVG standard is not available, for instance the 'text' feature
+is missing and silently ignored when reading the SVG data.
+The supported SVG features are:
+.
+.RS
+\fB elements:\fR g, path, rect, circle, ellipse, line, polyline, polygon,
+linearGradient, radialGradient, stop, defs, svg, style
+.PP
+\fB attributes:\fR width, height, viewBox,
+preserveAspectRatio with none, xMin, xMid, xMax, yMin, yMid, yMax, slice
+.PP
+\fB gradient attributes:\fR gradientUnits with objectBoundingBox,
+gradientTransform, cx, cy, r fx, fy x1, y1, x2, y2
+spreadMethod with pad, reflect or repeat,
+xlink:href
+.PP
+\fB poly attributes: \fR points
+.PP
+\fB line attributes: \fR x1, y1, x2, y2
+.PP
+\fB ellipse attributes: \fR cx, cy, rx, ry
+.PP
+\fB circle attributes: \fR cx, cy, r
+.PP
+\fB rectangle attributes: \fR x, y, width, height, rx, ry
+.PP
+\fB path attributes: \fR d with m, M, l, L, h, H, v, V, c, C, s, S, q, Q, t, T, a, A, z, Z
+.PP
+\fB style attributes: \fR display with none, visibility, hidden, visible,
+fill with nonzero and evenodd, opacity, fill-opacity,
+stroke, stroke-width, stroke-dasharray, stroke-dashoffset, stroke-opacity,
+stroke-linecap with butt, round and square,
+stroke-linejoin with miter, round and bevel, stroke-miterlimit
+fill-rule, font-size,
+transform with matrix, translate, scale, rotate, skewX and skewY,
+stop-color, stop-opacity, offset, id, class
+.RE
+.
+Currently only SVG images reading and conversion into (pixel-based
+format) photos is supported: Tk does not (yet) support bundling photo
+images in SVG vector graphics.
.VE 8.6
+.VS 8.7
+.SH "COLOR FORMATS"
+.PP
+The default image handler can represent/parse color and alpha values
+of a pixel in one of the formats listed below. If a color format does
+not contain transparency information, full opacity is assumed. The
+available color formats are:
+.IP \(bu 3
+The empty string - interpreted as full transparency, the color value
+is undefined.
+.IP \(bu 3
+Any value accepted by \fBTk_GetColor\fR, optionally followed by an
+alpha suffix. The alpha suffix may be one of:
+.RS
+.TP
+\fB@\fR\fIA\fR
+.
+The alpha value \fIA\fR must be a fractional value in the range 0.0
+(fully transparent) to 1.0 (fully opaque).
+.TP
+\fB#\fR\fIX\fR
+.
+The alpha value \fIX\fR is a hexadecimal digit that specifies an integer
+alpha value in the range 0 (fully transparent) to 255 (fully opaque).
+This is expanded in range from 4 bits wide to 8 bits wide by
+multiplication by 0x11.
+.TP
+\fB#\fR\fIXX\fR
+.
+The alpha value \fIXX\fR is passed as two hexadecimal digits that
+specify an integer alpha value in the range 0 (fully transparent) to 255
+(fully opaque).
+.RE
+.IP \(bu 3
+A Tcl list with three or four integers in the range 0 to 255,
+specifying the values for the red, green, blue and (optionally)
+alpha channels respectively.
+.IP \(bu 3
+\fB#\fR\fIRGBA\fR format: a \fB#\fR followed by four hexadecimal digits,
+where each digit is the value for the red, green, blue and alpha
+channels respectively. Each digit will be expanded internally to
+8 bits by multiplication by 0x11.
+.IP \(bu 3
+\fB#\fR\fIRRGGBBAA\fR format: \fB#\fR followed by eight hexadecimal digits,
+where each pair of subsequent digits represents the value for the red,
+green, blue and alpha channels respectively.
+.VE 8.7
.SH "COLOR ALLOCATION"
.PP
When a photo image is displayed in a window, the photo image code
@@ -500,6 +733,39 @@ each primary color to try to allocate. It can also be used to force
the image to be displayed in shades of gray, even on a color display,
by giving a single number rather than three numbers separated by
slashes.
+.VS 8.7
+.SH "METADATA DICTIONARY"
+.PP
+Each image has a metadata dictionary property.
+This dictionary is not relevant to the bitmap representation of the
+image, but may contain additional information like resolution or
+comments.
+Image format drivers may output metadata when image data is
+parsed, or may use metadata to be included in image files or formats.
+.SS "METADATA KEYS"
+.PP
+Each image format driver supports an individual set of metadata dictionary
+keys. Predefined keys are:
+.TP
+DPI
+.
+Horizontal image resolution in DPI as a double value.
+Supported by format \fBpng\fR.
+.TP
+aspect
+.
+Aspect ratio horizontal divided by vertical as double value.
+Supported by formats \fBgif\fR and \fBpng\fR.
+.TP
+comment
+.
+Image text comment.
+Supported by formats \fBgif\fR and \fBpng\fR.
+.PP
+It is valid to set any key in the metadata dict.
+A format driver will ignore keys it does not handle.
+.PP
+.VE 8.7
.SH CREDITS
.PP
The photo image type was designed and implemented by Paul Mackerras,
@@ -534,6 +800,23 @@ buttons:
button .b \-image icon \-disabledimage iconDisabled
.CE
.VE 8.6
+.PP
+.VS 8.7
+Create a green box with a simple shadow effect
+.PP
+.CS
+\fBimage create photo\fR foo
+
+# Make a simple graduated fill varying in alpha for the shadow
+for {set i 14} {$i > 0} {incr i -1} {
+ set i2 [expr {$i + 30}]
+ foo \fBput\fR [format black#%x [expr {15-$i}]] -to $i $i $i2 $i2
+}
+
+# Put a solid green rectangle on top
+foo \fBput\fR #F080 -to 0 0 30 30
+.VE 8.7
+.CE
.SH "SEE ALSO"
image(n)
.SH KEYWORDS
diff --git a/doc/place.n b/doc/place.n
index c86579c..b56ad58 100644
--- a/doc/place.n
+++ b/doc/place.n
@@ -191,15 +191,13 @@ The list consists of \fIoption\-value\fR pairs in exactly the
same form as might be specified to the \fBplace configure\fR
command.
.TP
-\fBplace slaves \fIwindow\fR
+\fBplace content \fIwindow\fR
Returns a list of all the content windows for which \fIwindow\fR is the container.
If there is no content for \fIwindow\fR then an empty string is returned.
-.VS "TIP 581"
.TP
-\fBplace content \fIwindow\fR
+\fBplace slaves \fIwindow\fR
.
-Synonym for \fBplace slaves \fIwindow\fR.
-.VE "TIP 581"
+Synonym for \fBplace content \fIwindow\fR.
.PP
If the configuration of a window has been retrieved with
\fBplace info\fR, that configuration can be restored later by
diff --git a/doc/popup.n b/doc/popup.n
index 6e6fd95..9543750 100644
--- a/doc/popup.n
+++ b/doc/popup.n
@@ -38,7 +38,7 @@ $m add command \-label "Example 2" \-command bell
pack [label .l \-text "Click me!"]
# Arrange for the menu to pop up when the label is clicked
-bind .l <1> {\fBtk_popup\fR .popupMenu %X %Y}
+bind .l <Button-1> {\fBtk_popup\fR .popupMenu %X %Y}
.CE
.SH "SEE ALSO"
bind(n), menu(n), tk_optionMenu(n)
diff --git a/doc/print.n b/doc/print.n
new file mode 100644
index 0000000..3f51866
--- /dev/null
+++ b/doc/print.n
@@ -0,0 +1,63 @@
+.\" Text automatically generated by txt2man
+'\"
+'\" Copyright (c) 2021 Kevin Walzer/WordTech Communications LLC.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+.TH tk print n "" Tk "Tk Built-in Commands"
+.so man.macros
+.SH NAME
+print \- Print canvas and text widgets using native dialogs and APIs.
+.SH SYNOPSIS
+\fBtk print \fIwindow\fR
+.
+.SH DESCRIPTION
+.PP
+The \fBtk print\fR command posts a dialog that allows users to print output
+from the \fBcanvas\fR and \fBtext\fR widgets. The printing will be done using
+platform-native APIs and dialogs where available.
+.PP
+The \fBcanvas\fR widget has long supported PostScript export and both
+PostScript and text files can be sent directly to a printer on Unix-like
+systems using the
+.QW "lp"
+and
+.QW "lpr"
+Unix commands, and the \fBtk print\fR command does not supersede that
+functionality; it builds on it. The \fBtk print\fR command is a fuller
+implementation that uses native dialogs on macOS and Windows, and a Tk-based
+dialog that provides parallel functionality on X11.
+.SH PLATFORM NOTES
+.TP
+\fBmacOS\fR
+.
+The Mac implementation uses native print dialogs and relies on the underlying
+Common Unix Printing System (CUPS) to render text output from the text widget
+and PostScript output from the canvas widget to the printer, to a PDF file, or
+a PostScript file.
+.TP
+\fBWindows\fR
+.
+The Windows implementation is based on the GDI (Graphics Device Interface)
+API. Because there are slight differences in how GDI and Tk's \fBcanvas\fR
+widget display graphics, printed output from the \fBcanvas\fR on Windows may
+not be identical to screen rendering.
+.TP
+\fBX11\fR
+.
+The X11 implementation uses a Tk GUI to configure print jobs for sending to a
+printer via the
+.QW "lpr"
+or
+.QW "lp"
+commands. While these commands have a large number of parameters for
+configuring print jobs, printers vary widely in how they support these
+parameters. As a result, only printer selection and number of copies are
+configured as arguments to the print command; many aspects of print rendering,
+such as grayscale or color for the canvas, are instead configured when
+PostScript is generated.
+.SH "SEE ALSO"
+canvas(n), text(n), tk(n)
+.SH KEYWORDS
+print, output, graphics, text, canvas
diff --git a/doc/radiobutton.n b/doc/radiobutton.n
index fceb1ec..2169515 100644
--- a/doc/radiobutton.n
+++ b/doc/radiobutton.n
@@ -176,7 +176,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/scale.n b/doc/scale.n
index d6407a0..0499d0a 100644
--- a/doc/scale.n
+++ b/doc/scale.n
@@ -138,7 +138,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/scrollbar.n b/doc/scrollbar.n
index 4b1d4ba..4f808f4 100644
--- a/doc/scrollbar.n
+++ b/doc/scrollbar.n
@@ -103,7 +103,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
@@ -215,15 +215,6 @@ document. 1.0 refers to the end of the document, 0.333
refers to a point one-third of the way through the document,
and so on.
.TP
-\fIprefix \fBscroll \fInumber \fBunits\fR
-.
-The widget should adjust its view by \fInumber\fR units.
-The units are defined in whatever way makes sense for the widget,
-such as characters or lines in a text widget.
-\fINumber\fR is either 1, which means one unit should scroll off
-the top or left of the window, or \-1, which means that one unit
-should scroll off the bottom or right of the window.
-.TP
\fIprefix \fBscroll \fInumber \fBpages\fR
.
The widget should adjust its view by \fInumber\fR pages.
@@ -232,7 +223,19 @@ it is slightly less than what fits in the window, so that there
is a slight overlap between the old and new views.
\fINumber\fR is either 1, which means the next page should
become visible, or \-1, which means that the previous page should
-become visible.
+become visible. Fractional number are rounded away from 0, so
+scrolling 0.001 pages has the same effect as scrolling 1 page.
+.TP
+\fIprefix \fBscroll \fInumber \fBunits\fR
+.
+The widget should adjust its view by \fInumber\fR units.
+The units are defined in whatever way makes sense for the widget,
+such as characters or lines in a text widget.
+\fINumber\fR is either 1, which means one unit should scroll off
+the top or left of the window, or \-1, which means that one unit
+should scroll off the bottom or right of the window. Fractional
+numbers are rounded away from 0, so scrolling 0.001 units has
+the same effect as scrolling 1 unit.
.SH "OLD COMMAND SYNTAX"
.PP
In versions of Tk before 4.0, the \fBset\fR and \fBget\fR widget
diff --git a/doc/selection.n b/doc/selection.n
index a2c5ae5..a26c5d9 100644
--- a/doc/selection.n
+++ b/doc/selection.n
@@ -12,7 +12,7 @@
.SH NAME
selection \- Manipulate the X selection
.SH SYNOPSIS
-\fBselection \fIoption\fR ?\fIarg arg ...\fR?
+\fBselection \fIoption\fR ?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/send.n b/doc/send.n
index e33a504..f200128 100644
--- a/doc/send.n
+++ b/doc/send.n
@@ -12,7 +12,7 @@
.SH NAME
send \- Execute a command in a different application
.SH SYNOPSIS
-\fBsend ?\fIoptions\fR? \fIapp cmd \fR?\fIarg arg ...\fR?
+\fBsend ?\fIoptions\fR? \fIapp cmd \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/spinbox.n b/doc/spinbox.n
index a2e7d05..d33c2d2 100644
--- a/doc/spinbox.n
+++ b/doc/spinbox.n
@@ -23,6 +23,7 @@ spinbox \- Create and manipulate 'spinbox' value spinner widgets
\-foreground \-justify \-xscrollcommand
\-highlightbackground \-relief
\-highlightcolor \-repeatdelay
+\-placeholder \-placeholderforeground
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-buttonbackground buttonBackground Background
@@ -54,7 +55,8 @@ as it will format a floating-point number.
A floating-point value corresponding to the lowest value for a spinbox, to
be used in conjunction with \fB\-to\fR and \fB\-increment\fR. When all
are specified correctly, the spinbox will use these values to control its
-contents. This value must be less than the \fB\-to\fR option.
+contents. If this value is greater than the \fB\-to\fR option, then
+\fB\-from\fR and \fB\-to\fR values are automatically swapped.
If \fB\-values\fR is specified, it supersedes this option.
.OP "\-invalidcommand or \-invcmd" invalidCommand InvalidCommand
Specifies a script to eval when \fB\-validatecommand\fR returns 0. Setting
@@ -83,7 +85,8 @@ be displayed in a different color, depending on the values of the
A floating-point value corresponding to the highest value for the spinbox,
to be used in conjunction with \fB\-from\fR and \fB\-increment\fR. When
all are specified correctly, the spinbox will use these values to control
-its contents. This value must be greater than the \fB\-from\fR option.
+its contents. If this value is less than the \fB\-from\fR option, then
+\fB\-from\fR and \fB\-to\fR values are automatically swapped.
If \fB\-values\fR is specified, it supersedes this option.
.OP \-validate validate Validate
Specifies the mode in which validation should operate: \fBnone\fR,
@@ -221,7 +224,7 @@ Also, the \fB-validate\fR option will set itself to \fBnone\fR when the
spinbox value gets changed because of adjustment of \fB-from\fR or \fB-to\fR
and the \fB-validatecommand\fR returns false. For instance
.CS
- \fIspinbox pathName \-from 1 \-to 10 \-validate all \-vcmd {return 0}\fR
+ \fIspinbox pathName \-from 1 \-to 10 \-validate all \-validatecommand {return 0}\fR
.CE
will in fact set the \fB-validate\fR option to \fBnone\fR because the default
value for the spinbox gets changed (due to the \fB-from\fR and \fB-to\fR
@@ -236,7 +239,7 @@ The \fBspinbox\fR command creates a new Tcl command whose
name is \fIpathName\fR. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
@@ -467,15 +470,16 @@ way through the text appears at the left edge of the window.
\fIpathName \fBxview scroll \fInumber what\fR
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
-\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
+\fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation
of one of these.
-If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
-\fInumber\fR average-width characters on the display; if it is
-\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
-If \fInumber\fR is negative then characters farther to the left
+If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR
+screenfuls. If \fInumber\fR is negative then characters farther to the left
become visible; if it is positive then characters farther to the right
become visible.
+If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
+\fInumber\fR average-width characters on the display.
.RE
.SH "DEFAULT BINDINGS"
.PP
diff --git a/doc/sysnotify.n b/doc/sysnotify.n
new file mode 100644
index 0000000..ea1ab89
--- /dev/null
+++ b/doc/sysnotify.n
@@ -0,0 +1,56 @@
+.\" Text automatically generated by txt2man
+'\"
+'\" Copyright (c) 2020 Kevin Walzer/WordTech Communications LLC.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.TH tk sysnotify n "" Tk "Tk Built-In Commands"
+.so man.macros
+.SH NAME
+sysnotify \- Creates a notification window with a title and message.
+.SH SYNOPSIS
+\fBtk sysnotify\fR \fItitle\fR \fImessage\fR
+.BE
+.SH DESCRIPTION
+.PP
+The \fBtk sysnotify\fR command creates a platform-specific system notification alert. Its intent is to provide a brief, unobtrusive notification to the user by popping up a window that briefly appears in a corner of the screen.
+.SH EXAMPLE
+.PP
+Here is an example of the \fBtk sysnotify\fR code:
+.PP
+.CS
+tk sysnotify "Alert" \e
+ "This is just a test of the Tk System Notification Code."
+.CE
+.SH PLATFORM NOTES
+.PP
+The macOS and Windows versions are native implementations using system
+API's. The X11 version has a conditional dependency on libnotify, and
+falls back to a Tcl-only implementation if libnotify is not installed. On
+each platform the notification includes a platform-specific default image to
+accompany the text.
+.TP
+\fBmacOS\fR
+.
+The macOS version will request permission from the user to authorize
+notifications. This must be activated in Apple's System Preferences
+Notifications section.
+.RS
+.PP
+If deploying an application using the standalone version of Wish.app,
+setting the bundle ID in the applications Info.plist file to begin with
+.QW \fBcom\fR
+seems necessary for notifications to work. Using a different prefix
+for the bundle ID, such as something like
+.QW \fBtk.tcl.tkchat\fR ,
+will cause notifications to silently fail.
+.RE
+.TP
+\fBWindows\fR
+.
+The image is taken from the system tray, i.e., \fBsysnotify\fR can only be
+called when a \fBsystray\fR was installed.
+.
+.SH KEYWORDS
+notify, alert
diff --git a/doc/systray.n b/doc/systray.n
new file mode 100644
index 0000000..d66659d
--- /dev/null
+++ b/doc/systray.n
@@ -0,0 +1,65 @@
+.\" Text automatically generated by txt2man
+'\"
+'\" Copyright (c) 2020 Kevin Walzer/WordTech Communications LLC.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.TH tk systray n "" Tk "Tk Built-In Commands"
+.so man.macros
+.SH NAME
+systray \- Creates an icon display in the platform-specific system tray.
+.SH SYNOPSIS
+\fBtk systray create \fI-image image\fR \fI?-text text\fR? \fI?-button1 callback?\fR \fI?-button3 callback?\fR
+.sp
+\fBtk systray configure \fI?option? ?value option value ...?\fR
+.sp
+\fBtk systray destroy\fR
+.BE
+.BE
+.SH DESCRIPTION
+.PP
+The \fBtk systray create\fR command creates an icon in the platform-specific
+tray. The widget is configured with a Tk image for the icon display, an
+optional string for display in a tooltip, and optional callbacks that are
+bound to <Button-1> and <Button-3>.
+.PP
+The \fBtk systray configure\fR command sets one or more options of the systray
+icon. Configurable options are the same as for the \fBcreate\fR subcommand. When
+a single option name is given, the command returns the current valus of this
+option. When no option is given this command returns the list of all options and
+their current value.
+.PP
+ The \fBtk systray destroy\fR command removes the icon from display and
+deallocates it.
+.PP
+From a user-interface standpoint, only one icon per interpreter is
+supported; attempts to create additional icons will return an error. The
+existing tray icon can be modified with different images and
+strings to indicate app state. Loading additional interpreters into a
+running instance of Wish will allow additional icons to be displayed.
+.SH EXAMPLE
+.PP
+Here is an example of the \fBtk systray\fR code:
+.CS
+ image create photo book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+ tk systray create -image book -text "tk systray sample" -button1 {puts "Here is the tk systray output"} -button3 {puts "here is alternate output"}
+.CE
+.PP
+Here is an example of modifying the \fBtk systray\fR icon:
+.CS
+ image create photo book_page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7
+ tk systray configure -image book_page -text "Updated sample" -button1 {puts "Different output from the tk systray"} -button3 {puts "and more different output from the tk systray"}
+.CE
+.SH PLATFORM NOTES
+.PP
+The X11 implementation is supported on a "best efforts" basis because it is
+dependent on the window manager. The "text" flag, which is implemented as
+a tooltip, does not always display if the WM does not support such features;
+the systray icon itself may not even display with some window managers.
+.PP
+On Windows, the Tk image provided in the \fI-image\fR option must be a
+photo image. On other platforms either a bitmap image or a photo image
+may be provided.
+.SH KEYWORDS
+image, callback
diff --git a/doc/text.n b/doc/text.n
index 73add92..53a7116 100644
--- a/doc/text.n
+++ b/doc/text.n
@@ -1052,7 +1052,7 @@ The \fBtext\fR command creates a new Tcl command whose name is the same as the
path name of the text's window. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as the text
widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact
@@ -1281,7 +1281,7 @@ must have a create script.) In this case an empty string is returned, and you
must query the window by its index position to get more information.
.RE
.TP
-\fIpathName \fBedit \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBedit \fIoption \fR?\fIarg ...\fR?
.
This command controls the undo mechanism and the modified flag. The exact
behavior of the command depends on the \fIoption\fR argument that follows the
@@ -1309,8 +1309,9 @@ of the widget to \fIboolean\fR.
\fIpathName \fBedit redo\fR
.
When the \fB\-undo\fR option is true, reapplies the last undone edits provided
-no other edits were done since then. Generates an error when the redo stack is
-empty. Does nothing when the \fB\-undo\fR option is false.
+no other edits were done since then, and returns a list of indices indicating
+what ranges were changed by the redo operation. Generates an error when the
+redo stack is empty. Does nothing when the \fB\-undo\fR option is false.
.TP
\fIpathName \fBedit reset\fR
.
@@ -1323,9 +1324,10 @@ Inserts a separator (boundary) on the undo stack. Does nothing when the
.TP
\fIpathName \fBedit undo\fR
.
-Undoes the last edit action when the \fB\-undo\fR option is true. An edit
-action is defined as all the insert and delete commands that are recorded on
-the undo stack in between two separators. Generates an error when the undo
+Undoes the last edit action when the \fB\-undo\fR option is true, and returns a
+list of indices indicating what ranges were changed by the undo operation. An
+edit action is defined as all the insert and delete commands that are recorded
+on the undo stack in between two separators. Generates an error when the undo
stack is empty. Does nothing when the \fB\-undo\fR option is false.
.RE
.TP
@@ -1347,7 +1349,7 @@ given, then, within each range, only those characters which are not elided
will be returned. This may have the effect that some of the returned ranges
are empty strings.
.TP
-\fIpathName \fBimage \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBimage \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate embedded images. The behavior of the
command depends on the \fIoption\fR argument that follows the \fBimage\fR
@@ -1412,7 +1414,7 @@ effect as if a separate \fIpathName \fBinsert\fR widget command had been
issued for each pair, in order. The last \fItagList\fR argument may be
omitted.
.TP
-\fIpathName \fBmark \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBmark \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate marks. The exact behavior of the command
depends on the \fIoption\fR argument that follows the \fBmark\fR argument. The
@@ -1692,7 +1694,7 @@ calculations, the scheduling is immediate. The command returns the empty
string. \fBbgerror\fR is called on \fIcommand\fR failure.
.RE
.TP
-\fIpathName \fBtag \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBtag \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate tags. The exact behavior of the command
depends on the \fIoption\fR argument that follows the \fBtag\fR argument. The
@@ -1731,8 +1733,8 @@ all the sequences for which bindings have been defined for \fItagName\fR.
.RS
.PP
The only events for which bindings may be specified are those related to the
-mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR, \fBButtonPress\fR,
-\fBMotion\fR, and \fBKeyPress\fR) or virtual events. Event bindings for a text
+mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR, \fBButton\fR,
+\fBMotion\fR, and \fBKey\fR) or virtual events. Event bindings for a text
widget use the \fBcurrent\fR mark described under \fBMARKS\fR above. An
\fBEnter\fR event triggers for a tag when the tag first becomes present on the
current character, and a \fBLeave\fR event triggers for a tag when it ceases
@@ -1859,7 +1861,7 @@ file or \fIindex2\fR is less than or equal to \fIindex1\fR) then the command
has no effect. This command returns an empty string.
.RE
.TP
-\fIpathName \fBwindow \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBwindow \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate embedded windows. The behavior of the
command depends on the \fIoption\fR argument that follows the \fBwindow\fR
@@ -1928,18 +1930,18 @@ and 1.
\fIpathName \fBxview scroll \fInumber what\fR
.
This command shifts the view in the window left or right according to
-\fInumber\fR and \fIwhat\fR. \fIWhat\fR must be \fBunits\fR, \fBpages\fR or
-\fBpixels\fR. If \fIwhat\fR is \fBunits\fR or \fBpages\fR then \fInumber\fR
-must be an integer, otherwise number may be specified in any of the forms
-acceptable to \fBTk_GetPixels\fR, such as
+\fInumber\fR and \fIwhat\fR. \fIWhat\fR must be \fBpages\fR,
+\fBpixels\fR, or \fBunits\fR. If \fIwhat\fR is \fBpages\fR or
+\fBunits\fR then \fInumber\fR must be an integer, otherwise number may be
+specified in any of the forms acceptable to \fBTk_GetPixels\fR, such as
.QW 2.0c
or
.QW 1i
(the result is rounded to the nearest integer value. If no units are given,
-pixels are assumed). If \fIwhat\fR is \fBunits\fR, the view adjusts left or
-right by \fInumber\fR average-width characters on the display; if it is
-\fBpages\fR then the view adjusts by \fInumber\fR screenfuls; if it is
-\fBpixels\fR then the view adjusts by \fInumber\fR pixels. If \fInumber\fR is
+pixels are assumed). If \fIwhat\fR is \fBpages\fR then the view adjusts by
+\fInumber\fR screenfuls; if it is \fBpixels\fR then the view adjusts by
+\fInumber\fR pixels; if it is \fBunits\fR, the view adjusts left or
+right by \fInumber\fR average-width characters on the display. If \fInumber\fR is
negative then characters farther to the left become visible; if it is positive
then characters farther to the right become visible.
.RE
@@ -1976,10 +1978,10 @@ the bottom of the window, and some other pixel is at the top.
\fIpathName \fByview scroll \fInumber what\fR
.
This command adjust the view in the window up or down according to
-\fInumber\fR and \fIwhat\fR. \fIWhat\fR must be \fBunits\fR, \fBpages\fR or
-\fBpixels\fR. If \fIwhat\fR is \fBunits\fR or \fBpages\fR then \fInumber\fR
-must be an integer, otherwise number may be specified in any of the forms
-acceptable to \fBTk_GetPixels\fR, such as
+\fInumber\fR and \fIwhat\fR. \fIWhat\fR must be \fBpages\fR,
+\fBpixels\fR, or \fBunits\fR. If \fIwhat\fR is \fBunits\fR or \fBpages\fR then
+\fInumber\fR must be an integer, otherwise number may be specified in any of
+the forms acceptable to \fBTk_GetPixels\fR, such as
.QW 2.0c
or
.QW 1i
@@ -2157,11 +2159,11 @@ insertion cursor without moving the insertion cursor.
Meta-backspace and Meta-Delete delete the word to the left of the insertion
cursor.
.IP [30]
-Control-x deletes whatever is selected in the text widget after copying it to
-the clipboard.
-.IP [31]
Control-t reverses the order of the two characters to the right of the
insertion cursor.
+.IP [31]
+Control-x deletes whatever is selected in the text widget after copying it to
+the clipboard.
.IP [32]
Control-z undoes the last edit action if the \fB\-undo\fR option is true.
Does nothing otherwise.
diff --git a/doc/tk.n b/doc/tk.n
index 43ce64d..27a2d58 100644
--- a/doc/tk.n
+++ b/doc/tk.n
@@ -12,7 +12,7 @@
.SH NAME
tk \- Manipulate Tk internal state
.SH SYNOPSIS
-\fBtk\fR \fIoption \fR?\fIarg arg ...\fR?
+\fBtk\fR \fIoption \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
@@ -86,6 +86,13 @@ error if tried.
Controls the Tk font selection dialog. For more details see the
\fBfontchooser\fR manual page.
.TP
+\fBtk print \fIwindow\fR
+.
+The \fBtk print\fR command posts a dialog that allows users to print output
+from the \fBcanvas\fR and \fBtext\fR widgets. The printing will be done using
+platform-native APIs and dialogs where available. For more details see the
+\fBprint\fR manual page.
+.TP
\fBtk scaling \fR?\fB\-displayof \fIwindow\fR? ?\fInumber\fR?
.
Sets and queries the current scaling factor used by Tk to convert between
@@ -111,6 +118,18 @@ is undefined whether existing widgets will resize themselves dynamically to
accommodate the new scaling factor.
.RE
.TP
+\fBtk sysnotify \fP \fItitle\fP? \fImessage\fP?
+.
+The \fBtk sysnotify\fP command creates a platform-specific system
+notification alert. Its intent is to provide a brief, unobtrusive
+notification to the user by popping up a window that briefly appears in a
+corner of the screen. For more details see the \fBsysnotify\fR manual page.
+.TP
+\fBtk systray create\fP \fIsubcommand...\fP
+.
+The \fBtk systray\fP command creates an icon in the platform-specific
+tray. For more details see the \fBsystray\fR manual page.
+.TP
\fBtk useinputmethods \fR?\fB\-displayof \fIwindow\fR? ?\fIboolean\fR?
.
Sets and queries the state of whether Tk should use XIM (X Input Methods)
@@ -127,9 +146,9 @@ Returns the current Tk windowing system, one of
\fBx11\fR (X11-based), \fBwin32\fR (MS Windows),
or \fBaqua\fR (Mac OS X Aqua).
.SH "SEE ALSO"
-busy(n), fontchooser(n), send(n), winfo(n)
+busy(n), fontchooser(n), print(n), send(n), sysnotify(n), systray(n), winfo(n)
.SH KEYWORDS
-application name, send
+application name, print, send, sysnotify, systray
'\" Local Variables:
'\" mode: nroff
'\" End:
diff --git a/doc/tk4.0.ps b/doc/tk4.0.ps
index d79642d..5b0b675 100644
--- a/doc/tk4.0.ps
+++ b/doc/tk4.0.ps
@@ -16,7 +16,7 @@
%
% Known Problems:
% Due to bugs in Transcript, the 'PS-Adobe-' is omitted from line 1
-/FMversion (3.0) def
+/FMversion (3.0) def
% Set up Color vs. Black-and-White
/FMPrintInColor { % once-thru loop gimmick
@@ -38,34 +38,34 @@ exit } loop def
% Uncomment the following line to force b&w on color printer
% /FMPrintInColor false def
-/FrameDict 195 dict def
+/FrameDict 195 dict def
systemdict /errordict known not {/errordict 10 dict def
errordict /rangecheck {stop} put} if
% The readline in 23.0 doesn't recognize cr's as nl's on AppleTalk
-FrameDict /tmprangecheck errordict /rangecheck get put
-errordict /rangecheck {FrameDict /bug true put} put
-FrameDict /bug false put
-mark
+FrameDict /tmprangecheck errordict /rangecheck get put
+errordict /rangecheck {FrameDict /bug true put} put
+FrameDict /bug false put
+mark
% Some PS machines read past the CR, so keep the following 3 lines together!
currentfile 5 string readline
00
0000000000
-cleartomark
-errordict /rangecheck FrameDict /tmprangecheck get put
-FrameDict /bug get {
+cleartomark
+errordict /rangecheck FrameDict /tmprangecheck get put
+FrameDict /bug get {
/readline {
/gstring exch def
/gfile exch def
/gindex 0 def
{
- gfile read pop
- dup 10 eq {exit} if
- dup 13 eq {exit} if
- gstring exch gindex exch put
- /gindex gindex 1 add def
+ gfile read pop
+ dup 10 eq {exit} if
+ dup 13 eq {exit} if
+ gstring exch gindex exch put
+ /gindex gindex 1 add def
} loop
- pop
- gstring 0 gindex getinterval true
+ pop
+ gstring 0 gindex getinterval true
} def
} if
/FMVERSION {
@@ -76,12 +76,12 @@ FrameDict /bug get {
dup =
show showpage
} if
- } def
+ } def
/FMLOCAL {
FrameDict begin
- 0 def
- end
- } def
+ 0 def
+ end
+ } def
/gstring FMLOCAL
/gfile FMLOCAL
/gindex FMLOCAL
@@ -94,8 +94,8 @@ FrameDict /bug get {
/manualfeed FMLOCAL
/paperheight FMLOCAL
/paperwidth FMLOCAL
-/FMDOCUMENT {
- array /FMfonts exch def
+/FMDOCUMENT {
+ array /FMfonts exch def
/#copies exch def
FrameDict begin
0 ne dup {setmanualfeed} if
@@ -107,62 +107,62 @@ FrameDict /bug get {
currenttransfer cvlit /orgxfer exch def
currentscreen cvlit /orgproc exch def
/organgle exch def /orgfreq exch def
- setpapername
- manualfeed {true} {papersize} ifelse
- {manualpapersize} {false} ifelse
+ setpapername
+ manualfeed {true} {papersize} ifelse
+ {manualpapersize} {false} ifelse
{desperatepapersize} if
- end
- } def
+ end
+ } def
/pagesave FMLOCAL
/orgmatrix FMLOCAL
/landscape FMLOCAL
-/FMBEGINPAGE {
- FrameDict begin
+/FMBEGINPAGE {
+ FrameDict begin
/pagesave save def
3.86 setmiterlimit
/landscape exch 0 ne def
- landscape {
- 90 rotate 0 exch neg translate pop
+ landscape {
+ 90 rotate 0 exch neg translate pop
}
{pop pop}
ifelse
xscale yscale scale
/orgmatrix matrix def
- gsave
- } def
+ gsave
+ } def
/FMENDPAGE {
- grestore
+ grestore
pagesave restore
- end
+ end
showpage
- } def
-/FMFONTDEFINE {
+ } def
+/FMFONTDEFINE {
FrameDict begin
- findfont
- ReEncode
- 1 index exch
- definefont
- FMfonts 3 1 roll
+ findfont
+ ReEncode
+ 1 index exch
+ definefont
+ FMfonts 3 1 roll
put
- end
- } def
+ end
+ } def
/FMFILLS {
FrameDict begin
array /fillvals exch def
- end
- } def
+ end
+ } def
/FMFILL {
FrameDict begin
fillvals 3 1 roll put
- end
- } def
-/FMNORMALIZEGRAPHICS {
+ end
+ } def
+/FMNORMALIZEGRAPHICS {
newpath
0.0 0.0 moveto
1 setlinewidth
0 setlinecap
0 0 0 sethsbcolor
- 0 setgray
+ 0 setgray
} bind def
/fx FMLOCAL
/fy FMLOCAL
@@ -172,22 +172,22 @@ FrameDict /bug get {
/lly FMLOCAL
/urx FMLOCAL
/ury FMLOCAL
-/FMBEGINEPSF {
- end
- /FMEPSF save def
- /showpage {} def
- FMNORMALIZEGRAPHICS
- [/fy /fx /fh /fw /ury /urx /lly /llx] {exch def} forall
- fx fy translate
+/FMBEGINEPSF {
+ end
+ /FMEPSF save def
+ /showpage {} def
+ FMNORMALIZEGRAPHICS
+ [/fy /fx /fh /fw /ury /urx /lly /llx] {exch def} forall
+ fx fy translate
rotate
- fw urx llx sub div fh ury lly sub div scale
- llx neg lly neg translate
+ fw urx llx sub div fh ury lly sub div scale
+ llx neg lly neg translate
} bind def
/FMENDEPSF {
FMEPSF restore
- FrameDict begin
+ FrameDict begin
} bind def
-FrameDict begin
+FrameDict begin
/setmanualfeed {
%%BeginFeature *ManualFeed True
statusdict /manualfeed true put
@@ -196,16 +196,16 @@ FrameDict begin
/max {2 copy lt {exch} if pop} bind def
/min {2 copy gt {exch} if pop} bind def
/inch {72 mul} def
-/pagedimen {
- paperheight sub abs 16 lt exch
+/pagedimen {
+ paperheight sub abs 16 lt exch
paperwidth sub abs 16 lt and
{/papername exch def} {pop} ifelse
} def
/papersizedict FMLOCAL
-/setpapername {
- /papersizedict 14 dict def
+/setpapername {
+ /papersizedict 14 dict def
papersizedict begin
- /papername /unknown def
+ /papername /unknown def
/Letter 8.5 inch 11.0 inch pagedimen
/LetterSmall 7.68 inch 10.16 inch pagedimen
/Tabloid 11.0 inch 17.0 inch pagedimen
@@ -237,9 +237,9 @@ FrameDict begin
/unknown {unknown} def
papersizedict dup papername known {papername} {/unknown} ifelse get
end
- /FMdicttop countdictstack 1 add def
- statusdict begin stopped end
- countdictstack -1 FMdicttop {pop end} for
+ /FMdicttop countdictstack 1 add def
+ statusdict begin stopped end
+ countdictstack -1 FMdicttop {pop end} for
} def
/manualpapersize {
papersizedict begin
@@ -258,14 +258,14 @@ FrameDict begin
/unknown {unknown} def
papersizedict dup papername known {papername} {/unknown} ifelse get
end
- stopped
+ stopped
} def
/desperatepapersize {
statusdict /setpageparams known
{
- paperwidth paperheight 0 1
+ paperwidth paperheight 0 1
statusdict begin
- {setpageparams} stopped pop
+ {setpageparams} stopped pop
end
} if
} def
@@ -314,18 +314,18 @@ FrameDict begin
/Uacute /Ucircumflex /Ugrave /dotlessi /circumflex /tilde /macron
/breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron
] def
-/ReEncode {
- dup
- length
- dict begin
+/ReEncode {
+ dup
+ length
+ dict begin
{
- 1 index /FID ne
- {def}
- {pop pop} ifelse
- } forall
- 0 eq {/Encoding DiacriticEncoding def} if
- currentdict
- end
+ 1 index /FID ne
+ {def}
+ {pop pop} ifelse
+ } forall
+ 0 eq {/Encoding DiacriticEncoding def} if
+ currentdict
+ end
} bind def
/graymode true def
/bwidth FMLOCAL
@@ -342,7 +342,7 @@ FrameDict begin
/bpside exch def
/bstring exch def
/onbits 0 def /offbits 0 def
- freq sangle landscape {90 add} if
+ freq sangle landscape {90 add} if
{/y exch def
/x exch def
/xindex x 1 add 2 div bpside mul cvi def
@@ -370,14 +370,14 @@ FrameDict begin
/SAT FMLOCAL
/BRIGHT FMLOCAL
/Colors FMLOCAL
-FMPrintInColor
-
+FMPrintInColor
+
{
/HUE 0 def
/SAT 0 def
/BRIGHT 0 def
% array of arrays Hue and Sat values for the separations [HUE BRIGHT]
- /Colors
+ /Colors
[[0 0 ] % black
[0 0 ] % white
[0.00 1.0] % red
@@ -387,44 +387,44 @@ FMPrintInColor
[0.83 1.0] % magenta
[0.16 1.0] % comment / yellow
] def
-
- /BEGINBITMAPCOLOR {
+
+ /BEGINBITMAPCOLOR {
BITMAPCOLOR} def
- /BEGINBITMAPCOLORc {
+ /BEGINBITMAPCOLORc {
BITMAPCOLORc} def
- /BEGINBITMAPTRUECOLOR {
+ /BEGINBITMAPTRUECOLOR {
BITMAPTRUECOLOR } def
- /BEGINBITMAPTRUECOLORc {
+ /BEGINBITMAPTRUECOLORc {
BITMAPTRUECOLORc } def
- /K {
+ /K {
Colors exch get dup
- 0 get /HUE exch store
+ 0 get /HUE exch store
1 get /BRIGHT exch store
HUE 0 eq BRIGHT 0 eq and
{1.0 SAT sub setgray}
- {HUE SAT BRIGHT sethsbcolor}
+ {HUE SAT BRIGHT sethsbcolor}
ifelse
} def
- /FMsetgray {
- /SAT exch 1.0 exch sub store
+ /FMsetgray {
+ /SAT exch 1.0 exch sub store
HUE 0 eq BRIGHT 0 eq and
{1.0 SAT sub setgray}
- {HUE SAT BRIGHT sethsbcolor}
+ {HUE SAT BRIGHT sethsbcolor}
ifelse
} bind def
}
-
+
{
- /BEGINBITMAPCOLOR {
+ /BEGINBITMAPCOLOR {
BITMAPGRAY} def
- /BEGINBITMAPCOLORc {
+ /BEGINBITMAPCOLORc {
BITMAPGRAYc} def
- /BEGINBITMAPTRUECOLOR {
+ /BEGINBITMAPTRUECOLOR {
BITMAPTRUEGRAY } def
- /BEGINBITMAPTRUECOLORc {
+ /BEGINBITMAPTRUECOLORc {
BITMAPTRUEGRAYc } def
/FMsetgray {setgray} bind def
- /K {
+ /K {
pop
} def
}
@@ -435,27 +435,27 @@ ifelse
/dnormalize {
dtransform round exch round exch idtransform
} bind def
-/lnormalize {
+/lnormalize {
0 dtransform exch cvi 2 idiv 2 mul 1 add exch idtransform pop
} bind def
-/H {
+/H {
lnormalize setlinewidth
} bind def
/Z {
setlinecap
} bind def
/fillvals FMLOCAL
-/X {
+/X {
fillvals exch get
dup type /stringtype eq
- {8 1 setpattern}
+ {8 1 setpattern}
{grayness}
ifelse
} bind def
-/V {
+/V {
gsave eofill grestore
} bind def
-/N {
+/N {
stroke
} bind def
/M {newpath moveto} bind def
@@ -463,15 +463,15 @@ ifelse
/D {curveto} bind def
/O {closepath} bind def
/n FMLOCAL
-/L {
+/L {
/n exch def
newpath
normalize
- moveto
+ moveto
2 1 n {pop normalize lineto} for
} bind def
-/Y {
- L
+/Y {
+ L
closepath
} bind def
/x1 FMLOCAL
@@ -479,7 +479,7 @@ ifelse
/y1 FMLOCAL
/y2 FMLOCAL
/rad FMLOCAL
-/R {
+/R {
/y2 exch def
/x2 exch def
/y1 exch def
@@ -488,9 +488,9 @@ ifelse
x2 y1
x2 y2
x1 y2
- 4 Y
+ 4 Y
} bind def
-/RR {
+/RR {
/rad exch def
normalize
/y2 exch def
@@ -507,87 +507,87 @@ ifelse
closepath
16 {pop} repeat
} bind def
-/C {
+/C {
grestore
gsave
- R
+ R
clip
} bind def
/FMpointsize FMLOCAL
-/F {
+/F {
FMfonts exch get
FMpointsize scalefont
setfont
} bind def
-/Q {
+/Q {
/FMpointsize exch def
- F
+ F
} bind def
-/T {
+/T {
moveto show
} bind def
-/RF {
+/RF {
rotate
0 ne {-1 1 scale} if
} bind def
-/TF {
+/TF {
gsave
- moveto
+ moveto
RF
show
grestore
} bind def
-/P {
+/P {
moveto
0 32 3 2 roll widthshow
} bind def
-/PF {
+/PF {
gsave
- moveto
+ moveto
RF
0 32 3 2 roll widthshow
grestore
} bind def
-/S {
+/S {
moveto
0 exch ashow
} bind def
-/SF {
+/SF {
gsave
moveto
RF
0 exch ashow
grestore
} bind def
-/B {
+/B {
moveto
0 32 4 2 roll 0 exch awidthshow
} bind def
-/BF {
+/BF {
gsave
moveto
RF
0 32 4 2 roll 0 exch awidthshow
grestore
} bind def
-/G {
+/G {
gsave
newpath
- normalize translate 0.0 0.0 moveto
- dnormalize scale
- 0.0 0.0 1.0 5 3 roll arc
+ normalize translate 0.0 0.0 moveto
+ dnormalize scale
+ 0.0 0.0 1.0 5 3 roll arc
closepath fill
grestore
} bind def
-/A {
+/A {
gsave
savematrix
newpath
- 2 index 2 div add exch 3 index 2 div sub exch
- normalize 2 index 2 div sub exch 3 index 2 div add exch
- translate
- scale
- 0.0 0.0 1.0 5 3 roll arc
+ 2 index 2 div add exch 3 index 2 div sub exch
+ normalize 2 index 2 div sub exch 3 index 2 div add exch
+ translate
+ scale
+ 0.0 0.0 1.0 5 3 roll arc
restorematrix
stroke
grestore
@@ -603,37 +603,37 @@ ifelse
/FMsaveobject FMLOCAL
/FMoptop FMLOCAL
/FMdicttop FMLOCAL
-/BEGINPRINTCODE {
- /FMdicttop countdictstack 1 add def
- /FMoptop count 4 sub def
+/BEGINPRINTCODE {
+ /FMdicttop countdictstack 1 add def
+ /FMoptop count 4 sub def
/FMsaveobject save def
- userdict begin
- /showpage {} def
- FMNORMALIZEGRAPHICS
+ userdict begin
+ /showpage {} def
+ FMNORMALIZEGRAPHICS
3 index neg 3 index neg translate
} bind def
/ENDPRINTCODE {
- count -1 FMoptop {pop pop} for
- countdictstack -1 FMdicttop {pop end} for
- FMsaveobject restore
+ count -1 FMoptop {pop pop} for
+ countdictstack -1 FMdicttop {pop end} for
+ FMsaveobject restore
} bind def
-/gn {
- 0
- { 46 mul
- cf read pop
- 32 sub
- dup 46 lt {exit} if
- 46 sub add
+/gn {
+ 0
+ { 46 mul
+ cf read pop
+ 32 sub
+ dup 46 lt {exit} if
+ 46 sub add
} loop
- add
+ add
} bind def
/str FMLOCAL
-/cfs {
- /str sl string def
- 0 1 sl 1 sub {str exch val put} for
- str def
+/cfs {
+ /str sl string def
+ 0 1 sl 1 sub {str exch val put} for
+ str def
} bind def
-/ic [
+/ic [
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223
0
@@ -655,49 +655,49 @@ ifelse
/cs FMLOCAL
/len FMLOCAL
/pos FMLOCAL
-/ms {
- /sl exch def
- /val 255 def
- /ws cfs
- /im cfs
- /val 0 def
- /bs cfs
- /cs cfs
+/ms {
+ /sl exch def
+ /val 255 def
+ /ws cfs
+ /im cfs
+ /val 0 def
+ /bs cfs
+ /cs cfs
} bind def
-400 ms
-/ip {
- is
- 0
- cf cs readline pop
- { ic exch get exec
- add
- } forall
- pop
-
+400 ms
+/ip {
+ is
+ 0
+ cf cs readline pop
+ { ic exch get exec
+ add
+ } forall
+ pop
+
} bind def
-/wh {
- /len exch def
- /pos exch def
+/wh {
+ /len exch def
+ /pos exch def
ws 0 len getinterval im pos len getinterval copy pop
- pos len
+ pos len
} bind def
-/bl {
- /len exch def
- /pos exch def
+/bl {
+ /len exch def
+ /pos exch def
bs 0 len getinterval im pos len getinterval copy pop
- pos len
+ pos len
} bind def
/s1 1 string def
-/fl {
- /len exch def
- /pos exch def
+/fl {
+ /len exch def
+ /pos exch def
/val cf s1 readhexstring pop 0 get def
pos 1 pos len add 1 sub {im exch val put} for
- pos len
+ pos len
} bind def
-/hx {
- 3 copy getinterval
- cf exch readhexstring pop pop
+/hx {
+ 3 copy getinterval
+ cf exch readhexstring pop pop
} bind def
/h FMLOCAL
/w FMLOCAL
@@ -706,57 +706,57 @@ ifelse
/bitmapsave FMLOCAL
/is FMLOCAL
/cf FMLOCAL
-/wbytes {
- dup
+/wbytes {
+ dup
8 eq {pop} {1 eq {7 add 8 idiv} {3 add 4 idiv} ifelse} ifelse
} bind def
-/BEGINBITMAPBWc {
+/BEGINBITMAPBWc {
1 {} COMMONBITMAPc
} bind def
-/BEGINBITMAPGRAYc {
+/BEGINBITMAPGRAYc {
8 {} COMMONBITMAPc
} bind def
-/BEGINBITMAP2BITc {
+/BEGINBITMAP2BITc {
2 {} COMMONBITMAPc
} bind def
-/COMMONBITMAPc {
+/COMMONBITMAPc {
/r exch def
/d exch def
gsave
translate rotate scale /h exch def /w exch def
- /lb w d wbytes def
- sl lb lt {lb ms} if
- /bitmapsave save def
- r
- /is im 0 lb getinterval def
- ws 0 lb getinterval is copy pop
- /cf currentfile def
- w h d [w 0 0 h neg 0 h]
- {ip} image
- bitmapsave restore
+ /lb w d wbytes def
+ sl lb lt {lb ms} if
+ /bitmapsave save def
+ r
+ /is im 0 lb getinterval def
+ ws 0 lb getinterval is copy pop
+ /cf currentfile def
+ w h d [w 0 0 h neg 0 h]
+ {ip} image
+ bitmapsave restore
grestore
} bind def
-/BEGINBITMAPBW {
+/BEGINBITMAPBW {
1 {} COMMONBITMAP
} bind def
-/BEGINBITMAPGRAY {
+/BEGINBITMAPGRAY {
8 {} COMMONBITMAP
} bind def
-/BEGINBITMAP2BIT {
+/BEGINBITMAP2BIT {
2 {} COMMONBITMAP
} bind def
-/COMMONBITMAP {
+/COMMONBITMAP {
/r exch def
/d exch def
gsave
translate rotate scale /h exch def /w exch def
- /bitmapsave save def
- r
+ /bitmapsave save def
+ r
/is w d wbytes string def
- /cf currentfile def
- w h d [w 0 0 h neg 0 h]
+ /cf currentfile def
+ w h d [w 0 0 h neg 0 h]
{cf is readhexstring pop} image
- bitmapsave restore
+ bitmapsave restore
grestore
} bind def
/proc1 FMLOCAL
@@ -813,7 +813,7 @@ ifelse
/tran FMLOCAL
/fakecolorsetup {
/tran 256 string def
- 0 1 255 {/indx exch def
+ 0 1 255 {/indx exch def
tran indx
red indx get 77 mul
green indx get 151 mul
@@ -823,77 +823,77 @@ ifelse
{255 mul cvi tran exch get 255.0 div}
exch Fmcc settransfer
} bind def
-/BITMAPCOLOR {
+/BITMAPCOLOR {
/d 8 def
gsave
translate rotate scale /h exch def /w exch def
- /bitmapsave save def
+ /bitmapsave save def
colorsetup
/is w d wbytes string def
- /cf currentfile def
- w h d [w 0 0 h neg 0 h]
- {cf is readhexstring pop} {is} {is} true 3 colorimage
- bitmapsave restore
+ /cf currentfile def
+ w h d [w 0 0 h neg 0 h]
+ {cf is readhexstring pop} {is} {is} true 3 colorimage
+ bitmapsave restore
grestore
} bind def
-/BITMAPCOLORc {
+/BITMAPCOLORc {
/d 8 def
gsave
translate rotate scale /h exch def /w exch def
- /lb w d wbytes def
- sl lb lt {lb ms} if
- /bitmapsave save def
+ /lb w d wbytes def
+ sl lb lt {lb ms} if
+ /bitmapsave save def
colorsetup
- /is im 0 lb getinterval def
- ws 0 lb getinterval is copy pop
- /cf currentfile def
- w h d [w 0 0 h neg 0 h]
+ /is im 0 lb getinterval def
+ ws 0 lb getinterval is copy pop
+ /cf currentfile def
+ w h d [w 0 0 h neg 0 h]
{ip} {is} {is} true 3 colorimage
- bitmapsave restore
+ bitmapsave restore
grestore
} bind def
-/BITMAPTRUECOLORc {
+/BITMAPTRUECOLORc {
gsave
translate rotate scale /h exch def /w exch def
- /bitmapsave save def
-
+ /bitmapsave save def
+
/is w string def
-
- ws 0 w getinterval is copy pop
- /cf currentfile def
- w h 8 [w 0 0 h neg 0 h]
+
+ ws 0 w getinterval is copy pop
+ /cf currentfile def
+ w h 8 [w 0 0 h neg 0 h]
{ip} {gip} {bip} true 3 colorimage
- bitmapsave restore
+ bitmapsave restore
grestore
} bind def
-/BITMAPTRUECOLOR {
+/BITMAPTRUECOLOR {
gsave
translate rotate scale /h exch def /w exch def
- /bitmapsave save def
+ /bitmapsave save def
/is w string def
/gis w string def
/bis w string def
- /cf currentfile def
- w h 8 [w 0 0 h neg 0 h]
- { cf is readhexstring pop }
- { cf gis readhexstring pop }
- { cf bis readhexstring pop }
- true 3 colorimage
- bitmapsave restore
+ /cf currentfile def
+ w h 8 [w 0 0 h neg 0 h]
+ { cf is readhexstring pop }
+ { cf gis readhexstring pop }
+ { cf bis readhexstring pop }
+ true 3 colorimage
+ bitmapsave restore
grestore
} bind def
-/BITMAPTRUEGRAYc {
+/BITMAPTRUEGRAYc {
gsave
translate rotate scale /h exch def /w exch def
- /bitmapsave save def
-
+ /bitmapsave save def
+
/is w string def
-
- ws 0 w getinterval is copy pop
- /cf currentfile def
- w h 8 [w 0 0 h neg 0 h]
+
+ ws 0 w getinterval is copy pop
+ /cf currentfile def
+ w h 8 [w 0 0 h neg 0 h]
{ip gip bip w gray} image
- bitmapsave restore
+ bitmapsave restore
grestore
} bind def
/ww FMLOCAL
@@ -901,7 +901,7 @@ ifelse
/g FMLOCAL
/b FMLOCAL
/i FMLOCAL
-/gray {
+/gray {
/ww exch def
/b exch def
/g exch def
@@ -910,30 +910,30 @@ ifelse
b i get .114 mul add add r i 3 -1 roll floor cvi put } for
r
} bind def
-/BITMAPTRUEGRAY {
+/BITMAPTRUEGRAY {
gsave
translate rotate scale /h exch def /w exch def
- /bitmapsave save def
+ /bitmapsave save def
/is w string def
/gis w string def
/bis w string def
- /cf currentfile def
- w h 8 [w 0 0 h neg 0 h]
- { cf is readhexstring pop
- cf gis readhexstring pop
+ /cf currentfile def
+ w h 8 [w 0 0 h neg 0 h]
+ { cf is readhexstring pop
+ cf gis readhexstring pop
cf bis readhexstring pop w gray} image
- bitmapsave restore
+ bitmapsave restore
grestore
} bind def
-/BITMAPGRAY {
+/BITMAPGRAY {
8 {fakecolorsetup} COMMONBITMAP
} bind def
-/BITMAPGRAYc {
+/BITMAPGRAYc {
8 {fakecolorsetup} COMMONBITMAPc
} bind def
/ENDBITMAP {
} bind def
-end
+end
/ALDsave FMLOCAL
/ALDmatrix matrix def ALDmatrix currentmatrix pop
/StartALD {
@@ -1384,7 +1384,7 @@ V
3 F
( takes precedence over a binding on) 270.54 567.89 T
5 F
-(<KeyPress>.) 416.24 567.89 T
+(<Key>.) 416.24 567.89 T
3 F
-0.26 (The mechanism for con\337ict resolution is similar in Tk 4.0 except that one binding can) 170.1 555.89 P
-0.35 (trigger for) 152.1 543.78 P
@@ -1578,7 +1578,7 @@ V
(tion of them. If you wish for a binding not to trigger when a modi\336er is present, you can) 152.1 596.33 T
(just de\336ne an empty binding for that modi\336er combination. For example,) 152.1 584.33 T
5 9 Q
-(bind .b <Control-ButtonPress-1> {# this script is a no-op}) 179.1 570 T
+(bind .b <Control-Button-1> {# this script is a no-op}) 179.1 570 T
3 10 Q
(creates a binding that will trigger on mouse button presses when the) 152.1 556.33 T
5 F
@@ -1587,7 +1587,7 @@ V
( key is) 468.34 556.33 T
-0.22 (down. If there is also a) 152.1 544.33 P
5 F
--0.52 (<ButtonPress-1>) 244.35 544.33 P
+-0.52 (<Button-1>) 244.35 544.33 P
3 F
-0.22 ( binding for) 334.3 544.33 P
5 F
diff --git a/doc/tkvars.n b/doc/tkvars.n
index 5ffa40a..f4db5cb 100644
--- a/doc/tkvars.n
+++ b/doc/tkvars.n
@@ -50,7 +50,7 @@ it uniquely identifies an official version of Tk.
.RS
.PP
This value is normally the same as the result of
-.QW "\fBpackage require\fR \fBTk\fR" .
+.QW "\fBpackage require\fR \fBtk\fR" .
.RE
.TP
\fBtk_strictMotif\fR
diff --git a/doc/toplevel.n b/doc/toplevel.n
index 95fab5b..e946248 100644
--- a/doc/toplevel.n
+++ b/doc/toplevel.n
@@ -25,6 +25,17 @@ except that its value may also be specified as an empty string.
In this case, the widget will display no background or border, and
no colors will be consumed from its colormap for its background
and border.
+.VS "8.7, TIP262"
+An empty background will disable drawing the background image.
+.OP \-backgroundimage backgroundImage BackgroundImage
+This specifies an image to display on the toplevel's background within
+the border of the toplevel (i.e., the image will be clipped by the
+toplevel's highlight ring and border, if either are present) on top of
+the background;
+subwidgets of the toplevel will be drawn on top. The image must have
+been created with the \fBimage create\fR command. If specified as the
+empty string, no image will be displayed.
+.VE "8.7, TIP262"
.OP \-class class Class
Specifies a class for the window.
This class will be used when querying the option database for
@@ -73,6 +84,15 @@ Defaults to the same screen as its parent.
This option is special in that it may not be specified via the option
database, and it may not be modified with the \fBconfigure\fR
widget command.
+.OP \-tile tile Tile
+.VS "8.7, TIP262"
+This specifies how to draw the background image (see
+\fB\-backgroundimage\fR) on the toplevel.
+If true (according to \fBTcl_GetBoolean\fR), the image will be tiled
+to fill the whole toplevel, with the origin of the first copy of the
+image being the top left of the interior of the toplevel.
+If false (the default), the image will be centered within the toplevel.
+.VE "8.7, TIP262"
.OP \-use use Use
This option is used for embedding. If the value is not an empty string,
it must be the window identifier of a container window, specified as
@@ -111,7 +131,7 @@ top-level window: its X parent is the root window of a screen
rather than the logical parent from its Tk path name. The primary
purpose of a toplevel is to serve as a container for dialog boxes
and other collections of widgets. The only visible features
-of a toplevel are its background color and an optional 3-D border
+of a toplevel are its background and an optional 3-D border
to make the toplevel appear raised or sunken.
.SH "WIDGET COMMAND"
.PP
@@ -121,7 +141,7 @@ command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
diff --git a/doc/ttk_button.n b/doc/ttk_button.n
index cf42e28..7afd052 100644
--- a/doc/ttk_button.n
+++ b/doc/ttk_button.n
@@ -17,7 +17,7 @@ A \fBttk::button\fR widget displays a textual label and/or image,
and evaluates a command when pressed.
.SO ttk_widget
\-class \-compound \-cursor
-\-image \-state \-style
+\-image \-justify \-state \-style
\-takefocus \-text \-textvariable
\-underline \-width
.SE
@@ -48,8 +48,10 @@ with an extra highlight ring, or with a different border color.
.SH "WIDGET COMMAND"
.PP
In addition to the standard
-\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
-commands, buttons support the following additional widget commands:
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+commands (see \fBttk::widget\fR),
+button widgets support the following additional commands:
.TP
\fIpathName \fBinvoke\fR
Invokes the command associated with the button.
diff --git a/doc/ttk_checkbutton.n b/doc/ttk_checkbutton.n
index c78dc0e..d78b7fc 100644
--- a/doc/ttk_checkbutton.n
+++ b/doc/ttk_checkbutton.n
@@ -37,9 +37,10 @@ Defaults to the widget pathname if not specified.
.SH "WIDGET COMMAND"
.PP
In addition to the standard
-\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
-commands, checkbuttons support the following additional
-widget commands:
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+commands (see \fBttk::widget\fR),
+checkbutton widgets support the following additional commands:
.TP
\fIpathname\fB invoke\fR
Toggles between the selected and deselected states
diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n
index 37b91aa..b6eddd8 100644
--- a/doc/ttk_combobox.n
+++ b/doc/ttk_combobox.n
@@ -19,7 +19,7 @@ the user may select the value of the text field from among the
values in the list.
.SO ttk_widget
\-class \-cursor \-takefocus
-\-style
+\-style \-placeholder \-placeholderforeground
.SE
.\" ALSO: Other entry widget options
.SH "WIDGET-SPECIFIC OPTIONS"
@@ -55,15 +55,11 @@ Specifies an integer value indicating the desired width of the entry window,
in average-size characters of the widget's font.
.SH "WIDGET COMMAND"
.PP
-The following subcommands are possible for combobox widgets:
-'\".TP
-'\"\fIpathName \fBcget\fR \fIoption\fR
-'\"Returns the current value of the specified \fIoption\fR.
-'\"See \fIttk::widget(n)\fR.
-'\".TP
-'\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
-'\"Modify or query widget options.
-'\"See \fIttk::widget(n)\fR.
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+commands (see \fBttk::widget\fR),
+combobox widgets support the following additional commands:
.TP
\fIpathName \fBcurrent\fR ?\fInewIndex\fR?
If \fInewIndex\fR is supplied, sets the combobox value
@@ -75,37 +71,18 @@ Otherwise, returns the index of the current value in the list of
.TP
\fIpathName \fBget\fR
Returns the current value of the combobox.
-'\".TP
-'\"\fIpathName \fBidentify \fIx y\fR
-'\"Returns the name of the element at position \fIx\fR, \fIy\fR.
-'\"See \fIttk::widget(n)\fR.
-'\".TP
-'\"\fIpathName \fBinstate \fIstateSpec\fR ?\fIscript\fR?
-'\"Test the widget state.
-'\"See \fIttk::widget(n)\fR.
.TP
\fIpathName \fBset\fR \fIvalue\fR
Sets the value of the combobox to \fIvalue\fR.
-'\".TP
-'\"\fIpathName \fBstate\fR ?\fIstateSpec\fR?
-'\"Modify or query the widget state.
-'\"See \fIttk::widget(n)\fR.
.PP
The combobox widget also supports the following \fBttk::entry\fR
-widget subcommands (see \fIttk::entry(n)\fR for details):
+widget commands:
.DS
.ta 5.5c 11c
\fBbbox\fR \fBdelete\fR \fBicursor\fR
\fBindex\fR \fBinsert\fR \fBselection\fR
\fBxview\fR
.DE
-The combobox widget also supports the following generic \fBttk::widget\fR
-widget subcommands (see \fIttk::widget(n)\fR for details):
-.DS
-.ta 5.5c 11c
-\fBcget\fR \fBconfigure\fR \fBidentify\fR
-\fBinstate\fR \fBstate\fR
-.DE
.SH "VIRTUAL EVENTS"
.PP
The combobox widget generates a \fB<<ComboboxSelected>>\fR virtual event
@@ -150,6 +127,8 @@ Can only be changed when using non-native and non-graphical themes.
.br
\fB\-padding\fP \fIpadding\fP
.br
+\fB\-placeholderforeground\fP \fIcolor\fP
+.br
\fB\-postoffset\fP \fIpadding\fP
.br
\fB\-selectbackground\fP \fIcolor\fP
diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n
index da183f7..816c08b 100644
--- a/doc/ttk_entry.n
+++ b/doc/ttk_entry.n
@@ -26,7 +26,7 @@ standard \fB\-xscrollcommand\fR option and \fBxview\fR widget command.
\-class \-cursor
\-font \-foreground
\-style
-\-takefocus \-xscrollcommand
+\-takefocus \-xscrollcommand \-placeholder \-placeholderforeground
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-exportselection exportSelection ExportSelection
@@ -139,7 +139,11 @@ In general, out-of-range indices are automatically rounded to the
nearest legal value.
.SH "WIDGET COMMAND"
.PP
-The following subcommands are possible for entry widgets:
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR, \fBstyle\fR and \fBxview\fR
+commands (see \fBttk::widget\fR),
+entry widgets support the following additional commands:
.TP
\fIpathName \fBbbox \fIindex\fR
Returns a list of four numbers describing the bounding box of the
@@ -150,14 +154,6 @@ the upper-left corner of the screen area covered by the character
the width and height of the character, in pixels.
The bounding box may refer to a region outside the visible area
of the window.
-'\".TP
-'\"\fIpathName \fBcget\fR \fIoption\fR
-'\"Returns the current value of the specified \fIoption\fR.
-'\"See \fIttk::widget(n)\fR.
-'\".TP
-'\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
-'\"Modify or query widget options.
-'\"See \fIttk::widget(n)\fR.
.TP
\fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
Delete one or more elements of the entry.
@@ -174,10 +170,6 @@ Returns the entry's string.
\fIpathName \fBicursor \fIindex\fR
Arrange for the insert cursor to be displayed just before the character
given by \fIindex\fR. Returns the empty string.
-'\".TP
-'\"\fIpathName \fBidentify \fIx y\fR
-'\"Returns the name of the element at position \fIx\fR, \fIy\fR,
-'\"or the empty string if the coordinates are outside the window.
.TP
\fIpathName \fBindex\fI index\fR
Returns the numerical index corresponding to \fIindex\fR.
@@ -185,10 +177,6 @@ Returns the numerical index corresponding to \fIindex\fR.
\fIpathName \fBinsert \fIindex string\fR
Insert \fIstring\fR just before the character
indicated by \fIindex\fR. Returns the empty string.
-'\".TP
-'\"\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
-'\"Test the widget state.
-'\"See \fIttk::widget(n)\fR.
.TP
\fIpathName \fBselection \fIoption arg\fR
This command is used to adjust the selection within an entry. It
@@ -211,10 +199,6 @@ before \fIend\fR.
If \fIend\fR refers to the same character as \fIstart\fR or an
earlier one, then the entry's selection is cleared.
.RE
-'\".TP
-'\"\fIpathName \fBstate\fR ?\fIstateSpec\fR?
-'\"Modify or query the widget state.
-'\"See \fIttk::widget(n)\fR.
.TP
\fIpathName \fBvalidate\fR
Force revalidation, independent of the conditions specified
@@ -222,14 +206,6 @@ by the \fB\-validate\fR option.
Returns 0 if validation fails, 1 if it succeeds.
Sets or clears the \fBinvalid\fR state accordingly.
See \fBVALIDATION\fR below for more details.
-.PP
-The entry widget also supports the following generic \fBttk::widget\fR
-widget subcommands (see \fIttk::widget(n)\fR for details):
-.DS
-.ta 5.5c 11c
-\fBcget\fR \fBconfigure\fR \fBidentify\fR
-\fBinstate\fR \fBstate\fR \fBxview\fR
-.DE
.SH VALIDATION
.PP
The \fB\-validate\fR, \fB\-validatecommand\fR, and \fB\-invalidcommand\fR
@@ -456,6 +432,8 @@ Some themes use a graphical background and their field background colors cannot
.br
\fB\-padding\fP \fIpadding\fP
.br
+\fB\-placeholderforeground\fP \fIcolor\fP
+.br
\fB\-relief\fP \fIrelief\fP
.br
\fB\-selectbackground\fP \fIcolor\fP
diff --git a/doc/ttk_frame.n b/doc/ttk_frame.n
index b02035e..413bb09 100644
--- a/doc/ttk_frame.n
+++ b/doc/ttk_frame.n
@@ -35,9 +35,10 @@ If specified, the widget's requested width in pixels.
If specified, the widget's requested height in pixels.
.SH "WIDGET COMMAND"
.PP
-Supports the standard widget commands
-\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR;
-see \fIttk::widget(n)\fR.
+Frame widgets support the standard commands
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+(see \fBttk::widget\fR).
.SH "NOTES"
.PP
Note that if the \fBpack\fR, \fBgrid\fR, or other geometry managers
diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n
index f93cbe3..c146dd1 100644
--- a/doc/ttk_intro.n
+++ b/doc/ttk_intro.n
@@ -121,7 +121,7 @@ widget are:
.CS
bind TButton <Enter> { %W state active }
bind TButton <Leave> { %W state !active }
-bind TButton <ButtonPress-1> { %W state pressed }
+bind TButton <Button-1> { %W state pressed }
bind TButton <Button1-Leave> { %W state !pressed }
bind TButton <Button1-Enter> { %W state pressed }
bind TButton <ButtonRelease-1> \e
diff --git a/doc/ttk_label.n b/doc/ttk_label.n
index 871fab7..54c0f47 100644
--- a/doc/ttk_label.n
+++ b/doc/ttk_label.n
@@ -18,31 +18,16 @@ A \fBttk::label\fR widget displays a textual label and/or image.
The label may be linked to a Tcl variable
to automatically change the displayed text.
.SO ttk_widget
-\-class \-compound \-cursor
-\-image \-padding \-state \-style \-takefocus
+\-anchor \-class \-compound \-cursor
+\-font \-foreground
+\-image \-justify \-padding \-state \-style \-takefocus
\-text \-textvariable \-underline
-\-width
+\-width \-wraplength
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
-.OP \-anchor anchor Anchor
-Specifies how the information in the widget is positioned
-relative to the inner margins. Legal values are
-\fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR,
-\fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, and \fBcenter\fR.
-See also \fB\-justify\fR.
.OP \-background frameColor FrameColor
The widget's background color.
If unspecified, the theme default is used.
-.OP \-font font Font
-Font to use for label text.
-.OP \-foreground textColor TextColor
-The widget's foreground color.
-If unspecified, the theme default is used.
-.OP \-justify justify Justify
-If there are multiple lines of text, specifies how
-the lines are laid out relative to one another.
-One of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
-See also \fB\-anchor\fR.
.OP \-relief relief Relief
.\" Rewrite this:
Specifies the 3-D effect desired for the widget border.
@@ -57,9 +42,10 @@ the text is split into lines such that no line is longer
than the specified value.
.SH "WIDGET COMMAND"
.PP
-Supports the standard widget commands
-\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR;
-see \fIttk::widget(n)\fR.
+Label widgets support the standard commands
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+(see \fBttk::widget\fR).
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::label\fP is \fBTLabel\fP.
diff --git a/doc/ttk_labelframe.n b/doc/ttk_labelframe.n
index 9e42781..593d96c 100644
--- a/doc/ttk_labelframe.n
+++ b/doc/ttk_labelframe.n
@@ -62,9 +62,10 @@ sets the keyboard focus to the first child of the \fBttk::labelframe\fR widget.
If specified, the widget's requested width in pixels.
.SH "WIDGET COMMAND"
.PP
-Supports the standard widget commands
-\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR;
-see \fIttk::widget(n)\fR.
+Labelframe widgets support the standard commands
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+(see \fBttk::widget\fR).
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::labelframe\fP is \fBTLabelframe\fP.
diff --git a/doc/ttk_menubutton.n b/doc/ttk_menubutton.n
index 0d80c1e..b9b716f 100644
--- a/doc/ttk_menubutton.n
+++ b/doc/ttk_menubutton.n
@@ -38,9 +38,10 @@ menubutton.
.\" .OP \-padding padding Pad
.SH "WIDGET COMMAND"
.PP
-Menubutton widgets support the standard
-\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
-methods. No other widget methods are used.
+Menubutton widgets support the standard commands
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+(see \fBttk::widget\fR).
.SH "STANDARD STYLES"
.PP
\fBTtk::menubutton\fR widgets support the \fBToolbutton\fR style in all
diff --git a/doc/ttk_notebook.n b/doc/ttk_notebook.n
index efbfe6c..bc6c95a 100644
--- a/doc/ttk_notebook.n
+++ b/doc/ttk_notebook.n
@@ -102,6 +102,12 @@ which returns the number of tabs
(only valid for
.QW "\fIpathname \fBindex\fR" ).
.SH "WIDGET COMMAND"
+.PP
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+commands (see \fBttk::widget\fR),
+notebook widgets support the following additional commands:
.TP
\fIpathname \fBadd \fIwindow\fR ?\fIoptions...\fR?
Adds a new tab to the notebook.
@@ -109,12 +115,6 @@ See \fBTAB OPTIONS\fR for the list of available \fIoptions\fR.
If \fIwindow\fR is currently managed by the notebook but hidden,
it is restored to its previous position.
.TP
-\fIpathname \fBconfigure\fR ?\fIoptions\fR?
-See \fIttk::widget(n)\fR.
-.TP
-\fIpathname \fBcget \fIoption\fR
-See \fIttk::widget(n)\fR.
-.TP
\fIpathname \fBforget \fItabid\fR
Removes the tab specified by \fItabid\fR,
unmaps and unmanages the associated window.
@@ -151,9 +151,6 @@ If \fIsubwindow\fR is already managed by the notebook,
moves it to the specified position.
See \fBTAB OPTIONS\fR for the list of available options.
.TP
-\fIpathname \fBinstate \fIstatespec \fR?\fIscript...\fR?
-See \fIttk::widget(n)\fR.
-.TP
\fIpathname \fBselect\fR ?\fItabid\fR?
Selects the specified tab.
The associated content window will be displayed,
@@ -161,9 +158,6 @@ and the previously-selected window (if different) is unmapped.
If \fItabid\fR is omitted, returns the widget name of the
currently selected pane.
.TP
-\fIpathname \fBstate\fR ?\fIstatespec\fR?
-See \fIttk::widget(n)\fR.
-.TP
\fIpathname \fBtab \fItabid\fR ?\fI\-option \fR?\fIvalue ...\fR
Query or modify the options of the specific tab.
If no \fI\-option\fR is specified,
diff --git a/doc/ttk_panedwindow.n b/doc/ttk_panedwindow.n
index d6b3ea3..beab063 100644
--- a/doc/ttk_panedwindow.n
+++ b/doc/ttk_panedwindow.n
@@ -48,9 +48,12 @@ An integer specifying the relative stretchability of the pane.
When the paned window is resized, the extra space is added
or subtracted to each pane proportionally to its \fB\-weight\fR.
.SH "WIDGET COMMAND"
-Supports the standard \fBconfigure\fR, \fBcget\fR, \fBstate\fR,
-and \fBinstate\fR commands; see \fIttk::widget(n)\fR for details.
-Additional commands:
+.PP
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+commands (see \fBttk::widget\fR),
+panedwindow widgets support the following additional commands:
.TP
\fIpathname \fBadd \fIsubwindow options...\fR
Adds a new pane to the window.
@@ -106,14 +109,6 @@ and the total size of the widget.
.\" depending on which changed most recently.
Returns the new position of sash number \fIindex\fR.
.\" Full story: new position may be different than the requested position.
-.PP
-The panedwindow widget also supports the following generic \fBttk::widget\fR
-widget subcommands (see \fIttk::widget(n)\fR for details):
-.DS
-.ta 5.5c 11c
-\fBcget\fR \fBconfigure\fR
-\fBinstate\fR \fBstate\fR
-.DE
.SH "VIRTUAL EVENTS"
.PP
The panedwindow widget generates an \fB<<EnteredChild>>\fR virtual event on
diff --git a/doc/ttk_progressbar.n b/doc/ttk_progressbar.n
index 5d6316a..0673ca6 100644
--- a/doc/ttk_progressbar.n
+++ b/doc/ttk_progressbar.n
@@ -19,14 +19,22 @@ operation. They can operate in two modes: \fIdeterminate\fR mode shows the
amount completed relative to the total amount of work to be done, and
\fIindeterminate\fR mode provides an animated display to let the user know
that something is happening.
+.PP
+If the value of \fB-orient\fR is \fBhorizontal\fR a text string can be
+displayed inside the progressbar. This string can be configured using
+the \fB-anchor\fR, \fB-font\fR, \fB-foreground\fR, \fB-justify\fR,
+\fB-text\fR and \fB-wraplength\fR options. If the value of \fB-orient\fR
+is \fBvertical\fR then these options are ignored.
.SO ttk_widget
-\-class \-cursor \-takefocus
-\-style
+\-anchor \-class \-cursor
+\-font \-foreground \-justify \-style
+\-takefocus \-text \-wraplength
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-length length Length
Specifies the length of the long axis of the progress bar
-(width if horizontal, height if vertical).
+(width if horizontal, height if vertical). The value may have any of the forms
+acceptable to \fBTk_GetPixels\fR.
.OP \-maximum maximum Maximum
A floating point number specifying the maximum \fB\-value\fR.
Defaults to 100.
@@ -58,19 +66,11 @@ automatically set to the value of the variable whenever
the latter is modified.
.SH "WIDGET COMMAND"
.PP
-.TP
-\fIpathName \fBcget \fIoption\fR
-Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR.
-.TP
-\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
-Modify or query widget options; see \fIttk::widget(n)\fR.
-.TP
-\fIpathName \fBidentify \fIx y\fR
-Returns the name of the element at position \fIx\fR, \fIy\fR.
-See \fIttk::widget(n)\fR.
-.TP
-\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
-Test the widget state; see \fIttk::widget(n)\fR.
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+commands (see \fBttk::widget\fR),
+progressbar widgets support the following additional commands:
.TP
\fIpathName \fBstart\fR ?\fIinterval\fR?
Begin autoincrement mode:
@@ -78,9 +78,6 @@ schedules a recurring timer event that calls \fBstep\fR
every \fIinterval\fR milliseconds.
If omitted, \fIinterval\fR defaults to 50 milliseconds (20 steps/second).
.TP
-\fIpathName \fBstate\fR ?\fIstateSpec\fR?
-Modify or query the widget state; see \fIttk::widget(n)\fR.
-.TP
\fIpathName \fBstep\fR ?\fIamount\fR?
Increments the \fB\-value\fR by \fIamount\fR.
\fIamount\fR defaults to 1.0 if omitted.
diff --git a/doc/ttk_radiobutton.n b/doc/ttk_radiobutton.n
index 2dc84be..45be7df 100644
--- a/doc/ttk_radiobutton.n
+++ b/doc/ttk_radiobutton.n
@@ -37,9 +37,10 @@ Default value is \fB::selectedButton\fR.
.SH "WIDGET COMMAND"
.PP
In addition to the standard
-\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
-commands, radiobuttons support the following additional
-widget commands:
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+commands (see \fBttk::widget\fR),
+radiobutton widgets support the following additional commands:
.TP
\fIpathname\fB invoke\fR
Sets the \fB\-variable\fR to the \fB\-value\fR, selects the widget,
diff --git a/doc/ttk_scale.n b/doc/ttk_scale.n
index 32686a6..c0c351b 100644
--- a/doc/ttk_scale.n
+++ b/doc/ttk_scale.n
@@ -51,45 +51,26 @@ Whenever the scale is manipulated interactively, the variable will be modified
to reflect the scale's new value.
.SH "WIDGET COMMAND"
.PP
-.TP
-\fIpathName \fBcget \fIoption\fR
-.
-Returns the current value of the specified \fIoption\fR; see
-\fIttk::widget(n)\fR.
-.TP
-\fIpathName \fBconfigure \fR?\fIoption\fR? ?\fIvalue option value ...\fR?
-.
-Modify or query widget options; see \fIttk::widget(n)\fR.
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+commands (see \fBttk::widget\fR),
+scale widgets support the following additional commands:
.TP
\fIpathName \fBget \fR?\fIx y\fR?
-.
Get the current value of the \fB\-value\fR option, or the value corresponding
to the coordinates \fIx,y\fR if they are specified. \fIX\fR and \fIy\fR are
pixel coordinates relative to the scale widget origin.
.TP
-\fIpathName \fBidentify \fIx y\fR
-Returns the name of the element at position \fIx\fR, \fIy\fR.
-See \fIttk::widget(n)\fR.
-.TP
-\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
-.
-Test the widget state; see \fIttk::widget(n)\fR.
-.TP
\fIpathName \fBset \fIvalue\fR
-.
Set the value of the widget (i.e. the \fB\-value\fR option) to \fIvalue\fR.
The value will be clipped to the range given by the \fB\-from\fR and
\fB\-to\fR options. Note that setting the linked variable (i.e. the variable
named in the \fB\-variable\fR option) does not cause such clipping.
-.TP
-\fIpathName \fBstate\fR ?\fIstateSpec\fR?
-.
-Modify or query the widget state; see \fIttk::widget(n)\fR.
.SH "INTERNAL COMMANDS"
.PP
.TP
\fIpathName \fBcoords \fR?\fIvalue\fR?
-.
Get the coordinates corresponding to \fIvalue\fR, or the coordinates
corresponding to the current value of the \fB\-value\fR option if \fIvalue\fR
is omitted.
diff --git a/doc/ttk_scrollbar.n b/doc/ttk_scrollbar.n
index bd80760..948c6eb 100644
--- a/doc/ttk_scrollbar.n
+++ b/doc/ttk_scrollbar.n
@@ -47,32 +47,21 @@ One of \fBhorizontal\fR or \fBvertical\fR.
Specifies the orientation of the scrollbar.
.SH "WIDGET COMMAND"
.PP
-.TP
-\fIpathName \fBcget \fIoption\fR
-Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR.
-.TP
-\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
-Modify or query widget options; see \fIttk::widget(n)\fR.
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+commands (see \fBttk::widget\fR),
+scrollbar widgets support the following additional commands:
.TP
\fIpathName \fBget\fR
Returns the scrollbar settings in the form of a list whose
elements are the arguments to the most recent \fBset\fR widget command.
.TP
-\fIpathName \fBidentify \fIx y\fR
-Returns the name of the element at position \fIx\fR, \fIy\fR.
-See \fIttk::widget(n)\fR.
-.TP
-\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
-Test the widget state; see \fIttk::widget(n)\fR.
-.TP
\fIpathName \fBset \fIfirst last\fR
This command is normally invoked by the scrollbar's associated widget
from an \fB\-xscrollcommand\fR or \fB\-yscrollcommand\fR callback.
Specifies the visible range to be displayed.
\fIfirst\fR and \fIlast\fR are real fractions between 0 and 1.
-.TP
-\fIpathName \fBstate\fR ?\fIstateSpec\fR?
-Modify or query the widget state; see \fIttk::widget(n)\fR.
.SH "INTERNAL COMMANDS"
.PP
The following widget commands are used internally
@@ -118,14 +107,6 @@ document. 1.0 refers to the end of the document, 0.333
refers to a point one-third of the way through the document,
and so on.
.TP
-\fIprefix \fBscroll \fInumber \fBunits\fR
-The widget should adjust its view by \fInumber\fR units.
-The units are defined in whatever way makes sense for the widget,
-such as characters or lines in a text widget.
-\fINumber\fR is either 1, which means one unit should scroll off
-the top or left of the window, or \-1, which means that one unit
-should scroll off the bottom or right of the window.
-.TP
\fIprefix \fBscroll \fInumber \fBpages\fR
The widget should adjust its view by \fInumber\fR pages.
It is up to the widget to define the meaning of a page; typically
@@ -134,6 +115,14 @@ is a slight overlap between the old and new views.
\fINumber\fR is either 1, which means the next page should
become visible, or \-1, which means that the previous page should
become visible.
+.TP
+\fIprefix \fBscroll \fInumber \fBunits\fR
+The widget should adjust its view by \fInumber\fR units.
+The units are defined in whatever way makes sense for the widget,
+such as characters or lines in a text widget.
+\fINumber\fR is either 1, which means one unit should scroll off
+the top or left of the window, or \-1, which means that one unit
+should scroll off the bottom or right of the window.
.SH "WIDGET STATES"
.PP
The scrollbar automatically sets the \fBdisabled\fR state bit.
diff --git a/doc/ttk_separator.n b/doc/ttk_separator.n
index 4befb0a..5331f3e 100644
--- a/doc/ttk_separator.n
+++ b/doc/ttk_separator.n
@@ -26,9 +26,10 @@ One of \fBhorizontal\fR or \fBvertical\fR.
Specifies the orientation of the separator.
.SH "WIDGET COMMAND"
.PP
-Separator widgets support the standard
-\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
-methods. No other widget methods are used.
+Separator widgets support the standard commands
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+(see \fBttk::widget\fR).
.PP
.SH "STYLING OPTIONS"
.PP
diff --git a/doc/ttk_sizegrip.n b/doc/ttk_sizegrip.n
index 707a17e..fda8d07 100644
--- a/doc/ttk_sizegrip.n
+++ b/doc/ttk_sizegrip.n
@@ -23,9 +23,10 @@ by pressing and dragging the grip.
.SE
.SH "WIDGET COMMAND"
.PP
-Sizegrip widgets support the standard
-\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
-methods. No other widget methods are used.
+Sizegrip widgets support the standard commands
+\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR,
+\fBstate\fR and \fBstyle\fR
+(see \fBttk::widget\fR).
.SH "PLATFORM-SPECIFIC NOTES"
.PP
On Mac OSX, toplevel windows automatically include a built-in
diff --git a/doc/ttk_spinbox.n b/doc/ttk_spinbox.n
index d7b7657..49dc8ff 100644
--- a/doc/ttk_spinbox.n
+++ b/doc/ttk_spinbox.n
@@ -22,7 +22,7 @@ of the \fBttk::entry\fR widget including support of the
to a Tcl variable.
.SO ttk_widget
\-class \-cursor \-state \-style
-\-takefocus \-xscrollcommand
+\-takefocus \-xscrollcommand \-placeholder \-placeholderforeground
.SE
.SO ttk_entry
\-validate \-validatecommand
@@ -115,6 +115,8 @@ value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored.
.br
\fB\-padding\fP \fIpadding\fP
.br
+\fB\-placeholderforeground\fP \fIcolor\fP
+.br
\fB\-selectbackground\fP \fIcolor\fP
.br
\fB\-selectforeground\fP \fIcolor\fP
diff --git a/doc/ttk_style.n b/doc/ttk_style.n
index 5d7b5d1..a8ecf06 100644
--- a/doc/ttk_style.n
+++ b/doc/ttk_style.n
@@ -27,12 +27,20 @@ this may be overridden by the \fB\-style\fR option.
.PP
A \fItheme\fR is a collection of elements and styles
which controls the overall look and feel of an application.
+The
+.QW .
+style is the theme root style on which derived styles are based.
.SH DESCRIPTION
.PP
The \fBttk::style\fR command takes the following arguments:
.TP
\fBttk::style configure \fIstyle\fR ?\fI\-option\fR ?\fIvalue option value...\fR? ?
Sets the default value of the specified option(s) in \fIstyle\fR.
+If \fIstyle\fR does not exist, it is created.
+If only \fIstyle\fR and \fI-option\fR are specified, get the default value
+for option \fI-option\fR of style \fIstyle\fR.
+If only \fIstyle\fR is specified, get the default value for all options
+of style \fIstyle\fR.
.TP
\fBttk::style element\fR \fIargs\fR
.RS
@@ -68,12 +76,18 @@ state).
If the \fIdefault\fR argument is present, it is used as a fallback
value in case no specification for \fI\-option\fR is found.
.\" Otherwise -- signal error? return empty string? Leave unspecified for now.
+If \fIstyle\fR does not exist, it is created.
.TP
\fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR?
-Sets dynamic values of the specified option(s) in \fIstyle\fR.
+Sets dynamic (state dependent) values of the specified option(s) in \fIstyle\fR.
Each \fIstatespec / value\fR pair is examined in order;
the value corresponding to the first matching \fIstatespec\fR
is used.
+If \fIstyle\fR does not exist, it is created.
+If only \fIstyle\fR and \fI-option\fR are specified, get the dynamic values
+for option \fI-option\fR of style \fIstyle\fR.
+If only \fIstyle\fR is specified, get the dynamic values for all options
+of style \fIstyle\fR.
.TP
\fBttk::style theme\fR \fIargs\fR
.RS
@@ -94,6 +108,10 @@ evaluate \fIscript\fR, then restore the previous theme.
Typically \fIscript\fR simply defines styles and elements,
though arbitrary Tcl code may appear.
.TP
+\fBttk::style theme styles\fR ?\fIthemeName\fR?
+Returns a list of all styles in \fIthemeName\fR. If \fIthemeName\fR
+is omitted, the current theme is used.
+.TP
\fBttk::style theme use\fR ?\fIthemeName\fR?
Without an argument the result is the name of the current theme.
Otherwise this command sets the current theme to \fIthemeName\fR,
diff --git a/doc/ttk_treeview.n b/doc/ttk_treeview.n
index 2deb5b5..02fd39c 100644
--- a/doc/ttk_treeview.n
+++ b/doc/ttk_treeview.n
@@ -92,6 +92,11 @@ even if \fB\-show tree\fR is not specified.
.RE
.SH "WIDGET COMMAND"
.PP
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBinstate\fR,
+\fBstate\fR, \fBstyle\fR, \fBxview\fR and \fByview\fR
+commands (see \fBttk::widget\fR),
+treeview widgets support the following additional commands:
.TP
\fIpathname \fBbbox \fIitem\fR ?\fIcolumn\fR?
Returns the bounding box (relative to the treeview widget's window)
@@ -102,9 +107,6 @@ If the \fIitem\fR is not visible
(i.e., if it is a descendant of a closed item or is scrolled offscreen),
returns the empty list.
.TP
-\fIpathname \fBcget \fIoption\fR
-Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR.
-.TP
\fIpathname \fBchildren \fIitem\fR ?\fInewchildren\fR?
If \fInewchildren\fR is not specified,
returns the list of children belonging to \fIitem\fR.
@@ -160,9 +162,6 @@ column separator.
Use \fIpathname column #0\fR to configure the tree column.
.RE
.TP
-\fIpathname \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
-Modify or query widget options; see \fIttk::widget(n)\fR.
-.TP
\fIpathname \fBdelete \fIitemList\fR
Deletes each of the items in \fIitemList\fR and all of their descendants.
The root item may not be deleted.
@@ -272,9 +271,6 @@ newly created item.
See \fBITEM OPTIONS\fR for the list of available options.
.RE
.TP
-\fIpathname \fBinstate \fIstatespec\fR ?\fIscript\fR?
-Test the widget state; see \fIttk::widget(n)\fR.
-.TP
\fIpathname \fBitem \fIitem\fR ?\fI\-option \fR?\fIvalue \-option value...\fR?
Query or modify the options for the specified \fIitem\fR.
If no \fI\-option\fR is specified,
@@ -338,12 +334,14 @@ With three arguments, sets the value of column \fIcolumn\fR
in item \fIitem\fR to the specified \fIvalue\fR.
See also \fBCOLUMN IDENTIFIERS\fR.
.TP
-\fIpathname \fBstate\fR ?\fIstateSpec\fR?
-Modify or query the widget state; see \fIttk::widget(n)\fR.
-.TP
\fIpathName \fBtag \fIargs...\fR
.RS
.TP
+\fIpathName \fBtag add \fItag items\fR
+Adds the specified \fItag\fR to each of the listed \fIitems\fR.
+If \fItag\fR is already present for a particular item,
+then the \fB\-tags\fR for that item are unchanged.
+.TP
\fIpathName \fBtag bind \fItagName \fR?\fIsequence\fR? ?\fIscript\fR?
Add a Tk binding script for the event sequence \fIsequence\fR
to the tag \fItagName\fR. When an X event is delivered to an item,
@@ -351,9 +349,9 @@ binding scripts for each of the item's \fB\-tags\fR are evaluated
in order as per \fIbindtags(n)\fR.
.RS
.PP
-\fB<KeyPress>\fR, \fB<KeyRelease>\fR, and virtual events
+\fB<Key>\fR, \fB<KeyRelease>\fR, and virtual events
are sent to the focus item.
-\fB<ButtonPress>\fR, \fB<ButtonRelease>\fR, and \fB<Motion>\fR events
+\fB<Button>\fR, \fB<ButtonRelease>\fR, and \fB<Motion>\fR events
are sent to the item under the mouse pointer.
No other event types are supported.
.PP
@@ -372,6 +370,12 @@ With no additional arguments,
returns a dictionary of the option settings for \fItagName\fR.
See \fBTAG OPTIONS\fR for the list of available options.
.TP
+\fIpathName \fBtag delete \fItagName\fR
+Deletes all tag information for the \fItagName\fR argument. The
+command removes the tag from all items in the widget and also deletes any
+other information associated with the tag, such as bindings and display
+information. The command returns an empty string.
+.TP
\fIpathName \fBtag has \fItagName\fR ?\fIitem\fR?
If \fIitem\fR is specified, returns 1 or 0
depending on whether the specified item has the named tag.
@@ -381,24 +385,12 @@ the specified tag.
\fIpathName \fBtag names\fR
Returns a list of all tags used by the widget.
.TP
-\fIpathName \fBtag add \fItag items\fR
-Adds the specified \fItag\fR to each of the listed \fIitems\fR.
-If \fItag\fR is already present for a particular item,
-then the \fB\-tags\fR for that item are unchanged.
-.TP
\fIpathName \fBtag remove \fItag\fR ?\fIitems\fR?
Removes the specified \fItag\fR from each of the listed \fIitems\fR.
If \fIitems\fR is omitted, removes \fItag\fR from each item in the tree.
If \fItag\fR is not present for a particular item,
then the \fB\-tags\fR for that item are unchanged.
.RE
-.PP
-The treeview widget also supports the following generic \fBttk::widget\fR
-widget subcommands (see \fIttk::widget(n)\fR for details):
-.DS
-.ta 5.5c 11c
-\fBxview\fR \fByview\fR
-.DE
.SH "ITEM OPTIONS"
.PP
The following item options may be specified for items
diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n
index 82a1520..06cb83c 100644
--- a/doc/ttk_widget.n
+++ b/doc/ttk_widget.n
@@ -71,6 +71,12 @@ See the description of \fB\-xscrollcommand\fR above for details.
.SH "LABEL OPTIONS"
The following options are supported by labels, buttons,
and other button-like widgets:
+.OP \-anchor anchor Anchor
+Specifies how the information in the widget is positioned
+relative to the inner margins. Legal values are
+\fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR,
+\fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, and \fBcenter\fR.
+See also \fB\-justify\fR (for widgets supporting this option).
.OP \-compound compound Compound
Specifies how to display the image relative to the text,
in the case both \fB\-text\fR and \fB\-image\fR are present.
@@ -106,6 +112,11 @@ The rest of the list is a sequence of \fIstatespec / value\fR pairs
as per \fBstyle map\fR, specifying different images to use when
the widget is in a particular state or combination of states.
All images in the list should have the same size.
+.OP \-justify justify Justify
+If there are multiple lines of text, specifies how
+the lines are laid out relative to one another.
+One of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
+See also \fB\-anchor\fR (for widgets supporting this option).
.OP \-padding padding Padding
Specifies the internal padding for the widget.
The padding is a list of up to four length specifications
@@ -119,7 +130,7 @@ a list of two numbers specify the horizontal and the vertical padding;
a single number specifies the same padding all the way around the widget.
.OP \-text text Text
Specifies a text string to be displayed inside the widget
-(unless overridden by \fB\-textvariable\fR).
+(unless overridden by \fB\-textvariable\fR for the widgets supporting this option).
.OP \-textvariable textVariable Variable
Specifies the name of a global variable whose value will be used
in place of the \fB\-text\fR resource.
@@ -132,6 +143,23 @@ If greater than zero, specifies how much space, in character widths,
to allocate for the text label.
If less than zero, specifies a minimum width.
If zero or unspecified, the natural width of the text label is used.
+Note that some themes may specify a non-zero \fB\-width\fR
+in the style.
+.OP \-wraplength wrapLength WrapLength
+Specifies the maximum line length. The value may have any of the forms
+acceptable to \fBTk_GetPixels\fR. If this option is less than or equal
+to zero, then automatic wrapping is not performed; otherwise
+the text is split into lines such that no line is longer
+than the specified value.
+.SH "ENTRY OPTIONS"
+The following options are supported by entry, spinbox and combobox:
+.OP \-placeholder placeHolder PlaceHolder
+Specifies a help text string to display if no text is otherwise displayed,
+that is when the widget is empty. The placeholder text is displayed using
+the values of the \fB\-font\fR, \fB\-justify\fR and
+\fB\-placeholderforeground\fR options.
+.OP \-placeholderforeground placeHolderForeground PlaceHolderForeground
+Specifies the foreground color of the placeholder text.
.SH "COMPATIBILITY OPTIONS"
This option is only available for themed widgets that have
.QW corresponding
@@ -146,12 +174,10 @@ does not affect the \fB\-state\fR option.
.SH COMMANDS
.TP
\fIpathName \fBcget \fIoption\fR
-.
Returns the current value of the configuration option given
by \fIoption\fR.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
-.
Query or modify the configuration options of the widget.
If one or more \fIoption\-value\fR pairs are specified,
then the command modifies the given widget option(s)
@@ -167,15 +193,14 @@ If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR.
.TP
\fIpathName \fBidentify element \fIx y\fR
-.
Returns the name of the element under the point given
by \fIx\fR and \fIy\fR, or an empty string if the point does
not lie within any element.
\fIx\fR and \fIy\fR are pixel coordinates relative to the widget.
-Some widgets accept other \fBidentify\fR subcommands.
+Some widgets accept other \fBidentify\fR subcommands described
+in these widgets documentation.
.TP
\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
-.
Test the widget's state.
If \fIscript\fR is not specified, returns 1 if
the widget state matches \fIstatespec\fR and 0 otherwise.
@@ -185,7 +210,6 @@ if {[\fIpathName\fR instate \fIstateSpec\fR]} \fIscript\fR
.CE
.TP
\fIpathName \fBstate\fR ?\fIstateSpec\fR?
-.
Modify or inquire widget state.
If \fIstateSpec\fR is present, sets the widget state:
for each flag in \fIstateSpec\fR, sets the corresponding flag
@@ -201,6 +225,9 @@ If \fIstateSpec\fR is not specified,
returns a list of the currently-enabled state flags.
.RE
.TP
+\fIpathName \fBstyle\fR
+Return the style used by the widget.
+.TP
\fIpathName \fBxview \fIargs\fR
This command is used to query and change the horizontal position of the
content in the widget's window. It can take any of the following
@@ -229,15 +256,17 @@ way through the content appears at the left edge of the window.
\fIpathName \fBxview scroll \fInumber what\fR
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
-\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
+\fIWhat\fR must be either \fBpages\fR or \fBunits\fR.
'\" or an abbreviation of one of these, but we don't document that.
-If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
-\fInumber\fR average-width characters on the display; if it is
+If \fIwhat\fR is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then characters farther to the left
become visible; if it is positive then characters farther to the right
become visible.
+If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
+\fInumber\fR average-width characters on the display.
.RE
.TP
\fIpathName \fByview \fIargs\fR
@@ -269,14 +298,15 @@ way through the content appears at the top edge of the window.
This command shifts the view in the window up or down according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
+\fIWhat\fR must be either \fBpages\fR or \fBunits\fR.
'\" or an abbreviation of one of these, but we don't document that.
-If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
-\fInumber\fR average-width characters on the display; if it is
+If \fIwhat\fR is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then items farther to the top
become visible; if it is positive then items farther to the bottom
become visible.
+If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
+\fInumber\fR average-width characters on the display.
.RE
.SH "WIDGET STATES"
The widget state is a bitmap of independent state flags.
diff --git a/doc/winfo.n b/doc/winfo.n
index fed5c39..5651f2c 100644
--- a/doc/winfo.n
+++ b/doc/winfo.n
@@ -12,7 +12,7 @@
.SH NAME
winfo \- Return window-related information
.SH SYNOPSIS
-\fBwinfo\fR \fIoption \fR?\fIarg arg ...\fR?
+\fBwinfo\fR \fIoption \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/wish.1 b/doc/wish.1
index f7d97d9..115911e 100644
--- a/doc/wish.1
+++ b/doc/wish.1
@@ -12,7 +12,7 @@
.SH NAME
wish \- Simple windowing shell
.SH SYNOPSIS
-\fBwish\fR ?\fB\-encoding \fIname\fR? ?\fIfileName arg arg ...\fR?
+\fBwish\fR ?\fB\-encoding \fIname\fR? ?\fIfileName arg ...\fR?
.SH OPTIONS
.IP "\fB\-encoding \fIname\fR" 20
Specifies the encoding of the text stored in \fIfileName\fR.
diff --git a/generic/ks_names.h b/generic/ks_names.h
index 8d3702d..9a9a51a 100644
--- a/generic/ks_names.h
+++ b/generic/ks_names.h
@@ -38,10 +38,21 @@
{ "Kana_Shift", 0xFF2E },
{ "Eisu_Shift", 0xFF2F },
{ "Eisu_toggle", 0xFF30 },
+{ "Hangul", 0xFF31 },
+{ "Hangul_Start", 0xFF32 },
+{ "Hangul_End", 0xFF33 },
+{ "Hangul_Hanja", 0xFF34 },
+{ "Hangul_Jamo", 0xFF35 },
+{ "Hangul_Romaja", 0xFF36 },
{ "Codeinput", 0xFF37 },
+{ "Hangul_Jeonja", 0xFF38 },
+{ "Hangul_Banja", 0xFF39 },
+{ "Hangul_PreHanja", 0xFF3A },
+{ "Hangul_PostHanja", 0xFF3B },
{ "SingleCandidate", 0xFF3C },
{ "MultipleCandidate", 0xFF3D },
{ "PreviousCandidate", 0xFF3E },
+{ "Hangul_Special", 0xFF3F },
{ "Home", 0xFF50 },
{ "Left", 0xFF51 },
{ "Up", 0xFF52 },
@@ -53,9 +64,6 @@
{ "Page_Down", 0xFF56 },
{ "End", 0xFF57 },
{ "Begin", 0xFF58 },
-{ "Win_L", 0xFF5B },
-{ "Win_R", 0xFF5C },
-{ "App", 0xFF5D },
{ "Select", 0xFF60 },
{ "Print", 0xFF61 },
{ "Execute", 0xFF62 },
@@ -63,16 +71,21 @@
{ "Undo", 0xFF65 },
{ "Redo", 0xFF66 },
{ "Menu", 0xFF67 },
+#ifndef TK_NO_DEPRECATED
+{ "App", 0xFF67 },
+#endif
{ "Find", 0xFF68 },
{ "Cancel", 0xFF69 },
{ "Help", 0xFF6A },
{ "Break", 0xFF6B },
{ "Mode_switch", 0xFF7E },
+#ifndef TK_NO_DEPRECATED
{ "script_switch", 0xFF7E },
{ "kana_switch", 0xFF7E },
{ "Arabic_switch", 0xFF7E },
{ "Greek_switch", 0xFF7E },
{ "Hebrew_switch", 0xFF7E },
+#endif
{ "Num_Lock", 0xFF7F },
{ "KP_Space", 0xFF80 },
{ "KP_Tab", 0xFF89 },
@@ -182,15 +195,207 @@
{ "Alt_L", 0xFFE9 },
{ "Alt_R", 0xFFEA },
{ "Super_L", 0xFFEB },
+#ifndef TK_NO_DEPRECATED
+{ "Win_L", 0xFFEB },
+#endif
{ "Super_R", 0xFFEC },
+#ifndef TK_NO_DEPRECATED
+{ "Win_R", 0xFFEC },
+#endif
{ "Hyper_L", 0xFFED },
{ "Hyper_R", 0xFFEE },
+{ "braille_dot_1", 0xFFF1 },
+{ "braille_dot_2", 0xFFF2 },
+{ "braille_dot_3", 0xFFF3 },
+{ "braille_dot_4", 0xFFF4 },
+{ "braille_dot_5", 0xFFF5 },
+{ "braille_dot_6", 0xFFF6 },
+{ "braille_dot_7", 0xFFF7 },
+{ "braille_dot_8", 0xFFF8 },
+{ "braille_dot_9", 0xFFF9 },
+{ "braille_dot_10", 0xFFFA },
{ "Delete", 0xFFFF },
+{ "ISO_Lock", 0xFE01 },
+{ "ISO_Level2_Latch", 0xFE02 },
+{ "ISO_Level3_Shift", 0xFE03 },
+{ "ISO_Level3_Latch", 0xFE04 },
+{ "ISO_Level3_Lock", 0xFE05 },
+{ "ISO_Group_Latch", 0xFE06 },
+{ "ISO_Group_Lock", 0xFE07 },
+{ "ISO_Next_Group", 0xFE08 },
+{ "ISO_Next_Group_Lock", 0xFE09 },
+{ "ISO_Prev_Group", 0xFE0A },
+{ "ISO_Prev_Group_Lock", 0xFE0B },
+{ "ISO_First_Group", 0xFE0C },
+{ "ISO_First_Group_Lock", 0xFE0D },
+{ "ISO_Last_Group", 0xFE0E },
+{ "ISO_Last_Group_Lock", 0xFE0F },
+{ "ISO_Level5_Shift", 0xFE11 },
+{ "ISO_Level5_Latch", 0xFE12 },
+{ "ISO_Level5_Lock", 0xFE13 },
+{ "ISO_Left_Tab", 0xFE20 },
+{ "ISO_Move_Line_Up", 0xFE21 },
+{ "ISO_Move_Line_Down", 0xFE22 },
+{ "ISO_Partial_Line_Up", 0xFE23 },
+{ "ISO_Partial_Line_Down", 0xFE24 },
+{ "ISO_Partial_Space_Left", 0xFE25 },
+{ "ISO_Partial_Space_Right", 0xFE26 },
+{ "ISO_Set_Margin_Left", 0xFE27 },
+{ "ISO_Set_Margin_Right", 0xFE28 },
+{ "ISO_Release_Margin_Left", 0xFE29 },
+{ "ISO_Release_Margin_Right", 0xFE2A },
+{ "ISO_Release_Both_Margins", 0xFE2B },
+{ "ISO_Fast_Cursor_Left", 0xFE2C },
+{ "ISO_Fast_Cursor_Right", 0xFE2D },
+{ "ISO_Fast_Cursor_Up", 0xFE2E },
+{ "ISO_Fast_Cursor_Down", 0xFE2F },
+{ "ISO_Continuous_Underline", 0xFE30 },
+{ "ISO_Discontinuous_Underline", 0xFE31 },
+{ "ISO_Emphasize", 0xFE32 },
+{ "ISO_Center_Object", 0xFE33 },
+{ "ISO_Enter", 0xFE34 },
+{ "dead_grave", 0xFE50 },
+{ "dead_acute", 0xFE51 },
+{ "dead_circumflex", 0xFE52 },
+{ "dead_tilde", 0xFE53 },
+{ "dead_perispomeni", 0xFE53 },
+{ "dead_macron", 0xFE54 },
+{ "dead_breve", 0xFE55 },
+{ "dead_abovedot", 0xFE56 },
+{ "dead_diaeresis", 0xFE57 },
+{ "dead_abovering", 0xFE58 },
+{ "dead_doubleacute", 0xFE59 },
+{ "dead_caron", 0xFE5A },
+{ "dead_cedilla", 0xFE5B },
+{ "dead_ogonek", 0xFE5C },
+{ "dead_iota", 0xFE5D },
+{ "dead_voiced_sound", 0xFE5E },
+{ "dead_semivoiced_sound", 0xFE5F },
+{ "dead_belowdot", 0xFE60 },
+{ "dead_hook", 0xFE61 },
+{ "dead_horn", 0xFE62 },
+{ "dead_stroke", 0xFE63 },
+{ "dead_abovecomma", 0xFE64 },
+{ "dead_psili", 0xFE64 },
+{ "dead_abovereversedcomma", 0xFE65 },
+{ "dead_dasia", 0xFE65 },
+{ "dead_doublegrave", 0xFE66 },
+{ "dead_belowring", 0xFE67 },
+{ "dead_belowmacron", 0xFE68 },
+{ "dead_belowcircumflex", 0xFE69 },
+{ "dead_belowtilde", 0xFE6A },
+{ "dead_belowbreve", 0xFE6B },
+{ "dead_belowdiaeresis", 0xFE6C },
+{ "dead_invertedbreve", 0xFE6D },
+{ "dead_belowcomma", 0xFE6E },
+{ "dead_currency", 0xFE6F },
+{ "AccessX_Enable", 0xFE70 },
+{ "AccessX_Feedback_Enable", 0xFE71 },
+{ "RepeatKeys_Enable", 0xFE72 },
+{ "SlowKeys_Enable", 0xFE73 },
+{ "BounceKeys_Enable", 0xFE74 },
+{ "StickyKeys_Enable", 0xFE75 },
+{ "MouseKeys_Enable", 0xFE76 },
+{ "MouseKeys_Accel_Enable", 0xFE77 },
+{ "Overlay1_Enable", 0xFE78 },
+{ "Overlay2_Enable", 0xFE79 },
+{ "AudibleBell_Enable", 0xFE7A },
+{ "dead_a", 0xFE80 },
+{ "dead_A", 0xFE81 },
+{ "dead_e", 0xFE82 },
+{ "dead_E", 0xFE83 },
+{ "dead_i", 0xFE84 },
+{ "dead_I", 0xFE85 },
+{ "dead_o", 0xFE86 },
+{ "dead_O", 0xFE87 },
+{ "dead_u", 0xFE88 },
+{ "dead_U", 0xFE89 },
+{ "dead_small_schwa", 0xFE8A },
+{ "dead_capital_schwa", 0xFE8B },
+{ "dead_greek", 0xFE8C },
+{ "dead_lowline", 0xFE90 },
+{ "dead_aboveverticalline", 0xFE91 },
+{ "dead_belowverticalline", 0xFE92 },
+{ "dead_longsolidusoverlay", 0xFE93 },
+{ "ch", 0xFEA0 },
+{ "Ch", 0xFEA1 },
+{ "CH", 0xFEA2 },
+{ "c_h", 0xFEA3 },
+{ "C_h", 0xFEA4 },
+{ "C_H", 0xFEA5 },
+{ "First_Virtual_Screen", 0xFED0 },
+{ "Prev_Virtual_Screen", 0xFED1 },
+{ "Next_Virtual_Screen", 0xFED2 },
+{ "Last_Virtual_Screen", 0xFED4 },
+{ "Terminate_Server", 0xFED5 },
+{ "Pointer_Left", 0xFEE0 },
+{ "Pointer_Right", 0xFEE1 },
+{ "Pointer_Up", 0xFEE2 },
+{ "Pointer_Down", 0xFEE3 },
+{ "Pointer_UpLeft", 0xFEE4 },
+{ "Pointer_UpRight", 0xFEE5 },
+{ "Pointer_DownLeft", 0xFEE6 },
+{ "Pointer_DownRight", 0xFEE7 },
+{ "Pointer_Button_Dflt", 0xFEE8 },
+{ "Pointer_Button1", 0xFEE9 },
+{ "Pointer_Button2", 0xFEEA },
+{ "Pointer_Button3", 0xFEEB },
+{ "Pointer_Button4", 0xFEEC },
+{ "Pointer_Button5", 0xFEED },
+{ "Pointer_DblClick_Dflt", 0xFEEE },
+{ "Pointer_DblClick1", 0xFEEF },
+{ "Pointer_DblClick2", 0xFEF0 },
+{ "Pointer_DblClick3", 0xFEF1 },
+{ "Pointer_DblClick4", 0xFEF2 },
+{ "Pointer_DblClick5", 0xFEF3 },
+{ "Pointer_Drag_Dflt", 0xFEF4 },
+{ "Pointer_Drag1", 0xFEF5 },
+{ "Pointer_Drag2", 0xFEF6 },
+{ "Pointer_Drag3", 0xFEF7 },
+{ "Pointer_Drag4", 0xFEF8 },
+{ "Pointer_EnableKeys", 0xFEF9 },
+{ "Pointer_Accelerate", 0xFEFA },
+{ "Pointer_DfltBtnNext", 0xFEFB },
+{ "Pointer_DfltBtnPrev", 0xFEFC },
+{ "Pointer_Drag5", 0xFEFD },
+{ "3270_Duplicate", 0xFD01 },
+{ "3270_FieldMark", 0xFD02 },
+{ "3270_Right2", 0xFD03 },
+{ "3270_Left2", 0xFD04 },
+{ "3270_BackTab", 0xFD05 },
+{ "3270_EraseEOF", 0xFD06 },
+{ "3270_EraseInput", 0xFD07 },
+{ "3270_Reset", 0xFD08 },
+{ "3270_Quit", 0xFD09 },
+{ "3270_PA1", 0xFD0A },
+{ "3270_PA2", 0xFD0B },
+{ "3270_PA3", 0xFD0C },
+{ "3270_Test", 0xFD0D },
+{ "3270_Attn", 0xFD0E },
+{ "3270_CursorBlink", 0xFD0F },
+{ "3270_AltCursor", 0xFD10 },
+{ "3270_KeyClick", 0xFD11 },
+{ "3270_Jump", 0xFD12 },
+{ "3270_Ident", 0xFD13 },
+{ "3270_Rule", 0xFD14 },
+{ "3270_Copy", 0xFD15 },
+{ "3270_Play", 0xFD16 },
+{ "3270_Setup", 0xFD17 },
+{ "3270_Record", 0xFD18 },
+{ "3270_ChangeScreen", 0xFD19 },
+{ "3270_DeleteWord", 0xFD1A },
+{ "3270_ExSelect", 0xFD1B },
+{ "3270_CursorSelect", 0xFD1C },
+{ "3270_PrintScreen", 0xFD1D },
+{ "3270_Enter", 0xFD1E },
{ "space", 0x20 },
+#ifndef TK_NO_DEPRECATED
{ "exclam", 0x21 },
+#endif
{ "quotedbl", 0x22 },
{ "numbersign", 0x23 },
{ "dollar", 0x24 },
+#ifndef TK_NO_DEPRECATED
{ "percent", 0x25 },
{ "ampersand", 0x26 },
{ "apostrophe", 0x27 },
@@ -200,7 +405,9 @@
{ "asterisk", 0x2A },
{ "plus", 0x2B },
{ "comma", 0x2C },
+#endif
{ "minus", 0x2D },
+#ifndef TK_NO_DEPRECATED
{ "period", 0x2E },
{ "slash", 0x2F },
{ "0", 0x30 },
@@ -214,10 +421,14 @@
{ "8", 0x38 },
{ "9", 0x39 },
{ "colon", 0x3A },
+#endif
{ "semicolon", 0x3B },
{ "less", 0x3C },
+#ifndef TK_NO_DEPRECATED
{ "equal", 0x3D },
+#endif
{ "greater", 0x3E },
+#ifndef TK_NO_DEPRECATED
{ "question", 0x3F },
{ "at", 0x40 },
{ "A", 0x41 },
@@ -246,9 +457,11 @@
{ "X", 0x58 },
{ "Y", 0x59 },
{ "Z", 0x5A },
+#endif
{ "bracketleft", 0x5B },
{ "backslash", 0x5C },
{ "bracketright", 0x5D },
+#ifndef TK_NO_DEPRECATED
{ "asciicircum", 0x5E },
{ "underscore", 0x5F },
{ "grave", 0x60 },
@@ -279,11 +492,17 @@
{ "x", 0x78 },
{ "y", 0x79 },
{ "z", 0x7A },
+#endif
{ "braceleft", 0x7B },
+#ifndef TK_NO_DEPRECATED
{ "bar", 0x7C },
+#endif
{ "braceright", 0x7D },
+#ifndef TK_NO_DEPRECATED
{ "asciitilde", 0x7E },
+#endif
{ "nobreakspace", 0xA0 },
+#ifndef TK_NO_DEPRECATED
{ "exclamdown", 0xA1 },
{ "cent", 0xA2 },
{ "sterling", 0xA3 },
@@ -341,7 +560,9 @@
{ "Odiaeresis", 0xD6 },
{ "multiply", 0xD7 },
{ "Oslash", 0xD8 },
+#ifndef TK_NO_DEPRECATED
{ "Ooblique", 0xD8 },
+#endif
{ "Ugrave", 0xD9 },
{ "Uacute", 0xDA },
{ "Ucircumflex", 0xDB },
@@ -382,6 +603,7 @@
{ "yacute", 0xFD },
{ "thorn", 0xFE },
{ "ydiaeresis", 0xFF },
+#endif /* TK_NO_DEPRECATED */
{ "Aogonek", 0x1A1 },
{ "breve", 0x1A2 },
{ "Lstroke", 0x1A3 },
@@ -462,7 +684,9 @@
{ "ubreve", 0x2FD },
{ "scircumflex", 0x2FE },
{ "kra", 0x3A2 },
+#ifndef TK_NO_DEPRECATED
{ "kappa", 0x3A2 },
+#endif
{ "Rcedilla", 0x3A3 },
{ "Itilde", 0x3A5 },
{ "Lcedilla", 0x3A6 },
@@ -474,7 +698,9 @@
{ "lcedilla", 0x3B6 },
{ "emacron", 0x3BA },
{ "gcedilla", 0x3BB },
+#ifndef TK_NO_DEPRECATED
{ "gacute", 0x3BB },
+#endif
{ "tslash", 0x3BC },
{ "ENG", 0x3BD },
{ "eng", 0x3BF },
@@ -507,7 +733,9 @@
{ "kana_closingbracket", 0x4A3 },
{ "kana_comma", 0x4A4 },
{ "kana_conjunctive", 0x4A5 },
+#ifndef TK_NO_DEPRECATED
{ "kana_middledot", 0x4A5 },
+#endif
{ "kana_WO", 0x4A6 },
{ "kana_a", 0x4A7 },
{ "kana_i", 0x4A8 },
@@ -518,7 +746,9 @@
{ "kana_yu", 0x4AD },
{ "kana_yo", 0x4AE },
{ "kana_tsu", 0x4AF },
+#ifndef TK_NO_DEPRECATED
{ "kana_tu", 0x4AF },
+#endif
{ "prolongedsound", 0x4B0 },
{ "kana_A", 0x4B1 },
{ "kana_I", 0x4B2 },
@@ -537,9 +767,13 @@
{ "kana_SO", 0x4BF },
{ "kana_TA", 0x4C0 },
{ "kana_CHI", 0x4C1 },
+#ifndef TK_NO_DEPRECATED
{ "kana_TI", 0x4C1 },
+#endif
{ "kana_TSU", 0x4C2 },
+#ifndef TK_NO_DEPRECATED
{ "kana_TU", 0x4C2 },
+#endif
{ "kana_TE", 0x4C3 },
{ "kana_TO", 0x4C4 },
{ "kana_NA", 0x4C5 },
@@ -550,7 +784,9 @@
{ "kana_HA", 0x4CA },
{ "kana_HI", 0x4CB },
{ "kana_FU", 0x4CC },
+#ifndef TK_NO_DEPRECATED
{ "kana_HU", 0x4CC },
+#endif
{ "kana_HE", 0x4CD },
{ "kana_HO", 0x4CE },
{ "kana_MA", 0x4CF },
@@ -607,7 +843,9 @@
{ "Arabic_meem", 0x5E5 },
{ "Arabic_noon", 0x5E6 },
{ "Arabic_ha", 0x5E7 },
+#ifndef TK_NO_DEPRECATED
{ "Arabic_heh", 0x5E7 },
+#endif
{ "Arabic_waw", 0x5E8 },
{ "Arabic_alefmaksura", 0x5E9 },
{ "Arabic_yeh", 0x5EA },
@@ -623,47 +861,75 @@
{ "Macedonia_gje", 0x6A2 },
{ "Cyrillic_io", 0x6A3 },
{ "Ukrainian_ie", 0x6A4 },
+#ifndef TK_NO_DEPRECATED
{ "Ukranian_je", 0x6A4 },
+#endif
{ "Macedonia_dse", 0x6A5 },
{ "Ukrainian_i", 0x6A6 },
+#ifndef TK_NO_DEPRECATED
{ "Ukranian_i", 0x6A6 },
+#endif
{ "Ukrainian_yi", 0x6A7 },
+#ifndef TK_NO_DEPRECATED
{ "Ukranian_yi", 0x6A7 },
+#endif
{ "Cyrillic_je", 0x6A8 },
+#ifndef TK_NO_DEPRECATED
{ "Serbian_je", 0x6A8 },
+#endif
{ "Cyrillic_lje", 0x6A9 },
+#ifndef TK_NO_DEPRECATED
{ "Serbian_lje", 0x6A9 },
+#endif
{ "Cyrillic_nje", 0x6AA },
+#ifndef TK_NO_DEPRECATED
{ "Serbian_nje", 0x6AA },
+#endif
{ "Serbian_tshe", 0x6AB },
{ "Macedonia_kje", 0x6AC },
{ "Ukrainian_ghe_with_upturn", 0x6AD },
{ "Byelorussian_shortu", 0x6AE },
{ "Cyrillic_dzhe", 0x6AF },
+#ifndef TK_NO_DEPRECATED
{ "Serbian_dze", 0x6AF },
+#endif
{ "numerosign", 0x6B0 },
{ "Serbian_DJE", 0x6B1 },
{ "Macedonia_GJE", 0x6B2 },
{ "Cyrillic_IO", 0x6B3 },
{ "Ukrainian_IE", 0x6B4 },
+#ifndef TK_NO_DEPRECATED
{ "Ukranian_JE", 0x6B4 },
+#endif
{ "Macedonia_DSE", 0x6B5 },
{ "Ukrainian_I", 0x6B6 },
+#ifndef TK_NO_DEPRECATED
{ "Ukranian_I", 0x6B6 },
+#endif
{ "Ukrainian_YI", 0x6B7 },
+#ifndef TK_NO_DEPRECATED
{ "Ukranian_YI", 0x6B7 },
+#endif
{ "Cyrillic_JE", 0x6B8 },
+#ifndef TK_NO_DEPRECATED
{ "Serbian_JE", 0x6B8 },
+#endif
{ "Cyrillic_LJE", 0x6B9 },
+#ifndef TK_NO_DEPRECATED
{ "Serbian_LJE", 0x6B9 },
+#endif
{ "Cyrillic_NJE", 0x6BA },
+#ifndef TK_NO_DEPRECATED
{ "Serbian_NJE", 0x6BA },
+#endif
{ "Serbian_TSHE", 0x6BB },
{ "Macedonia_KJE", 0x6BC },
{ "Ukrainian_GHE_WITH_UPTURN", 0x6BD },
{ "Byelorussian_SHORTU", 0x6BE },
{ "Cyrillic_DZHE", 0x6BF },
+#ifndef TK_NO_DEPRECATED
{ "Serbian_DZE", 0x6BF },
+#endif
{ "Cyrillic_yu", 0x6C0 },
{ "Cyrillic_a", 0x6C1 },
{ "Cyrillic_be", 0x6C2 },
@@ -733,7 +999,9 @@
{ "Greek_ETAaccent", 0x7A3 },
{ "Greek_IOTAaccent", 0x7A4 },
{ "Greek_IOTAdieresis", 0x7A5 },
+#ifndef TK_NO_DEPRECATED
{ "Greek_IOTAdiaeresis", 0x7A5 },
+#endif
{ "Greek_IOTAaccentdiaeresis", 0x7A6 },
{ "Greek_OMICRONaccent", 0x7A7 },
{ "Greek_UPSILONaccent", 0x7A8 },
@@ -983,19 +1251,31 @@
{ "hebrew_doublelowline", 0xCDF },
{ "hebrew_aleph", 0xCE0 },
{ "hebrew_bet", 0xCE1 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_beth", 0xCE1 },
+#endif
{ "hebrew_gimel", 0xCE2 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_gimmel", 0xCE2 },
+#endif
{ "hebrew_dalet", 0xCE3 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_daleth", 0xCE3 },
+#endif
{ "hebrew_he", 0xCE4 },
{ "hebrew_waw", 0xCE5 },
{ "hebrew_zain", 0xCE6 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_zayin", 0xCE6 },
+#endif
{ "hebrew_chet", 0xCE7 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_het", 0xCE7 },
+#endif
{ "hebrew_tet", 0xCE8 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_teth", 0xCE8 },
+#endif
{ "hebrew_yod", 0xCE9 },
{ "hebrew_finalkaph", 0xCEA },
{ "hebrew_kaph", 0xCEB },
@@ -1005,20 +1285,205 @@
{ "hebrew_finalnun", 0xCEF },
{ "hebrew_nun", 0xCF0 },
{ "hebrew_samech", 0xCF1 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_samekh", 0xCF1 },
+#endif
{ "hebrew_ayin", 0xCF2 },
{ "hebrew_finalpe", 0xCF3 },
{ "hebrew_pe", 0xCF4 },
{ "hebrew_finalzade", 0xCF5 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_finalzadi", 0xCF5 },
+#endif
{ "hebrew_zade", 0xCF6 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_zadi", 0xCF6 },
+#endif
{ "hebrew_qoph", 0xCF7 },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_kuf", 0xCF7 },
+#endif
{ "hebrew_resh", 0xCF8 },
{ "hebrew_shin", 0xCF9 },
{ "hebrew_taw", 0xCFA },
+#ifndef TK_NO_DEPRECATED
{ "hebrew_taf", 0xCFA },
+#endif
+{ "Thai_kokai", 0xDA1 },
+{ "Thai_khokhai", 0xDA2 },
+{ "Thai_khokhuat", 0xDA3 },
+{ "Thai_khokhwai", 0xDA4 },
+{ "Thai_khokhon", 0xDA5 },
+{ "Thai_khorakhang", 0xDA6 },
+{ "Thai_ngongu", 0xDA7 },
+{ "Thai_chochan", 0xDA8 },
+{ "Thai_choching", 0xDA9 },
+{ "Thai_chochang", 0xDAA },
+{ "Thai_soso", 0xDAB },
+{ "Thai_chochoe", 0xDAC },
+{ "Thai_yoying", 0xDAD },
+{ "Thai_dochada", 0xDAE },
+{ "Thai_topatak", 0xDAF },
+{ "Thai_thothan", 0xDB0 },
+{ "Thai_thonangmontho", 0xDB1 },
+{ "Thai_thophuthao", 0xDB2 },
+{ "Thai_nonen", 0xDB3 },
+{ "Thai_dodek", 0xDB4 },
+{ "Thai_totao", 0xDB5 },
+{ "Thai_thothung", 0xDB6 },
+{ "Thai_thothahan", 0xDB7 },
+{ "Thai_thothong", 0xDB8 },
+{ "Thai_nonu", 0xDB9 },
+{ "Thai_bobaimai", 0xDBA },
+{ "Thai_popla", 0xDBB },
+{ "Thai_phophung", 0xDBC },
+{ "Thai_fofa", 0xDBD },
+{ "Thai_phophan", 0xDBE },
+{ "Thai_fofan", 0xDBF },
+{ "Thai_phosamphao", 0xDC0 },
+{ "Thai_moma", 0xDC1 },
+{ "Thai_yoyak", 0xDC2 },
+{ "Thai_rorua", 0xDC3 },
+{ "Thai_ru", 0xDC4 },
+{ "Thai_loling", 0xDC5 },
+{ "Thai_lu", 0xDC6 },
+{ "Thai_wowaen", 0xDC7 },
+{ "Thai_sosala", 0xDC8 },
+{ "Thai_sorusi", 0xDC9 },
+{ "Thai_sosua", 0xDCA },
+{ "Thai_hohip", 0xDCB },
+{ "Thai_lochula", 0xDCC },
+{ "Thai_oang", 0xDCD },
+{ "Thai_honokhuk", 0xDCE },
+{ "Thai_paiyannoi", 0xDCF },
+{ "Thai_saraa", 0xDD0 },
+{ "Thai_maihanakat", 0xDD1 },
+{ "Thai_saraaa", 0xDD2 },
+{ "Thai_saraam", 0xDD3 },
+{ "Thai_sarai", 0xDD4 },
+{ "Thai_saraii", 0xDD5 },
+{ "Thai_saraue", 0xDD6 },
+{ "Thai_sarauee", 0xDD7 },
+{ "Thai_sarau", 0xDD8 },
+{ "Thai_sarauu", 0xDD9 },
+{ "Thai_phinthu", 0xDDA },
+{ "Thai_maihanakat_maitho", 0xDDE },
+{ "Thai_baht", 0xDDF },
+{ "Thai_sarae", 0xDE0 },
+{ "Thai_saraae", 0xDE1 },
+{ "Thai_sarao", 0xDE2 },
+{ "Thai_saraaimaimuan", 0xDE3 },
+{ "Thai_saraaimaimalai", 0xDE4 },
+{ "Thai_lakkhangyao", 0xDE5 },
+{ "Thai_maiyamok", 0xDE6 },
+{ "Thai_maitaikhu", 0xDE7 },
+{ "Thai_maiek", 0xDE8 },
+{ "Thai_maitho", 0xDE9 },
+{ "Thai_maitri", 0xDEA },
+{ "Thai_maichattawa", 0xDEB },
+{ "Thai_thanthakhat", 0xDEC },
+{ "Thai_nikhahit", 0xDED },
+{ "Thai_leksun", 0xDF0 },
+{ "Thai_leknung", 0xDF1 },
+{ "Thai_leksong", 0xDF2 },
+{ "Thai_leksam", 0xDF3 },
+{ "Thai_leksi", 0xDF4 },
+{ "Thai_lekha", 0xDF5 },
+{ "Thai_lekhok", 0xDF6 },
+{ "Thai_lekchet", 0xDF7 },
+{ "Thai_lekpaet", 0xDF8 },
+{ "Thai_lekkao", 0xDF9 },
+{ "Hangul_Kiyeog", 0xEA1 },
+{ "Hangul_SsangKiyeog", 0xEA2 },
+{ "Hangul_KiyeogSios", 0xEA3 },
+{ "Hangul_Nieun", 0xEA4 },
+{ "Hangul_NieunJieuj", 0xEA5 },
+{ "Hangul_NieunHieuh", 0xEA6 },
+{ "Hangul_Dikeud", 0xEA7 },
+{ "Hangul_SsangDikeud", 0xEA8 },
+{ "Hangul_Rieul", 0xEA9 },
+{ "Hangul_RieulKiyeog", 0xEAA },
+{ "Hangul_RieulMieum", 0xEAB },
+{ "Hangul_RieulPieub", 0xEAC },
+{ "Hangul_RieulSios", 0xEAD },
+{ "Hangul_RieulTieut", 0xEAE },
+{ "Hangul_RieulPhieuf", 0xEAF },
+{ "Hangul_RieulHieuh", 0xEB0 },
+{ "Hangul_Mieum", 0xEB1 },
+{ "Hangul_Pieub", 0xEB2 },
+{ "Hangul_SsangPieub", 0xEB3 },
+{ "Hangul_PieubSios", 0xEB4 },
+{ "Hangul_Sios", 0xEB5 },
+{ "Hangul_SsangSios", 0xEB6 },
+{ "Hangul_Ieung", 0xEB7 },
+{ "Hangul_Jieuj", 0xEB8 },
+{ "Hangul_SsangJieuj", 0xEB9 },
+{ "Hangul_Cieuc", 0xEBA },
+{ "Hangul_Khieuq", 0xEBB },
+{ "Hangul_Tieut", 0xEBC },
+{ "Hangul_Phieuf", 0xEBD },
+{ "Hangul_Hieuh", 0xEBE },
+{ "Hangul_A", 0xEBF },
+{ "Hangul_AE", 0xEC0 },
+{ "Hangul_YA", 0xEC1 },
+{ "Hangul_YAE", 0xEC2 },
+{ "Hangul_EO", 0xEC3 },
+{ "Hangul_E", 0xEC4 },
+{ "Hangul_YEO", 0xEC5 },
+{ "Hangul_YE", 0xEC6 },
+{ "Hangul_O", 0xEC7 },
+{ "Hangul_WA", 0xEC8 },
+{ "Hangul_WAE", 0xEC9 },
+{ "Hangul_OE", 0xECA },
+{ "Hangul_YO", 0xECB },
+{ "Hangul_U", 0xECC },
+{ "Hangul_WEO", 0xECD },
+{ "Hangul_WE", 0xECE },
+{ "Hangul_WI", 0xECF },
+{ "Hangul_YU", 0xED0 },
+{ "Hangul_EU", 0xED1 },
+{ "Hangul_YI", 0xED2 },
+{ "Hangul_I", 0xED3 },
+{ "Hangul_J_Kiyeog", 0xED4 },
+{ "Hangul_J_SsangKiyeog", 0xED5 },
+{ "Hangul_J_KiyeogSios", 0xED6 },
+{ "Hangul_J_Nieun", 0xED7 },
+{ "Hangul_J_NieunJieuj", 0xED8 },
+{ "Hangul_J_NieunHieuh", 0xED9 },
+{ "Hangul_J_Dikeud", 0xEDA },
+{ "Hangul_J_Rieul", 0xEDB },
+{ "Hangul_J_RieulKiyeog", 0xEDC },
+{ "Hangul_J_RieulMieum", 0xEDD },
+{ "Hangul_J_RieulPieub", 0xEDE },
+{ "Hangul_J_RieulSios", 0xEDF },
+{ "Hangul_J_RieulTieut", 0xEE0 },
+{ "Hangul_J_RieulPhieuf", 0xEE1 },
+{ "Hangul_J_RieulHieuh", 0xEE2 },
+{ "Hangul_J_Mieum", 0xEE3 },
+{ "Hangul_J_Pieub", 0xEE4 },
+{ "Hangul_J_PieubSios", 0xEE5 },
+{ "Hangul_J_Sios", 0xEE6 },
+{ "Hangul_J_SsangSios", 0xEE7 },
+{ "Hangul_J_Ieung", 0xEE8 },
+{ "Hangul_J_Jieuj", 0xEE9 },
+{ "Hangul_J_Cieuc", 0xEEA },
+{ "Hangul_J_Khieuq", 0xEEB },
+{ "Hangul_J_Tieut", 0xEEC },
+{ "Hangul_J_Phieuf", 0xEED },
+{ "Hangul_J_Hieuh", 0xEEE },
+{ "Hangul_RieulYeorinHieuh", 0xEEF },
+{ "Hangul_SunkyeongeumMieum", 0xEF0 },
+{ "Hangul_SunkyeongeumPieub", 0xEF1 },
+{ "Hangul_PanSios", 0xEF2 },
+{ "Hangul_KkogjiDalrinIeung", 0xEF3 },
+{ "Hangul_SunkyeongeumPhieuf", 0xEF4 },
+{ "Hangul_YeorinHieuh", 0xEF5 },
+{ "Hangul_AraeA", 0xEF6 },
+{ "Hangul_AraeAE", 0xEF7 },
+{ "Hangul_J_PanSios", 0xEF8 },
+{ "Hangul_J_KkogjiDalrinIeung", 0xEF9 },
+{ "Hangul_J_YeorinHieuh", 0xEFA },
+{ "Korean_Won", 0xEFF },
{ "XF86ModeLock", 0x1008FF01 },
{ "XF86MonBrightnessUp", 0x1008FF02 },
{ "XF86MonBrightnessDown", 0x1008FF03 },
@@ -1202,3 +1667,26 @@
{ "XF86Prev_VMode", 0x1008FE23 },
{ "XF86LogWindowTree", 0x1008FE24 },
{ "XF86LogGrabInfo", 0x1008FE25 },
+{ "SunFA_Grave", 0x1005FF00 },
+{ "SunFA_Circum", 0x1005FF01 },
+{ "SunFA_Tilde", 0x1005FF02 },
+{ "SunFA_Acute", 0x1005FF03 },
+{ "SunFA_Diaeresis", 0x1005FF04 },
+{ "SunFA_Cedilla", 0x1005FF05 },
+{ "SunF36", 0x1005FF10 },
+{ "SunF37", 0x1005FF11 },
+{ "SunSys_Req", 0x1005FF60 },
+{ "SunProps", 0x1005FF70 },
+{ "SunFront", 0x1005FF71 },
+{ "SunCopy", 0x1005FF72 },
+{ "SunOpen", 0x1005FF73 },
+{ "SunPaste", 0x1005FF74 },
+{ "SunCut", 0x1005FF75 },
+{ "SunPowerSwitch", 0x1005FF76 },
+{ "SunAudioLowerVolume", 0x1005FF77 },
+{ "SunAudioMute", 0x1005FF78 },
+{ "SunAudioRaiseVolume", 0x1005FF79 },
+{ "SunVideoDegauss", 0x1005FF7A },
+{ "SunVideoLowerBrightness", 0x1005FF7B },
+{ "SunVideoRaiseBrightness", 0x1005FF7C },
+{ "SunPowerSwitchShift", 0x1005FF7D },
diff --git a/generic/nanosvg.h b/generic/nanosvg.h
new file mode 100644
index 0000000..bb5ba25
--- /dev/null
+++ b/generic/nanosvg.h
@@ -0,0 +1,3122 @@
+/*
+ * Copyright (c) 2013-14 Mikko Mononen memon@inside.org
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ * The SVG parser is based on Anti-Grain Geometry 2.4 SVG example
+ * Copyright (C) 2002-2004 Maxim Shemanarev (McSeem) (http://www.antigrain.com/)
+ *
+ * Arc calculation code based on canvg (https://code.google.com/p/canvg/)
+ *
+ * Bounding box calculation based on http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
+ *
+ */
+
+#ifndef NANOSVG_H
+#define NANOSVG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* NanoSVG is a simple stupid single-header-file SVG parse. The output of the parser is a list of cubic bezier shapes.
+ *
+ * The library suits well for anything from rendering scalable icons in your editor application to prototyping a game.
+ *
+ * NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request!
+ *
+ * The shapes in the SVG images are transformed by the viewBox and converted to specified units.
+ * That is, you should get the same looking data as your designed in your favorite app.
+ *
+ * NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose
+ * to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters.
+ *
+ * The units passed to NanoSVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'.
+ * DPI (dots-per-inch) controls how the unit conversion is done.
+ *
+ * If you don't know or care about the units stuff, "px" and 96 should get you going.
+ */
+
+
+/* Example Usage:
+ // Load SVG
+ NSVGimage* image;
+ image = nsvgParseFromFile("test.svg", "px", 96);
+ printf("size: %f x %f\n", image->width, image->height);
+ // Use...
+ for (NSVGshape *shape = image->shapes; shape != NULL; shape = shape->next) {
+ for (NSVGpath *path = shape->paths; path != NULL; path = path->next) {
+ for (int i = 0; i < path->npts-1; i += 3) {
+ float* p = &path->pts[i*2];
+ drawCubicBez(p[0],p[1], p[2],p[3], p[4],p[5], p[6],p[7]);
+ }
+ }
+ }
+ // Delete
+ nsvgDelete(image);
+*/
+
+#ifndef NANOSVG_SCOPE
+#define NANOSVG_SCOPE
+#endif
+
+#ifndef NANOSVG_malloc
+#define NANOSVG_malloc malloc
+#endif
+
+#ifndef NANOSVG_realloc
+#define NANOSVG_realloc realloc
+#endif
+
+#ifndef NANOSVG_free
+#define NANOSVG_free free
+#endif
+
+/* float emulation for MS VC6++ compiler */
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
+#define tanf(a) (float)tan(a)
+#define cosf(a) (float)cos(a)
+#define sinf(a) (float)sin(a)
+#define sqrtf(a) (float)sqrt(a)
+#define fabsf(a) (float)fabs(a)
+#define acosf(a) (float)acos(a)
+#define atan2f(a,b) (float)atan2(a,b)
+#define ceilf(a) (float)ceil(a)
+#define fmodf(a,b) (float)fmod(a,b)
+#define floorf(a) (float)floor(a)
+#endif
+/* float emulation for MS VC8++ compiler */
+#if defined(_MSC_VER) && (_MSC_VER == 1400)
+#define fabsf(a) (float)fabs(a)
+#endif
+
+enum NSVGpaintType {
+ NSVG_PAINT_NONE = 0,
+ NSVG_PAINT_COLOR = 1,
+ NSVG_PAINT_LINEAR_GRADIENT = 2,
+ NSVG_PAINT_RADIAL_GRADIENT = 3
+};
+
+enum NSVGspreadType {
+ NSVG_SPREAD_PAD = 0,
+ NSVG_SPREAD_REFLECT = 1,
+ NSVG_SPREAD_REPEAT = 2
+};
+
+enum NSVGlineJoin {
+ NSVG_JOIN_MITER = 0,
+ NSVG_JOIN_ROUND = 1,
+ NSVG_JOIN_BEVEL = 2
+};
+
+enum NSVGlineCap {
+ NSVG_CAP_BUTT = 0,
+ NSVG_CAP_ROUND = 1,
+ NSVG_CAP_SQUARE = 2
+};
+
+enum NSVGfillRule {
+ NSVG_FILLRULE_NONZERO = 0,
+ NSVG_FILLRULE_EVENODD = 1
+};
+
+enum NSVGflags {
+ NSVG_FLAGS_VISIBLE = 0x01
+};
+
+typedef struct NSVGgradientStop {
+ unsigned int color;
+ float offset;
+} NSVGgradientStop;
+
+typedef struct NSVGgradient {
+ float xform[6];
+ char spread;
+ float fx, fy;
+ int nstops;
+ NSVGgradientStop stops[1];
+} NSVGgradient;
+
+typedef struct NSVGpaint {
+ char type;
+ union {
+ unsigned int color;
+ NSVGgradient* gradient;
+ };
+} NSVGpaint;
+
+typedef struct NSVGpath
+{
+ float* pts; /* Cubic bezier points: x0,y0, [cpx1,cpx1,cpx2,cpy2,x1,y1], ... */
+ int npts; /* Total number of bezier points. */
+ char closed; /* Flag indicating if shapes should be treated as closed. */
+ float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */
+ struct NSVGpath* next; /* Pointer to next path, or NULL if last element. */
+} NSVGpath;
+
+typedef struct NSVGshape
+{
+ char id[64]; /* Optional 'id' attr of the shape or its group */
+ NSVGpaint fill; /* Fill paint */
+ NSVGpaint stroke; /* Stroke paint */
+ float opacity; /* Opacity of the shape. */
+ float strokeWidth; /* Stroke width (scaled). */
+ float strokeDashOffset; /* Stroke dash offset (scaled). */
+ float strokeDashArray[8]; /* Stroke dash array (scaled). */
+ char strokeDashCount; /* Number of dash values in dash array. */
+ char strokeLineJoin; /* Stroke join type. */
+ char strokeLineCap; /* Stroke cap type. */
+ float miterLimit; /* Miter limit */
+ char fillRule; /* Fill rule, see NSVGfillRule. */
+ unsigned char flags; /* Logical or of NSVG_FLAGS_* flags */
+ float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */
+ NSVGpath* paths; /* Linked list of paths in the image. */
+ struct NSVGshape* next; /* Pointer to next shape, or NULL if last element. */
+} NSVGshape;
+
+typedef struct NSVGimage
+{
+ float width; /* Width of the image. */
+ float height; /* Height of the image. */
+ NSVGshape* shapes; /* Linked list of shapes in the image. */
+} NSVGimage;
+
+/* Parses SVG file from a file, returns SVG image as paths. */
+NANOSVG_SCOPE NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi);
+
+/* Parses SVG file from a null terminated string, returns SVG image as paths. */
+/* Important note: changes the string. */
+NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi);
+
+/* Deletes list of paths. */
+NANOSVG_SCOPE void nsvgDelete(NSVGimage* image);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NANOSVG_H */
+
+#ifdef NANOSVG_IMPLEMENTATION
+
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define NSVG_PI (3.14159265358979323846264338327f)
+#define NSVG_KAPPA90 (0.5522847493f) /* Length proportional to radius of a cubic bezier handle for 90deg arcs. */
+
+#define NSVG_ALIGN_MIN 0
+#define NSVG_ALIGN_MID 1
+#define NSVG_ALIGN_MAX 2
+#define NSVG_ALIGN_NONE 0
+#define NSVG_ALIGN_MEET 1
+#define NSVG_ALIGN_SLICE 2
+
+#define NSVG_NOTUSED(v) do { (void)(1 ? (void)0 : ( (void)(v) ) ); } while(0)
+#define NSVG_RGB(r, g, b) (((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16))
+
+#ifdef _MSC_VER
+ #pragma warning (disable: 4996) /* Switch off security warnings */
+ #pragma warning (disable: 4100) /* Switch off unreferenced formal parameter warnings */
+ #ifdef __cplusplus
+ #define NSVG_INLINE inline
+ #else
+ #define NSVG_INLINE
+ #endif
+ #if !defined(strtoll) /* old MSVC versions do not have strtoll() */
+ #define strtoll _strtoi64
+ #endif
+#else
+ #define NSVG_INLINE inline
+#endif
+
+
+static int nsvg__isspace(char c)
+{
+ return strchr(" \t\n\v\f\r", c) != 0;
+}
+
+static int nsvg__isdigit(char c)
+{
+ return c >= '0' && c <= '9';
+}
+
+static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; }
+static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; }
+
+
+/* Simple XML parser */
+
+#define NSVG_XML_TAG 1
+#define NSVG_XML_CONTENT 2
+#define NSVG_XML_MAX_ATTRIBS 256
+
+static void nsvg__parseContent(char* s,
+ void (*contentCb)(void* ud, const char* s),
+ void* ud)
+{
+ /* Trim start white spaces */
+ while (*s && nsvg__isspace(*s)) s++;
+ if (!*s) return;
+
+ if (contentCb)
+ (*contentCb)(ud, s);
+}
+
+static void nsvg__parseElement(char* s,
+ void (*startelCb)(void* ud, const char* el, const char** attr),
+ void (*endelCb)(void* ud, const char* el),
+ void* ud)
+{
+ const char* attr[NSVG_XML_MAX_ATTRIBS];
+ int nattr = 0;
+ char* cbname;
+ int start = 0;
+ int end = 0;
+ char quote;
+
+ /* Skip white space after the '<' */
+ while (*s && nsvg__isspace(*s)) s++;
+
+ /* Check if the tag is end tag */
+ if (*s == '/') {
+ s++;
+ end = 1;
+ } else {
+ start = 1;
+ }
+
+ /* Skip comments, data and preprocessor stuff. */
+ if (!*s || *s == '?' || *s == '!')
+ return;
+
+ /* Get tag name */
+ cbname = s;
+ while (*s && !nsvg__isspace(*s)) s++;
+ if (*s) { *s++ = '\0'; }
+
+ /* Get attribs */
+ while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) {
+ char* name = NULL;
+ char* value = NULL;
+
+ /* Skip white space before the attrib name */
+ while (*s && nsvg__isspace(*s)) s++;
+ if (!*s) break;
+ if (*s == '/') {
+ end = 1;
+ break;
+ }
+ name = s;
+ /* Find end of the attrib name. */
+ while (*s && !nsvg__isspace(*s) && *s != '=') s++;
+ if (*s) { *s++ = '\0'; }
+ /* Skip until the beginning of the value. */
+ while (*s && *s != '\"' && *s != '\'') s++;
+ if (!*s) break;
+ quote = *s;
+ s++;
+ /* Store value and find the end of it. */
+ value = s;
+ while (*s && *s != quote) s++;
+ if (*s) { *s++ = '\0'; }
+
+ /* Store only well formed attributes */
+ if (name && value) {
+ attr[nattr++] = name;
+ attr[nattr++] = value;
+ }
+ }
+
+ /* List terminator */
+ attr[nattr++] = 0;
+ attr[nattr++] = 0;
+
+ /* Call callbacks. */
+ if (start && startelCb)
+ (*startelCb)(ud, cbname, attr);
+ if (end && endelCb)
+ (*endelCb)(ud, cbname);
+}
+
+NANOSVG_SCOPE
+int nsvg__parseXML(char* input,
+ void (*startelCb)(void* ud, const char* el, const char** attr),
+ void (*endelCb)(void* ud, const char* el),
+ void (*contentCb)(void* ud, const char* s),
+ void* ud)
+{
+ char* s = input;
+ char* mark = s;
+ int state = NSVG_XML_CONTENT;
+ while (*s) {
+ if (*s == '<' && state == NSVG_XML_CONTENT) {
+ /* Start of a tag */
+ *s++ = '\0';
+ nsvg__parseContent(mark, contentCb, ud);
+ mark = s;
+ state = NSVG_XML_TAG;
+ } else if (*s == '>' && state == NSVG_XML_TAG) {
+ /* Start of a content or new tag. */
+ *s++ = '\0';
+ nsvg__parseContent(mark, contentCb, ud);
+ nsvg__parseElement(mark, startelCb, endelCb, ud);
+ mark = s;
+ state = NSVG_XML_CONTENT;
+ } else {
+ s++;
+ }
+ }
+
+ return 1;
+}
+
+
+/* Simple SVG parser. */
+
+#define NSVG_MAX_ATTR 128
+
+enum NSVGgradientUnits {
+ NSVG_USER_SPACE = 0,
+ NSVG_OBJECT_SPACE = 1
+};
+
+#define NSVG_MAX_DASHES 8
+
+enum NSVGunits {
+ NSVG_UNITS_USER,
+ NSVG_UNITS_PX,
+ NSVG_UNITS_PT,
+ NSVG_UNITS_PC,
+ NSVG_UNITS_MM,
+ NSVG_UNITS_CM,
+ NSVG_UNITS_IN,
+ NSVG_UNITS_PERCENT,
+ NSVG_UNITS_EM,
+ NSVG_UNITS_EX
+};
+
+enum NSVGvisible {
+ NSVG_VIS_DISPLAY = 1,
+ NSVG_VIS_VISIBLE = 2
+};
+
+typedef struct NSVGcoordinate {
+ float value;
+ int units;
+} NSVGcoordinate;
+
+typedef struct NSVGlinearData {
+ NSVGcoordinate x1, y1, x2, y2;
+} NSVGlinearData;
+
+typedef struct NSVGradialData {
+ NSVGcoordinate cx, cy, r, fx, fy;
+} NSVGradialData;
+
+typedef struct NSVGgradientData
+{
+ char id[64];
+ char ref[64];
+ char type;
+ union {
+ NSVGlinearData linear;
+ NSVGradialData radial;
+ };
+ char spread;
+ char units;
+ float xform[6];
+ int nstops;
+ NSVGgradientStop* stops;
+ struct NSVGgradientData* next;
+} NSVGgradientData;
+
+typedef struct NSVGattrib
+{
+ char id[64];
+ float xform[6];
+ unsigned int fillColor;
+ unsigned int strokeColor;
+ float opacity;
+ float fillOpacity;
+ float strokeOpacity;
+ char fillGradient[64];
+ char strokeGradient[64];
+ float strokeWidth;
+ float strokeDashOffset;
+ float strokeDashArray[NSVG_MAX_DASHES];
+ int strokeDashCount;
+ char strokeLineJoin;
+ char strokeLineCap;
+ float miterLimit;
+ char fillRule;
+ float fontSize;
+ unsigned int stopColor;
+ float stopOpacity;
+ float stopOffset;
+ char hasFill;
+ char hasStroke;
+ char visible;
+} NSVGattrib;
+
+typedef struct NSVGstyles
+{
+ char* name;
+ char* description;
+ struct NSVGstyles* next;
+} NSVGstyles;
+
+typedef struct NSVGparser
+{
+ NSVGattrib attr[NSVG_MAX_ATTR];
+ int attrHead;
+ float* pts;
+ int npts;
+ int cpts;
+ NSVGpath* plist;
+ NSVGimage* image;
+ NSVGstyles* styles;
+ NSVGgradientData* gradients;
+ NSVGshape* shapesTail;
+ float viewMinx, viewMiny, viewWidth, viewHeight;
+ int alignX, alignY, alignType;
+ float dpi;
+ char pathFlag;
+ char defsFlag;
+ char styleFlag;
+} NSVGparser;
+
+static void nsvg__xformIdentity(float* t)
+{
+ t[0] = 1.0f; t[1] = 0.0f;
+ t[2] = 0.0f; t[3] = 1.0f;
+ t[4] = 0.0f; t[5] = 0.0f;
+}
+
+static void nsvg__xformSetTranslation(float* t, float tx, float ty)
+{
+ t[0] = 1.0f; t[1] = 0.0f;
+ t[2] = 0.0f; t[3] = 1.0f;
+ t[4] = tx; t[5] = ty;
+}
+
+static void nsvg__xformSetScale(float* t, float sx, float sy)
+{
+ t[0] = sx; t[1] = 0.0f;
+ t[2] = 0.0f; t[3] = sy;
+ t[4] = 0.0f; t[5] = 0.0f;
+}
+
+static void nsvg__xformSetSkewX(float* t, float a)
+{
+ t[0] = 1.0f; t[1] = 0.0f;
+ t[2] = tanf(a); t[3] = 1.0f;
+ t[4] = 0.0f; t[5] = 0.0f;
+}
+
+static void nsvg__xformSetSkewY(float* t, float a)
+{
+ t[0] = 1.0f; t[1] = tanf(a);
+ t[2] = 0.0f; t[3] = 1.0f;
+ t[4] = 0.0f; t[5] = 0.0f;
+}
+
+static void nsvg__xformSetRotation(float* t, float a)
+{
+ float cs = cosf(a), sn = sinf(a);
+ t[0] = cs; t[1] = sn;
+ t[2] = -sn; t[3] = cs;
+ t[4] = 0.0f; t[5] = 0.0f;
+}
+
+static void nsvg__xformMultiply(float* t, float* s)
+{
+ float t0 = t[0] * s[0] + t[1] * s[2];
+ float t2 = t[2] * s[0] + t[3] * s[2];
+ float t4 = t[4] * s[0] + t[5] * s[2] + s[4];
+ t[1] = t[0] * s[1] + t[1] * s[3];
+ t[3] = t[2] * s[1] + t[3] * s[3];
+ t[5] = t[4] * s[1] + t[5] * s[3] + s[5];
+ t[0] = t0;
+ t[2] = t2;
+ t[4] = t4;
+}
+
+static void nsvg__xformInverse(float* inv, float* t)
+{
+ double invdet, det = (double)t[0] * t[3] - (double)t[2] * t[1];
+ if (det > -1e-6 && det < 1e-6) {
+ nsvg__xformIdentity(t);
+ return;
+ }
+ invdet = 1.0 / det;
+ inv[0] = (float)(t[3] * invdet);
+ inv[2] = (float)(-t[2] * invdet);
+ inv[4] = (float)(((double)t[2] * t[5] - (double)t[3] * t[4]) * invdet);
+ inv[1] = (float)(-t[1] * invdet);
+ inv[3] = (float)(t[0] * invdet);
+ inv[5] = (float)(((double)t[1] * t[4] - (double)t[0] * t[5]) * invdet);
+}
+
+static void nsvg__xformPremultiply(float* t, float* s)
+{
+ float s2[6];
+ memcpy(s2, s, sizeof(float)*6);
+ nsvg__xformMultiply(s2, t);
+ memcpy(t, s2, sizeof(float)*6);
+}
+
+static void nsvg__xformPoint(float* dx, float* dy, float x, float y, float* t)
+{
+ *dx = x*t[0] + y*t[2] + t[4];
+ *dy = x*t[1] + y*t[3] + t[5];
+}
+
+static void nsvg__xformVec(float* dx, float* dy, float x, float y, float* t)
+{
+ *dx = x*t[0] + y*t[2];
+ *dy = x*t[1] + y*t[3];
+}
+
+#define NSVG_EPSILON (1e-12)
+
+static int nsvg__ptInBounds(float* pt, float* bounds)
+{
+ return pt[0] >= bounds[0] && pt[0] <= bounds[2] && pt[1] >= bounds[1] && pt[1] <= bounds[3];
+}
+
+
+static double nsvg__evalBezier(double t, double p0, double p1, double p2, double p3)
+{
+ double it = 1.0-t;
+ return it*it*it*p0 + 3.0*it*it*t*p1 + 3.0*it*t*t*p2 + t*t*t*p3;
+}
+
+static void nsvg__curveBounds(float* bounds, float* curve)
+{
+ int i, j, count;
+ double roots[2], a, b, c, b2ac, t, v;
+ float* v0 = &curve[0];
+ float* v1 = &curve[2];
+ float* v2 = &curve[4];
+ float* v3 = &curve[6];
+
+ /* Start the bounding box by end points */
+ bounds[0] = nsvg__minf(v0[0], v3[0]);
+ bounds[1] = nsvg__minf(v0[1], v3[1]);
+ bounds[2] = nsvg__maxf(v0[0], v3[0]);
+ bounds[3] = nsvg__maxf(v0[1], v3[1]);
+
+ /* Bezier curve fits inside the convex hull of it's control points. */
+ /* If control points are inside the bounds, we're done. */
+ if (nsvg__ptInBounds(v1, bounds) && nsvg__ptInBounds(v2, bounds))
+ return;
+
+ /* Add bezier curve inflection points in X and Y. */
+ for (i = 0; i < 2; i++) {
+ a = -3.0 * v0[i] + 9.0 * v1[i] - 9.0 * v2[i] + 3.0 * v3[i];
+ b = 6.0 * v0[i] - 12.0 * v1[i] + 6.0 * v2[i];
+ c = 3.0 * v1[i] - 3.0 * v0[i];
+ count = 0;
+ if (fabs(a) < NSVG_EPSILON) {
+ if (fabs(b) > NSVG_EPSILON) {
+ t = -c / b;
+ if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON)
+ roots[count++] = t;
+ }
+ } else {
+ b2ac = b*b - 4.0*c*a;
+ if (b2ac > NSVG_EPSILON) {
+ t = (-b + sqrt(b2ac)) / (2.0 * a);
+ if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON)
+ roots[count++] = t;
+ t = (-b - sqrt(b2ac)) / (2.0 * a);
+ if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON)
+ roots[count++] = t;
+ }
+ }
+ for (j = 0; j < count; j++) {
+ v = nsvg__evalBezier(roots[j], v0[i], v1[i], v2[i], v3[i]);
+ bounds[0+i] = nsvg__minf(bounds[0+i], (float)v);
+ bounds[2+i] = nsvg__maxf(bounds[2+i], (float)v);
+ }
+ }
+}
+
+static NSVGparser* nsvg__createParser(void)
+{
+ NSVGparser* p;
+ p = (NSVGparser*)NANOSVG_malloc(sizeof(NSVGparser));
+ if (p == NULL) goto error;
+ memset(p, 0, sizeof(NSVGparser));
+
+ p->image = (NSVGimage*)NANOSVG_malloc(sizeof(NSVGimage));
+ if (p->image == NULL) goto error;
+ memset(p->image, 0, sizeof(NSVGimage));
+
+ /* Init style */
+ nsvg__xformIdentity(p->attr[0].xform);
+ memset(p->attr[0].id, 0, sizeof p->attr[0].id);
+ p->attr[0].fillColor = NSVG_RGB(0,0,0);
+ p->attr[0].strokeColor = NSVG_RGB(0,0,0);
+ p->attr[0].opacity = 1;
+ p->attr[0].fillOpacity = 1;
+ p->attr[0].strokeOpacity = 1;
+ p->attr[0].stopOpacity = 1;
+ p->attr[0].strokeWidth = 1;
+ p->attr[0].strokeLineJoin = NSVG_JOIN_MITER;
+ p->attr[0].strokeLineCap = NSVG_CAP_BUTT;
+ p->attr[0].miterLimit = 4;
+ p->attr[0].fillRule = NSVG_FILLRULE_NONZERO;
+ p->attr[0].hasFill = 1;
+ p->attr[0].visible = NSVG_VIS_DISPLAY | NSVG_VIS_VISIBLE;
+
+ return p;
+
+error:
+ if (p) {
+ if (p->image) NANOSVG_free(p->image);
+ NANOSVG_free(p);
+ }
+ return NULL;
+}
+
+static void nsvg__deleteStyles(NSVGstyles* style) {
+ while (style) {
+ NSVGstyles *next = style->next;
+ if (style->name!= NULL)
+ NANOSVG_free(style->name);
+ if (style->description != NULL)
+ NANOSVG_free(style->description);
+ NANOSVG_free(style);
+ style = next;
+ }
+}
+
+static void nsvg__deletePaths(NSVGpath* path)
+{
+ while (path) {
+ NSVGpath *next = path->next;
+ if (path->pts != NULL)
+ NANOSVG_free(path->pts);
+ NANOSVG_free(path);
+ path = next;
+ }
+}
+
+static void nsvg__deletePaint(NSVGpaint* paint)
+{
+ if (paint->type == NSVG_PAINT_LINEAR_GRADIENT || paint->type == NSVG_PAINT_RADIAL_GRADIENT)
+ NANOSVG_free(paint->gradient);
+}
+
+static void nsvg__deleteGradientData(NSVGgradientData* grad)
+{
+ NSVGgradientData* next;
+ while (grad != NULL) {
+ next = grad->next;
+ NANOSVG_free(grad->stops);
+ NANOSVG_free(grad);
+ grad = next;
+ }
+}
+
+static void nsvg__deleteParser(NSVGparser* p)
+{
+ if (p != NULL) {
+ nsvg__deleteStyles(p->styles);
+ nsvg__deletePaths(p->plist);
+ nsvg__deleteGradientData(p->gradients);
+ nsvgDelete(p->image);
+ NANOSVG_free(p->pts);
+ NANOSVG_free(p);
+ }
+}
+
+static void nsvg__resetPath(NSVGparser* p)
+{
+ p->npts = 0;
+}
+
+static void nsvg__addPoint(NSVGparser* p, float x, float y)
+{
+ if (p->npts+1 > p->cpts) {
+ p->cpts = p->cpts ? p->cpts*2 : 8;
+ p->pts = (float*)NANOSVG_realloc(p->pts, p->cpts*2*sizeof(float));
+ if (!p->pts) return;
+ }
+ p->pts[p->npts*2+0] = x;
+ p->pts[p->npts*2+1] = y;
+ p->npts++;
+}
+
+static void nsvg__moveTo(NSVGparser* p, float x, float y)
+{
+ if (p->npts > 0) {
+ p->pts[(p->npts-1)*2+0] = x;
+ p->pts[(p->npts-1)*2+1] = y;
+ } else {
+ nsvg__addPoint(p, x, y);
+ }
+}
+
+static void nsvg__lineTo(NSVGparser* p, float x, float y)
+{
+ float px,py, dx,dy;
+ if (p->npts > 0) {
+ px = p->pts[(p->npts-1)*2+0];
+ py = p->pts[(p->npts-1)*2+1];
+ dx = x - px;
+ dy = y - py;
+ nsvg__addPoint(p, px + dx/3.0f, py + dy/3.0f);
+ nsvg__addPoint(p, x - dx/3.0f, y - dy/3.0f);
+ nsvg__addPoint(p, x, y);
+ }
+}
+
+static void nsvg__cubicBezTo(NSVGparser* p, float cpx1, float cpy1, float cpx2, float cpy2, float x, float y)
+{
+ if (p->npts > 0) {
+ nsvg__addPoint(p, cpx1, cpy1);
+ nsvg__addPoint(p, cpx2, cpy2);
+ nsvg__addPoint(p, x, y);
+ }
+}
+
+static NSVGattrib* nsvg__getAttr(NSVGparser* p)
+{
+ return &p->attr[p->attrHead];
+}
+
+static void nsvg__pushAttr(NSVGparser* p)
+{
+ if (p->attrHead < NSVG_MAX_ATTR-1) {
+ p->attrHead++;
+ memcpy(&p->attr[p->attrHead], &p->attr[p->attrHead-1], sizeof(NSVGattrib));
+ }
+}
+
+static void nsvg__popAttr(NSVGparser* p)
+{
+ if (p->attrHead > 0)
+ p->attrHead--;
+}
+
+static float nsvg__actualOrigX(NSVGparser* p)
+{
+ return p->viewMinx;
+}
+
+static float nsvg__actualOrigY(NSVGparser* p)
+{
+ return p->viewMiny;
+}
+
+static float nsvg__actualWidth(NSVGparser* p)
+{
+ return p->viewWidth;
+}
+
+static float nsvg__actualHeight(NSVGparser* p)
+{
+ return p->viewHeight;
+}
+
+static float nsvg__actualLength(NSVGparser* p)
+{
+ float w = nsvg__actualWidth(p), h = nsvg__actualHeight(p);
+ return sqrtf(w*w + h*h) / sqrtf(2.0f);
+}
+
+static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig, float length)
+{
+ NSVGattrib* attr = nsvg__getAttr(p);
+ switch (c.units) {
+ case NSVG_UNITS_USER: return c.value;
+ case NSVG_UNITS_PX: return c.value;
+ case NSVG_UNITS_PT: return c.value / 72.0f * p->dpi;
+ case NSVG_UNITS_PC: return c.value / 6.0f * p->dpi;
+ case NSVG_UNITS_MM: return c.value / 25.4f * p->dpi;
+ case NSVG_UNITS_CM: return c.value / 2.54f * p->dpi;
+ case NSVG_UNITS_IN: return c.value * p->dpi;
+ case NSVG_UNITS_EM: return c.value * attr->fontSize;
+ case NSVG_UNITS_EX: return c.value * attr->fontSize * 0.52f; /* x-height of Helvetica. */
+ case NSVG_UNITS_PERCENT: return orig + c.value / 100.0f * length;
+ default: return c.value;
+ }
+ return c.value;
+}
+
+static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
+{
+ NSVGgradientData* grad = p->gradients;
+ if (id == NULL || *id == '\0')
+ return NULL;
+ while (grad != NULL) {
+ if (strcmp(grad->id, id) == 0)
+ return grad;
+ grad = grad->next;
+ }
+ return NULL;
+}
+
+static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const float* localBounds, char* paintType)
+{
+ NSVGattrib* attr = nsvg__getAttr(p);
+ NSVGgradientData* data = NULL;
+ NSVGgradientData* ref = NULL;
+ NSVGgradientStop* stops = NULL;
+ NSVGgradient* grad;
+ float ox, oy, sw, sh, sl;
+ int nstops = 0;
+ int refIter;
+
+ data = nsvg__findGradientData(p, id);
+ if (data == NULL) return NULL;
+
+ /* TODO: use ref to fill in all unset values too. */
+ ref = data;
+ refIter = 0;
+ while (ref != NULL) {
+ NSVGgradientData* nextRef = NULL;
+ if (stops == NULL && ref->stops != NULL) {
+ stops = ref->stops;
+ nstops = ref->nstops;
+ break;
+ }
+ nextRef = nsvg__findGradientData(p, ref->ref);
+ if (nextRef == ref) break; /* prevent infite loops on malformed data */
+ ref = nextRef;
+ refIter++;
+ if (refIter > 32) break; /* prevent infite loops on malformed data */
+ }
+ if (stops == NULL) return NULL;
+
+ grad = (NSVGgradient*)NANOSVG_malloc(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1));
+ if (grad == NULL) return NULL;
+
+ /* The shape width and height. */
+ if (data->units == NSVG_OBJECT_SPACE) {
+ ox = localBounds[0];
+ oy = localBounds[1];
+ sw = localBounds[2] - localBounds[0];
+ sh = localBounds[3] - localBounds[1];
+ } else {
+ ox = nsvg__actualOrigX(p);
+ oy = nsvg__actualOrigY(p);
+ sw = nsvg__actualWidth(p);
+ sh = nsvg__actualHeight(p);
+ }
+ sl = sqrtf(sw*sw + sh*sh) / sqrtf(2.0f);
+
+ if (data->type == NSVG_PAINT_LINEAR_GRADIENT) {
+ float x1, y1, x2, y2, dx, dy;
+ x1 = nsvg__convertToPixels(p, data->linear.x1, ox, sw);
+ y1 = nsvg__convertToPixels(p, data->linear.y1, oy, sh);
+ x2 = nsvg__convertToPixels(p, data->linear.x2, ox, sw);
+ y2 = nsvg__convertToPixels(p, data->linear.y2, oy, sh);
+ /* Calculate transform aligned to the line */
+ dx = x2 - x1;
+ dy = y2 - y1;
+ grad->xform[0] = dy; grad->xform[1] = -dx;
+ grad->xform[2] = dx; grad->xform[3] = dy;
+ grad->xform[4] = x1; grad->xform[5] = y1;
+ } else {
+ float cx, cy, fx, fy, r;
+ cx = nsvg__convertToPixels(p, data->radial.cx, ox, sw);
+ cy = nsvg__convertToPixels(p, data->radial.cy, oy, sh);
+ fx = nsvg__convertToPixels(p, data->radial.fx, ox, sw);
+ fy = nsvg__convertToPixels(p, data->radial.fy, oy, sh);
+ r = nsvg__convertToPixels(p, data->radial.r, 0, sl);
+ /* Calculate transform aligned to the circle */
+ grad->xform[0] = r; grad->xform[1] = 0;
+ grad->xform[2] = 0; grad->xform[3] = r;
+ grad->xform[4] = cx; grad->xform[5] = cy;
+ grad->fx = fx / r;
+ grad->fy = fy / r;
+ }
+
+ nsvg__xformMultiply(grad->xform, data->xform);
+ nsvg__xformMultiply(grad->xform, attr->xform);
+
+ grad->spread = data->spread;
+ memcpy(grad->stops, stops, nstops*sizeof(NSVGgradientStop));
+ grad->nstops = nstops;
+
+ *paintType = data->type;
+
+ return grad;
+}
+
+static float nsvg__getAverageScale(float* t)
+{
+ float sx = sqrtf(t[0]*t[0] + t[2]*t[2]);
+ float sy = sqrtf(t[1]*t[1] + t[3]*t[3]);
+ return (sx + sy) * 0.5f;
+}
+
+static void nsvg__getLocalBounds(float* bounds, NSVGshape *shape, float* xform)
+{
+ NSVGpath* path;
+ float curve[4*2], curveBounds[4];
+ int i, first = 1;
+ for (path = shape->paths; path != NULL; path = path->next) {
+ nsvg__xformPoint(&curve[0], &curve[1], path->pts[0], path->pts[1], xform);
+ for (i = 0; i < path->npts-1; i += 3) {
+ nsvg__xformPoint(&curve[2], &curve[3], path->pts[(i+1)*2], path->pts[(i+1)*2+1], xform);
+ nsvg__xformPoint(&curve[4], &curve[5], path->pts[(i+2)*2], path->pts[(i+2)*2+1], xform);
+ nsvg__xformPoint(&curve[6], &curve[7], path->pts[(i+3)*2], path->pts[(i+3)*2+1], xform);
+ nsvg__curveBounds(curveBounds, curve);
+ if (first) {
+ bounds[0] = curveBounds[0];
+ bounds[1] = curveBounds[1];
+ bounds[2] = curveBounds[2];
+ bounds[3] = curveBounds[3];
+ first = 0;
+ } else {
+ bounds[0] = nsvg__minf(bounds[0], curveBounds[0]);
+ bounds[1] = nsvg__minf(bounds[1], curveBounds[1]);
+ bounds[2] = nsvg__maxf(bounds[2], curveBounds[2]);
+ bounds[3] = nsvg__maxf(bounds[3], curveBounds[3]);
+ }
+ curve[0] = curve[6];
+ curve[1] = curve[7];
+ }
+ }
+}
+
+static void nsvg__addShape(NSVGparser* p)
+{
+ NSVGattrib* attr = nsvg__getAttr(p);
+ float scale = 1.0f;
+ NSVGshape* shape;
+ NSVGpath* path;
+ int i;
+
+ if (p->plist == NULL)
+ return;
+
+ shape = (NSVGshape*)NANOSVG_malloc(sizeof(NSVGshape));
+ if (shape == NULL) goto error;
+ memset(shape, 0, sizeof(NSVGshape));
+
+ memcpy(shape->id, attr->id, sizeof shape->id);
+ scale = nsvg__getAverageScale(attr->xform);
+ shape->strokeWidth = attr->strokeWidth * scale;
+ shape->strokeDashOffset = attr->strokeDashOffset * scale;
+ shape->strokeDashCount = (char)attr->strokeDashCount;
+ for (i = 0; i < attr->strokeDashCount; i++)
+ shape->strokeDashArray[i] = attr->strokeDashArray[i] * scale;
+ shape->strokeLineJoin = attr->strokeLineJoin;
+ shape->strokeLineCap = attr->strokeLineCap;
+ shape->miterLimit = attr->miterLimit;
+ shape->fillRule = attr->fillRule;
+ shape->opacity = attr->opacity;
+
+ shape->paths = p->plist;
+ p->plist = NULL;
+
+ /* Calculate shape bounds */
+ shape->bounds[0] = shape->paths->bounds[0];
+ shape->bounds[1] = shape->paths->bounds[1];
+ shape->bounds[2] = shape->paths->bounds[2];
+ shape->bounds[3] = shape->paths->bounds[3];
+ for (path = shape->paths->next; path != NULL; path = path->next) {
+ shape->bounds[0] = nsvg__minf(shape->bounds[0], path->bounds[0]);
+ shape->bounds[1] = nsvg__minf(shape->bounds[1], path->bounds[1]);
+ shape->bounds[2] = nsvg__maxf(shape->bounds[2], path->bounds[2]);
+ shape->bounds[3] = nsvg__maxf(shape->bounds[3], path->bounds[3]);
+ }
+
+ /* Set fill */
+ if (attr->hasFill == 0) {
+ shape->fill.type = NSVG_PAINT_NONE;
+ } else if (attr->hasFill == 1) {
+ shape->fill.type = NSVG_PAINT_COLOR;
+ shape->fill.color = attr->fillColor;
+ shape->fill.color |= (unsigned int)(attr->fillOpacity*255) << 24;
+ } else if (attr->hasFill == 2) {
+ float inv[6], localBounds[4];
+ nsvg__xformInverse(inv, attr->xform);
+ nsvg__getLocalBounds(localBounds, shape, inv);
+ shape->fill.gradient = nsvg__createGradient(p, attr->fillGradient, localBounds, &shape->fill.type);
+ if (shape->fill.gradient == NULL) {
+ shape->fill.type = NSVG_PAINT_NONE;
+ }
+ }
+
+ /* Set stroke */
+ if (attr->hasStroke == 0) {
+ shape->stroke.type = NSVG_PAINT_NONE;
+ } else if (attr->hasStroke == 1) {
+ shape->stroke.type = NSVG_PAINT_COLOR;
+ shape->stroke.color = attr->strokeColor;
+ shape->stroke.color |= (unsigned int)(attr->strokeOpacity*255) << 24;
+ } else if (attr->hasStroke == 2) {
+ float inv[6], localBounds[4];
+ nsvg__xformInverse(inv, attr->xform);
+ nsvg__getLocalBounds(localBounds, shape, inv);
+ shape->stroke.gradient = nsvg__createGradient(p, attr->strokeGradient, localBounds, &shape->stroke.type);
+ if (shape->stroke.gradient == NULL)
+ shape->stroke.type = NSVG_PAINT_NONE;
+ }
+
+ /* Set flags */
+ shape->flags = ((attr->visible & NSVG_VIS_DISPLAY) && (attr->visible & NSVG_VIS_VISIBLE) ? NSVG_FLAGS_VISIBLE : 0x00);
+
+ /* Add to tail */
+ if (p->image->shapes == NULL)
+ p->image->shapes = shape;
+ else
+ p->shapesTail->next = shape;
+ p->shapesTail = shape;
+
+ return;
+
+error:
+ if (shape) NANOSVG_free(shape);
+}
+
+static void nsvg__addPath(NSVGparser* p, char closed)
+{
+ NSVGattrib* attr = nsvg__getAttr(p);
+ NSVGpath* path = NULL;
+ float bounds[4];
+ float* curve;
+ int i;
+
+ if (p->npts < 4)
+ return;
+
+ if (closed)
+ nsvg__lineTo(p, p->pts[0], p->pts[1]);
+
+ /* Expect 1 + N*3 points (N = number of cubic bezier segments). */
+ if ((p->npts % 3) != 1)
+ return;
+
+ path = (NSVGpath*)NANOSVG_malloc(sizeof(NSVGpath));
+ if (path == NULL) goto error;
+ memset(path, 0, sizeof(NSVGpath));
+
+ path->pts = (float*)NANOSVG_malloc(p->npts*2*sizeof(float));
+ if (path->pts == NULL) goto error;
+ path->closed = closed;
+ path->npts = p->npts;
+
+ /* Transform path. */
+ for (i = 0; i < p->npts; ++i)
+ nsvg__xformPoint(&path->pts[i*2], &path->pts[i*2+1], p->pts[i*2], p->pts[i*2+1], attr->xform);
+
+ /* Find bounds */
+ for (i = 0; i < path->npts-1; i += 3) {
+ curve = &path->pts[i*2];
+ nsvg__curveBounds(bounds, curve);
+ if (i == 0) {
+ path->bounds[0] = bounds[0];
+ path->bounds[1] = bounds[1];
+ path->bounds[2] = bounds[2];
+ path->bounds[3] = bounds[3];
+ } else {
+ path->bounds[0] = nsvg__minf(path->bounds[0], bounds[0]);
+ path->bounds[1] = nsvg__minf(path->bounds[1], bounds[1]);
+ path->bounds[2] = nsvg__maxf(path->bounds[2], bounds[2]);
+ path->bounds[3] = nsvg__maxf(path->bounds[3], bounds[3]);
+ }
+ }
+
+ path->next = p->plist;
+ p->plist = path;
+
+ return;
+
+error:
+ if (path != NULL) {
+ if (path->pts != NULL) NANOSVG_free(path->pts);
+ NANOSVG_free(path);
+ }
+}
+
+/* We roll our own string to float because the std library one uses locale and messes things up. */
+static double nsvg__atof(const char* s)
+{
+ char* cur = (char*)s;
+ char* end = NULL;
+ double res = 0.0, sign = 1.0;
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
+ __int64 intPart = 0, fracPart = 0;
+#else
+ long long intPart = 0, fracPart = 0;
+#endif
+ char hasIntPart = 0, hasFracPart = 0;
+
+ /* Parse optional sign */
+ if (*cur == '+') {
+ cur++;
+ } else if (*cur == '-') {
+ sign = -1;
+ cur++;
+ }
+
+ /* Parse integer part */
+ if (nsvg__isdigit(*cur)) {
+ /* Parse digit sequence */
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
+ intPart = strtol(cur, &end, 10);
+#else
+ intPart = strtoll(cur, &end, 10);
+#endif
+ if (cur != end) {
+ res = (double)intPart;
+ hasIntPart = 1;
+ cur = end;
+ }
+ }
+
+ /* Parse fractional part. */
+ if (*cur == '.') {
+ cur++; /* Skip '.' */
+ if (nsvg__isdigit(*cur)) {
+ /* Parse digit sequence */
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
+ fracPart = strtol(cur, &end, 10);
+#else
+ fracPart = strtoll(cur, &end, 10);
+#endif
+ if (cur != end) {
+ res += (double)fracPart / pow(10.0, (double)(end - cur));
+ hasFracPart = 1;
+ cur = end;
+ }
+ }
+ }
+
+ /* A valid number should have integer or fractional part. */
+ if (!hasIntPart && !hasFracPart)
+ return 0.0;
+
+ /* Parse optional exponent */
+ if (*cur == 'e' || *cur == 'E') {
+ int expPart = 0;
+ cur++; /* skip 'E' */
+ expPart = strtol(cur, &end, 10); /* Parse digit sequence with sign */
+ if (cur != end) {
+ res *= pow(10.0, (double)expPart);
+ }
+ }
+
+ return res * sign;
+}
+
+
+static const char* nsvg__parseNumber(const char* s, char* it, const int size)
+{
+ const int last = size-1;
+ int i = 0;
+
+ /* sign */
+ if (*s == '-' || *s == '+') {
+ if (i < last) it[i++] = *s;
+ s++;
+ }
+ /* integer part */
+ while (*s && nsvg__isdigit(*s)) {
+ if (i < last) it[i++] = *s;
+ s++;
+ }
+ if (*s == '.') {
+ /* decimal point */
+ if (i < last) it[i++] = *s;
+ s++;
+ /* fraction part */
+ while (*s && nsvg__isdigit(*s)) {
+ if (i < last) it[i++] = *s;
+ s++;
+ }
+ }
+ /* exponent */
+ if (*s == 'e' || *s == 'E') {
+ if (i < last) it[i++] = *s;
+ s++;
+ if (*s == '-' || *s == '+') {
+ if (i < last) it[i++] = *s;
+ s++;
+ }
+ while (*s && nsvg__isdigit(*s)) {
+ if (i < last) it[i++] = *s;
+ s++;
+ }
+ }
+ it[i] = '\0';
+
+ return s;
+}
+
+static const char* nsvg__getNextPathItem(const char* s, char* it)
+{
+ it[0] = '\0';
+ /* Skip white spaces and commas */
+ while (*s && (nsvg__isspace(*s) || *s == ',')) s++;
+ if (!*s) return s;
+ if (*s == '-' || *s == '+' || *s == '.' || nsvg__isdigit(*s)) {
+ s = nsvg__parseNumber(s, it, 64);
+ } else {
+ /* Parse command */
+ it[0] = *s++;
+ it[1] = '\0';
+ return s;
+ }
+
+ return s;
+}
+
+static unsigned int nsvg__parseColorHex(const char* str)
+{
+ unsigned int r=0, g=0, b=0;
+ if (sscanf(str, "#%2x%2x%2x", &r, &g, &b) == 3 ) /* 2 digit hex */
+ return NSVG_RGB(r, g, b);
+ if (sscanf(str, "#%1x%1x%1x", &r, &g, &b) == 3 ) /* 1 digit hex, e.g. #abc -> 0xccbbaa */
+ return NSVG_RGB(r*17, g*17, b*17); /* same effect as (r<<4|r), (g<<4|g), .. */
+ return NSVG_RGB(128, 128, 128);
+}
+
+static unsigned int nsvg__parseColorRGB(const char* str)
+{
+ unsigned int r=0, g=0, b=0;
+ if (sscanf(str, "rgb(%u, %u, %u)", &r, &g, &b) == 3) /* decimal integers */
+ return NSVG_RGB(r, g, b);
+ if (sscanf(str, "rgb(%u%%, %u%%, %u%%)", &r, &g, &b) == 3) /* decimal integer percentage */
+ return NSVG_RGB(r*255/100, g*255/100, b*255/100);
+ return NSVG_RGB(128, 128, 128);
+}
+
+typedef struct NSVGNamedColor {
+ const char* name;
+ unsigned int color;
+} NSVGNamedColor;
+
+NSVGNamedColor nsvg__colors[] = {
+
+ { "red", NSVG_RGB(255, 0, 0) },
+ { "green", NSVG_RGB( 0, 128, 0) },
+ { "blue", NSVG_RGB( 0, 0, 255) },
+ { "yellow", NSVG_RGB(255, 255, 0) },
+ { "cyan", NSVG_RGB( 0, 255, 255) },
+ { "magenta", NSVG_RGB(255, 0, 255) },
+ { "black", NSVG_RGB( 0, 0, 0) },
+ { "grey", NSVG_RGB(128, 128, 128) },
+ { "gray", NSVG_RGB(128, 128, 128) },
+ { "white", NSVG_RGB(255, 255, 255) },
+
+#ifdef NANOSVG_ALL_COLOR_KEYWORDS
+ { "aliceblue", NSVG_RGB(240, 248, 255) },
+ { "antiquewhite", NSVG_RGB(250, 235, 215) },
+ { "aqua", NSVG_RGB( 0, 255, 255) },
+ { "aquamarine", NSVG_RGB(127, 255, 212) },
+ { "azure", NSVG_RGB(240, 255, 255) },
+ { "beige", NSVG_RGB(245, 245, 220) },
+ { "bisque", NSVG_RGB(255, 228, 196) },
+ { "blanchedalmond", NSVG_RGB(255, 235, 205) },
+ { "blueviolet", NSVG_RGB(138, 43, 226) },
+ { "brown", NSVG_RGB(165, 42, 42) },
+ { "burlywood", NSVG_RGB(222, 184, 135) },
+ { "cadetblue", NSVG_RGB( 95, 158, 160) },
+ { "chartreuse", NSVG_RGB(127, 255, 0) },
+ { "chocolate", NSVG_RGB(210, 105, 30) },
+ { "coral", NSVG_RGB(255, 127, 80) },
+ { "cornflowerblue", NSVG_RGB(100, 149, 237) },
+ { "cornsilk", NSVG_RGB(255, 248, 220) },
+ { "crimson", NSVG_RGB(220, 20, 60) },
+ { "darkblue", NSVG_RGB( 0, 0, 139) },
+ { "darkcyan", NSVG_RGB( 0, 139, 139) },
+ { "darkgoldenrod", NSVG_RGB(184, 134, 11) },
+ { "darkgray", NSVG_RGB(169, 169, 169) },
+ { "darkgreen", NSVG_RGB( 0, 100, 0) },
+ { "darkgrey", NSVG_RGB(169, 169, 169) },
+ { "darkkhaki", NSVG_RGB(189, 183, 107) },
+ { "darkmagenta", NSVG_RGB(139, 0, 139) },
+ { "darkolivegreen", NSVG_RGB( 85, 107, 47) },
+ { "darkorange", NSVG_RGB(255, 140, 0) },
+ { "darkorchid", NSVG_RGB(153, 50, 204) },
+ { "darkred", NSVG_RGB(139, 0, 0) },
+ { "darksalmon", NSVG_RGB(233, 150, 122) },
+ { "darkseagreen", NSVG_RGB(143, 188, 143) },
+ { "darkslateblue", NSVG_RGB( 72, 61, 139) },
+ { "darkslategray", NSVG_RGB( 47, 79, 79) },
+ { "darkslategrey", NSVG_RGB( 47, 79, 79) },
+ { "darkturquoise", NSVG_RGB( 0, 206, 209) },
+ { "darkviolet", NSVG_RGB(148, 0, 211) },
+ { "deeppink", NSVG_RGB(255, 20, 147) },
+ { "deepskyblue", NSVG_RGB( 0, 191, 255) },
+ { "dimgray", NSVG_RGB(105, 105, 105) },
+ { "dimgrey", NSVG_RGB(105, 105, 105) },
+ { "dodgerblue", NSVG_RGB( 30, 144, 255) },
+ { "firebrick", NSVG_RGB(178, 34, 34) },
+ { "floralwhite", NSVG_RGB(255, 250, 240) },
+ { "forestgreen", NSVG_RGB( 34, 139, 34) },
+ { "fuchsia", NSVG_RGB(255, 0, 255) },
+ { "gainsboro", NSVG_RGB(220, 220, 220) },
+ { "ghostwhite", NSVG_RGB(248, 248, 255) },
+ { "gold", NSVG_RGB(255, 215, 0) },
+ { "goldenrod", NSVG_RGB(218, 165, 32) },
+ { "greenyellow", NSVG_RGB(173, 255, 47) },
+ { "honeydew", NSVG_RGB(240, 255, 240) },
+ { "hotpink", NSVG_RGB(255, 105, 180) },
+ { "indianred", NSVG_RGB(205, 92, 92) },
+ { "indigo", NSVG_RGB( 75, 0, 130) },
+ { "ivory", NSVG_RGB(255, 255, 240) },
+ { "khaki", NSVG_RGB(240, 230, 140) },
+ { "lavender", NSVG_RGB(230, 230, 250) },
+ { "lavenderblush", NSVG_RGB(255, 240, 245) },
+ { "lawngreen", NSVG_RGB(124, 252, 0) },
+ { "lemonchiffon", NSVG_RGB(255, 250, 205) },
+ { "lightblue", NSVG_RGB(173, 216, 230) },
+ { "lightcoral", NSVG_RGB(240, 128, 128) },
+ { "lightcyan", NSVG_RGB(224, 255, 255) },
+ { "lightgoldenrodyellow", NSVG_RGB(250, 250, 210) },
+ { "lightgray", NSVG_RGB(211, 211, 211) },
+ { "lightgreen", NSVG_RGB(144, 238, 144) },
+ { "lightgrey", NSVG_RGB(211, 211, 211) },
+ { "lightpink", NSVG_RGB(255, 182, 193) },
+ { "lightsalmon", NSVG_RGB(255, 160, 122) },
+ { "lightseagreen", NSVG_RGB( 32, 178, 170) },
+ { "lightskyblue", NSVG_RGB(135, 206, 250) },
+ { "lightslategray", NSVG_RGB(119, 136, 153) },
+ { "lightslategrey", NSVG_RGB(119, 136, 153) },
+ { "lightsteelblue", NSVG_RGB(176, 196, 222) },
+ { "lightyellow", NSVG_RGB(255, 255, 224) },
+ { "lime", NSVG_RGB( 0, 255, 0) },
+ { "limegreen", NSVG_RGB( 50, 205, 50) },
+ { "linen", NSVG_RGB(250, 240, 230) },
+ { "maroon", NSVG_RGB(128, 0, 0) },
+ { "mediumaquamarine", NSVG_RGB(102, 205, 170) },
+ { "mediumblue", NSVG_RGB( 0, 0, 205) },
+ { "mediumorchid", NSVG_RGB(186, 85, 211) },
+ { "mediumpurple", NSVG_RGB(147, 112, 219) },
+ { "mediumseagreen", NSVG_RGB( 60, 179, 113) },
+ { "mediumslateblue", NSVG_RGB(123, 104, 238) },
+ { "mediumspringgreen", NSVG_RGB( 0, 250, 154) },
+ { "mediumturquoise", NSVG_RGB( 72, 209, 204) },
+ { "mediumvioletred", NSVG_RGB(199, 21, 133) },
+ { "midnightblue", NSVG_RGB( 25, 25, 112) },
+ { "mintcream", NSVG_RGB(245, 255, 250) },
+ { "mistyrose", NSVG_RGB(255, 228, 225) },
+ { "moccasin", NSVG_RGB(255, 228, 181) },
+ { "navajowhite", NSVG_RGB(255, 222, 173) },
+ { "navy", NSVG_RGB( 0, 0, 128) },
+ { "oldlace", NSVG_RGB(253, 245, 230) },
+ { "olive", NSVG_RGB(128, 128, 0) },
+ { "olivedrab", NSVG_RGB(107, 142, 35) },
+ { "orange", NSVG_RGB(255, 165, 0) },
+ { "orangered", NSVG_RGB(255, 69, 0) },
+ { "orchid", NSVG_RGB(218, 112, 214) },
+ { "palegoldenrod", NSVG_RGB(238, 232, 170) },
+ { "palegreen", NSVG_RGB(152, 251, 152) },
+ { "paleturquoise", NSVG_RGB(175, 238, 238) },
+ { "palevioletred", NSVG_RGB(219, 112, 147) },
+ { "papayawhip", NSVG_RGB(255, 239, 213) },
+ { "peachpuff", NSVG_RGB(255, 218, 185) },
+ { "peru", NSVG_RGB(205, 133, 63) },
+ { "pink", NSVG_RGB(255, 192, 203) },
+ { "plum", NSVG_RGB(221, 160, 221) },
+ { "powderblue", NSVG_RGB(176, 224, 230) },
+ { "purple", NSVG_RGB(128, 0, 128) },
+ { "rosybrown", NSVG_RGB(188, 143, 143) },
+ { "royalblue", NSVG_RGB( 65, 105, 225) },
+ { "saddlebrown", NSVG_RGB(139, 69, 19) },
+ { "salmon", NSVG_RGB(250, 128, 114) },
+ { "sandybrown", NSVG_RGB(244, 164, 96) },
+ { "seagreen", NSVG_RGB( 46, 139, 87) },
+ { "seashell", NSVG_RGB(255, 245, 238) },
+ { "sienna", NSVG_RGB(160, 82, 45) },
+ { "silver", NSVG_RGB(192, 192, 192) },
+ { "skyblue", NSVG_RGB(135, 206, 235) },
+ { "slateblue", NSVG_RGB(106, 90, 205) },
+ { "slategray", NSVG_RGB(112, 128, 144) },
+ { "slategrey", NSVG_RGB(112, 128, 144) },
+ { "snow", NSVG_RGB(255, 250, 250) },
+ { "springgreen", NSVG_RGB( 0, 255, 127) },
+ { "steelblue", NSVG_RGB( 70, 130, 180) },
+ { "tan", NSVG_RGB(210, 180, 140) },
+ { "teal", NSVG_RGB( 0, 128, 128) },
+ { "thistle", NSVG_RGB(216, 191, 216) },
+ { "tomato", NSVG_RGB(255, 99, 71) },
+ { "turquoise", NSVG_RGB( 64, 224, 208) },
+ { "violet", NSVG_RGB(238, 130, 238) },
+ { "wheat", NSVG_RGB(245, 222, 179) },
+ { "whitesmoke", NSVG_RGB(245, 245, 245) },
+ { "yellowgreen", NSVG_RGB(154, 205, 50) },
+#endif
+};
+
+static unsigned int nsvg__parseColorName(const char* str)
+{
+ int i, ncolors = sizeof(nsvg__colors) / sizeof(NSVGNamedColor);
+
+ for (i = 0; i < ncolors; i++) {
+ if (strcmp(nsvg__colors[i].name, str) == 0) {
+ return nsvg__colors[i].color;
+ }
+ }
+
+ return NSVG_RGB(128, 128, 128);
+}
+
+static unsigned int nsvg__parseColor(const char* str)
+{
+ size_t len = 0;
+ while(*str == ' ') ++str;
+ len = strlen(str);
+ if (len >= 1 && *str == '#')
+ return nsvg__parseColorHex(str);
+ else if (len >= 4 && str[0] == 'r' && str[1] == 'g' && str[2] == 'b' && str[3] == '(')
+ return nsvg__parseColorRGB(str);
+ return nsvg__parseColorName(str);
+}
+
+static float nsvg__parseOpacity(const char* str)
+{
+ float val = 0;
+ sscanf(str, "%f", &val);
+ if (val < 0.0f) val = 0.0f;
+ if (val > 1.0f) val = 1.0f;
+ return val;
+}
+
+static float nsvg__parseMiterLimit(const char* str)
+{
+ float val = 0;
+ sscanf(str, "%f", &val);
+ if (val < 0.0f) val = 0.0f;
+ return val;
+}
+
+static int nsvg__parseUnits(const char* units)
+{
+ if (units[0] == 'p' && units[1] == 'x')
+ return NSVG_UNITS_PX;
+ else if (units[0] == 'p' && units[1] == 't')
+ return NSVG_UNITS_PT;
+ else if (units[0] == 'p' && units[1] == 'c')
+ return NSVG_UNITS_PC;
+ else if (units[0] == 'm' && units[1] == 'm')
+ return NSVG_UNITS_MM;
+ else if (units[0] == 'c' && units[1] == 'm')
+ return NSVG_UNITS_CM;
+ else if (units[0] == 'i' && units[1] == 'n')
+ return NSVG_UNITS_IN;
+ else if (units[0] == '%')
+ return NSVG_UNITS_PERCENT;
+ else if (units[0] == 'e' && units[1] == 'm')
+ return NSVG_UNITS_EM;
+ else if (units[0] == 'e' && units[1] == 'x')
+ return NSVG_UNITS_EX;
+ return NSVG_UNITS_USER;
+}
+
+static int nsvg__isCoordinate(const char* s)
+{
+ /* optional sign */
+ if (*s == '-' || *s == '+')
+ s++;
+ /* must have at least one digit, or start by a dot */
+ return (nsvg__isdigit(*s) || *s == '.');
+}
+
+static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str)
+{
+ NSVGcoordinate coord = {0, NSVG_UNITS_USER};
+ char units[32]="";
+ sscanf(str, "%f%s", &coord.value, units);
+ coord.units = nsvg__parseUnits(units);
+ return coord;
+}
+
+static NSVGcoordinate nsvg__coord(float v, int units)
+{
+ NSVGcoordinate coord = {v, units};
+ return coord;
+}
+
+static float nsvg__parseCoordinate(NSVGparser* p, const char* str, float orig, float length)
+{
+ NSVGcoordinate coord = nsvg__parseCoordinateRaw(str);
+ return nsvg__convertToPixels(p, coord, orig, length);
+}
+
+static int nsvg__parseTransformArgs(const char* str, float* args, int maxNa, int* na)
+{
+ const char* end;
+ const char* ptr;
+ char it[64];
+
+ *na = 0;
+ ptr = str;
+ while (*ptr && *ptr != '(') ++ptr;
+ if (*ptr == 0)
+ return 1;
+ end = ptr;
+ while (*end && *end != ')') ++end;
+ if (*end == 0)
+ return 1;
+
+ while (ptr < end) {
+ if (*ptr == '-' || *ptr == '+' || *ptr == '.' || nsvg__isdigit(*ptr)) {
+ if (*na >= maxNa) return 0;
+ ptr = nsvg__parseNumber(ptr, it, 64);
+ args[(*na)++] = (float)nsvg__atof(it);
+ } else {
+ ++ptr;
+ }
+ }
+ return (int)(end - str);
+}
+
+
+static int nsvg__parseMatrix(float* xform, const char* str)
+{
+ float t[6];
+ int na = 0;
+ int len = nsvg__parseTransformArgs(str, t, 6, &na);
+ if (na != 6) return len;
+ memcpy(xform, t, sizeof(float)*6);
+ return len;
+}
+
+static int nsvg__parseTranslate(float* xform, const char* str)
+{
+ float args[2];
+ float t[6];
+ int na = 0;
+ int len = nsvg__parseTransformArgs(str, args, 2, &na);
+ if (na == 1) args[1] = 0.0;
+
+ nsvg__xformSetTranslation(t, args[0], args[1]);
+ memcpy(xform, t, sizeof(float)*6);
+ return len;
+}
+
+static int nsvg__parseScale(float* xform, const char* str)
+{
+ float args[2];
+ int na = 0;
+ float t[6];
+ int len = nsvg__parseTransformArgs(str, args, 2, &na);
+ if (na == 1) args[1] = args[0];
+ nsvg__xformSetScale(t, args[0], args[1]);
+ memcpy(xform, t, sizeof(float)*6);
+ return len;
+}
+
+static int nsvg__parseSkewX(float* xform, const char* str)
+{
+ float args[1];
+ int na = 0;
+ float t[6];
+ int len = nsvg__parseTransformArgs(str, args, 1, &na);
+ nsvg__xformSetSkewX(t, args[0]/180.0f*NSVG_PI);
+ memcpy(xform, t, sizeof(float)*6);
+ return len;
+}
+
+static int nsvg__parseSkewY(float* xform, const char* str)
+{
+ float args[1];
+ int na = 0;
+ float t[6];
+ int len = nsvg__parseTransformArgs(str, args, 1, &na);
+ nsvg__xformSetSkewY(t, args[0]/180.0f*NSVG_PI);
+ memcpy(xform, t, sizeof(float)*6);
+ return len;
+}
+
+static int nsvg__parseRotate(float* xform, const char* str)
+{
+ float args[3];
+ int na = 0;
+ float m[6];
+ float t[6];
+ int len = nsvg__parseTransformArgs(str, args, 3, &na);
+ if (na == 1)
+ args[1] = args[2] = 0.0f;
+ nsvg__xformIdentity(m);
+
+ if (na > 1) {
+ nsvg__xformSetTranslation(t, -args[1], -args[2]);
+ nsvg__xformMultiply(m, t);
+ }
+
+ nsvg__xformSetRotation(t, args[0]/180.0f*NSVG_PI);
+ nsvg__xformMultiply(m, t);
+
+ if (na > 1) {
+ nsvg__xformSetTranslation(t, args[1], args[2]);
+ nsvg__xformMultiply(m, t);
+ }
+
+ memcpy(xform, m, sizeof(float)*6);
+
+ return len;
+}
+
+static void nsvg__parseTransform(float* xform, const char* str)
+{
+ float t[6];
+ int len;
+ nsvg__xformIdentity(xform);
+ while (*str)
+ {
+ if (strncmp(str, "matrix", 6) == 0)
+ len = nsvg__parseMatrix(t, str);
+ else if (strncmp(str, "translate", 9) == 0)
+ len = nsvg__parseTranslate(t, str);
+ else if (strncmp(str, "scale", 5) == 0)
+ len = nsvg__parseScale(t, str);
+ else if (strncmp(str, "rotate", 6) == 0)
+ len = nsvg__parseRotate(t, str);
+ else if (strncmp(str, "skewX", 5) == 0)
+ len = nsvg__parseSkewX(t, str);
+ else if (strncmp(str, "skewY", 5) == 0)
+ len = nsvg__parseSkewY(t, str);
+ else{
+ ++str;
+ continue;
+ }
+ if (len != 0) {
+ str += len;
+ } else {
+ ++str;
+ continue;
+ }
+
+ nsvg__xformPremultiply(xform, t);
+ }
+}
+
+static void nsvg__parseUrl(char* id, const char* str)
+{
+ int i = 0;
+ str += 4; /* "url("; */
+ if (*str == '#')
+ str++;
+ while (i < 63 && *str != ')') {
+ id[i] = *str++;
+ i++;
+ }
+ id[i] = '\0';
+}
+
+static char nsvg__parseLineCap(const char* str)
+{
+ if (strcmp(str, "butt") == 0)
+ return NSVG_CAP_BUTT;
+ else if (strcmp(str, "round") == 0)
+ return NSVG_CAP_ROUND;
+ else if (strcmp(str, "square") == 0)
+ return NSVG_CAP_SQUARE;
+ /* TODO: handle inherit. */
+ return NSVG_CAP_BUTT;
+}
+
+static char nsvg__parseLineJoin(const char* str)
+{
+ if (strcmp(str, "miter") == 0)
+ return NSVG_JOIN_MITER;
+ else if (strcmp(str, "round") == 0)
+ return NSVG_JOIN_ROUND;
+ else if (strcmp(str, "bevel") == 0)
+ return NSVG_JOIN_BEVEL;
+ /* TODO: handle inherit. */
+ return NSVG_JOIN_MITER;
+}
+
+static char nsvg__parseFillRule(const char* str)
+{
+ if (strcmp(str, "nonzero") == 0)
+ return NSVG_FILLRULE_NONZERO;
+ else if (strcmp(str, "evenodd") == 0)
+ return NSVG_FILLRULE_EVENODD;
+ /* TODO: handle inherit. */
+ return NSVG_FILLRULE_NONZERO;
+}
+
+static const char* nsvg__getNextDashItem(const char* s, char* it)
+{
+ int n = 0;
+ it[0] = '\0';
+ /* Skip white spaces and commas */
+ while (*s && (nsvg__isspace(*s) || *s == ',')) s++;
+ /* Advance until whitespace, comma or end. */
+ while (*s && (!nsvg__isspace(*s) && *s != ',')) {
+ if (n < 63)
+ it[n++] = *s;
+ s++;
+ }
+ it[n++] = '\0';
+ return s;
+}
+
+static int nsvg__parseStrokeDashArray(NSVGparser* p, const char* str, float* strokeDashArray)
+{
+ char item[64];
+ int count = 0, i;
+ float sum = 0.0f;
+
+ /* Handle "none" */
+ if (str[0] == 'n')
+ return 0;
+
+ /* Parse dashes */
+ while (*str) {
+ str = nsvg__getNextDashItem(str, item);
+ if (!*item) break;
+ if (count < NSVG_MAX_DASHES)
+ strokeDashArray[count++] = fabsf(nsvg__parseCoordinate(p, item, 0.0f, nsvg__actualLength(p)));
+ }
+
+ for (i = 0; i < count; i++)
+ sum += strokeDashArray[i];
+ if (sum <= 1e-6f)
+ count = 0;
+
+ return count;
+}
+
+static void nsvg__parseStyle(NSVGparser* p, const char* str);
+
+static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
+{
+ float xform[6];
+ NSVGattrib* attr = nsvg__getAttr(p);
+ if (!attr) return 0;
+
+ if (strcmp(name, "style") == 0) {
+ nsvg__parseStyle(p, value);
+ } else if (strcmp(name, "display") == 0) {
+ if (strcmp(value, "none") == 0)
+ attr->visible &= ~NSVG_VIS_DISPLAY;
+ /* Don't reset ->visible on display:inline, one display:none hides the whole subtree */
+
+ } else if (strcmp(name, "visibility") == 0) {
+ if (strcmp(value, "hidden") == 0) {
+ attr->visible &= ~NSVG_VIS_VISIBLE;
+ } else if (strcmp(value, "visible") == 0) {
+ attr->visible |= NSVG_VIS_VISIBLE;
+ }
+ } else if (strcmp(name, "fill") == 0) {
+ if (strcmp(value, "none") == 0) {
+ attr->hasFill = 0;
+ } else if (strncmp(value, "url(", 4) == 0) {
+ attr->hasFill = 2;
+ nsvg__parseUrl(attr->fillGradient, value);
+ } else {
+ attr->hasFill = 1;
+ attr->fillColor = nsvg__parseColor(value);
+ }
+ } else if (strcmp(name, "opacity") == 0) {
+ attr->opacity = nsvg__parseOpacity(value);
+ } else if (strcmp(name, "fill-opacity") == 0) {
+ attr->fillOpacity = nsvg__parseOpacity(value);
+ } else if (strcmp(name, "stroke") == 0) {
+ if (strcmp(value, "none") == 0) {
+ attr->hasStroke = 0;
+ } else if (strncmp(value, "url(", 4) == 0) {
+ attr->hasStroke = 2;
+ nsvg__parseUrl(attr->strokeGradient, value);
+ } else {
+ attr->hasStroke = 1;
+ attr->strokeColor = nsvg__parseColor(value);
+ }
+ } else if (strcmp(name, "stroke-width") == 0) {
+ attr->strokeWidth = nsvg__parseCoordinate(p, value, 0.0f, nsvg__actualLength(p));
+ } else if (strcmp(name, "stroke-dasharray") == 0) {
+ attr->strokeDashCount = nsvg__parseStrokeDashArray(p, value, attr->strokeDashArray);
+ } else if (strcmp(name, "stroke-dashoffset") == 0) {
+ attr->strokeDashOffset = nsvg__parseCoordinate(p, value, 0.0f, nsvg__actualLength(p));
+ } else if (strcmp(name, "stroke-opacity") == 0) {
+ attr->strokeOpacity = nsvg__parseOpacity(value);
+ } else if (strcmp(name, "stroke-linecap") == 0) {
+ attr->strokeLineCap = nsvg__parseLineCap(value);
+ } else if (strcmp(name, "stroke-linejoin") == 0) {
+ attr->strokeLineJoin = nsvg__parseLineJoin(value);
+ } else if (strcmp(name, "stroke-miterlimit") == 0) {
+ attr->miterLimit = nsvg__parseMiterLimit(value);
+ } else if (strcmp(name, "fill-rule") == 0) {
+ attr->fillRule = nsvg__parseFillRule(value);
+ } else if (strcmp(name, "font-size") == 0) {
+ attr->fontSize = nsvg__parseCoordinate(p, value, 0.0f, nsvg__actualLength(p));
+ } else if (strcmp(name, "transform") == 0) {
+ nsvg__parseTransform(xform, value);
+ nsvg__xformPremultiply(attr->xform, xform);
+ } else if (strcmp(name, "stop-color") == 0) {
+ attr->stopColor = nsvg__parseColor(value);
+ } else if (strcmp(name, "stop-opacity") == 0) {
+ attr->stopOpacity = nsvg__parseOpacity(value);
+ } else if (strcmp(name, "offset") == 0) {
+ attr->stopOffset = nsvg__parseCoordinate(p, value, 0.0f, 1.0f);
+ } else if (strcmp(name, "id") == 0) {
+ strncpy(attr->id, value, 63);
+ attr->id[63] = '\0';
+ } else if (strcmp(name, "class") == 0) {
+ NSVGstyles* style = p->styles;
+ while (style) {
+ if (strcmp(style->name + 1, value) == 0) {
+ break;
+ }
+ style = style->next;
+ }
+ if (style) {
+ nsvg__parseStyle(p, style->description);
+ }
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+static int nsvg__parseNameValue(NSVGparser* p, const char* start, const char* end)
+{
+ const char* str;
+ const char* val;
+ char name[512];
+ char value[512];
+ int n;
+
+ str = start;
+ while (str < end && *str != ':') ++str;
+
+ val = str;
+
+ /* Right Trim */
+ while (str > start && (*str == ':' || nsvg__isspace(*str))) --str;
+ ++str;
+
+ n = (int)(str - start);
+ if (n > 511) n = 511;
+ if (n) memcpy(name, start, n);
+ name[n] = 0;
+
+ while (val < end && (*val == ':' || nsvg__isspace(*val))) ++val;
+
+ n = (int)(end - val);
+ if (n > 511) n = 511;
+ if (n) memcpy(value, val, n);
+ value[n] = 0;
+
+ return nsvg__parseAttr(p, name, value);
+}
+
+static void nsvg__parseStyle(NSVGparser* p, const char* str)
+{
+ const char* start;
+ const char* end;
+
+ while (*str) {
+ /* Left Trim */
+ while(*str && nsvg__isspace(*str)) ++str;
+ start = str;
+ while(*str && *str != ';') ++str;
+ end = str;
+
+ /* Right Trim */
+ while (end > start && (*end == ';' || nsvg__isspace(*end))) --end;
+ ++end;
+
+ nsvg__parseNameValue(p, start, end);
+ if (*str) ++str;
+ }
+}
+
+static void nsvg__parseAttribs(NSVGparser* p, const char** attr)
+{
+ int i;
+ for (i = 0; attr[i]; i += 2)
+ {
+ if (strcmp(attr[i], "style") == 0)
+ nsvg__parseStyle(p, attr[i + 1]);
+ else
+ nsvg__parseAttr(p, attr[i], attr[i + 1]);
+ }
+}
+
+static int nsvg__getArgsPerElement(char cmd)
+{
+ switch (cmd) {
+ case 'v':
+ case 'V':
+ case 'h':
+ case 'H':
+ return 1;
+ case 'm':
+ case 'M':
+ case 'l':
+ case 'L':
+ case 't':
+ case 'T':
+ return 2;
+ case 'q':
+ case 'Q':
+ case 's':
+ case 'S':
+ return 4;
+ case 'c':
+ case 'C':
+ return 6;
+ case 'a':
+ case 'A':
+ return 7;
+ case 'z':
+ case 'Z':
+ return 0;
+ }
+ return -1;
+}
+
+static void nsvg__pathMoveTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
+{
+ if (rel) {
+ *cpx += args[0];
+ *cpy += args[1];
+ } else {
+ *cpx = args[0];
+ *cpy = args[1];
+ }
+ nsvg__moveTo(p, *cpx, *cpy);
+}
+
+static void nsvg__pathLineTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
+{
+ if (rel) {
+ *cpx += args[0];
+ *cpy += args[1];
+ } else {
+ *cpx = args[0];
+ *cpy = args[1];
+ }
+ nsvg__lineTo(p, *cpx, *cpy);
+}
+
+static void nsvg__pathHLineTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
+{
+ if (rel)
+ *cpx += args[0];
+ else
+ *cpx = args[0];
+ nsvg__lineTo(p, *cpx, *cpy);
+}
+
+static void nsvg__pathVLineTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
+{
+ if (rel)
+ *cpy += args[0];
+ else
+ *cpy = args[0];
+ nsvg__lineTo(p, *cpx, *cpy);
+}
+
+static void nsvg__pathCubicBezTo(NSVGparser* p, float* cpx, float* cpy,
+ float* cpx2, float* cpy2, float* args, int rel)
+{
+ float x2, y2, cx1, cy1, cx2, cy2;
+
+ if (rel) {
+ cx1 = *cpx + args[0];
+ cy1 = *cpy + args[1];
+ cx2 = *cpx + args[2];
+ cy2 = *cpy + args[3];
+ x2 = *cpx + args[4];
+ y2 = *cpy + args[5];
+ } else {
+ cx1 = args[0];
+ cy1 = args[1];
+ cx2 = args[2];
+ cy2 = args[3];
+ x2 = args[4];
+ y2 = args[5];
+ }
+
+ nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2);
+
+ *cpx2 = cx2;
+ *cpy2 = cy2;
+ *cpx = x2;
+ *cpy = y2;
+}
+
+static void nsvg__pathCubicBezShortTo(NSVGparser* p, float* cpx, float* cpy,
+ float* cpx2, float* cpy2, float* args, int rel)
+{
+ float x1, y1, x2, y2, cx1, cy1, cx2, cy2;
+
+ x1 = *cpx;
+ y1 = *cpy;
+ if (rel) {
+ cx2 = *cpx + args[0];
+ cy2 = *cpy + args[1];
+ x2 = *cpx + args[2];
+ y2 = *cpy + args[3];
+ } else {
+ cx2 = args[0];
+ cy2 = args[1];
+ x2 = args[2];
+ y2 = args[3];
+ }
+
+ cx1 = 2*x1 - *cpx2;
+ cy1 = 2*y1 - *cpy2;
+
+ nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2);
+
+ *cpx2 = cx2;
+ *cpy2 = cy2;
+ *cpx = x2;
+ *cpy = y2;
+}
+
+static void nsvg__pathQuadBezTo(NSVGparser* p, float* cpx, float* cpy,
+ float* cpx2, float* cpy2, float* args, int rel)
+{
+ float x1, y1, x2, y2, cx, cy;
+ float cx1, cy1, cx2, cy2;
+
+ x1 = *cpx;
+ y1 = *cpy;
+ if (rel) {
+ cx = *cpx + args[0];
+ cy = *cpy + args[1];
+ x2 = *cpx + args[2];
+ y2 = *cpy + args[3];
+ } else {
+ cx = args[0];
+ cy = args[1];
+ x2 = args[2];
+ y2 = args[3];
+ }
+
+ /* Convert to cubic bezier */
+ cx1 = x1 + 2.0f/3.0f*(cx - x1);
+ cy1 = y1 + 2.0f/3.0f*(cy - y1);
+ cx2 = x2 + 2.0f/3.0f*(cx - x2);
+ cy2 = y2 + 2.0f/3.0f*(cy - y2);
+
+ nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2);
+
+ *cpx2 = cx;
+ *cpy2 = cy;
+ *cpx = x2;
+ *cpy = y2;
+}
+
+static void nsvg__pathQuadBezShortTo(NSVGparser* p, float* cpx, float* cpy,
+ float* cpx2, float* cpy2, float* args, int rel)
+{
+ float x1, y1, x2, y2, cx, cy;
+ float cx1, cy1, cx2, cy2;
+
+ x1 = *cpx;
+ y1 = *cpy;
+ if (rel) {
+ x2 = *cpx + args[0];
+ y2 = *cpy + args[1];
+ } else {
+ x2 = args[0];
+ y2 = args[1];
+ }
+
+ cx = 2*x1 - *cpx2;
+ cy = 2*y1 - *cpy2;
+
+ /* Convert to cubix bezier */
+ cx1 = x1 + 2.0f/3.0f*(cx - x1);
+ cy1 = y1 + 2.0f/3.0f*(cy - y1);
+ cx2 = x2 + 2.0f/3.0f*(cx - x2);
+ cy2 = y2 + 2.0f/3.0f*(cy - y2);
+
+ nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2);
+
+ *cpx2 = cx;
+ *cpy2 = cy;
+ *cpx = x2;
+ *cpy = y2;
+}
+
+static float nsvg__sqr(float x) { return x*x; }
+static float nsvg__vmag(float x, float y) { return sqrtf(x*x + y*y); }
+
+static float nsvg__vecrat(float ux, float uy, float vx, float vy)
+{
+ return (ux*vx + uy*vy) / (nsvg__vmag(ux,uy) * nsvg__vmag(vx,vy));
+}
+
+static float nsvg__vecang(float ux, float uy, float vx, float vy)
+{
+ float r = nsvg__vecrat(ux,uy, vx,vy);
+ if (r < -1.0f) r = -1.0f;
+ if (r > 1.0f) r = 1.0f;
+ return ((ux*vy < uy*vx) ? -1.0f : 1.0f) * acosf(r);
+}
+
+static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
+{
+ /* Ported from canvg (https://code.google.com/p/canvg/) */
+ float rx, ry, rotx;
+ float x1, y1, x2, y2, cx, cy, dx, dy, d;
+ float x1p, y1p, cxp, cyp, s, sa, sb;
+ float ux, uy, vx, vy, a1, da;
+ float x, y, tanx, tany, a, px = 0, py = 0, ptanx = 0, ptany = 0, t[6];
+ float sinrx, cosrx;
+ int fa, fs;
+ int i, ndivs;
+ float hda, kappa;
+
+ rx = fabsf(args[0]); /* y radius */
+ ry = fabsf(args[1]); /* x radius */
+ rotx = args[2] / 180.0f * NSVG_PI; /* x rotation angle */
+ fa = fabsf(args[3]) > 1e-6 ? 1 : 0; /* Large arc */
+ fs = fabsf(args[4]) > 1e-6 ? 1 : 0; /* Sweep direction */
+ x1 = *cpx; /* start point */
+ y1 = *cpy;
+ if (rel) { /* end point */
+ x2 = *cpx + args[5];
+ y2 = *cpy + args[6];
+ } else {
+ x2 = args[5];
+ y2 = args[6];
+ }
+
+ dx = x1 - x2;
+ dy = y1 - y2;
+ d = sqrtf(dx*dx + dy*dy);
+ if (d < 1e-6f || rx < 1e-6f || ry < 1e-6f) {
+ /* The arc degenerates to a line */
+ nsvg__lineTo(p, x2, y2);
+ *cpx = x2;
+ *cpy = y2;
+ return;
+ }
+
+ sinrx = sinf(rotx);
+ cosrx = cosf(rotx);
+
+ /* Convert to center point parameterization. */
+ /* http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes */
+ /* 1) Compute x1', y1' */
+ x1p = cosrx * dx / 2.0f + sinrx * dy / 2.0f;
+ y1p = -sinrx * dx / 2.0f + cosrx * dy / 2.0f;
+ d = nsvg__sqr(x1p)/nsvg__sqr(rx) + nsvg__sqr(y1p)/nsvg__sqr(ry);
+ if (d > 1) {
+ d = sqrtf(d);
+ rx *= d;
+ ry *= d;
+ }
+ /* 2) Compute cx', cy' */
+ s = 0.0f;
+ sa = nsvg__sqr(rx)*nsvg__sqr(ry) - nsvg__sqr(rx)*nsvg__sqr(y1p) - nsvg__sqr(ry)*nsvg__sqr(x1p);
+ sb = nsvg__sqr(rx)*nsvg__sqr(y1p) + nsvg__sqr(ry)*nsvg__sqr(x1p);
+ if (sa < 0.0f) sa = 0.0f;
+ if (sb > 0.0f)
+ s = sqrtf(sa / sb);
+ if (fa == fs)
+ s = -s;
+ cxp = s * rx * y1p / ry;
+ cyp = s * -ry * x1p / rx;
+
+ /* 3) Compute cx,cy from cx',cy' */
+ cx = (x1 + x2)/2.0f + cosrx*cxp - sinrx*cyp;
+ cy = (y1 + y2)/2.0f + sinrx*cxp + cosrx*cyp;
+
+ /* 4) Calculate theta1, and delta theta. */
+ ux = (x1p - cxp) / rx;
+ uy = (y1p - cyp) / ry;
+ vx = (-x1p - cxp) / rx;
+ vy = (-y1p - cyp) / ry;
+ a1 = nsvg__vecang(1.0f,0.0f, ux,uy); /* Initial angle */
+ da = nsvg__vecang(ux,uy, vx,vy); /* Delta angle */
+
+/* if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI; */
+/* if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0; */
+
+ if (fs == 0 && da > 0)
+ da -= 2 * NSVG_PI;
+ else if (fs == 1 && da < 0)
+ da += 2 * NSVG_PI;
+
+ /* Approximate the arc using cubic spline segments. */
+ t[0] = cosrx; t[1] = sinrx;
+ t[2] = -sinrx; t[3] = cosrx;
+ t[4] = cx; t[5] = cy;
+
+ /* Split arc into max 90 degree segments. */
+ /* The loop assumes an iteration per end point (including start and end), this +1. */
+ ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f);
+ hda = (da / (float)ndivs) / 2.0f;
+ /* Fix for ticket #179: division by 0: avoid cotangens around 0 (infinite) */
+ if ((hda < 1e-3f) && (hda > -1e-3f))
+ hda *= 0.5f;
+ else
+ hda = (1.0f - cosf(hda)) / sinf(hda);
+ kappa = fabsf(4.0f / 3.0f * hda);
+ if (da < 0.0f)
+ kappa = -kappa;
+
+ for (i = 0; i <= ndivs; i++) {
+ a = a1 + da * ((float)i/(float)ndivs);
+ dx = cosf(a);
+ dy = sinf(a);
+ nsvg__xformPoint(&x, &y, dx*rx, dy*ry, t); /* position */
+ nsvg__xformVec(&tanx, &tany, -dy*rx * kappa, dx*ry * kappa, t); /* tangent */
+ if (i > 0)
+ nsvg__cubicBezTo(p, px+ptanx,py+ptany, x-tanx, y-tany, x, y);
+ px = x;
+ py = y;
+ ptanx = tanx;
+ ptany = tany;
+ }
+
+ *cpx = x2;
+ *cpy = y2;
+}
+
+static void nsvg__parsePath(NSVGparser* p, const char** attr)
+{
+ const char* s = NULL;
+ char cmd = '\0';
+ float args[10];
+ int nargs;
+ int rargs = 0;
+ char initPoint;
+ float cpx, cpy, cpx2, cpy2;
+ const char* tmp[4];
+ char closedFlag;
+ int i;
+ char item[64];
+
+ for (i = 0; attr[i]; i += 2) {
+ if (strcmp(attr[i], "d") == 0) {
+ s = attr[i + 1];
+ } else {
+ tmp[0] = attr[i];
+ tmp[1] = attr[i + 1];
+ tmp[2] = 0;
+ tmp[3] = 0;
+ nsvg__parseAttribs(p, tmp);
+ }
+ }
+
+ if (s) {
+ nsvg__resetPath(p);
+ cpx = 0; cpy = 0;
+ cpx2 = 0; cpy2 = 0;
+ initPoint = 0;
+ closedFlag = 0;
+ nargs = 0;
+
+ while (*s) {
+ s = nsvg__getNextPathItem(s, item);
+ if (!*item) break;
+ if (cmd != '\0' && nsvg__isCoordinate(item)) {
+ if (nargs < 10)
+ args[nargs++] = (float)nsvg__atof(item);
+ if (nargs >= rargs) {
+ switch (cmd) {
+ case 'm':
+ case 'M':
+ nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0);
+ /* Moveto can be followed by multiple coordinate pairs, */
+ /* which should be treated as linetos. */
+ cmd = (cmd == 'm') ? 'l' : 'L';
+ rargs = nsvg__getArgsPerElement(cmd);
+ cpx2 = cpx; cpy2 = cpy;
+ initPoint = 1;
+ break;
+ case 'l':
+ case 'L':
+ nsvg__pathLineTo(p, &cpx, &cpy, args, cmd == 'l' ? 1 : 0);
+ cpx2 = cpx; cpy2 = cpy;
+ break;
+ case 'H':
+ case 'h':
+ nsvg__pathHLineTo(p, &cpx, &cpy, args, cmd == 'h' ? 1 : 0);
+ cpx2 = cpx; cpy2 = cpy;
+ break;
+ case 'V':
+ case 'v':
+ nsvg__pathVLineTo(p, &cpx, &cpy, args, cmd == 'v' ? 1 : 0);
+ cpx2 = cpx; cpy2 = cpy;
+ break;
+ case 'C':
+ case 'c':
+ nsvg__pathCubicBezTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 'c' ? 1 : 0);
+ break;
+ case 'S':
+ case 's':
+ nsvg__pathCubicBezShortTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 's' ? 1 : 0);
+ break;
+ case 'Q':
+ case 'q':
+ nsvg__pathQuadBezTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 'q' ? 1 : 0);
+ break;
+ case 'T':
+ case 't':
+ nsvg__pathQuadBezShortTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 't' ? 1 : 0);
+ break;
+ case 'A':
+ case 'a':
+ nsvg__pathArcTo(p, &cpx, &cpy, args, cmd == 'a' ? 1 : 0);
+ cpx2 = cpx; cpy2 = cpy;
+ break;
+ default:
+ if (nargs >= 2) {
+ cpx = args[nargs-2];
+ cpy = args[nargs-1];
+ cpx2 = cpx; cpy2 = cpy;
+ }
+ break;
+ }
+ nargs = 0;
+ }
+ } else {
+ cmd = item[0];
+ if (cmd == 'M' || cmd == 'm') {
+ /* Commit path. */
+ if (p->npts > 0)
+ nsvg__addPath(p, closedFlag);
+ /* Start new subpath. */
+ nsvg__resetPath(p);
+ closedFlag = 0;
+ nargs = 0;
+ } else if (initPoint == 0) {
+ /* Do not allow other commands until initial point has been set (moveTo called once). */
+ cmd = '\0';
+ }
+ if (cmd == 'Z' || cmd == 'z') {
+ closedFlag = 1;
+ /* Commit path. */
+ if (p->npts > 0) {
+ /* Move current point to first point */
+ cpx = p->pts[0];
+ cpy = p->pts[1];
+ cpx2 = cpx; cpy2 = cpy;
+ nsvg__addPath(p, closedFlag);
+ }
+ /* Start new subpath. */
+ nsvg__resetPath(p);
+ nsvg__moveTo(p, cpx, cpy);
+ closedFlag = 0;
+ nargs = 0;
+ }
+ rargs = nsvg__getArgsPerElement(cmd);
+ if (rargs == -1) {
+ /* Command not recognized */
+ cmd = '\0';
+ rargs = 0;
+ }
+ }
+ }
+ /* Commit path. */
+ if (p->npts)
+ nsvg__addPath(p, closedFlag);
+ }
+
+ nsvg__addShape(p);
+}
+
+static void nsvg__parseRect(NSVGparser* p, const char** attr)
+{
+ float x = 0.0f;
+ float y = 0.0f;
+ float w = 0.0f;
+ float h = 0.0f;
+ float rx = -1.0f; /* marks not set */
+ float ry = -1.0f;
+ int i;
+
+ for (i = 0; attr[i]; i += 2) {
+ if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
+ if (strcmp(attr[i], "x") == 0) x = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p));
+ if (strcmp(attr[i], "y") == 0) y = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p));
+ if (strcmp(attr[i], "width") == 0) w = nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualWidth(p));
+ if (strcmp(attr[i], "height") == 0) h = nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualHeight(p));
+ if (strcmp(attr[i], "rx") == 0) rx = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualWidth(p)));
+ if (strcmp(attr[i], "ry") == 0) ry = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualHeight(p)));
+ }
+ }
+
+ if (rx < 0.0f && ry > 0.0f) rx = ry;
+ if (ry < 0.0f && rx > 0.0f) ry = rx;
+ if (rx < 0.0f) rx = 0.0f;
+ if (ry < 0.0f) ry = 0.0f;
+ if (rx > w/2.0f) rx = w/2.0f;
+ if (ry > h/2.0f) ry = h/2.0f;
+
+ if (w != 0.0f && h != 0.0f) {
+ nsvg__resetPath(p);
+
+ if (rx < 0.00001f || ry < 0.0001f) {
+ nsvg__moveTo(p, x, y);
+ nsvg__lineTo(p, x+w, y);
+ nsvg__lineTo(p, x+w, y+h);
+ nsvg__lineTo(p, x, y+h);
+ } else {
+ /* Rounded rectangle */
+ nsvg__moveTo(p, x+rx, y);
+ nsvg__lineTo(p, x+w-rx, y);
+ nsvg__cubicBezTo(p, x+w-rx*(1-NSVG_KAPPA90), y, x+w, y+ry*(1-NSVG_KAPPA90), x+w, y+ry);
+ nsvg__lineTo(p, x+w, y+h-ry);
+ nsvg__cubicBezTo(p, x+w, y+h-ry*(1-NSVG_KAPPA90), x+w-rx*(1-NSVG_KAPPA90), y+h, x+w-rx, y+h);
+ nsvg__lineTo(p, x+rx, y+h);
+ nsvg__cubicBezTo(p, x+rx*(1-NSVG_KAPPA90), y+h, x, y+h-ry*(1-NSVG_KAPPA90), x, y+h-ry);
+ nsvg__lineTo(p, x, y+ry);
+ nsvg__cubicBezTo(p, x, y+ry*(1-NSVG_KAPPA90), x+rx*(1-NSVG_KAPPA90), y, x+rx, y);
+ }
+
+ nsvg__addPath(p, 1);
+
+ nsvg__addShape(p);
+ }
+}
+
+static void nsvg__parseCircle(NSVGparser* p, const char** attr)
+{
+ float cx = 0.0f;
+ float cy = 0.0f;
+ float r = 0.0f;
+ int i;
+
+ for (i = 0; attr[i]; i += 2) {
+ if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
+ if (strcmp(attr[i], "cx") == 0) cx = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p));
+ if (strcmp(attr[i], "cy") == 0) cy = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p));
+ if (strcmp(attr[i], "r") == 0) r = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualLength(p)));
+ }
+ }
+
+ if (r > 0.0f) {
+ nsvg__resetPath(p);
+
+ nsvg__moveTo(p, cx+r, cy);
+ nsvg__cubicBezTo(p, cx+r, cy+r*NSVG_KAPPA90, cx+r*NSVG_KAPPA90, cy+r, cx, cy+r);
+ nsvg__cubicBezTo(p, cx-r*NSVG_KAPPA90, cy+r, cx-r, cy+r*NSVG_KAPPA90, cx-r, cy);
+ nsvg__cubicBezTo(p, cx-r, cy-r*NSVG_KAPPA90, cx-r*NSVG_KAPPA90, cy-r, cx, cy-r);
+ nsvg__cubicBezTo(p, cx+r*NSVG_KAPPA90, cy-r, cx+r, cy-r*NSVG_KAPPA90, cx+r, cy);
+
+ nsvg__addPath(p, 1);
+
+ nsvg__addShape(p);
+ }
+}
+
+static void nsvg__parseEllipse(NSVGparser* p, const char** attr)
+{
+ float cx = 0.0f;
+ float cy = 0.0f;
+ float rx = 0.0f;
+ float ry = 0.0f;
+ int i;
+
+ for (i = 0; attr[i]; i += 2) {
+ if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
+ if (strcmp(attr[i], "cx") == 0) cx = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p));
+ if (strcmp(attr[i], "cy") == 0) cy = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p));
+ if (strcmp(attr[i], "rx") == 0) rx = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualWidth(p)));
+ if (strcmp(attr[i], "ry") == 0) ry = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualHeight(p)));
+ }
+ }
+
+ if (rx > 0.0f && ry > 0.0f) {
+
+ nsvg__resetPath(p);
+
+ nsvg__moveTo(p, cx+rx, cy);
+ nsvg__cubicBezTo(p, cx+rx, cy+ry*NSVG_KAPPA90, cx+rx*NSVG_KAPPA90, cy+ry, cx, cy+ry);
+ nsvg__cubicBezTo(p, cx-rx*NSVG_KAPPA90, cy+ry, cx-rx, cy+ry*NSVG_KAPPA90, cx-rx, cy);
+ nsvg__cubicBezTo(p, cx-rx, cy-ry*NSVG_KAPPA90, cx-rx*NSVG_KAPPA90, cy-ry, cx, cy-ry);
+ nsvg__cubicBezTo(p, cx+rx*NSVG_KAPPA90, cy-ry, cx+rx, cy-ry*NSVG_KAPPA90, cx+rx, cy);
+
+ nsvg__addPath(p, 1);
+
+ nsvg__addShape(p);
+ }
+}
+
+static void nsvg__parseLine(NSVGparser* p, const char** attr)
+{
+ float x1 = 0.0;
+ float y1 = 0.0;
+ float x2 = 0.0;
+ float y2 = 0.0;
+ int i;
+
+ for (i = 0; attr[i]; i += 2) {
+ if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
+ if (strcmp(attr[i], "x1") == 0) x1 = nsvg__parseCoordinate(p, attr[i + 1], nsvg__actualOrigX(p), nsvg__actualWidth(p));
+ if (strcmp(attr[i], "y1") == 0) y1 = nsvg__parseCoordinate(p, attr[i + 1], nsvg__actualOrigY(p), nsvg__actualHeight(p));
+ if (strcmp(attr[i], "x2") == 0) x2 = nsvg__parseCoordinate(p, attr[i + 1], nsvg__actualOrigX(p), nsvg__actualWidth(p));
+ if (strcmp(attr[i], "y2") == 0) y2 = nsvg__parseCoordinate(p, attr[i + 1], nsvg__actualOrigY(p), nsvg__actualHeight(p));
+ }
+ }
+
+ nsvg__resetPath(p);
+
+ nsvg__moveTo(p, x1, y1);
+ nsvg__lineTo(p, x2, y2);
+
+ nsvg__addPath(p, 0);
+
+ nsvg__addShape(p);
+}
+
+static void nsvg__parsePoly(NSVGparser* p, const char** attr, int closeFlag)
+{
+ int i;
+ const char* s;
+ float args[2];
+ int nargs, npts = 0;
+ char item[64];
+
+ nsvg__resetPath(p);
+
+ for (i = 0; attr[i]; i += 2) {
+ if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
+ if (strcmp(attr[i], "points") == 0) {
+ s = attr[i + 1];
+ nargs = 0;
+ while (*s) {
+ s = nsvg__getNextPathItem(s, item);
+ args[nargs++] = (float)nsvg__atof(item);
+ if (nargs >= 2) {
+ if (npts == 0)
+ nsvg__moveTo(p, args[0], args[1]);
+ else
+ nsvg__lineTo(p, args[0], args[1]);
+ nargs = 0;
+ npts++;
+ }
+ }
+ }
+ }
+ }
+
+ nsvg__addPath(p, (char)closeFlag);
+
+ nsvg__addShape(p);
+}
+
+static void nsvg__parseSVG(NSVGparser* p, const char** attr)
+{
+ int i;
+ for (i = 0; attr[i]; i += 2) {
+ if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
+ if (strcmp(attr[i], "width") == 0) {
+ p->image->width = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f);
+ } else if (strcmp(attr[i], "height") == 0) {
+ p->image->height = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f);
+ } else if (strcmp(attr[i], "viewBox") == 0) {
+ sscanf(attr[i + 1], "%f%*[%%, \t]%f%*[%%, \t]%f%*[%%, \t]%f", &p->viewMinx, &p->viewMiny, &p->viewWidth, &p->viewHeight);
+ } else if (strcmp(attr[i], "preserveAspectRatio") == 0) {
+ if (strstr(attr[i + 1], "none") != 0) {
+ /* No uniform scaling */
+ p->alignType = NSVG_ALIGN_NONE;
+ } else {
+ /* Parse X align */
+ if (strstr(attr[i + 1], "xMin") != 0)
+ p->alignX = NSVG_ALIGN_MIN;
+ else if (strstr(attr[i + 1], "xMid") != 0)
+ p->alignX = NSVG_ALIGN_MID;
+ else if (strstr(attr[i + 1], "xMax") != 0)
+ p->alignX = NSVG_ALIGN_MAX;
+ /* Parse X align */
+ if (strstr(attr[i + 1], "yMin") != 0)
+ p->alignY = NSVG_ALIGN_MIN;
+ else if (strstr(attr[i + 1], "yMid") != 0)
+ p->alignY = NSVG_ALIGN_MID;
+ else if (strstr(attr[i + 1], "yMax") != 0)
+ p->alignY = NSVG_ALIGN_MAX;
+ /* Parse meet/slice */
+ p->alignType = NSVG_ALIGN_MEET;
+ if (strstr(attr[i + 1], "slice") != 0)
+ p->alignType = NSVG_ALIGN_SLICE;
+ }
+ }
+ }
+ }
+}
+
+static void nsvg__parseGradient(NSVGparser* p, const char** attr, char type)
+{
+ int i;
+ NSVGgradientData* grad = (NSVGgradientData*)NANOSVG_malloc(sizeof(NSVGgradientData));
+ if (grad == NULL) return;
+ memset(grad, 0, sizeof(NSVGgradientData));
+ grad->units = NSVG_OBJECT_SPACE;
+ grad->type = type;
+ if (grad->type == NSVG_PAINT_LINEAR_GRADIENT) {
+ grad->linear.x1 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT);
+ grad->linear.y1 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT);
+ grad->linear.x2 = nsvg__coord(100.0f, NSVG_UNITS_PERCENT);
+ grad->linear.y2 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT);
+ } else if (grad->type == NSVG_PAINT_RADIAL_GRADIENT) {
+ grad->radial.cx = nsvg__coord(50.0f, NSVG_UNITS_PERCENT);
+ grad->radial.cy = nsvg__coord(50.0f, NSVG_UNITS_PERCENT);
+ grad->radial.r = nsvg__coord(50.0f, NSVG_UNITS_PERCENT);
+ }
+
+ nsvg__xformIdentity(grad->xform);
+
+ for (i = 0; attr[i]; i += 2) {
+ if (strcmp(attr[i], "id") == 0) {
+ strncpy(grad->id, attr[i+1], 63);
+ grad->id[63] = '\0';
+ } else if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
+ if (strcmp(attr[i], "gradientUnits") == 0) {
+ if (strcmp(attr[i+1], "objectBoundingBox") == 0)
+ grad->units = NSVG_OBJECT_SPACE;
+ else
+ grad->units = NSVG_USER_SPACE;
+ } else if (strcmp(attr[i], "gradientTransform") == 0) {
+ nsvg__parseTransform(grad->xform, attr[i + 1]);
+ } else if (strcmp(attr[i], "cx") == 0) {
+ grad->radial.cx = nsvg__parseCoordinateRaw(attr[i + 1]);
+ } else if (strcmp(attr[i], "cy") == 0) {
+ grad->radial.cy = nsvg__parseCoordinateRaw(attr[i + 1]);
+ } else if (strcmp(attr[i], "r") == 0) {
+ grad->radial.r = nsvg__parseCoordinateRaw(attr[i + 1]);
+ } else if (strcmp(attr[i], "fx") == 0) {
+ grad->radial.fx = nsvg__parseCoordinateRaw(attr[i + 1]);
+ } else if (strcmp(attr[i], "fy") == 0) {
+ grad->radial.fy = nsvg__parseCoordinateRaw(attr[i + 1]);
+ } else if (strcmp(attr[i], "x1") == 0) {
+ grad->linear.x1 = nsvg__parseCoordinateRaw(attr[i + 1]);
+ } else if (strcmp(attr[i], "y1") == 0) {
+ grad->linear.y1 = nsvg__parseCoordinateRaw(attr[i + 1]);
+ } else if (strcmp(attr[i], "x2") == 0) {
+ grad->linear.x2 = nsvg__parseCoordinateRaw(attr[i + 1]);
+ } else if (strcmp(attr[i], "y2") == 0) {
+ grad->linear.y2 = nsvg__parseCoordinateRaw(attr[i + 1]);
+ } else if (strcmp(attr[i], "spreadMethod") == 0) {
+ if (strcmp(attr[i+1], "pad") == 0)
+ grad->spread = NSVG_SPREAD_PAD;
+ else if (strcmp(attr[i+1], "reflect") == 0)
+ grad->spread = NSVG_SPREAD_REFLECT;
+ else if (strcmp(attr[i+1], "repeat") == 0)
+ grad->spread = NSVG_SPREAD_REPEAT;
+ } else if (strcmp(attr[i], "xlink:href") == 0) {
+ const char *href = attr[i+1];
+ strncpy(grad->ref, href+1, 62);
+ grad->ref[62] = '\0';
+ }
+ }
+ }
+
+ grad->next = p->gradients;
+ p->gradients = grad;
+}
+
+static void nsvg__parseGradientStop(NSVGparser* p, const char** attr)
+{
+ NSVGattrib* curAttr = nsvg__getAttr(p);
+ NSVGgradientData* grad;
+ NSVGgradientStop* stop;
+ int i, idx;
+
+ curAttr->stopOffset = 0;
+ curAttr->stopColor = 0;
+ curAttr->stopOpacity = 1.0f;
+
+ for (i = 0; attr[i]; i += 2) {
+ nsvg__parseAttr(p, attr[i], attr[i + 1]);
+ }
+
+ /* Add stop to the last gradient. */
+ grad = p->gradients;
+ if (grad == NULL) return;
+
+ grad->nstops++;
+ grad->stops = (NSVGgradientStop*)NANOSVG_realloc(grad->stops, sizeof(NSVGgradientStop)*grad->nstops);
+ if (grad->stops == NULL) return;
+
+ /* Insert */
+ idx = grad->nstops-1;
+ for (i = 0; i < grad->nstops-1; i++) {
+ if (curAttr->stopOffset < grad->stops[i].offset) {
+ idx = i;
+ break;
+ }
+ }
+ if (idx != grad->nstops-1) {
+ for (i = grad->nstops-1; i > idx; i--)
+ grad->stops[i] = grad->stops[i-1];
+ }
+
+ stop = &grad->stops[idx];
+ stop->color = curAttr->stopColor;
+ stop->color |= (unsigned int)(curAttr->stopOpacity*255) << 24;
+ stop->offset = curAttr->stopOffset;
+}
+
+static void nsvg__startElement(void* ud, const char* el, const char** attr)
+{
+ NSVGparser* p = (NSVGparser*)ud;
+
+ if (p->defsFlag) {
+ /* Skip everything but gradients in defs */
+ if (strcmp(el, "linearGradient") == 0) {
+ nsvg__parseGradient(p, attr, NSVG_PAINT_LINEAR_GRADIENT);
+ } else if (strcmp(el, "radialGradient") == 0) {
+ nsvg__parseGradient(p, attr, NSVG_PAINT_RADIAL_GRADIENT);
+ } else if (strcmp(el, "stop") == 0) {
+ nsvg__parseGradientStop(p, attr);
+ }
+ return;
+ }
+
+ if (strcmp(el, "g") == 0) {
+ nsvg__pushAttr(p);
+ nsvg__parseAttribs(p, attr);
+ } else if (strcmp(el, "path") == 0) {
+ if (p->pathFlag) /* Do not allow nested paths. */
+ return;
+ nsvg__pushAttr(p);
+ nsvg__parsePath(p, attr);
+ nsvg__popAttr(p);
+ } else if (strcmp(el, "rect") == 0) {
+ nsvg__pushAttr(p);
+ nsvg__parseRect(p, attr);
+ nsvg__popAttr(p);
+ } else if (strcmp(el, "circle") == 0) {
+ nsvg__pushAttr(p);
+ nsvg__parseCircle(p, attr);
+ nsvg__popAttr(p);
+ } else if (strcmp(el, "ellipse") == 0) {
+ nsvg__pushAttr(p);
+ nsvg__parseEllipse(p, attr);
+ nsvg__popAttr(p);
+ } else if (strcmp(el, "line") == 0) {
+ nsvg__pushAttr(p);
+ nsvg__parseLine(p, attr);
+ nsvg__popAttr(p);
+ } else if (strcmp(el, "polyline") == 0) {
+ nsvg__pushAttr(p);
+ nsvg__parsePoly(p, attr, 0);
+ nsvg__popAttr(p);
+ } else if (strcmp(el, "polygon") == 0) {
+ nsvg__pushAttr(p);
+ nsvg__parsePoly(p, attr, 1);
+ nsvg__popAttr(p);
+ } else if (strcmp(el, "linearGradient") == 0) {
+ nsvg__parseGradient(p, attr, NSVG_PAINT_LINEAR_GRADIENT);
+ } else if (strcmp(el, "radialGradient") == 0) {
+ nsvg__parseGradient(p, attr, NSVG_PAINT_RADIAL_GRADIENT);
+ } else if (strcmp(el, "stop") == 0) {
+ nsvg__parseGradientStop(p, attr);
+ } else if (strcmp(el, "defs") == 0) {
+ p->defsFlag = 1;
+ } else if (strcmp(el, "svg") == 0) {
+ nsvg__parseSVG(p, attr);
+ } else if (strcmp(el, "style") == 0) {
+ p->styleFlag = 1;
+ }
+}
+
+static void nsvg__endElement(void* ud, const char* el)
+{
+ NSVGparser* p = (NSVGparser*)ud;
+
+ if (strcmp(el, "g") == 0) {
+ nsvg__popAttr(p);
+ } else if (strcmp(el, "path") == 0) {
+ p->pathFlag = 0;
+ } else if (strcmp(el, "defs") == 0) {
+ p->defsFlag = 0;
+ } else if (strcmp(el, "style") == 0) {
+ p->styleFlag = 0;
+ }
+}
+
+static char *nsvg__strndup(const char *s, size_t n)
+{
+ char *result;
+ size_t len = strlen(s);
+
+ if (n < len)
+ len = n;
+
+ result = (char*)NANOSVG_malloc(len+1);
+ if (!result)
+ return 0;
+
+ result[len] = '\0';
+ return (char *)memcpy(result, s, len);
+}
+
+static void nsvg__content(void* ud, const char* s)
+{
+ NSVGparser* p = (NSVGparser*)ud;
+ if (p->styleFlag) {
+
+ int state = 0;
+ const char* start = NULL;
+ while (*s) {
+ char c = *s;
+ if (nsvg__isspace(c) || c == '{') {
+ if (state == 1) {
+ NSVGstyles* next = p->styles;
+
+ p->styles = (NSVGstyles*)NANOSVG_malloc(sizeof(NSVGstyles));
+ p->styles->next = next;
+ p->styles->name = nsvg__strndup(start, (size_t)(s - start));
+ start = s + 1;
+ state = 2;
+ }
+ } else if (state == 2 && c == '}') {
+ p->styles->description = nsvg__strndup(start, (size_t)(s - start));
+ state = 0;
+ }
+ else if (state == 0) {
+ start = s;
+ state = 1;
+ }
+ s++;
+ /*
+ if (*s == '{' && state == NSVG_XML_CONTENT) {
+ // Start of a tag
+ *s++ = '\0';
+ nsvg__parseContent(mark, contentCb, ud);
+ mark = s;
+ state = NSVG_XML_TAG;
+ }
+ else if (*s == '>' && state == NSVG_XML_TAG) {
+ // Start of a content or new tag.
+ *s++ = '\0';
+ nsvg__parseElement(mark, startelCb, endelCb, ud);
+ mark = s;
+ state = NSVG_XML_CONTENT;
+ }
+ else {
+ s++;
+ }
+ */
+ }
+
+ }
+}
+
+static void nsvg__imageBounds(NSVGparser* p, float* bounds)
+{
+ NSVGshape* shape;
+ shape = p->image->shapes;
+ if (shape == NULL) {
+ bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0;
+ return;
+ }
+ bounds[0] = shape->bounds[0];
+ bounds[1] = shape->bounds[1];
+ bounds[2] = shape->bounds[2];
+ bounds[3] = shape->bounds[3];
+ for (shape = shape->next; shape != NULL; shape = shape->next) {
+ bounds[0] = nsvg__minf(bounds[0], shape->bounds[0]);
+ bounds[1] = nsvg__minf(bounds[1], shape->bounds[1]);
+ bounds[2] = nsvg__maxf(bounds[2], shape->bounds[2]);
+ bounds[3] = nsvg__maxf(bounds[3], shape->bounds[3]);
+ }
+}
+
+static float nsvg__viewAlign(float content, float container, int type)
+{
+ if (type == NSVG_ALIGN_MIN)
+ return 0;
+ else if (type == NSVG_ALIGN_MAX)
+ return container - content;
+ /* mid */
+ return (container - content) * 0.5f;
+}
+
+static void nsvg__scaleGradient(NSVGgradient* grad, float tx, float ty, float sx, float sy)
+{
+ float t[6];
+ nsvg__xformSetTranslation(t, tx, ty);
+ nsvg__xformMultiply (grad->xform, t);
+
+ nsvg__xformSetScale(t, sx, sy);
+ nsvg__xformMultiply (grad->xform, t);
+}
+
+static void nsvg__scaleToViewbox(NSVGparser* p, const char* units)
+{
+ NSVGshape* shape;
+ NSVGpath* path;
+ float tx, ty, sx, sy, us, bounds[4], t[6], avgs;
+ int i;
+ float* pt;
+
+ /* Guess image size if not set completely. */
+ nsvg__imageBounds(p, bounds);
+
+ if (p->viewWidth == 0) {
+ if (p->image->width > 0) {
+ p->viewWidth = p->image->width;
+ } else {
+ p->viewMinx = bounds[0];
+ p->viewWidth = bounds[2] - bounds[0];
+ }
+ }
+ if (p->viewHeight == 0) {
+ if (p->image->height > 0) {
+ p->viewHeight = p->image->height;
+ } else {
+ p->viewMiny = bounds[1];
+ p->viewHeight = bounds[3] - bounds[1];
+ }
+ }
+ if (p->image->width == 0)
+ p->image->width = p->viewWidth;
+ if (p->image->height == 0)
+ p->image->height = p->viewHeight;
+
+ tx = -p->viewMinx;
+ ty = -p->viewMiny;
+ sx = p->viewWidth > 0 ? p->image->width / p->viewWidth : 0;
+ sy = p->viewHeight > 0 ? p->image->height / p->viewHeight : 0;
+ /* Unit scaling */
+ us = 1.0f / nsvg__convertToPixels(p, nsvg__coord(1.0f, nsvg__parseUnits(units)), 0.0f, 1.0f);
+
+ /* Fix aspect ratio */
+ if (p->alignType == NSVG_ALIGN_MEET) {
+ /* fit whole image into viewbox */
+ sx = sy = nsvg__minf(sx, sy);
+ tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx;
+ ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy;
+ } else if (p->alignType == NSVG_ALIGN_SLICE) {
+ /* fill whole viewbox with image */
+ sx = sy = nsvg__maxf(sx, sy);
+ tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx;
+ ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy;
+ }
+
+ /* Transform */
+ sx *= us;
+ sy *= us;
+ avgs = (sx+sy) / 2.0f;
+ for (shape = p->image->shapes; shape != NULL; shape = shape->next) {
+ shape->bounds[0] = (shape->bounds[0] + tx) * sx;
+ shape->bounds[1] = (shape->bounds[1] + ty) * sy;
+ shape->bounds[2] = (shape->bounds[2] + tx) * sx;
+ shape->bounds[3] = (shape->bounds[3] + ty) * sy;
+ for (path = shape->paths; path != NULL; path = path->next) {
+ path->bounds[0] = (path->bounds[0] + tx) * sx;
+ path->bounds[1] = (path->bounds[1] + ty) * sy;
+ path->bounds[2] = (path->bounds[2] + tx) * sx;
+ path->bounds[3] = (path->bounds[3] + ty) * sy;
+ for (i =0; i < path->npts; i++) {
+ pt = &path->pts[i*2];
+ pt[0] = (pt[0] + tx) * sx;
+ pt[1] = (pt[1] + ty) * sy;
+ }
+ }
+
+ if (shape->fill.type == NSVG_PAINT_LINEAR_GRADIENT || shape->fill.type == NSVG_PAINT_RADIAL_GRADIENT) {
+ nsvg__scaleGradient(shape->fill.gradient, tx,ty, sx,sy);
+ memcpy(t, shape->fill.gradient->xform, sizeof(float)*6);
+ nsvg__xformInverse(shape->fill.gradient->xform, t);
+ }
+ if (shape->stroke.type == NSVG_PAINT_LINEAR_GRADIENT || shape->stroke.type == NSVG_PAINT_RADIAL_GRADIENT) {
+ nsvg__scaleGradient(shape->stroke.gradient, tx,ty, sx,sy);
+ memcpy(t, shape->stroke.gradient->xform, sizeof(float)*6);
+ nsvg__xformInverse(shape->stroke.gradient->xform, t);
+ }
+
+ shape->strokeWidth *= avgs;
+ shape->strokeDashOffset *= avgs;
+ for (i = 0; i < shape->strokeDashCount; i++)
+ shape->strokeDashArray[i] *= avgs;
+ }
+}
+
+NANOSVG_SCOPE
+NSVGimage* nsvgParse(char* input, const char* units, float dpi)
+{
+ NSVGparser* p;
+ NSVGimage* ret = 0;
+
+ p = nsvg__createParser();
+ if (p == NULL) {
+ return NULL;
+ }
+ p->dpi = dpi;
+
+ nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p);
+
+ /* Scale to viewBox */
+ nsvg__scaleToViewbox(p, units);
+
+ ret = p->image;
+ p->image = NULL;
+
+ nsvg__deleteParser(p);
+
+ return ret;
+}
+
+NANOSVG_SCOPE
+NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
+{
+ FILE* fp = NULL;
+ size_t size;
+ char* data = NULL;
+ NSVGimage* image = NULL;
+
+ fp = fopen(filename, "rb");
+ if (!fp) goto error;
+ fseek(fp, 0, SEEK_END);
+ size = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
+ data = (char*)NANOSVG_malloc(size+1);
+ if (data == NULL) goto error;
+ if (fread(data, 1, size, fp) != size) goto error;
+ data[size] = '\0'; /* Must be null terminated. */
+ fclose(fp);
+ image = nsvgParse(data, units, dpi);
+ NANOSVG_free(data);
+
+ return image;
+
+error:
+ if (fp) fclose(fp);
+ if (data) NANOSVG_free(data);
+ if (image) nsvgDelete(image);
+ return NULL;
+}
+
+NANOSVG_SCOPE
+void nsvgDelete(NSVGimage* image)
+{
+ NSVGshape *snext, *shape;
+ if (image == NULL) return;
+ shape = image->shapes;
+ while (shape != NULL) {
+ snext = shape->next;
+ nsvg__deletePaths(shape->paths);
+ nsvg__deletePaint(&shape->fill);
+ nsvg__deletePaint(&shape->stroke);
+ NANOSVG_free(shape);
+ shape = snext;
+ }
+ NANOSVG_free(image);
+}
+
+#endif
diff --git a/generic/nanosvgrast.h b/generic/nanosvgrast.h
new file mode 100644
index 0000000..b288bcf
--- /dev/null
+++ b/generic/nanosvgrast.h
@@ -0,0 +1,1469 @@
+/*
+ * Copyright (c) 2013-14 Mikko Mononen memon@inside.org
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ * The polygon rasterization is heavily based on stb_truetype rasterizer
+ * by Sean Barrett - http://nothings.org/
+ *
+ */
+
+#ifndef NANOSVGRAST_H
+#define NANOSVGRAST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef NANOSVG_SCOPE
+#define NANOSVG_SCOPE
+#endif
+
+#ifndef NANOSVG_malloc
+#define NANOSVG_malloc malloc
+#endif
+
+#ifndef NANOSVG_realloc
+#define NANOSVG_realloc realloc
+#endif
+
+#ifndef NANOSVG_free
+#define NANOSVG_free free
+#endif
+
+typedef struct NSVGrasterizer NSVGrasterizer;
+
+/* Example Usage:
+ // Load SVG
+ struct SNVGImage* image = nsvgParseFromFile("test.svg.");
+
+ // Create rasterizer (can be used to render multiple images).
+ struct NSVGrasterizer* rast = nsvgCreateRasterizer();
+ // Allocate memory for image
+ unsigned char* img = malloc(w*h*4);
+ // Rasterize
+ nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4);
+*/
+
+/* Allocated rasterizer context. */
+NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer(void);
+
+/* Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
+ * r - pointer to rasterizer context
+ * image - pointer to image to rasterize
+ * tx,ty - image offset (applied after scaling)
+ * scale - image scale
+ * dst - pointer to destination image data, 4 bytes per pixel (RGBA)
+ * w - width of the image to render
+ * h - height of the image to render
+ * stride - number of bytes per scaleline in the destination buffer
+NANOSVG_SCOPE void nsvgRasterize(NSVGrasterizer* r,
+ NSVGimage* image, float tx, float ty, float scale,
+ unsigned char* dst, int w, int h, int stride);
+ */
+
+/* Deletes rasterizer context. */
+NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer*);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NANOSVGRAST_H */
+
+#ifdef NANOSVGRAST_IMPLEMENTATION
+
+#include <math.h>
+
+#define NSVG__SUBSAMPLES 5
+#define NSVG__FIXSHIFT 10
+#define NSVG__FIX (1 << NSVG__FIXSHIFT)
+#define NSVG__FIXMASK (NSVG__FIX-1)
+#define NSVG__MEMPAGE_SIZE 1024
+
+typedef struct NSVGedge {
+ float x0,y0, x1,y1;
+ int dir;
+ struct NSVGedge* next;
+} NSVGedge;
+
+typedef struct NSVGpoint {
+ float x, y;
+ float dx, dy;
+ float len;
+ float dmx, dmy;
+ unsigned char flags;
+} NSVGpoint;
+
+typedef struct NSVGactiveEdge {
+ int x,dx;
+ float ey;
+ int dir;
+ struct NSVGactiveEdge *next;
+} NSVGactiveEdge;
+
+typedef struct NSVGmemPage {
+ unsigned char mem[NSVG__MEMPAGE_SIZE];
+ int size;
+ struct NSVGmemPage* next;
+} NSVGmemPage;
+
+typedef struct NSVGcachedPaint {
+ char type;
+ char spread;
+ float xform[6];
+ unsigned int colors[256];
+} NSVGcachedPaint;
+
+struct NSVGrasterizer
+{
+ float px, py;
+
+ float tessTol;
+ float distTol;
+
+ NSVGedge* edges;
+ int nedges;
+ int cedges;
+
+ NSVGpoint* points;
+ int npoints;
+ int cpoints;
+
+ NSVGpoint* points2;
+ int npoints2;
+ int cpoints2;
+
+ NSVGactiveEdge* freelist;
+ NSVGmemPage* pages;
+ NSVGmemPage* curpage;
+
+ unsigned char* scanline;
+ int cscanline;
+
+ unsigned char* bitmap;
+ int width, height, stride;
+};
+
+NANOSVG_SCOPE
+NSVGrasterizer* nsvgCreateRasterizer(void)
+{
+ NSVGrasterizer* r = (NSVGrasterizer*)NANOSVG_malloc(sizeof(NSVGrasterizer));
+ if (r == NULL) goto error;
+ memset(r, 0, sizeof(NSVGrasterizer));
+
+ r->tessTol = 0.25f;
+ r->distTol = 0.01f;
+
+ return r;
+
+error:
+ nsvgDeleteRasterizer(r);
+ return NULL;
+}
+
+NANOSVG_SCOPE
+void nsvgDeleteRasterizer(NSVGrasterizer* r)
+{
+ NSVGmemPage* p;
+
+ if (r == NULL) return;
+
+ p = r->pages;
+ while (p != NULL) {
+ NSVGmemPage* next = p->next;
+ NANOSVG_free(p);
+ p = next;
+ }
+
+ if (r->edges) NANOSVG_free(r->edges);
+ if (r->points) NANOSVG_free(r->points);
+ if (r->points2) NANOSVG_free(r->points2);
+ if (r->scanline) NANOSVG_free(r->scanline);
+
+ NANOSVG_free(r);
+}
+
+static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur)
+{
+ NSVGmemPage *newp;
+
+ /* If using existing chain, return the next page in chain */
+ if (cur != NULL && cur->next != NULL) {
+ return cur->next;
+ }
+
+ /* Alloc new page */
+ newp = (NSVGmemPage*)NANOSVG_malloc(sizeof(NSVGmemPage));
+ if (newp == NULL) return NULL;
+ memset(newp, 0, sizeof(NSVGmemPage));
+
+ /* Add to linked list */
+ if (cur != NULL)
+ cur->next = newp;
+ else
+ r->pages = newp;
+
+ return newp;
+}
+
+static void nsvg__resetPool(NSVGrasterizer* r)
+{
+ NSVGmemPage* p = r->pages;
+ while (p != NULL) {
+ p->size = 0;
+ p = p->next;
+ }
+ r->curpage = r->pages;
+}
+
+static unsigned char* nsvg__alloc(NSVGrasterizer* r, int size)
+{
+ unsigned char* buf;
+ if (size > NSVG__MEMPAGE_SIZE) return NULL;
+ if (r->curpage == NULL || r->curpage->size+size > NSVG__MEMPAGE_SIZE) {
+ r->curpage = nsvg__nextPage(r, r->curpage);
+ }
+ buf = &r->curpage->mem[r->curpage->size];
+ r->curpage->size += size;
+ return buf;
+}
+
+static int nsvg__ptEquals(float x1, float y1, float x2, float y2, float tol)
+{
+ float dx = x2 - x1;
+ float dy = y2 - y1;
+ return dx*dx + dy*dy < tol*tol;
+}
+
+static void nsvg__addPathPoint(NSVGrasterizer* r, float x, float y, int flags)
+{
+ NSVGpoint* pt;
+
+ if (r->npoints > 0) {
+ pt = &r->points[r->npoints-1];
+ if (nsvg__ptEquals(pt->x,pt->y, x,y, r->distTol)) {
+ pt->flags = (unsigned char)(pt->flags | flags);
+ return;
+ }
+ }
+
+ if (r->npoints+1 > r->cpoints) {
+ r->cpoints = r->cpoints > 0 ? r->cpoints * 2 : 64;
+ r->points = (NSVGpoint*)NANOSVG_realloc(r->points, sizeof(NSVGpoint) * r->cpoints);
+ if (r->points == NULL) return;
+ }
+
+ pt = &r->points[r->npoints];
+ pt->x = x;
+ pt->y = y;
+ pt->flags = (unsigned char)flags;
+ r->npoints++;
+}
+
+static void nsvg__appendPathPoint(NSVGrasterizer* r, NSVGpoint pt)
+{
+ if (r->npoints+1 > r->cpoints) {
+ r->cpoints = r->cpoints > 0 ? r->cpoints * 2 : 64;
+ r->points = (NSVGpoint*)NANOSVG_realloc(r->points, sizeof(NSVGpoint) * r->cpoints);
+ if (r->points == NULL) return;
+ }
+ r->points[r->npoints] = pt;
+ r->npoints++;
+}
+
+static void nsvg__duplicatePoints(NSVGrasterizer* r)
+{
+ if (r->npoints > r->cpoints2) {
+ r->cpoints2 = r->npoints;
+ r->points2 = (NSVGpoint*)NANOSVG_realloc(r->points2, sizeof(NSVGpoint) * r->cpoints2);
+ if (r->points2 == NULL) return;
+ }
+
+ memcpy(r->points2, r->points, sizeof(NSVGpoint) * r->npoints);
+ r->npoints2 = r->npoints;
+}
+
+static void nsvg__addEdge(NSVGrasterizer* r, float x0, float y0, float x1, float y1)
+{
+ NSVGedge* e;
+
+ /* Skip horizontal edges */
+ if (y0 == y1)
+ return;
+
+ if (r->nedges+1 > r->cedges) {
+ r->cedges = r->cedges > 0 ? r->cedges * 2 : 64;
+ r->edges = (NSVGedge*)NANOSVG_realloc(r->edges, sizeof(NSVGedge) * r->cedges);
+ if (r->edges == NULL) return;
+ }
+
+ e = &r->edges[r->nedges];
+ r->nedges++;
+
+ if (y0 < y1) {
+ e->x0 = x0;
+ e->y0 = y0;
+ e->x1 = x1;
+ e->y1 = y1;
+ e->dir = 1;
+ } else {
+ e->x0 = x1;
+ e->y0 = y1;
+ e->x1 = x0;
+ e->y1 = y0;
+ e->dir = -1;
+ }
+}
+
+static float nsvg__normalize(float *x, float* y)
+{
+ float d = sqrtf((*x)*(*x) + (*y)*(*y));
+ if (d > 1e-6f) {
+ float id = 1.0f / d;
+ *x *= id;
+ *y *= id;
+ }
+ return d;
+}
+
+static float nsvg__absf(float x) { return x < 0 ? -x : x; }
+
+static void nsvg__flattenCubicBez(NSVGrasterizer* r,
+ float x1, float y1, float x2, float y2,
+ float x3, float y3, float x4, float y4,
+ int level, int type)
+{
+ float x12,y12,x23,y23,x34,y34,x123,y123,x234,y234,x1234,y1234;
+ float dx,dy,d2,d3;
+
+ if (level > 10) return;
+
+ x12 = (x1+x2)*0.5f;
+ y12 = (y1+y2)*0.5f;
+ x23 = (x2+x3)*0.5f;
+ y23 = (y2+y3)*0.5f;
+ x34 = (x3+x4)*0.5f;
+ y34 = (y3+y4)*0.5f;
+ x123 = (x12+x23)*0.5f;
+ y123 = (y12+y23)*0.5f;
+
+ dx = x4 - x1;
+ dy = y4 - y1;
+ d2 = nsvg__absf(((x2 - x4) * dy - (y2 - y4) * dx));
+ d3 = nsvg__absf(((x3 - x4) * dy - (y3 - y4) * dx));
+
+ if ((d2 + d3)*(d2 + d3) < r->tessTol * (dx*dx + dy*dy)) {
+ nsvg__addPathPoint(r, x4, y4, type);
+ return;
+ }
+
+ x234 = (x23+x34)*0.5f;
+ y234 = (y23+y34)*0.5f;
+ x1234 = (x123+x234)*0.5f;
+ y1234 = (y123+y234)*0.5f;
+
+ nsvg__flattenCubicBez(r, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0);
+ nsvg__flattenCubicBez(r, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type);
+}
+
+static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale)
+{
+ int i, j;
+ NSVGpath* path;
+
+ for (path = shape->paths; path != NULL; path = path->next) {
+ r->npoints = 0;
+ /* Flatten path */
+ nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
+ for (i = 0; i < path->npts-1; i += 3) {
+ float* p = &path->pts[i*2];
+ nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, 0);
+ }
+ /* Close path */
+ nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
+ /* Build edges */
+ for (i = 0, j = r->npoints-1; i < r->npoints; j = i++)
+ nsvg__addEdge(r, r->points[j].x, r->points[j].y, r->points[i].x, r->points[i].y);
+ }
+}
+
+enum NSVGpointFlags
+{
+ NSVG_PT_CORNER = 0x01,
+ NSVG_PT_BEVEL = 0x02,
+ NSVG_PT_LEFT = 0x04
+};
+
+static void nsvg__initClosed(NSVGpoint* left, NSVGpoint* right, NSVGpoint* p0, NSVGpoint* p1, float lineWidth)
+{
+ float w = lineWidth * 0.5f;
+ float dx = p1->x - p0->x;
+ float dy = p1->y - p0->y;
+ float len = nsvg__normalize(&dx, &dy);
+ float px = p0->x + dx*len*0.5f, py = p0->y + dy*len*0.5f;
+ float dlx = dy, dly = -dx;
+ float lx = px - dlx*w, ly = py - dly*w;
+ float rx = px + dlx*w, ry = py + dly*w;
+ left->x = lx; left->y = ly;
+ right->x = rx; right->y = ry;
+}
+
+static void nsvg__buttCap(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p, float dx, float dy, float lineWidth, int connect)
+{
+ float w = lineWidth * 0.5f;
+ float px = p->x, py = p->y;
+ float dlx = dy, dly = -dx;
+ float lx = px - dlx*w, ly = py - dly*w;
+ float rx = px + dlx*w, ry = py + dly*w;
+
+ nsvg__addEdge(r, lx, ly, rx, ry);
+
+ if (connect) {
+ nsvg__addEdge(r, left->x, left->y, lx, ly);
+ nsvg__addEdge(r, rx, ry, right->x, right->y);
+ }
+ left->x = lx; left->y = ly;
+ right->x = rx; right->y = ry;
+}
+
+static void nsvg__squareCap(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p, float dx, float dy, float lineWidth, int connect)
+{
+ float w = lineWidth * 0.5f;
+ float px = p->x - dx*w, py = p->y - dy*w;
+ float dlx = dy, dly = -dx;
+ float lx = px - dlx*w, ly = py - dly*w;
+ float rx = px + dlx*w, ry = py + dly*w;
+
+ nsvg__addEdge(r, lx, ly, rx, ry);
+
+ if (connect) {
+ nsvg__addEdge(r, left->x, left->y, lx, ly);
+ nsvg__addEdge(r, rx, ry, right->x, right->y);
+ }
+ left->x = lx; left->y = ly;
+ right->x = rx; right->y = ry;
+}
+
+#ifndef NSVG_PI
+#define NSVG_PI (3.14159265358979323846264338327f)
+#endif
+
+static void nsvg__roundCap(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p, float dx, float dy, float lineWidth, int ncap, int connect)
+{
+ int i;
+ float w = lineWidth * 0.5f;
+ float px = p->x, py = p->y;
+ float dlx = dy, dly = -dx;
+ float lx = 0, ly = 0, rx = 0, ry = 0, prevx = 0, prevy = 0;
+
+ for (i = 0; i < ncap; i++) {
+ float a = (float)i/(float)(ncap-1)*NSVG_PI;
+ float ax = cosf(a) * w, ay = sinf(a) * w;
+ float x = px - dlx*ax - dx*ay;
+ float y = py - dly*ax - dy*ay;
+
+ if (i > 0)
+ nsvg__addEdge(r, prevx, prevy, x, y);
+
+ prevx = x;
+ prevy = y;
+
+ if (i == 0) {
+ lx = x; ly = y;
+ } else if (i == ncap-1) {
+ rx = x; ry = y;
+ }
+ }
+
+ if (connect) {
+ nsvg__addEdge(r, left->x, left->y, lx, ly);
+ nsvg__addEdge(r, rx, ry, right->x, right->y);
+ }
+
+ left->x = lx; left->y = ly;
+ right->x = rx; right->y = ry;
+}
+
+static void nsvg__bevelJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p0, NSVGpoint* p1, float lineWidth)
+{
+ float w = lineWidth * 0.5f;
+ float dlx0 = p0->dy, dly0 = -p0->dx;
+ float dlx1 = p1->dy, dly1 = -p1->dx;
+ float lx0 = p1->x - (dlx0 * w), ly0 = p1->y - (dly0 * w);
+ float rx0 = p1->x + (dlx0 * w), ry0 = p1->y + (dly0 * w);
+ float lx1 = p1->x - (dlx1 * w), ly1 = p1->y - (dly1 * w);
+ float rx1 = p1->x + (dlx1 * w), ry1 = p1->y + (dly1 * w);
+
+ nsvg__addEdge(r, lx0, ly0, left->x, left->y);
+ nsvg__addEdge(r, lx1, ly1, lx0, ly0);
+
+ nsvg__addEdge(r, right->x, right->y, rx0, ry0);
+ nsvg__addEdge(r, rx0, ry0, rx1, ry1);
+
+ left->x = lx1; left->y = ly1;
+ right->x = rx1; right->y = ry1;
+}
+
+static void nsvg__miterJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p0, NSVGpoint* p1, float lineWidth)
+{
+ float w = lineWidth * 0.5f;
+ float dlx0 = p0->dy, dly0 = -p0->dx;
+ float dlx1 = p1->dy, dly1 = -p1->dx;
+ float lx0, rx0, lx1, rx1;
+ float ly0, ry0, ly1, ry1;
+
+ if (p1->flags & NSVG_PT_LEFT) {
+ lx0 = lx1 = p1->x - p1->dmx * w;
+ ly0 = ly1 = p1->y - p1->dmy * w;
+ nsvg__addEdge(r, lx1, ly1, left->x, left->y);
+
+ rx0 = p1->x + (dlx0 * w);
+ ry0 = p1->y + (dly0 * w);
+ rx1 = p1->x + (dlx1 * w);
+ ry1 = p1->y + (dly1 * w);
+ nsvg__addEdge(r, right->x, right->y, rx0, ry0);
+ nsvg__addEdge(r, rx0, ry0, rx1, ry1);
+ } else {
+ lx0 = p1->x - (dlx0 * w);
+ ly0 = p1->y - (dly0 * w);
+ lx1 = p1->x - (dlx1 * w);
+ ly1 = p1->y - (dly1 * w);
+ nsvg__addEdge(r, lx0, ly0, left->x, left->y);
+ nsvg__addEdge(r, lx1, ly1, lx0, ly0);
+
+ rx0 = rx1 = p1->x + p1->dmx * w;
+ ry0 = ry1 = p1->y + p1->dmy * w;
+ nsvg__addEdge(r, right->x, right->y, rx1, ry1);
+ }
+
+ left->x = lx1; left->y = ly1;
+ right->x = rx1; right->y = ry1;
+}
+
+static void nsvg__roundJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p0, NSVGpoint* p1, float lineWidth, int ncap)
+{
+ int i, n;
+ float w = lineWidth * 0.5f;
+ float dlx0 = p0->dy, dly0 = -p0->dx;
+ float dlx1 = p1->dy, dly1 = -p1->dx;
+ float a0 = atan2f(dly0, dlx0);
+ float a1 = atan2f(dly1, dlx1);
+ float da = a1 - a0;
+ float lx, ly, rx, ry;
+
+ if (da < NSVG_PI) da += NSVG_PI*2;
+ if (da > NSVG_PI) da -= NSVG_PI*2;
+
+ n = (int)ceilf((nsvg__absf(da) / NSVG_PI) * (float)ncap);
+ if (n < 2) n = 2;
+ if (n > ncap) n = ncap;
+
+ lx = left->x;
+ ly = left->y;
+ rx = right->x;
+ ry = right->y;
+
+ for (i = 0; i < n; i++) {
+ float u = (float)i/(float)(n-1);
+ float a = a0 + u*da;
+ float ax = cosf(a) * w, ay = sinf(a) * w;
+ float lx1 = p1->x - ax, ly1 = p1->y - ay;
+ float rx1 = p1->x + ax, ry1 = p1->y + ay;
+
+ nsvg__addEdge(r, lx1, ly1, lx, ly);
+ nsvg__addEdge(r, rx, ry, rx1, ry1);
+
+ lx = lx1; ly = ly1;
+ rx = rx1; ry = ry1;
+ }
+
+ left->x = lx; left->y = ly;
+ right->x = rx; right->y = ry;
+}
+
+static void nsvg__straightJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p1, float lineWidth)
+{
+ float w = lineWidth * 0.5f;
+ float lx = p1->x - (p1->dmx * w), ly = p1->y - (p1->dmy * w);
+ float rx = p1->x + (p1->dmx * w), ry = p1->y + (p1->dmy * w);
+
+ nsvg__addEdge(r, lx, ly, left->x, left->y);
+ nsvg__addEdge(r, right->x, right->y, rx, ry);
+
+ left->x = lx; left->y = ly;
+ right->x = rx; right->y = ry;
+}
+
+static int nsvg__curveDivs(float r, float arc, float tol)
+{
+ float da = acosf(r / (r + tol)) * 2.0f;
+ int divs = (int)ceilf(arc / da);
+ if (divs < 2) divs = 2;
+ return divs;
+}
+
+static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints, int closed, int lineJoin, int lineCap, float lineWidth)
+{
+ int ncap = nsvg__curveDivs(lineWidth*0.5f, NSVG_PI, r->tessTol); /* Calculate divisions per half circle. */
+ NSVGpoint left = {0,0,0,0,0,0,0,0}, right = {0,0,0,0,0,0,0,0}, firstLeft = {0,0,0,0,0,0,0,0}, firstRight = {0,0,0,0,0,0,0,0};
+ NSVGpoint* p0, *p1;
+ int j, s, e;
+
+ /* Build stroke edges */
+ if (closed) {
+ /* Looping */
+ p0 = &points[npoints-1];
+ p1 = &points[0];
+ s = 0;
+ e = npoints;
+ } else {
+ /* Add cap */
+ p0 = &points[0];
+ p1 = &points[1];
+ s = 1;
+ e = npoints-1;
+ }
+
+ if (closed) {
+ nsvg__initClosed(&left, &right, p0, p1, lineWidth);
+ firstLeft = left;
+ firstRight = right;
+ } else {
+ /* Add cap */
+ float dx = p1->x - p0->x;
+ float dy = p1->y - p0->y;
+ nsvg__normalize(&dx, &dy);
+ if (lineCap == NSVG_CAP_BUTT)
+ nsvg__buttCap(r, &left, &right, p0, dx, dy, lineWidth, 0);
+ else if (lineCap == NSVG_CAP_SQUARE)
+ nsvg__squareCap(r, &left, &right, p0, dx, dy, lineWidth, 0);
+ else if (lineCap == NSVG_CAP_ROUND)
+ nsvg__roundCap(r, &left, &right, p0, dx, dy, lineWidth, ncap, 0);
+ }
+
+ for (j = s; j < e; ++j) {
+ if (p1->flags & NSVG_PT_CORNER) {
+ if (lineJoin == NSVG_JOIN_ROUND)
+ nsvg__roundJoin(r, &left, &right, p0, p1, lineWidth, ncap);
+ else if (lineJoin == NSVG_JOIN_BEVEL || (p1->flags & NSVG_PT_BEVEL))
+ nsvg__bevelJoin(r, &left, &right, p0, p1, lineWidth);
+ else
+ nsvg__miterJoin(r, &left, &right, p0, p1, lineWidth);
+ } else {
+ nsvg__straightJoin(r, &left, &right, p1, lineWidth);
+ }
+ p0 = p1++;
+ }
+
+ if (closed) {
+ /* Loop it */
+ nsvg__addEdge(r, firstLeft.x, firstLeft.y, left.x, left.y);
+ nsvg__addEdge(r, right.x, right.y, firstRight.x, firstRight.y);
+ } else {
+ /* Add cap */
+ float dx = p1->x - p0->x;
+ float dy = p1->y - p0->y;
+ nsvg__normalize(&dx, &dy);
+ if (lineCap == NSVG_CAP_BUTT)
+ nsvg__buttCap(r, &right, &left, p1, -dx, -dy, lineWidth, 1);
+ else if (lineCap == NSVG_CAP_SQUARE)
+ nsvg__squareCap(r, &right, &left, p1, -dx, -dy, lineWidth, 1);
+ else if (lineCap == NSVG_CAP_ROUND)
+ nsvg__roundCap(r, &right, &left, p1, -dx, -dy, lineWidth, ncap, 1);
+ }
+}
+
+static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoin)
+{
+ int i, j;
+ NSVGpoint* p0, *p1;
+
+ p0 = &r->points[r->npoints-1];
+ p1 = &r->points[0];
+ for (i = 0; i < r->npoints; i++) {
+ /* Calculate segment direction and length */
+ p0->dx = p1->x - p0->x;
+ p0->dy = p1->y - p0->y;
+ p0->len = nsvg__normalize(&p0->dx, &p0->dy);
+ /* Advance */
+ p0 = p1++;
+ }
+
+ /* calculate joins */
+ p0 = &r->points[r->npoints-1];
+ p1 = &r->points[0];
+ for (j = 0; j < r->npoints; j++) {
+ float dlx0, dly0, dlx1, dly1, dmr2, cross;
+ dlx0 = p0->dy;
+ dly0 = -p0->dx;
+ dlx1 = p1->dy;
+ dly1 = -p1->dx;
+ /* Calculate extrusions */
+ p1->dmx = (dlx0 + dlx1) * 0.5f;
+ p1->dmy = (dly0 + dly1) * 0.5f;
+ dmr2 = p1->dmx*p1->dmx + p1->dmy*p1->dmy;
+ if (dmr2 > 0.000001f) {
+ float s2 = 1.0f / dmr2;
+ if (s2 > 600.0f) {
+ s2 = 600.0f;
+ }
+ p1->dmx *= s2;
+ p1->dmy *= s2;
+ }
+
+ /* Clear flags, but keep the corner. */
+ p1->flags = (p1->flags & NSVG_PT_CORNER) ? NSVG_PT_CORNER : 0;
+
+ /* Keep track of left turns. */
+ cross = p1->dx * p0->dy - p0->dx * p1->dy;
+ if (cross > 0.0f)
+ p1->flags |= NSVG_PT_LEFT;
+
+ /* Check to see if the corner needs to be beveled. */
+ if (p1->flags & NSVG_PT_CORNER) {
+ if ((dmr2 * miterLimit*miterLimit) < 1.0f || lineJoin == NSVG_JOIN_BEVEL || lineJoin == NSVG_JOIN_ROUND) {
+ p1->flags |= NSVG_PT_BEVEL;
+ }
+ }
+
+ p0 = p1++;
+ }
+}
+
+static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float scale)
+{
+ int i, j, closed;
+ NSVGpath* path;
+ NSVGpoint* p0, *p1;
+ float miterLimit = shape->miterLimit;
+ int lineJoin = shape->strokeLineJoin;
+ int lineCap = shape->strokeLineCap;
+ float lineWidth = shape->strokeWidth * scale;
+
+ for (path = shape->paths; path != NULL; path = path->next) {
+ /* Flatten path */
+ r->npoints = 0;
+ nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, NSVG_PT_CORNER);
+ for (i = 0; i < path->npts-1; i += 3) {
+ float* p = &path->pts[i*2];
+ nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, NSVG_PT_CORNER);
+ }
+ if (r->npoints < 2)
+ continue;
+
+ closed = path->closed;
+
+ /* If the first and last points are the same, remove the last, mark as closed path. */
+ p0 = &r->points[r->npoints-1];
+ p1 = &r->points[0];
+ if (nsvg__ptEquals(p0->x,p0->y, p1->x,p1->y, r->distTol)) {
+ r->npoints--;
+ p0 = &r->points[r->npoints-1];
+ closed = 1;
+ }
+
+ if (shape->strokeDashCount > 0) {
+ int idash = 0, dashState = 1;
+ float totalDist = 0, dashLen, allDashLen, dashOffset;
+ NSVGpoint cur;
+
+ if (closed)
+ nsvg__appendPathPoint(r, r->points[0]);
+
+ /* Duplicate points -> points2. */
+ nsvg__duplicatePoints(r);
+
+ r->npoints = 0;
+ cur = r->points2[0];
+ nsvg__appendPathPoint(r, cur);
+
+ /* Figure out dash offset. */
+ allDashLen = 0;
+ for (j = 0; j < shape->strokeDashCount; j++)
+ allDashLen += shape->strokeDashArray[j];
+ if (shape->strokeDashCount & 1)
+ allDashLen *= 2.0f;
+ /* Find location inside pattern */
+ dashOffset = fmodf(shape->strokeDashOffset, allDashLen);
+ if (dashOffset < 0.0f)
+ dashOffset += allDashLen;
+
+ while (dashOffset > shape->strokeDashArray[idash]) {
+ dashOffset -= shape->strokeDashArray[idash];
+ idash = (idash + 1) % shape->strokeDashCount;
+ }
+ dashLen = (shape->strokeDashArray[idash] - dashOffset) * scale;
+
+ for (j = 1; j < r->npoints2; ) {
+ float dx = r->points2[j].x - cur.x;
+ float dy = r->points2[j].y - cur.y;
+ float dist = sqrtf(dx*dx + dy*dy);
+
+ if ((totalDist + dist) > dashLen) {
+ /* Calculate intermediate point */
+ float d = (dashLen - totalDist) / dist;
+ float x = cur.x + dx * d;
+ float y = cur.y + dy * d;
+ nsvg__addPathPoint(r, x, y, NSVG_PT_CORNER);
+
+ /* Stroke */
+ if (r->npoints > 1 && dashState) {
+ nsvg__prepareStroke(r, miterLimit, lineJoin);
+ nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth);
+ }
+ /* Advance dash pattern */
+ dashState = !dashState;
+ idash = (idash+1) % shape->strokeDashCount;
+ dashLen = shape->strokeDashArray[idash] * scale;
+ /* Restart */
+ cur.x = x;
+ cur.y = y;
+ cur.flags = NSVG_PT_CORNER;
+ totalDist = 0.0f;
+ r->npoints = 0;
+ nsvg__appendPathPoint(r, cur);
+ } else {
+ totalDist += dist;
+ cur = r->points2[j];
+ nsvg__appendPathPoint(r, cur);
+ j++;
+ }
+ }
+ /* Stroke any leftover path */
+ if (r->npoints > 1 && dashState)
+ nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth);
+ } else {
+ nsvg__prepareStroke(r, miterLimit, lineJoin);
+ nsvg__expandStroke(r, r->points, r->npoints, closed, lineJoin, lineCap, lineWidth);
+ }
+ }
+}
+
+static int nsvg__cmpEdge(const void *p, const void *q)
+{
+ const NSVGedge* a = (const NSVGedge*)p;
+ const NSVGedge* b = (const NSVGedge*)q;
+
+ if (a->y0 < b->y0) return -1;
+ if (a->y0 > b->y0) return 1;
+ return 0;
+}
+
+
+static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float startPoint)
+{
+ NSVGactiveEdge* z;
+ float dxdy;
+
+ if (r->freelist != NULL) {
+ /* Restore from freelist. */
+ z = r->freelist;
+ r->freelist = z->next;
+ } else {
+ /* Alloc new edge. */
+ z = (NSVGactiveEdge*)nsvg__alloc(r, sizeof(NSVGactiveEdge));
+ if (z == NULL) return NULL;
+ }
+
+ dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);
+/* STBTT_assert(e->y0 <= start_point); */
+ /* round dx down to avoid going too far */
+ if (dxdy < 0)
+ z->dx = (int)(-floorf(NSVG__FIX * -dxdy));
+ else
+ z->dx = (int)floorf(NSVG__FIX * dxdy);
+ z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
+/* z->x -= off_x * FIX; */
+ z->ey = e->y1;
+ z->next = 0;
+ z->dir = e->dir;
+
+ return z;
+}
+
+static void nsvg__freeActive(NSVGrasterizer* r, NSVGactiveEdge* z)
+{
+ z->next = r->freelist;
+ r->freelist = z;
+}
+
+static void nsvg__fillScanline(unsigned char* scanline, int len, int x0, int x1, int maxWeight, int* xmin, int* xmax)
+{
+ int i = x0 >> NSVG__FIXSHIFT;
+ int j = x1 >> NSVG__FIXSHIFT;
+ if (i < *xmin) *xmin = i;
+ if (j > *xmax) *xmax = j;
+ if (i < len && j >= 0) {
+ if (i == j) {
+ /* x0,x1 are the same pixel, so compute combined coverage */
+ scanline[i] = (unsigned char)(scanline[i] + ((x1 - x0) * maxWeight >> NSVG__FIXSHIFT));
+ } else {
+ if (i >= 0) /* add antialiasing for x0 */
+ scanline[i] = (unsigned char)(scanline[i] + (((NSVG__FIX - (x0 & NSVG__FIXMASK)) * maxWeight) >> NSVG__FIXSHIFT));
+ else
+ i = -1; /* clip */
+
+ if (j < len) /* add antialiasing for x1 */
+ scanline[j] = (unsigned char)(scanline[j] + (((x1 & NSVG__FIXMASK) * maxWeight) >> NSVG__FIXSHIFT));
+ else
+ j = len; /* clip */
+
+ for (++i; i < j; ++i) /* fill pixels between x0 and x1 */
+ scanline[i] = (unsigned char)(scanline[i] + maxWeight);
+ }
+ }
+}
+
+/* note: this routine clips fills that extend off the edges... ideally this
+ * wouldn't happen, but it could happen if the truetype glyph bounding boxes
+ * are wrong, or if the user supplies a too-small bitmap
+ */
+static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEdge* e, int maxWeight, int* xmin, int* xmax, char fillRule)
+{
+ /* non-zero winding fill */
+ int x0 = 0, w = 0;
+
+ if (fillRule == NSVG_FILLRULE_NONZERO) {
+ /* Non-zero */
+ while (e != NULL) {
+ if (w == 0) {
+ /* if we're currently at zero, we need to record the edge start point */
+ x0 = e->x; w += e->dir;
+ } else {
+ int x1 = e->x; w += e->dir;
+ /* if we went to zero, we need to draw */
+ if (w == 0)
+ nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax);
+ }
+ e = e->next;
+ }
+ } else if (fillRule == NSVG_FILLRULE_EVENODD) {
+ /* Even-odd */
+ while (e != NULL) {
+ if (w == 0) {
+ /* if we're currently at zero, we need to record the edge start point */
+ x0 = e->x; w = 1;
+ } else {
+ int x1 = e->x; w = 0;
+ nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax);
+ }
+ e = e->next;
+ }
+ }
+}
+
+static float nsvg__clampf(float a, float mn, float mx) { return a < mn ? mn : (a > mx ? mx : a); }
+
+static unsigned int nsvg__RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
+{
+ return (r) | (g << 8) | (b << 16) | (a << 24);
+}
+
+static unsigned int nsvg__lerpRGBA(unsigned int c0, unsigned int c1, float u)
+{
+ int iu = (int)(nsvg__clampf(u, 0.0f, 1.0f) * 256.0f);
+ int r = (((c0) & 0xff)*(256-iu) + (((c1) & 0xff)*iu)) >> 8;
+ int g = (((c0>>8) & 0xff)*(256-iu) + (((c1>>8) & 0xff)*iu)) >> 8;
+ int b = (((c0>>16) & 0xff)*(256-iu) + (((c1>>16) & 0xff)*iu)) >> 8;
+ int a = (((c0>>24) & 0xff)*(256-iu) + (((c1>>24) & 0xff)*iu)) >> 8;
+ return nsvg__RGBA((unsigned char)r, (unsigned char)g, (unsigned char)b, (unsigned char)a);
+}
+
+static unsigned int nsvg__applyOpacity(unsigned int c, float u)
+{
+ int iu = (int)(nsvg__clampf(u, 0.0f, 1.0f) * 256.0f);
+ int r = (c) & 0xff;
+ int g = (c>>8) & 0xff;
+ int b = (c>>16) & 0xff;
+ int a = (((c>>24) & 0xff)*iu) >> 8;
+ return nsvg__RGBA((unsigned char)r, (unsigned char)g, (unsigned char)b, (unsigned char)a);
+}
+
+static inline int nsvg__div255(int x)
+{
+ return ((x+1) * 257) >> 16;
+}
+
+static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* cover, int x, int y,
+ float tx, float ty, float scale, NSVGcachedPaint* cache)
+{
+
+ if (cache->type == NSVG_PAINT_COLOR) {
+ int i, cr, cg, cb, ca;
+ cr = cache->colors[0] & 0xff;
+ cg = (cache->colors[0] >> 8) & 0xff;
+ cb = (cache->colors[0] >> 16) & 0xff;
+ ca = (cache->colors[0] >> 24) & 0xff;
+
+ for (i = 0; i < count; i++) {
+ int r,g,b;
+ int a = nsvg__div255((int)cover[0] * ca);
+ int ia = 255 - a;
+ /* Premultiply */
+ r = nsvg__div255(cr * a);
+ g = nsvg__div255(cg * a);
+ b = nsvg__div255(cb * a);
+
+ /* Blend over */
+ r += nsvg__div255(ia * (int)dst[0]);
+ g += nsvg__div255(ia * (int)dst[1]);
+ b += nsvg__div255(ia * (int)dst[2]);
+ a += nsvg__div255(ia * (int)dst[3]);
+
+ dst[0] = (unsigned char)r;
+ dst[1] = (unsigned char)g;
+ dst[2] = (unsigned char)b;
+ dst[3] = (unsigned char)a;
+
+ cover++;
+ dst += 4;
+ }
+ } else if (cache->type == NSVG_PAINT_LINEAR_GRADIENT) {
+ /* TODO: spread modes. */
+ /* TODO: plenty of opportunities to optimize. */
+ float fx, fy, dx, gy;
+ float* t = cache->xform;
+ int i, cr, cg, cb, ca;
+ unsigned int c;
+
+ fx = ((float)x - tx) / scale;
+ fy = ((float)y - ty) / scale;
+ dx = 1.0f / scale;
+
+ for (i = 0; i < count; i++) {
+ int r,g,b,a,ia;
+ gy = fx*t[1] + fy*t[3] + t[5];
+ c = cache->colors[(int)nsvg__clampf(gy*255.0f, 0, 255.0f)];
+ cr = (c) & 0xff;
+ cg = (c >> 8) & 0xff;
+ cb = (c >> 16) & 0xff;
+ ca = (c >> 24) & 0xff;
+
+ a = nsvg__div255((int)cover[0] * ca);
+ ia = 255 - a;
+
+ /* Premultiply */
+ r = nsvg__div255(cr * a);
+ g = nsvg__div255(cg * a);
+ b = nsvg__div255(cb * a);
+
+ /* Blend over */
+ r += nsvg__div255(ia * (int)dst[0]);
+ g += nsvg__div255(ia * (int)dst[1]);
+ b += nsvg__div255(ia * (int)dst[2]);
+ a += nsvg__div255(ia * (int)dst[3]);
+
+ dst[0] = (unsigned char)r;
+ dst[1] = (unsigned char)g;
+ dst[2] = (unsigned char)b;
+ dst[3] = (unsigned char)a;
+
+ cover++;
+ dst += 4;
+ fx += dx;
+ }
+ } else if (cache->type == NSVG_PAINT_RADIAL_GRADIENT) {
+ /* TODO: spread modes. */
+ /* TODO: plenty of opportunities to optimize. */
+ /* TODO: focus (fx,fy) */
+ float fx, fy, dx, gx, gy, gd;
+ float* t = cache->xform;
+ int i, cr, cg, cb, ca;
+ unsigned int c;
+
+ fx = ((float)x - tx) / scale;
+ fy = ((float)y - ty) / scale;
+ dx = 1.0f / scale;
+
+ for (i = 0; i < count; i++) {
+ int r,g,b,a,ia;
+ gx = fx*t[0] + fy*t[2] + t[4];
+ gy = fx*t[1] + fy*t[3] + t[5];
+ gd = sqrtf(gx*gx + gy*gy);
+ c = cache->colors[(int)nsvg__clampf(gd*255.0f, 0, 255.0f)];
+ cr = (c) & 0xff;
+ cg = (c >> 8) & 0xff;
+ cb = (c >> 16) & 0xff;
+ ca = (c >> 24) & 0xff;
+
+ a = nsvg__div255((int)cover[0] * ca);
+ ia = 255 - a;
+
+ /* Premultiply */
+ r = nsvg__div255(cr * a);
+ g = nsvg__div255(cg * a);
+ b = nsvg__div255(cb * a);
+
+ /* Blend over */
+ r += nsvg__div255(ia * (int)dst[0]);
+ g += nsvg__div255(ia * (int)dst[1]);
+ b += nsvg__div255(ia * (int)dst[2]);
+ a += nsvg__div255(ia * (int)dst[3]);
+
+ dst[0] = (unsigned char)r;
+ dst[1] = (unsigned char)g;
+ dst[2] = (unsigned char)b;
+ dst[3] = (unsigned char)a;
+
+ cover++;
+ dst += 4;
+ fx += dx;
+ }
+ }
+}
+
+static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, float scale, NSVGcachedPaint* cache, char fillRule)
+{
+ NSVGactiveEdge *active = NULL;
+ int y, s;
+ int e = 0;
+ int maxWeight = (255 / NSVG__SUBSAMPLES); /* weight per vertical scanline */
+ int xmin, xmax;
+
+ for (y = 0; y < r->height; y++) {
+ memset(r->scanline, 0, r->width);
+ xmin = r->width;
+ xmax = 0;
+ for (s = 0; s < NSVG__SUBSAMPLES; ++s) {
+ /* find center of pixel for this scanline */
+ float scany = (float)(y*NSVG__SUBSAMPLES + s) + 0.5f;
+ NSVGactiveEdge **step = &active;
+
+ /* update all active edges; */
+ /* remove all active edges that terminate before the center of this scanline */
+ while (*step) {
+ NSVGactiveEdge *z = *step;
+ if (z->ey <= scany) {
+ *step = z->next; /* delete from list */
+/* NSVG__assert(z->valid); */
+ nsvg__freeActive(r, z);
+ } else {
+ z->x += z->dx; /* advance to position for current scanline */
+ step = &((*step)->next); /* advance through list */
+ }
+ }
+
+ /* resort the list if needed */
+ for (;;) {
+ int changed = 0;
+ step = &active;
+ while (*step && (*step)->next) {
+ if ((*step)->x > (*step)->next->x) {
+ NSVGactiveEdge* t = *step;
+ NSVGactiveEdge* q = t->next;
+ t->next = q->next;
+ q->next = t;
+ *step = q;
+ changed = 1;
+ }
+ step = &(*step)->next;
+ }
+ if (!changed) break;
+ }
+
+ /* insert all edges that start before the center of this scanline -- omit ones that also end on this scanline */
+ while (e < r->nedges && r->edges[e].y0 <= scany) {
+ if (r->edges[e].y1 > scany) {
+ NSVGactiveEdge* z = nsvg__addActive(r, &r->edges[e], scany);
+ if (z == NULL) break;
+ /* find insertion point */
+ if (active == NULL) {
+ active = z;
+ } else if (z->x < active->x) {
+ /* insert at front */
+ z->next = active;
+ active = z;
+ } else {
+ /* find thing to insert AFTER */
+ NSVGactiveEdge* p = active;
+ while (p->next && p->next->x < z->x)
+ p = p->next;
+ /* at this point, p->next->x is NOT < z->x */
+ z->next = p->next;
+ p->next = z;
+ }
+ }
+ e++;
+ }
+
+ /* now process all active edges in non-zero fashion */
+ if (active != NULL)
+ nsvg__fillActiveEdges(r->scanline, r->width, active, maxWeight, &xmin, &xmax, fillRule);
+ }
+ /* Blit */
+ if (xmin < 0) xmin = 0;
+ if (xmax > r->width-1) xmax = r->width-1;
+ if (xmin <= xmax) {
+ nsvg__scanlineSolid(&r->bitmap[y * r->stride] + xmin*4, xmax-xmin+1, &r->scanline[xmin], xmin, y, tx,ty, scale, cache);
+ }
+ }
+
+}
+
+static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int stride)
+{
+ int x,y;
+
+ /* Unpremultiply */
+ for (y = 0; y < h; y++) {
+ unsigned char *row = &image[y*stride];
+ for (x = 0; x < w; x++) {
+ int r = row[0], g = row[1], b = row[2], a = row[3];
+ if (a != 0) {
+ row[0] = (unsigned char)(r*255/a);
+ row[1] = (unsigned char)(g*255/a);
+ row[2] = (unsigned char)(b*255/a);
+ }
+ row += 4;
+ }
+ }
+
+ /* Defringe */
+ for (y = 0; y < h; y++) {
+ unsigned char *row = &image[y*stride];
+ for (x = 0; x < w; x++) {
+ int r = 0, g = 0, b = 0, a = row[3], n = 0;
+ if (a == 0) {
+ if (x-1 > 0 && row[-1] != 0) {
+ r += row[-4];
+ g += row[-3];
+ b += row[-2];
+ n++;
+ }
+ if (x+1 < w && row[7] != 0) {
+ r += row[4];
+ g += row[5];
+ b += row[6];
+ n++;
+ }
+ if (y-1 > 0 && row[-stride+3] != 0) {
+ r += row[-stride];
+ g += row[-stride+1];
+ b += row[-stride+2];
+ n++;
+ }
+ if (y+1 < h && row[stride+3] != 0) {
+ r += row[stride];
+ g += row[stride+1];
+ b += row[stride+2];
+ n++;
+ }
+ if (n > 0) {
+ row[0] = (unsigned char)(r/n);
+ row[1] = (unsigned char)(g/n);
+ row[2] = (unsigned char)(b/n);
+ }
+ }
+ row += 4;
+ }
+ }
+}
+
+
+static void nsvg__initPaint(NSVGcachedPaint* cache, NSVGpaint* paint, float opacity)
+{
+ int i, j;
+ NSVGgradient* grad;
+
+ cache->type = paint->type;
+
+ if (paint->type == NSVG_PAINT_COLOR) {
+ cache->colors[0] = nsvg__applyOpacity(paint->color, opacity);
+ return;
+ }
+
+ grad = paint->gradient;
+
+ cache->spread = grad->spread;
+ memcpy(cache->xform, grad->xform, sizeof(float)*6);
+
+ if (grad->nstops == 0) {
+ for (i = 0; i < 256; i++)
+ cache->colors[i] = 0;
+ } if (grad->nstops == 1) {
+ for (i = 0; i < 256; i++)
+ cache->colors[i] = nsvg__applyOpacity(grad->stops[i].color, opacity);
+ } else {
+ unsigned int ca, cb = 0;
+ float ua, ub, du, u;
+ int ia, ib, count;
+
+ ca = nsvg__applyOpacity(grad->stops[0].color, opacity);
+ ua = nsvg__clampf(grad->stops[0].offset, 0, 1);
+ ub = nsvg__clampf(grad->stops[grad->nstops-1].offset, ua, 1);
+ ia = (int)(ua * 255.0f);
+ ib = (int)(ub * 255.0f);
+ for (i = 0; i < ia; i++) {
+ cache->colors[i] = ca;
+ }
+
+ for (i = 0; i < grad->nstops-1; i++) {
+ ca = nsvg__applyOpacity(grad->stops[i].color, opacity);
+ cb = nsvg__applyOpacity(grad->stops[i+1].color, opacity);
+ ua = nsvg__clampf(grad->stops[i].offset, 0, 1);
+ ub = nsvg__clampf(grad->stops[i+1].offset, 0, 1);
+ ia = (int)(ua * 255.0f);
+ ib = (int)(ub * 255.0f);
+ count = ib - ia;
+ if (count <= 0) continue;
+ u = 0;
+ du = 1.0f / (float)count;
+ for (j = 0; j < count; j++) {
+ cache->colors[ia+j] = nsvg__lerpRGBA(ca,cb,u);
+ u += du;
+ }
+ }
+
+ for (i = ib; i < 256; i++)
+ cache->colors[i] = cb;
+ }
+
+}
+
+/*
+static void dumpEdges(NSVGrasterizer* r, const char* name)
+{
+ float xmin = 0, xmax = 0, ymin = 0, ymax = 0;
+ NSVGedge *e = NULL;
+ int i;
+ if (r->nedges == 0) return;
+ FILE* fp = fopen(name, "w");
+ if (fp == NULL) return;
+
+ xmin = xmax = r->edges[0].x0;
+ ymin = ymax = r->edges[0].y0;
+ for (i = 0; i < r->nedges; i++) {
+ e = &r->edges[i];
+ xmin = nsvg__minf(xmin, e->x0);
+ xmin = nsvg__minf(xmin, e->x1);
+ xmax = nsvg__maxf(xmax, e->x0);
+ xmax = nsvg__maxf(xmax, e->x1);
+ ymin = nsvg__minf(ymin, e->y0);
+ ymin = nsvg__minf(ymin, e->y1);
+ ymax = nsvg__maxf(ymax, e->y0);
+ ymax = nsvg__maxf(ymax, e->y1);
+ }
+
+ fprintf(fp, "<svg viewBox=\"%f %f %f %f\" xmlns=\"http://www.w3.org/2000/svg\">", xmin, ymin, (xmax - xmin), (ymax - ymin));
+
+ for (i = 0; i < r->nedges; i++) {
+ e = &r->edges[i];
+ fprintf(fp ,"<line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" style=\"stroke:#000;\" />", e->x0,e->y0, e->x1,e->y1);
+ }
+
+ for (i = 0; i < r->npoints; i++) {
+ if (i+1 < r->npoints)
+ fprintf(fp ,"<line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" style=\"stroke:#f00;\" />", r->points[i].x, r->points[i].y, r->points[i+1].x, r->points[i+1].y);
+ fprintf(fp ,"<circle cx=\"%f\" cy=\"%f\" r=\"1\" style=\"fill:%s;\" />", r->points[i].x, r->points[i].y, r->points[i].flags == 0 ? "#f00" : "#0f0");
+ }
+
+ fprintf(fp, "</svg>");
+ fclose(fp);
+}
+*/
+
+NANOSVG_SCOPE
+void nsvgRasterize(NSVGrasterizer* r,
+ NSVGimage* image, float tx, float ty, float scale,
+ unsigned char* dst, int w, int h, int stride)
+{
+ NSVGshape *shape = NULL;
+ NSVGedge *e = NULL;
+ NSVGcachedPaint cache;
+ int i;
+
+ r->bitmap = dst;
+ r->width = w;
+ r->height = h;
+ r->stride = stride;
+
+ if (w > r->cscanline) {
+ r->cscanline = w;
+ r->scanline = (unsigned char*)NANOSVG_realloc(r->scanline, w);
+ if (r->scanline == NULL) return;
+ }
+
+ for (i = 0; i < h; i++)
+ memset(&dst[i*stride], 0, w*4);
+
+ for (shape = image->shapes; shape != NULL; shape = shape->next) {
+ if (!(shape->flags & NSVG_FLAGS_VISIBLE))
+ continue;
+
+ if (shape->fill.type != NSVG_PAINT_NONE) {
+ nsvg__resetPool(r);
+ r->freelist = NULL;
+ r->nedges = 0;
+
+ nsvg__flattenShape(r, shape, scale);
+
+ /* Scale and translate edges */
+ for (i = 0; i < r->nedges; i++) {
+ e = &r->edges[i];
+ e->x0 = tx + e->x0;
+ e->y0 = (ty + e->y0) * NSVG__SUBSAMPLES;
+ e->x1 = tx + e->x1;
+ e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES;
+ }
+
+ /* Rasterize edges */
+ qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
+
+ /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */
+ nsvg__initPaint(&cache, &shape->fill, shape->opacity);
+
+ nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, shape->fillRule);
+ }
+ if (shape->stroke.type != NSVG_PAINT_NONE && (shape->strokeWidth * scale) > 0.01f) {
+ nsvg__resetPool(r);
+ r->freelist = NULL;
+ r->nedges = 0;
+
+ nsvg__flattenShapeStroke(r, shape, scale);
+
+/* dumpEdges(r, "edge.svg"); */
+
+ /* Scale and translate edges */
+ for (i = 0; i < r->nedges; i++) {
+ e = &r->edges[i];
+ e->x0 = tx + e->x0;
+ e->y0 = (ty + e->y0) * NSVG__SUBSAMPLES;
+ e->x1 = tx + e->x1;
+ e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES;
+ }
+
+ /* Rasterize edges */
+ qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
+
+ /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */
+ nsvg__initPaint(&cache, &shape->stroke, shape->opacity);
+
+ nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, NSVG_FILLRULE_NONZERO);
+ }
+ }
+
+ nsvg__unpremultiplyAlpha(dst, w, h, stride);
+
+ r->bitmap = NULL;
+ r->width = 0;
+ r->height = 0;
+ r->stride = 0;
+}
+
+#endif
diff --git a/generic/tk.decls b/generic/tk.decls
index e891dbb..418ae35 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -5,8 +5,8 @@
# This file is used to generate the tkDecls.h, tkPlatDecls.h,
# tkStub.c, and tkPlatStub.c files.
#
-# Copyright (c) 1998-2000 Ajuba Solutions.
-# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
+# Copyright © 1998-2000 Ajuba Solutions.
+# Copyright © 2007 Daniel A. Steffen <das@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -105,7 +105,7 @@ declare 18 {
Tk_Window tkwin, const char *value, char *widgRec, int offset)
}
declare 19 {
- CONST86 char *Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin,
+ const char *Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
}
declare 20 {
@@ -146,7 +146,7 @@ declare 28 {
declare 29 {
int Tk_ConfigureWidget(Tcl_Interp *interp,
Tk_Window tkwin, const Tk_ConfigSpec *specs,
- int argc, CONST84 char **argv, char *widgRec,
+ int argc, const char **argv, char *widgRec,
int flags)
}
declare 30 {
@@ -245,7 +245,7 @@ declare 54 {
void Tk_DestroyWindow(Tk_Window tkwin)
}
declare 55 {
- CONST84_RETURN char *Tk_DisplayName(Tk_Window tkwin)
+ const char *Tk_DisplayName(Tk_Window tkwin)
}
declare 56 {
int Tk_DistanceToTextLayout(Tk_TextLayout layout, int x, int y)
@@ -326,7 +326,7 @@ declare 75 {
declare 76 {
void Tk_FreeTextLayout(Tk_TextLayout textLayout)
}
-declare 77 {
+declare 77 {deprecated {function does nothing, call can be removed}} {
void Tk_FreeXId(Display *display, XID xid)
}
declare 78 {
@@ -348,10 +348,10 @@ declare 82 {
const char *str, Tk_Anchor *anchorPtr)
}
declare 83 {
- CONST84_RETURN char *Tk_GetAtomName(Tk_Window tkwin, Atom atom)
+ const char *Tk_GetAtomName(Tk_Window tkwin, Atom atom)
}
declare 84 {
- CONST84_RETURN char *Tk_GetBinding(Tcl_Interp *interp,
+ const char *Tk_GetBinding(Tcl_Interp *interp,
Tk_BindingTable bindingTable, ClientData object,
const char *eventStr)
}
@@ -403,8 +403,8 @@ declare 97 {
Tk_ImageChangedProc *changeProc, ClientData clientData)
}
declare 98 {
- ClientData Tk_GetImageMasterData(Tcl_Interp *interp,
- const char *name, CONST86 Tk_ImageType **typePtrPtr)
+ ClientData Tk_GetImageModelData(Tcl_Interp *interp,
+ const char *name, const Tk_ImageType **typePtrPtr)
}
declare 99 {
Tk_ItemType *Tk_GetItemTypes(void)
@@ -439,7 +439,7 @@ declare 107 {
}
declare 108 {
int Tk_GetScrollInfo(Tcl_Interp *interp,
- int argc, CONST84 char **argv, double *dblPtr, int *intPtr)
+ int argc, const char **argv, double *dblPtr, int *intPtr)
}
declare 109 {
int Tk_GetScreenMM(Tcl_Interp *interp,
@@ -472,7 +472,7 @@ declare 116 {
Tk_Window Tk_IdToWindow(Display *display, Window window)
}
declare 117 {
- void Tk_ImageChanged(Tk_ImageMaster model, int x, int y,
+ void Tk_ImageChanged(Tk_ImageModel model, int x, int y,
int width, int height, int imageWidth, int imageHeight)
}
declare 118 {
@@ -518,37 +518,37 @@ declare 129 {
void Tk_MoveToplevelWindow(Tk_Window tkwin, int x, int y)
}
declare 130 {
- CONST84_RETURN char *Tk_NameOf3DBorder(Tk_3DBorder border)
+ const char *Tk_NameOf3DBorder(Tk_3DBorder border)
}
declare 131 {
- CONST84_RETURN char *Tk_NameOfAnchor(Tk_Anchor anchor)
+ const char *Tk_NameOfAnchor(Tk_Anchor anchor)
}
declare 132 {
- CONST84_RETURN char *Tk_NameOfBitmap(Display *display, Pixmap bitmap)
+ const char *Tk_NameOfBitmap(Display *display, Pixmap bitmap)
}
declare 133 {
- CONST84_RETURN char *Tk_NameOfCapStyle(int cap)
+ const char *Tk_NameOfCapStyle(int cap)
}
declare 134 {
- CONST84_RETURN char *Tk_NameOfColor(XColor *colorPtr)
+ const char *Tk_NameOfColor(XColor *colorPtr)
}
declare 135 {
- CONST84_RETURN char *Tk_NameOfCursor(Display *display, Tk_Cursor cursor)
+ const char *Tk_NameOfCursor(Display *display, Tk_Cursor cursor)
}
declare 136 {
- CONST84_RETURN char *Tk_NameOfFont(Tk_Font font)
+ const char *Tk_NameOfFont(Tk_Font font)
}
declare 137 {
- CONST84_RETURN char *Tk_NameOfImage(Tk_ImageMaster model)
+ const char *Tk_NameOfImage(Tk_ImageModel model)
}
declare 138 {
- CONST84_RETURN char *Tk_NameOfJoinStyle(int join)
+ const char *Tk_NameOfJoinStyle(int join)
}
declare 139 {
- CONST84_RETURN char *Tk_NameOfJustify(Tk_Justify justify)
+ const char *Tk_NameOfJustify(Tk_Justify justify)
}
declare 140 {
- CONST84_RETURN char *Tk_NameOfRelief(int relief)
+ const char *Tk_NameOfRelief(int relief)
}
declare 141 {
Tk_Window Tk_NameToWindow(Tcl_Interp *interp,
@@ -561,15 +561,15 @@ declare 142 {
}
declare 143 {
int Tk_ParseArgv(Tcl_Interp *interp,
- Tk_Window tkwin, int *argcPtr, CONST84 char **argv,
+ Tk_Window tkwin, int *argcPtr, const char **argv,
const Tk_ArgvInfo *argTable, int flags)
}
-declare 144 {
+declare 144 {deprecated {function signature changed}} {
void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height)
}
-declare 145 {
+declare 145 {deprecated {function signature changed}} {
void Tk_PhotoPutZoomedBlock_NoComposite(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height, int zoomX, int zoomY,
@@ -581,13 +581,13 @@ declare 146 {
declare 147 {
void Tk_PhotoBlank(Tk_PhotoHandle handle)
}
-declare 148 {
+declare 148 {deprecated {function signature changed}} {
void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle, int width, int height )
}
declare 149 {
void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr, int *heightPtr)
}
-declare 150 {
+declare 150 {deprecated {function signature changed}} {
void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle, int width, int height)
}
declare 151 {
@@ -744,7 +744,7 @@ declare 194 {
void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
declare 195 {
- void Tk_FreeConfigOptions(char *recordPtr, Tk_OptionTable optionToken,
+ void Tk_FreeConfigOptions(void *recordPtr, Tk_OptionTable optionToken,
Tk_Window tkwin)
}
declare 196 {
@@ -774,11 +774,11 @@ declare 203 {
}
declare 204 {
Tcl_Obj *Tk_GetOptionInfo(Tcl_Interp *interp,
- char *recordPtr, Tk_OptionTable optionTable,
+ void *recordPtr, Tk_OptionTable optionTable,
Tcl_Obj *namePtr, Tk_Window tkwin)
}
declare 205 {
- Tcl_Obj *Tk_GetOptionValue(Tcl_Interp *interp, char *recordPtr,
+ Tcl_Obj *Tk_GetOptionValue(Tcl_Interp *interp, void *recordPtr,
Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin)
}
declare 206 {
@@ -802,10 +802,10 @@ declare 210 {
int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr)
}
declare 211 {
- int Tk_InitOptions(Tcl_Interp *interp, char *recordPtr,
+ int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr,
Tk_OptionTable optionToken, Tk_Window tkwin)
}
-declare 212 {
+declare 212 {nostub {Don't use this function in a stub-enabled extension}} {
void Tk_MainEx(int argc, char **argv, Tcl_AppInitProc *appInitProc,
Tcl_Interp *interp)
}
@@ -813,7 +813,7 @@ declare 213 {
void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr)
}
declare 214 {
- int Tk_SetOptions(Tcl_Interp *interp, char *recordPtr,
+ int Tk_SetOptions(Tcl_Interp *interp, void *recordPtr,
Tk_OptionTable optionTable, int objc,
Tcl_Obj *const objv[], Tk_Window tkwin,
Tk_SavedOptions *savePtr, int *maskPtr)
@@ -943,12 +943,12 @@ declare 244 {
declare 245 {
void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height)
}
-declare 246 {
+declare 246 {deprecated {function signature changed}} {
void Tk_PhotoPutBlock_Panic(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height, int compRule)
}
-declare 247 {
+declare 247 {deprecated {function signature changed}} {
void Tk_PhotoPutZoomedBlock_Panic(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height, int zoomX, int zoomY,
@@ -1001,22 +1001,22 @@ declare 260 {
}
declare 261 {
void Tk_GetElementSize(Tk_Style style, Tk_StyledElement element,
- char *recordPtr, Tk_Window tkwin, int width, int height,
+ void *recordPtr, Tk_Window tkwin, int width, int height,
int inner, int *widthPtr, int *heightPtr)
}
declare 262 {
void Tk_GetElementBox(Tk_Style style, Tk_StyledElement element,
- char *recordPtr, Tk_Window tkwin, int x, int y, int width,
+ void *recordPtr, Tk_Window tkwin, int x, int y, int width,
int height, int inner, int *xPtr, int *yPtr, int *widthPtr,
int *heightPtr)
}
declare 263 {
int Tk_GetElementBorderWidth(Tk_Style style, Tk_StyledElement element,
- char *recordPtr, Tk_Window tkwin)
+ void *recordPtr, Tk_Window tkwin)
}
declare 264 {
void Tk_DrawElement(Tk_Style style, Tk_StyledElement element,
- char *recordPtr, Tk_Window tkwin, Drawable d, int x, int y,
+ void *recordPtr, Tk_Window tkwin, Drawable d, int x, int y,
int width, int height, int state)
}
@@ -1068,8 +1068,33 @@ declare 272 {
declare 273 {
void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat *formatPtr)
}
+
+# TIP#580
+declare 274 {
+ int Tk_AlwaysShowSelection(Tk_Window tkwin)
+}
+declare 275 {
+ unsigned Tk_GetButtonMask(unsigned button)
+}
+declare 276 {
+ int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin,
+ Tcl_Obj *objPtr, double *doublePtr)
+}
+declare 277 {
+ Tcl_Obj *Tk_NewWindowObj(Tk_Window tkwin)
+}
+declare 278 {
+ void Tk_SendVirtualEvent(Tk_Window tkwin, const char *eventName,
+ Tcl_Obj *detail)
+}
+declare 279 {
+ Tcl_Obj *Tk_FontGetDescription(Tk_Font tkfont)
+}
+
+# TIP#529
declare 280 {
- void TkUnusedStubEntry(void)
+ void Tk_CreatePhotoImageFormatVersion3(
+ const Tk_PhotoImageFormatVersion3 *formatPtr)
}
# Define the platform specific public Tk interface. These functions are
@@ -1102,37 +1127,24 @@ declare 5 win {
################################
# Aqua specific functions
-
-declare 0 aqua {
- void Tk_MacOSXSetEmbedHandler(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
-}
-declare 1 aqua {
- void Tk_MacOSXTurnOffMenus(void)
-}
-declare 2 aqua {
- void Tk_MacOSXTkOwnsCursor(int tkOwnsIt)
-}
-declare 3 aqua {
- void TkMacOSXInitMenus(Tcl_Interp *interp)
-}
+# Stub removed because the function no longer exists.
+#declare 3 aqua {
+# void TkMacOSXInitMenus(Tcl_Interp *interp)
+#}
declare 4 aqua {
void TkMacOSXInitAppleEvents(Tcl_Interp *interp)
}
declare 5 aqua {
- void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y, int width,
+ void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width,
int height, int flags)
}
declare 6 aqua {
void TkMacOSXInvalClipRgns(Tk_Window tkwin)
}
-declare 7 aqua {
- void *TkMacOSXGetDrawablePort(Drawable drawable)
-}
+# Stub removed because it just returned NULL.
+#declare 7 aqua {
+# void *TkMacOSXGetDrawablePort(Drawable drawable)
+#}
declare 8 aqua {
void *TkMacOSXGetRootControl(Drawable drawable)
}
@@ -1153,7 +1165,7 @@ declare 13 aqua {
void *Tk_MacOSXGetNSWindowForDrawable(Drawable drawable)
}
declare 16 aqua {
- void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width,
+ void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y, int width,
int height, int flags)
}
@@ -1165,6 +1177,14 @@ export {
const char *Tk_PkgInitStubsCheck(Tcl_Interp *interp, const char *version,
int exact)
}
+export {
+ void Tk_MainEx(int argc, char **argv, Tcl_AppInitProc *appInitProc,
+ Tcl_Interp *interp)
+}
+export {
+ void Tk_MainExW(int argc, wchar_t **argv,
+ Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
+}
# Local Variables:
# mode: tcl
diff --git a/generic/tk.h b/generic/tk.h
index ec1f78d..ec54701 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -17,17 +17,10 @@
#define _TK
#include <tcl.h>
-#if (TCL_MAJOR_VERSION != 8) || (TCL_MINOR_VERSION < 6)
-# error Tk 8.6 must be compiled with tcl.h from Tcl 8.6 or better
+#if (TCL_MAJOR_VERSION < 8) || (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6)
+# error Tk 8.7 must be compiled with tcl.h from Tcl 8.6 or better
#endif
-#ifndef CONST84
-# define CONST84 const
-# define CONST84_RETURN const
-#endif
-#ifndef CONST86
-# define CONST86 CONST84
-#endif
#ifndef EXTERN
# define EXTERN extern TCL_STORAGE_CLASS
#endif
@@ -59,8 +52,8 @@ extern "C" {
* and update the version numbers:
*
* library/tk.tcl (1 LOC patch)
- * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch)
- * win/configure.in (as above)
+ * unix/configure.ac (2 LOC Major, 2 LOC minor, 1 LOC patch)
+ * win/configure.ac (as above)
* README (sections 0 and 1)
* macosx/Tk-Common.xcconfig (not patchlevel) 1 LOC
* win/README (not patchlevel)
@@ -73,12 +66,12 @@ extern "C" {
*/
#define TK_MAJOR_VERSION 8
-#define TK_MINOR_VERSION 6
-#define TK_RELEASE_LEVEL TCL_FINAL_RELEASE
-#define TK_RELEASE_SERIAL 11
+#define TK_MINOR_VERSION 7
+#define TK_RELEASE_LEVEL TCL_ALPHA_RELEASE
+#define TK_RELEASE_SERIAL 6
-#define TK_VERSION "8.6"
-#define TK_PATCH_LEVEL "8.6.11"
+#define TK_VERSION "8.7"
+#define TK_PATCH_LEVEL "8.7a6"
/*
* A special definition used to allow this header file to be included from
@@ -101,14 +94,15 @@ extern "C" {
# include <X11/X.h>
# endif
#endif
-#if defined(STDC_HEADERS) || defined(__STDC__) || defined(__C99__FUNC__) \
- || defined(__cplusplus) || defined(_MSC_VER) || defined(__ICC)
-# include <stddef.h>
-#endif
+#include <stddef.h>
#ifdef BUILD_tk
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
+#else
+# ifndef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS DLLIMPORT
+# endif
#endif
/*
@@ -117,7 +111,7 @@ extern "C" {
* Decide whether or not to use input methods.
*/
-#ifdef XNQueryInputStyle
+#if defined(XNQueryInputStyle) && !defined(_WIN32) && !defined(MAC_OSX_TK)
#define TK_USE_INPUT_METHODS
#endif
@@ -125,14 +119,14 @@ extern "C" {
* Dummy types that are used by clients:
*/
-#define Tk_ImageModel Tk_ImageMaster
+#define Tk_ImageMaster Tk_ImageModel
typedef struct Tk_BindingTable_ *Tk_BindingTable;
typedef struct Tk_Canvas_ *Tk_Canvas;
typedef struct Tk_Cursor_ *Tk_Cursor;
typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler;
typedef struct Tk_Font_ *Tk_Font;
typedef struct Tk_Image__ *Tk_Image;
-typedef struct Tk_ImageMaster_ *Tk_ImageMaster;
+typedef struct Tk_ImageModel_ *Tk_ImageModel;
typedef struct Tk_OptionTable_ *Tk_OptionTable;
typedef struct Tk_PostscriptInfo_ *Tk_PostscriptInfo;
typedef struct Tk_TextLayout_ *Tk_TextLayout;
@@ -195,20 +189,25 @@ typedef struct Tk_OptionSpec {
const char *defValue; /* Default value for option if not specified
* in command line, the option database, or
* the system. */
- int objOffset; /* Where in record to store a Tcl_Obj * that
+#if TCL_MAJOR_VERSION > 8
+ size_t objOffset; /* Where in record to store a Tcl_Obj * that
* holds the value of this option, specified
* as an offset in bytes from the start of the
- * record. Use the Tk_Offset macro to generate
- * values for this. -1 means don't store the
- * Tcl_Obj in the record. */
- int internalOffset; /* Where in record to store the internal
+ * record. Use the offsetof macro to generate
+ * values for this. TCL_INDEX_NONE means don't
+ * store the Tcl_Obj in the record. */
+ size_t internalOffset; /* Where in record to store the internal
* representation of the value of this option,
* such as an int or XColor *. This field is
* specified as an offset in bytes from the
- * start of the record. Use the Tk_Offset
- * macro to generate values for it. -1 means
- * don't store the internal representation in
- * the record. */
+ * start of the record. Use the offsetof
+ * macro to generate values for it.
+ * TCL_INDEX_NONE means don't store the
+ * internal representation in the record. */
+#else
+ int objOffset;
+ int internalOffset;
+#endif
int flags; /* Any combination of the values defined
* below. */
const void *clientData; /* An alternate place to put option-specific
@@ -237,11 +236,19 @@ typedef struct Tk_OptionSpec {
* option config code to handle a custom option.
*/
+#if TCL_MAJOR_VERSION > 8
+typedef int (Tk_CustomOptionSetProc) (ClientData clientData,
+ Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *widgRec,
+ size_t offset, char *saveInternalPtr, int flags);
+typedef Tcl_Obj *(Tk_CustomOptionGetProc) (ClientData clientData,
+ Tk_Window tkwin, char *widgRec, size_t offset);
+#else
typedef int (Tk_CustomOptionSetProc) (ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *widgRec,
int offset, char *saveInternalPtr, int flags);
typedef Tcl_Obj *(Tk_CustomOptionGetProc) (ClientData clientData,
Tk_Window tkwin, char *widgRec, int offset);
+#endif
typedef void (Tk_CustomOptionRestoreProc) (ClientData clientData,
Tk_Window tkwin, char *internalPtr, char *saveInternalPtr);
typedef void (Tk_CustomOptionFreeProc) (ClientData clientData, Tk_Window tkwin,
@@ -271,7 +278,9 @@ typedef struct Tk_ObjCustomOption {
* Computes number of bytes from beginning of structure to a given field.
*/
-#define Tk_Offset(type, field) ((int) offsetof(type, field))
+#ifndef TK_NO_DEPRECATED
+# define Tk_Offset(type, field) ((int) offsetof(type, field))
+#endif
/* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */
#ifndef offsetof
# define offsetof(type, field) ((size_t) ((char *) &((type *) 0)->field))
@@ -295,7 +304,7 @@ typedef struct Tk_SavedOption {
double internalForm; /* The old value of the option, in some
* internal representation such as an int or
* (XColor *). Valid only if the field
- * optionPtr->specPtr->objOffset is < 0. The
+ * optionPtr->specPtr->objOffset is -1. The
* space must be large enough to accommodate a
* double, a long, or a pointer; right now it
* looks like a double (i.e., 8 bytes) is big
@@ -311,11 +320,15 @@ typedef struct Tk_SavedOption {
#endif
typedef struct Tk_SavedOptions {
- char *recordPtr; /* The data structure in which to restore
+ void *recordPtr; /* The data structure in which to restore
* configuration options. */
Tk_Window tkwin; /* Window associated with recordPtr; needed to
* restore certain options. */
- int numItems; /* The number of valid items in items field. */
+#if TCL_MAJOR_VERSION > 8
+ size_t numItems; /* The number of valid items in items field. */
+#else
+ int numItems;
+#endif
Tk_SavedOption items[TK_NUM_SAVED_OPTIONS];
/* Items used to hold old values. */
struct Tk_SavedOptions *nextPtr;
@@ -339,10 +352,17 @@ typedef struct Tk_SavedOptions {
#ifndef __NO_OLD_CONFIG
+#if TCL_MAJOR_VERSION > 8
+typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, const char *value, char *widgRec, size_t offset);
+typedef const char *(Tk_OptionPrintProc) (ClientData clientData,
+ Tk_Window tkwin, char *widgRec, size_t offset, Tcl_FreeProc **freeProcPtr);
+#else
typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, CONST84 char *value, char *widgRec, int offset);
-typedef CONST86 char *(Tk_OptionPrintProc) (ClientData clientData,
+ Tk_Window tkwin, const char *value, char *widgRec, int offset);
+typedef const char *(Tk_OptionPrintProc) (ClientData clientData,
Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
+#endif
typedef struct Tk_CustomOption {
Tk_OptionParseProc *parseProc;
@@ -367,19 +387,23 @@ typedef struct Tk_ConfigSpec {
int type; /* Type of option, such as TK_CONFIG_COLOR;
* see definitions below. Last option in table
* must have type TK_CONFIG_END. */
- CONST86 char *argvName; /* Switch used to specify option in argv. NULL
+ const char *argvName; /* Switch used to specify option in argv. NULL
* means this spec is part of a group. */
Tk_Uid dbName; /* Name for option in option database. */
Tk_Uid dbClass; /* Class for option in database. */
Tk_Uid defValue; /* Default value for option if not specified
* in command line or database. */
- int offset; /* Where in widget record to store value; use
- * Tk_Offset macro to generate values for
+#if TCL_MAJOR_VERSION > 8
+ size_t offset; /* Where in widget record to store value; use
+ * offsetof macro to generate values for
* this. */
+#else
+ int offset;
+#endif
int specFlags; /* Any combination of the values defined
* below; other bits are used internally by
* tkConfig.c. */
- CONST86 Tk_CustomOption *customPtr;
+ const Tk_CustomOption *customPtr;
/* If type is TK_CONFIG_CUSTOM then this is a
* pointer to info about how to parse and
* print the option. Otherwise it is
@@ -419,7 +443,9 @@ typedef enum {
#define TK_CONFIG_COLOR_ONLY (1 << 1)
#define TK_CONFIG_MONO_ONLY (1 << 2)
#define TK_CONFIG_DONT_SET_DEFAULT (1 << 3)
-#define TK_CONFIG_OPTION_SPECIFIED (1 << 4)
+#ifndef TK_NO_DEPRECATED
+# define TK_CONFIG_OPTION_SPECIFIED (1 << 4)
+#endif /* !TK_NO_DEPRECATED */
#define TK_CONFIG_USER_BIT 0x100
#endif /* __NO_OLD_CONFIG */
@@ -428,14 +454,14 @@ typedef enum {
*/
typedef struct {
- CONST86 char *key; /* The key string that flags the option in the
+ const char *key; /* The key string that flags the option in the
* argv array. */
int type; /* Indicates option type; see below. */
- char *src; /* Value to be used in setting dst; usage
+ void *src; /* Value to be used in setting dst; usage
* depends on type. */
- char *dst; /* Address of value to be modified; usage
+ void *dst; /* Address of value to be modified; usage
* depends on type. */
- CONST86 char *help; /* Documentation message describing this
+ const char *help; /* Documentation message describing this
* option. */
} Tk_ArgvInfo;
@@ -580,7 +606,11 @@ typedef void (Tk_ClassWorldChangedProc) (ClientData instanceData);
typedef void (Tk_ClassModalProc) (Tk_Window tkwin, XEvent *eventPtr);
typedef struct Tk_ClassProcs {
+#if TCL_MAJOR_VERSION > 8
+ size_t size;
+#else
unsigned int size;
+#endif
Tk_ClassWorldChangedProc *worldChangedProc;
/* Procedure to invoke when the widget needs
* to respond in some way to a change in the
@@ -605,12 +635,12 @@ typedef struct Tk_ClassProcs {
*
* #define Tk_GetField(name, who, which) \
* (((who) == NULL) ? NULL :
- * (((who)->size <= Tk_Offset(name, which)) ? NULL :(name)->which))
+ * (((who)->size <= offsetof(name, which)) ? NULL :(name)->which))
*/
#define Tk_GetClassProc(procs, which) \
(((procs) == NULL) ? NULL : \
- (((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which))
+ (((procs)->size <= offsetof(Tk_ClassProcs, which)) ? NULL:(procs)->which))
/*
* Each geometry manager (the packer, the placer, etc.) is represented by a
@@ -618,7 +648,7 @@ typedef struct Tk_ClassProcs {
* the geometry manager to carry out certain functions.
*/
-#define Tk_GeomLostContentProc Tk_GeomLostSlaveProc
+#define Tk_GeomLostSlaveProc Tk_GeomLostContentProc
typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin);
typedef void (Tk_GeomLostContentProc) (ClientData clientData, Tk_Window tkwin);
@@ -629,7 +659,7 @@ typedef struct Tk_GeomMgr {
Tk_GeomRequestProc *requestProc;
/* Procedure to invoke when a content's
* requested geometry changes. */
- Tk_GeomLostContentProc *lostSlaveProc;
+ Tk_GeomLostContentProc *lostContentProc;
/* Procedure to invoke when content is taken
* away from one geometry manager by another.
* NULL means geometry manager doesn't care
@@ -752,9 +782,10 @@ typedef XActivateDeactivateEvent XDeactivateEvent;
(((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE)
#define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth)
#define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight)
-/* Tk_InternalBorderWidth is deprecated */
+#ifndef TK_NO_DEPRECATED
#define Tk_InternalBorderWidth(tkwin) \
(((Tk_FakeWin *) (tkwin))->internalBorderLeft)
+#endif /* !TK_NO_DEPRECATED */
#define Tk_InternalBorderLeft(tkwin) \
(((Tk_FakeWin *) (tkwin))->internalBorderLeft)
#define Tk_InternalBorderRight(tkwin) \
@@ -799,7 +830,7 @@ typedef struct Tk_FakeWin {
unsigned long dummy7; /* dirtyAtts */
unsigned int flags;
char *dummy8; /* handlerList */
-#ifdef TK_USE_INPUT_METHODS
+#if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8)
XIC dummy9; /* inputContext */
#endif /* TK_USE_INPUT_METHODS */
ClientData *dummy10; /* tagPtr */
@@ -819,11 +850,15 @@ typedef struct Tk_FakeWin {
int internalBorderBottom;
int minReqWidth;
int minReqHeight;
-#ifdef TK_USE_INPUT_METHODS
+#if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8)
int dummy20;
#endif /* TK_USE_INPUT_METHODS */
char *dummy21; /* geomMgrName */
Tk_Window dummy22; /* maintainerPtr */
+#if !defined(TK_USE_INPUT_METHODS) && (TCL_MAJOR_VERSION < 9)
+ XIC dummy9; /* inputContext */
+ int dummy20;
+#endif /* TK_USE_INPUT_METHODS */
} Tk_FakeWin;
/*
@@ -931,7 +966,7 @@ typedef enum {
} Tk_State;
typedef struct Tk_SmoothMethod {
- CONST86 char *name;
+ const char *name;
int (*coordProc) (Tk_Canvas canvas, double *pointPtr, int numPoints,
int numSteps, XPoint xPoints[], double dblPoints[]);
void (*postscriptProc) (Tcl_Interp *interp, Tk_Canvas canvas,
@@ -947,8 +982,12 @@ typedef struct Tk_SmoothMethod {
#define TK_TAG_SPACE 3
typedef struct Tk_Item {
- int id; /* Unique identifier for this item (also
+#if TCL_MAJOR_VERSION > 8
+ size_t id; /* Unique identifier for this item (also
* serves as first tag for item). */
+#else
+ int id;
+#endif
struct Tk_Item *nextPtr; /* Next in display list of all items in this
* canvas. Later items in list are drawn on
* top of earlier ones. */
@@ -957,10 +996,14 @@ typedef struct Tk_Item {
Tk_Uid *tagPtr; /* Pointer to array of tags. Usually points to
* staticTagSpace, but may point to malloc-ed
* space if there are lots of tags. */
- int tagSpace; /* Total amount of tag space available at
+#if TCL_MAJOR_VERSION > 8
+ size_t tagSpace; /* Total amount of tag space available at
* tagPtr. */
- int numTags; /* Number of tag slots actually used at
+ size_t numTags; /* Number of tag slots actually used at
* *tagPtr. */
+#else
+ int tagSpace, numTags;
+#endif
struct Tk_ItemType *typePtr;/* Table of procedures that implement this
* type of item. */
int x1, y1, x2, y2; /* Bounding box for item, in integer canvas
@@ -1003,13 +1046,17 @@ typedef struct Tk_Item {
* lines, circles, etc.) that can form part of a canvas widget.
*/
-#ifdef USE_OLD_CANVAS
+#if defined(USE_OLD_CANVAS) && TCL_MAJOR_VERSION < 9
typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, char **argv);
typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, char **argv, int flags);
typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, char **argv);
+typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ int beforeThis, char *string);
+typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, char *indexString, int *indexPtr);
#else
typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, Tcl_Obj *const objv[]);
@@ -1018,6 +1065,17 @@ typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas,
int flags);
typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, Tcl_Obj *const argv[]);
+#if TCL_MAJOR_VERSION > 8
+typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ size_t beforeThis, Tcl_Obj *string);
+typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, Tcl_Obj *indexString, size_t *indexPtr);
+#else
+typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ int beforeThis, Tcl_Obj *string);
+typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, Tcl_Obj *indexString, int *indexPtr);
+#endif
#endif /* USE_OLD_CANVAS */
typedef void (Tk_ItemDeleteProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
Display *display);
@@ -1030,43 +1088,44 @@ typedef int (Tk_ItemAreaProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
double *rectPtr);
typedef int (Tk_ItemPostscriptProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int prepass);
+typedef void (Tk_ItemRotateProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRadians);
typedef void (Tk_ItemScaleProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
double originX, double originY, double scaleX,
double scaleY);
typedef void (Tk_ItemTranslateProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
double deltaX, double deltaY);
-#ifdef USE_OLD_CANVAS
-typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, char *indexString, int *indexPtr);
+#if TCL_MAJOR_VERSION > 8
+typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ size_t index);
+typedef size_t (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ size_t offset, char *buffer, size_t maxBytes);
+typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ size_t first, size_t last);
#else
-typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, Tcl_Obj *indexString, int *indexPtr);
-#endif /* USE_OLD_CANVAS */
typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
int index);
typedef int (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
int offset, char *buffer, int maxBytes);
-#ifdef USE_OLD_CANVAS
-typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- int beforeThis, char *string);
-#else
-typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- int beforeThis, Tcl_Obj *string);
-#endif /* USE_OLD_CANVAS */
typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
int first, int last);
+#endif
#ifndef __NO_OLD_CONFIG
typedef struct Tk_ItemType {
- CONST86 char *name; /* The name of this type of item, such as
+ const char *name; /* The name of this type of item, such as
* "line". */
- int itemSize; /* Total amount of space needed for item's
+#if TCL_MAJOR_VERSION > 8
+ size_t itemSize; /* Total amount of space needed for item's
* record. */
+#else
+ int itemSize;
+#endif
Tk_ItemCreateProc *createProc;
/* Procedure to create a new item of this
* type. */
- CONST86 Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for
+ const Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for
* this type. Used for returning configuration
* info. */
Tk_ItemConfigureProc *configProc;
@@ -1109,7 +1168,9 @@ typedef struct Tk_ItemType {
/* Procedure to delete characters from an
* item. */
struct Tk_ItemType *nextPtr;/* Used to link types together into a list. */
- char *reserved1; /* Reserved for future extension. */
+ Tk_ItemRotateProc *rotateProc;
+ /* Procedure to rotate an item's coordinates
+ * about a point. */
int reserved2; /* Carefully compatible with */
char *reserved3; /* Jan Nijtmans dash patch */
char *reserved4;
@@ -1142,17 +1203,25 @@ typedef struct Tk_CanvasTextInfo {
Tk_Item *selItemPtr; /* Pointer to selected item. NULL means
* selection isn't in this canvas. Writable by
* items. */
- int selectFirst; /* Character index of first selected
+#if TCL_MAJOR_VERSION > 8
+ size_t selectFirst; /* Character index of first selected
* character. Writable by items. */
- int selectLast; /* Character index of last selected character.
+ size_t selectLast; /* Character index of last selected character.
* Writable by items. */
+#else
+ int selectFirst, selectLast;
+#endif
Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor": not
* necessarily selItemPtr. Read-only to
* items. */
- int selectAnchor; /* Character index of fixed end of selection
+#if TCL_MAJOR_VERSION > 8
+ size_t selectAnchor; /* Character index of fixed end of selection
* (i.e. "select to" operation will use this
* as one end of the selection). Writable by
* items. */
+#else
+ int selectAnchor;
+#endif
Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion
* cursor. Read-only to items. */
int insertWidth; /* Total width of insertion cursor. Read-only
@@ -1231,13 +1300,13 @@ typedef struct Tk_Outline {
*/
typedef struct Tk_ImageType Tk_ImageType;
-#ifdef USE_OLD_IMAGE
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && defined(USE_OLD_IMAGE)
typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc,
- char **argv, Tk_ImageType *typePtr, Tk_ImageMaster model,
+ char **argv, Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
#else
-typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, CONST86 char *name, int objc,
- Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster model,
+typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, const char *name, int objc,
+ Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
#endif /* USE_OLD_IMAGE */
typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData clientData);
@@ -1261,7 +1330,7 @@ typedef int (Tk_ImagePostscriptProc) (ClientData clientData,
*/
struct Tk_ImageType {
- CONST86 char *name; /* Name of image type. */
+ const char *name; /* Name of image type. */
Tk_ImageCreateProc *createProc;
/* Procedure to call to create a new image of
* this type. */
@@ -1367,13 +1436,43 @@ typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, Tcl_Obj *format,
#endif /* USE_OLD_IMAGE */
/*
+ * The following alternate definitions are used with the Tk8.7 file format
+ * supporting a metadata dict, internal dstring and close file flag
+ */
+
+typedef struct Tk_PhotoImageFormatVersion3 Tk_PhotoImageFormatVersion3;
+typedef int (Tk_ImageFileMatchProcVersion3) (Tcl_Interp *interp,
+ Tcl_Channel chan, const char *fileName, Tcl_Obj *format,
+ Tcl_Obj *metadataIn, int *widthPtr, int *heightPtr,
+ Tcl_Obj *metadataOut);
+typedef int (Tk_ImageStringMatchProcVersion3) (Tcl_Interp *interp,
+ Tcl_Obj *dataObj, Tcl_Obj *format, Tcl_Obj *metadataIn, int *widthPtr,
+ int *heightPtr, Tcl_Obj *metadataOut);
+typedef int (Tk_ImageFileReadProcVersion3) (Tcl_Interp *interp,
+ Tcl_Channel chan,
+ const char *fileName, Tcl_Obj *format, Tcl_Obj *metadataIn,
+ Tk_PhotoHandle imageHandle,
+ int destX, int destY, int width, int height, int srcX, int srcY,
+ Tcl_Obj *metadataOut);
+typedef int (Tk_ImageStringReadProcVersion3) (Tcl_Interp *interp,
+ Tcl_Obj *dataObj, Tcl_Obj *format, Tcl_Obj *metadataIn,
+ Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height,
+ int srcX, int srcY, Tcl_Obj *metadataOut);
+typedef int (Tk_ImageFileWriteProcVersion3) (Tcl_Interp *interp,
+ const char *fileName, Tcl_Obj *format, Tcl_Obj *metadataIn,
+ Tk_PhotoImageBlock *blockPtr);
+typedef int (Tk_ImageStringWriteProcVersion3) (Tcl_Interp *interp,
+ Tcl_Obj *format, Tcl_Obj *metadataIn, Tk_PhotoImageBlock *blockPtr);
+
+
+/*
* The following structure represents a particular file format for storing
* images (e.g., PPM, GIF, JPEG, etc.). It provides information to allow image
* files of that format to be recognized and read into a photo image.
*/
struct Tk_PhotoImageFormat {
- CONST86 char *name; /* Name of image file format */
+ const char *name; /* Name of image file format */
Tk_ImageFileMatchProc *fileMatchProc;
/* Procedure to call to determine whether an
* image file matches this format. */
@@ -1398,6 +1497,38 @@ struct Tk_PhotoImageFormat {
* currently known. Filled in by Tk, not by
* image format handler. */
};
+
+/*
+ * The following structure is the same plus added support for the metadata
+ * structure.
+ */
+
+struct Tk_PhotoImageFormatVersion3 {
+ const char *name; /* Name of image file format */
+ Tk_ImageFileMatchProcVersion3 *fileMatchProc;
+ /* Procedure to call to determine whether an
+ * image file matches this format. */
+ Tk_ImageStringMatchProcVersion3 *stringMatchProc;
+ /* Procedure to call to determine whether the
+ * data in a string matches this format. */
+ Tk_ImageFileReadProcVersion3 *fileReadProc;
+ /* Procedure to call to read data from an
+ * image file into a photo image. */
+ Tk_ImageStringReadProcVersion3 *stringReadProc;
+ /* Procedure to call to read data from a
+ * string into a photo image. */
+ Tk_ImageFileWriteProcVersion3 *fileWriteProc;
+ /* Procedure to call to write data from a
+ * photo image to a file. */
+ Tk_ImageStringWriteProcVersion3 *stringWriteProc;
+ /* Procedure to call to obtain a string
+ * representation of the data in a photo
+ * image.*/
+ struct Tk_PhotoImageFormatVersion3 *nextPtr;
+ /* Next in list of all photo image formats
+ * currently known. Filled in by Tk, not by
+ * image format handler. */
+};
/*
*----------------------------------------------------------------------
@@ -1477,6 +1608,7 @@ typedef struct Tk_ElementSpec {
*----------------------------------------------------------------------
*/
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#define TK_READABLE TCL_READABLE
#define TK_WRITABLE TCL_WRITABLE
#define TK_EXCEPTION TCL_EXCEPTION
@@ -1510,6 +1642,7 @@ typedef struct Tk_ElementSpec {
#define Tk_FreeProc Tcl_FreeProc
#define Tk_Preserve Tcl_Preserve
#define Tk_Release Tcl_Release
+#endif
/* Removed Tk_Main, use macro instead */
#if defined(_WIN32) || defined(__CYGWIN__)
@@ -1544,12 +1677,17 @@ typedef void (Tk_EventProc) (ClientData clientData, XEvent *eventPtr);
typedef int (Tk_GenericProc) (ClientData clientData, XEvent *eventPtr);
typedef int (Tk_ClientMessageProc) (Tk_Window tkwin, XEvent *eventPtr);
typedef int (Tk_GetSelProc) (ClientData clientData, Tcl_Interp *interp,
- CONST86 char *portion);
+ const char *portion);
typedef void (Tk_LostSelProc) (ClientData clientData);
typedef Tk_RestrictAction (Tk_RestrictProc) (ClientData clientData,
XEvent *eventPtr);
+#if TCL_MAJOR_VERSION > 8
+typedef size_t (Tk_SelectionProc) (ClientData clientData, size_t offset,
+ char *buffer, size_t maxBytes);
+#else
typedef int (Tk_SelectionProc) (ClientData clientData, int offset,
char *buffer, int maxBytes);
+#endif
/*
*----------------------------------------------------------------------
@@ -1572,12 +1710,13 @@ typedef int (Tk_SelectionProc) (ClientData clientData, int offset,
*----------------------------------------------------------------------
*
* Allow users to say that they don't want to alter their source to add extra
- * arguments to Tk_PhotoPutBlock() et al; DO NOT DEFINE THIS WHEN BUILDING TK.
+ * arguments to Tk_PhotoPutBlock() et al.
*
* This goes after the inclusion of the stubbed-decls so that the declarations
* of what is actually there can be correct.
*/
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK
# ifdef Tk_PhotoPutBlock
# undef Tk_PhotoPutBlock
@@ -1610,6 +1749,7 @@ typedef int (Tk_SelectionProc) (ClientData clientData, int offset,
# endif
# define Tk_PhotoSetSize Tk_PhotoSetSize_Panic
#endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */
+#endif /* !TK_NO_DEPRECATED */
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tk3d.c b/generic/tk3d.c
index f1cc8f1..249d62c 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -4,8 +4,8 @@
* This module provides procedures to draw borders in the
* three-dimensional Motif style.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -1379,9 +1379,9 @@ TkDebugBorder(
Tcl_Obj *objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(borderPtr->resourceRefCount));
+ Tcl_NewWideIntObj(borderPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(borderPtr->objRefCount));
+ Tcl_NewWideIntObj(borderPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
diff --git a/generic/tk3d.h b/generic/tk3d.h
index ec7f7c7..7c22398 100644
--- a/generic/tk3d.h
+++ b/generic/tk3d.h
@@ -3,7 +3,7 @@
*
* Declarations of types and functions shared by the 3d border module.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -28,7 +28,7 @@ typedef struct TkBorder {
* the border will be used. */
Colormap colormap; /* Colormap out of which pixels are
* allocated. */
- int resourceRefCount; /* Number of active uses of this color (each
+ TkSizeT resourceRefCount; /* Number of active uses of this color (each
* active use corresponds to a call to
* Tk_Alloc3DBorderFromObj or Tk_Get3DBorder).
* If this count is 0, then this structure is
@@ -37,7 +37,7 @@ typedef struct TkBorder {
* because there are objects referring to it.
* The structure is freed when objRefCount and
* resourceRefCount are both 0. */
- int objRefCount; /* The number of Tcl objects that reference
+ TkSizeT objRefCount; /* The number of Tcl objects that reference
* this structure. */
XColor *bgColorPtr; /* Background color (intensity between
* lightColorPtr and darkColorPtr). */
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 8fe8514..e16dd3c 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -4,8 +4,8 @@
* This file contains a function that handles table-based argv-argc
* parsing.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -228,9 +228,9 @@ Tk_ParseArgv(
break;
case TK_ARGV_FUNC: {
typedef int (ArgvFunc)(char *, const char *, const char *);
- ArgvFunc *handlerProc = (ArgvFunc *) infoPtr->src;
+ ArgvFunc *handlerProc = (ArgvFunc *)infoPtr->src;
- if (handlerProc(infoPtr->dst, infoPtr->key, argv[srcIndex])) {
+ if (handlerProc((char *)infoPtr->dst, infoPtr->key, argv[srcIndex])) {
srcIndex++;
argc--;
}
@@ -239,9 +239,9 @@ Tk_ParseArgv(
case TK_ARGV_GENFUNC: {
typedef int (ArgvGenFunc)(char *, Tcl_Interp *, const char *, int,
const char **);
- ArgvGenFunc *handlerProc = (ArgvGenFunc *) infoPtr->src;
+ ArgvGenFunc *handlerProc = (ArgvGenFunc *)infoPtr->src;
- argc = handlerProc(infoPtr->dst, interp, infoPtr->key, argc,
+ argc = handlerProc((char *)infoPtr->dst, interp, infoPtr->key, argc,
argv+srcIndex);
if (argc < 0) {
return TCL_ERROR;
@@ -253,14 +253,14 @@ Tk_ParseArgv(
Tcl_SetErrorCode(interp, "TK", "ARG", "HELP", NULL);
return TCL_ERROR;
case TK_ARGV_CONST_OPTION:
- Tk_AddOption(tkwin, infoPtr->dst, infoPtr->src,
+ Tk_AddOption(tkwin, (char *)infoPtr->dst, (char *)infoPtr->src,
TK_INTERACTIVE_PRIO);
break;
case TK_ARGV_OPTION_VALUE:
if (argc < 1) {
goto missingArg;
}
- Tk_AddOption(tkwin, infoPtr->dst, argv[srcIndex],
+ Tk_AddOption(tkwin, (char *)infoPtr->dst, argv[srcIndex],
TK_INTERACTIVE_PRIO);
srcIndex++;
argc--;
diff --git a/generic/tkArray.h b/generic/tkArray.h
index 65693fe..dbb43ba 100644
--- a/generic/tkArray.h
+++ b/generic/tkArray.h
@@ -5,7 +5,7 @@
* Random access to any item is very fast. New items can be either appended
* or prepended. An array may be traversed in the forward or backward direction.
*
- * Copyright (c) 2018-2019 by Gregor Cramer.
+ * Copyright © 2018-2019 Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -188,7 +188,7 @@ AT##_Init(AT *arr) \
\
__TK_ARRAY_UNUSED \
static size_t \
-AT##_ElemSize() \
+AT##_ElemSize(void) \
{ \
return sizeof(ElemType); \
} \
@@ -273,7 +273,7 @@ AT##_Resize(AT **arrp, size_t newSize) \
} else { \
int init = *arrp == NULL; \
size_t memSize = AT##_BufferSize(newSize - 1) + sizeof(AT); \
- *arrp = ckrealloc(*arrp, memSize); \
+ *arrp = (AT *)ckrealloc(*arrp, memSize); \
if (init) { \
(*arrp)->size = 0; \
} else if (newSize < (*arrp)->size) { \
@@ -399,7 +399,7 @@ typedef struct AT { \
\
__TK_ARRAY_UNUSED \
static size_t \
-AT##_ElemSize() \
+AT##_ElemSize(void) \
{ \
return sizeof(ElemType); \
} \
@@ -484,7 +484,7 @@ AT##_Resize(AT **arrp, size_t newCapacity) \
} else { \
int init = *arrp == NULL; \
size_t memSize = AT##_BufferSize(newCapacity - 1) + sizeof(AT); \
- *arrp = ckrealloc(*arrp, memSize); \
+ *arrp = (AT *)ckrealloc(*arrp, memSize); \
if (init) { \
(*arrp)->size = 0; \
} else if (newCapacity < (*arrp)->size) { \
diff --git a/generic/tkAtom.c b/generic/tkAtom.c
index 475f9d2..0f86b0b 100644
--- a/generic/tkAtom.c
+++ b/generic/tkAtom.c
@@ -6,8 +6,8 @@
* cleaner interface (caller doesn't have to provide permanent storage
* for atom names, for example).
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -156,7 +156,7 @@ Tk_GetAtomName(
}
name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew);
- Tcl_SetHashValue(hPtr, name);
+ Tcl_SetHashValue(hPtr, (char *)name);
}
return (const char *)Tcl_GetHashValue(hPtr);
}
@@ -202,7 +202,7 @@ AtomInit(
Tcl_SetHashValue(hPtr, INT2PTR(atom));
name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew);
- Tcl_SetHashValue(hPtr, name);
+ Tcl_SetHashValue(hPtr, (char *)name);
}
}
diff --git a/generic/tkBind.c b/generic/tkBind.c
index da52c61..0f885f3 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -4,10 +4,10 @@
* This file provides functions that associate Tcl commands with X events
* or sequences of X events.
*
- * Copyright (c) 1989-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998 by Scriptics Corporation.
- * Copyright (c) 2018-2019 by Gregor Cramer.
+ * Copyright © 1989-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998 Scriptics Corporation.
+ * Copyright © 2018-2019 Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -62,21 +62,21 @@
* equivalent sequences. However it is logical to give <Double-1> higher precedence
* since it is more specific. Indeed <Double-1> includes time and space requirements,
* which is not the case for <1><1>.
- * This can be achieved by setting PREFER_MOST_SPECIALIZED_EVENT to 1.
+ * This is achieved by setting PREFER_MOST_SPECIALIZED_EVENT to 1.
*/
#ifndef PREFER_MOST_SPECIALIZED_EVENT
-# define PREFER_MOST_SPECIALIZED_EVENT 0
+# define PREFER_MOST_SPECIALIZED_EVENT 1
#endif
/*
* Traditionally motion events can be combined with buttons in this way: <B1-B2-Motion>.
- * However it should be allowed to express this as <Motion-1-2> in addition. This can be
- * achieved by setting SUPPORT_ADDITIONAL_MOTION_SYNTAX to 1.
+ * However it should be allowed to express this as <Motion-1-2> in addition. This is achieved
+ * by setting SUPPORT_ADDITIONAL_MOTION_SYNTAX to 1.
*/
#ifndef SUPPORT_ADDITIONAL_MOTION_SYNTAX
-# define SUPPORT_ADDITIONAL_MOTION_SYNTAX 0 /* set to 1 if wanted */
+# define SUPPORT_ADDITIONAL_MOTION_SYNTAX 1
#endif
/*
@@ -432,7 +432,9 @@ static const ModInfo modArray[] = {
{"Shift", ShiftMask, 0},
{"Lock", LockMask, 0},
{"Meta", META_MASK, 0},
+#ifndef TK_NO_DEPRECATED
{"M", META_MASK, 0},
+#endif
{"Alt", ALT_MASK, 0},
{"Extended", EXTENDED_MASK, 0},
{"B1", Button1Mask, 0},
@@ -445,12 +447,30 @@ static const ModInfo modArray[] = {
{"Button4", Button4Mask, 0},
{"B5", Button5Mask, 0},
{"Button5", Button5Mask, 0},
+ {"B6", Button6Mask, 0},
+ {"Button6", Button6Mask, 0},
+ {"B7", Button7Mask, 0},
+ {"Button7", Button7Mask, 0},
+ {"B8", Button8Mask, 0},
+ {"Button8", Button8Mask, 0},
+ {"B9", Button9Mask, 0},
+ {"Button9", Button9Mask, 0},
{"Mod1", Mod1Mask, 0},
{"M1", Mod1Mask, 0},
+#ifdef MAC_OSX_TK
{"Command", Mod1Mask, 0},
+#elif defined (_WIN32)
+ {"Command", ControlMask, 0},
+#else
+ {"Command", META_MASK, 0},
+#endif
{"Mod2", Mod2Mask, 0},
{"M2", Mod2Mask, 0},
+#ifdef MAC_OSX_TK
{"Option", Mod2Mask, 0},
+#else
+ {"Option", ALT_MASK, 0},
+#endif
{"Mod3", Mod3Mask, 0},
{"M3", Mod3Mask, 0},
{"Mod4", Mod4Mask, 0},
@@ -486,10 +506,14 @@ typedef struct {
static const EventInfo eventArray[] = {
{"Key", KeyPress, KeyPressMask},
+#ifndef TK_NO_DEPRECATED
{"KeyPress", KeyPress, KeyPressMask},
+#endif
{"KeyRelease", KeyRelease, KeyPressMask|KeyReleaseMask},
{"Button", ButtonPress, ButtonPressMask},
+#ifndef TK_NO_DEPRECATED
{"ButtonPress", ButtonPress, ButtonPressMask},
+#endif
{"ButtonRelease", ButtonRelease, ButtonPressMask|ButtonReleaseMask},
{"Motion", MotionNotify, ButtonPressMask|PointerMotionMask},
{"Enter", EnterNotify, EnterWindowMask},
@@ -723,7 +747,6 @@ static int NameToWindow(Tcl_Interp *interp, Tk_Window main,
Tcl_Obj *objPtr, Tk_Window *tkwinPtr);
static unsigned ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr,
TkPattern *patPtr, unsigned *eventMaskPtr);
-static void DoWarp(ClientData clientData);
static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr,
Tcl_Obj *object, int onlyConsiderDetailedEvents);
static void ClearLookupTable(LookupTables *lookupTables, ClientData object);
@@ -785,8 +808,10 @@ static unsigned
GetButtonNumber(
const char *field)
{
+ unsigned button;
assert(field);
- return (field[0] >= '1' && field[0] <= '5' && field[1] == '\0') ? field[0] - '0' : 0;
+ button = (field[0] >= '1' && field[0] <= '9' && field[1] == '\0') ? field[0] - '0' : 0;
+ return (button > 3) ? (button + 4) : button;
}
static Time
@@ -946,6 +971,7 @@ FreePatSeqEntry(
PSEntry *entry)
{
PSEntry *next = PSList_Next(entry);
+
PSModMaskArr_Free(&entry->lastModMaskArr);
ckfree(entry);
return next;
@@ -983,7 +1009,11 @@ ButtonNumberFromState(
if (state & Button2Mask) { return 2; }
if (state & Button3Mask) { return 3; }
if (state & Button4Mask) { return 4; }
- return 5;
+ if (state & Button5Mask) { return 5; }
+ if (state & Button6Mask) { return 6; }
+ if (state & Button7Mask) { return 7; }
+ if (state & Button8Mask) { return 8; }
+ return 9;
}
static void
@@ -1272,49 +1302,49 @@ TkBindInit(
assert(NoSymbol == 0L);
/* this must be a union, not a struct, otherwise comparison with NULL will not work */
- assert(Tk_Offset(Detail, name) == Tk_Offset(Detail, info));
+ assert(offsetof(Detail, name) == offsetof(Detail, info));
/* we use some constraints about X*Event */
- assert(Tk_Offset(XButtonEvent, time) == Tk_Offset(XMotionEvent, time));
- assert(Tk_Offset(XButtonEvent, x_root) == Tk_Offset(XMotionEvent, x_root));
- assert(Tk_Offset(XButtonEvent, y_root) == Tk_Offset(XMotionEvent, y_root));
- assert(Tk_Offset(XCreateWindowEvent, border_width) == Tk_Offset(XConfigureEvent, border_width));
- assert(Tk_Offset(XCreateWindowEvent, width) == Tk_Offset(XConfigureEvent, width));
- assert(Tk_Offset(XCreateWindowEvent, window) == Tk_Offset(XCirculateRequestEvent, window));
- assert(Tk_Offset(XCreateWindowEvent, window) == Tk_Offset(XConfigureEvent, window));
- assert(Tk_Offset(XCreateWindowEvent, window) == Tk_Offset(XGravityEvent, window));
- assert(Tk_Offset(XCreateWindowEvent, window) == Tk_Offset(XMapEvent, window));
- assert(Tk_Offset(XCreateWindowEvent, window) == Tk_Offset(XReparentEvent, window));
- assert(Tk_Offset(XCreateWindowEvent, window) == Tk_Offset(XUnmapEvent, window));
- assert(Tk_Offset(XCreateWindowEvent, x) == Tk_Offset(XConfigureEvent, x));
- assert(Tk_Offset(XCreateWindowEvent, x) == Tk_Offset(XGravityEvent, x));
- assert(Tk_Offset(XCreateWindowEvent, y) == Tk_Offset(XConfigureEvent, y));
- assert(Tk_Offset(XCreateWindowEvent, y) == Tk_Offset(XGravityEvent, y));
- assert(Tk_Offset(XCrossingEvent, time) == Tk_Offset(XEnterWindowEvent, time));
- assert(Tk_Offset(XCrossingEvent, time) == Tk_Offset(XLeaveWindowEvent, time));
- assert(Tk_Offset(XCrossingEvent, time) == Tk_Offset(XKeyEvent, time));
- assert(Tk_Offset(XKeyEvent, root) == Tk_Offset(XButtonEvent, root));
- assert(Tk_Offset(XKeyEvent, root) == Tk_Offset(XCrossingEvent, root));
- assert(Tk_Offset(XKeyEvent, root) == Tk_Offset(XMotionEvent, root));
- assert(Tk_Offset(XKeyEvent, state) == Tk_Offset(XButtonEvent, state));
- assert(Tk_Offset(XKeyEvent, state) == Tk_Offset(XMotionEvent, state));
- assert(Tk_Offset(XKeyEvent, subwindow) == Tk_Offset(XButtonEvent, subwindow));
- assert(Tk_Offset(XKeyEvent, subwindow) == Tk_Offset(XCrossingEvent, subwindow));
- assert(Tk_Offset(XKeyEvent, subwindow) == Tk_Offset(XMotionEvent, subwindow));
- assert(Tk_Offset(XKeyEvent, time) == Tk_Offset(XButtonEvent, time));
- assert(Tk_Offset(XKeyEvent, time) == Tk_Offset(XMotionEvent, time));
- assert(Tk_Offset(XKeyEvent, x) == Tk_Offset(XButtonEvent, x));
- assert(Tk_Offset(XKeyEvent, x) == Tk_Offset(XCrossingEvent, x));
- assert(Tk_Offset(XKeyEvent, x) == Tk_Offset(XMotionEvent, x));
- assert(Tk_Offset(XKeyEvent, x_root) == Tk_Offset(XButtonEvent, x_root));
- assert(Tk_Offset(XKeyEvent, x_root) == Tk_Offset(XCrossingEvent, x_root));
- assert(Tk_Offset(XKeyEvent, x_root) == Tk_Offset(XMotionEvent, x_root));
- assert(Tk_Offset(XKeyEvent, y) == Tk_Offset(XButtonEvent, y));
- assert(Tk_Offset(XKeyEvent, y) == Tk_Offset(XCrossingEvent, y));
- assert(Tk_Offset(XKeyEvent, y) == Tk_Offset(XMotionEvent, y));
- assert(Tk_Offset(XKeyEvent, y_root) == Tk_Offset(XButtonEvent, y_root));
- assert(Tk_Offset(XKeyEvent, y_root) == Tk_Offset(XCrossingEvent, y_root));
- assert(Tk_Offset(XKeyEvent, y_root) == Tk_Offset(XMotionEvent, y_root));
+ assert(offsetof(XButtonEvent, time) == offsetof(XMotionEvent, time));
+ assert(offsetof(XButtonEvent, x_root) == offsetof(XMotionEvent, x_root));
+ assert(offsetof(XButtonEvent, y_root) == offsetof(XMotionEvent, y_root));
+ assert(offsetof(XCreateWindowEvent, border_width) == offsetof(XConfigureEvent, border_width));
+ assert(offsetof(XCreateWindowEvent, width) == offsetof(XConfigureEvent, width));
+ assert(offsetof(XCreateWindowEvent, window) == offsetof(XCirculateRequestEvent, window));
+ assert(offsetof(XCreateWindowEvent, window) == offsetof(XConfigureEvent, window));
+ assert(offsetof(XCreateWindowEvent, window) == offsetof(XGravityEvent, window));
+ assert(offsetof(XCreateWindowEvent, window) == offsetof(XMapEvent, window));
+ assert(offsetof(XCreateWindowEvent, window) == offsetof(XReparentEvent, window));
+ assert(offsetof(XCreateWindowEvent, window) == offsetof(XUnmapEvent, window));
+ assert(offsetof(XCreateWindowEvent, x) == offsetof(XConfigureEvent, x));
+ assert(offsetof(XCreateWindowEvent, x) == offsetof(XGravityEvent, x));
+ assert(offsetof(XCreateWindowEvent, y) == offsetof(XConfigureEvent, y));
+ assert(offsetof(XCreateWindowEvent, y) == offsetof(XGravityEvent, y));
+ assert(offsetof(XCrossingEvent, time) == offsetof(XEnterWindowEvent, time));
+ assert(offsetof(XCrossingEvent, time) == offsetof(XLeaveWindowEvent, time));
+ assert(offsetof(XCrossingEvent, time) == offsetof(XKeyEvent, time));
+ assert(offsetof(XKeyEvent, root) == offsetof(XButtonEvent, root));
+ assert(offsetof(XKeyEvent, root) == offsetof(XCrossingEvent, root));
+ assert(offsetof(XKeyEvent, root) == offsetof(XMotionEvent, root));
+ assert(offsetof(XKeyEvent, state) == offsetof(XButtonEvent, state));
+ assert(offsetof(XKeyEvent, state) == offsetof(XMotionEvent, state));
+ assert(offsetof(XKeyEvent, subwindow) == offsetof(XButtonEvent, subwindow));
+ assert(offsetof(XKeyEvent, subwindow) == offsetof(XCrossingEvent, subwindow));
+ assert(offsetof(XKeyEvent, subwindow) == offsetof(XMotionEvent, subwindow));
+ assert(offsetof(XKeyEvent, time) == offsetof(XButtonEvent, time));
+ assert(offsetof(XKeyEvent, time) == offsetof(XMotionEvent, time));
+ assert(offsetof(XKeyEvent, x) == offsetof(XButtonEvent, x));
+ assert(offsetof(XKeyEvent, x) == offsetof(XCrossingEvent, x));
+ assert(offsetof(XKeyEvent, x) == offsetof(XMotionEvent, x));
+ assert(offsetof(XKeyEvent, x_root) == offsetof(XButtonEvent, x_root));
+ assert(offsetof(XKeyEvent, x_root) == offsetof(XCrossingEvent, x_root));
+ assert(offsetof(XKeyEvent, x_root) == offsetof(XMotionEvent, x_root));
+ assert(offsetof(XKeyEvent, y) == offsetof(XButtonEvent, y));
+ assert(offsetof(XKeyEvent, y) == offsetof(XCrossingEvent, y));
+ assert(offsetof(XKeyEvent, y) == offsetof(XMotionEvent, y));
+ assert(offsetof(XKeyEvent, y_root) == offsetof(XButtonEvent, y_root));
+ assert(offsetof(XKeyEvent, y_root) == offsetof(XCrossingEvent, y_root));
+ assert(offsetof(XKeyEvent, y_root) == offsetof(XMotionEvent, y_root));
/*
* Initialize the static data structures used by the binding package. They
@@ -1621,7 +1651,7 @@ Tk_CreateBinding(
ClientData object, /* Token for object with which binding is associated. */
const char *eventString, /* String describing event sequence that triggers binding. */
const char *script, /* Contains Tcl script to execute when binding triggers. */
- int append) /* 0 means replace any existing binding for eventString;
+ int append) /* 0 means replace any existing binding for eventString;
* 1 means append to that binding. If the existing binding is
* for a callback function and not a Tcl command string, the
* existing binding will always be replaced. */
@@ -2980,8 +3010,8 @@ ExpandPercents(
while (1) {
char numStorage[TCL_INTEGER_SPACE];
const char *string;
- Tcl_WideInt number; /* signed */
- Tcl_WideUInt unumber; /* unsigned */
+ long long number; /* signed */
+ unsigned long long unumber; /* unsigned */
/*
* Find everything up to the next % character and append it to the
@@ -4026,6 +4056,9 @@ HandleEventGenerate(
return TCL_ERROR;
}
if (flags & BUTTON) {
+ if (number >= Button4) {
+ number += (Button8 - Button4);
+ }
event.general.xbutton.button = number;
} else {
badOpt = 1;
@@ -4401,10 +4434,19 @@ HandleEventGenerate(
dispPtr->warpX = event.general.xmotion.x;
dispPtr->warpY = event.general.xmotion.y;
- if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) {
- Tcl_DoWhenIdle(DoWarp, dispPtr);
- dispPtr->flags |= TK_DISPLAY_IN_WARP;
- }
+ /*
+ * Warping with respect to a window will be done when Tk_handleEvent
+ * below will run the event handlers and in particular TkPointerEvent.
+ * This allows to make grabs and warping work together robustly, that
+ * is without depending on a precise sequence of events.
+ * Warping with respect to the whole screen (i.e. dispPtr->warpWindow
+ * is NULL) is run directly here.
+ */
+
+ if (!dispPtr->warpWindow) {
+ TkpWarpPointer(dispPtr);
+ XForceScreenSaver(dispPtr->display, ScreenSaverReset);
+ }
}
/*
@@ -4488,9 +4530,9 @@ NameToWindow(
/*
*-------------------------------------------------------------------------
*
- * DoWarp --
+ * TkDoWarpWrtWin --
*
- * Perform warping of mouse pointer. Executed as an idle handler only.
+ * Perform warping of mouse pointer with respect to a window.
*
* Results:
* None
@@ -4501,33 +4543,34 @@ NameToWindow(
*-------------------------------------------------------------------------
*/
-static void
-DoWarp(
- ClientData clientData)
+void
+TkDoWarpWrtWin(
+ TkDisplay *dispPtr)
{
- TkDisplay *dispPtr = (TkDisplay *)clientData;
-
- assert(clientData);
+ assert(dispPtr);
/*
- * DoWarp was scheduled only if the window was mapped. It needs to be
- * still mapped at the time the present idle callback is executed. Also
- * one needs to guard against window destruction in the meantime.
- * Finally, the case warpWindow == NULL is special in that it means
- * the whole screen.
+ * A NULL warpWindow means warping with respect to the whole screen.
+ * We want to warp here only if we're warping with respect to a window.
*/
- if (!dispPtr->warpWindow ||
- (Tk_IsMapped(dispPtr->warpWindow) && Tk_WindowId(dispPtr->warpWindow) != None)) {
- TkpWarpPointer(dispPtr);
- XForceScreenSaver(dispPtr->display, ScreenSaverReset);
- }
-
if (dispPtr->warpWindow) {
- Tcl_Release(dispPtr->warpWindow);
- dispPtr->warpWindow = NULL;
+
+ /*
+ * Warping with respect to a window can only be done if the window is
+ * mapped. This was checked in HandleEvent. The window needs to be
+ * still mapped at the time the present code is executed. Also
+ * one needs to guard against window destruction in the meantime,
+ * which could have happened as a side effect of an event handler.
+ */
+
+ if (Tk_IsMapped(dispPtr->warpWindow) && Tk_WindowId(dispPtr->warpWindow) != None) {
+ TkpWarpPointer(dispPtr);
+ XForceScreenSaver(dispPtr->display, ScreenSaverReset);
+ }
+ Tcl_Release(dispPtr->warpWindow);
+ dispPtr->warpWindow = NULL;
}
- dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
}
/*
@@ -4610,7 +4653,7 @@ FindSequence(
* associated. For virtual event table, NULL. */
const char *eventString, /* String description of pattern to match on. See user
* documentation for details. */
- int create, /* 0 means don't create the entry if it doesn't already exist.
+ int create, /* 0 means don't create the entry if it doesn't already exist.
* 1 means create. */
int allowVirtual, /* 0 means that virtual events are not allowed in the sequence.
* 1 otherwise. */
@@ -4979,7 +5022,7 @@ ParseEventDescription(
"NON_BUTTON");
}
#if SUPPORT_ADDITIONAL_MOTION_SYNTAX
- patPtr->modMask |= TkGetButtonMask(button);
+ patPtr->modMask |= Tk_GetButtonMask(button);
p = SkipFieldDelims(p);
while (*p && *p != '>') {
p = SkipFieldDelims(GetField(p, field, sizeof(field)));
@@ -4989,7 +5032,7 @@ ParseEventDescription(
patPtr, 0,
Tcl_ObjPrintf("bad button number \"%s\"", field), "BUTTON");
}
- patPtr->modMask |= TkGetButtonMask(button);
+ patPtr->modMask |= Tk_GetButtonMask(button);
}
patPtr->info = ButtonNumberFromState(patPtr->modMask);
#endif
@@ -5167,16 +5210,16 @@ GetPatternObj(
}
case ButtonPress:
case ButtonRelease:
- assert(patPtr->info <= Button5);
- Tcl_AppendPrintfToObj(patternObj, "-%u", (unsigned) patPtr->info);
+ assert(patPtr->info <= 13);
+ Tcl_AppendPrintfToObj(patternObj, "-%u", (unsigned) ((patPtr->info > 7) ? (patPtr->info - 4) : patPtr->info));
break;
#if PRINT_SHORT_MOTION_SYNTAX
case MotionNotify: {
unsigned mask = patPtr->modMask;
while (mask & ALL_BUTTONS) {
unsigned button = ButtonNumberFromState(mask);
- Tcl_AppendPrintfToObj(patternObj, "-%u", button);
- mask &= ~TkGetButtonMask(button);
+ Tcl_AppendPrintfToObj(patternObj, "-%u", (button > 7) ? (button - 4) : button);
+ mask &= ~Tk_GetButtonMask(button);
}
break;
}
@@ -5213,14 +5256,48 @@ TkStringToKeysym(
const char *name) /* Name of a keysym. */
{
#ifdef REDO_KEYSYM_LOOKUP
- Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&keySymTable, name);
-
+ Tcl_HashEntry *hPtr;
+#endif /* REDO_KEYSYM_LOOKUP */
+ int keysym;
+
+ size_t len = TkUtfToUniChar(name, &keysym);
+ if (name[len] == '\0') {
+ if (!Tcl_UniCharIsPrint(keysym)) {
+ /* This form not supported */
+ } else if ((unsigned)(keysym - 0x21) <= 0x5D) {
+ return keysym;
+ } else if ((unsigned)(keysym - 0xA1) <= 0x5E) {
+ return keysym;
+ } else if (keysym == 0x20AC) {
+ return 0x20AC;
+ } else {
+ return keysym + 0x1000000;
+ }
+ }
+#ifdef REDO_KEYSYM_LOOKUP
+ if ((name[0] == 'U') && ((unsigned)(name[1] - '0') <= 9)) {
+ char *p = (char *)name + 1;
+ keysym = strtol(p, &p, 16);
+ if ((p >= name + 5) && (p <= name + 9) && !*p && (keysym >= 0x20)
+ && ((unsigned)(keysym - 0x7F) > 0x20)) {
+ if ((unsigned)(keysym - 0x21) <= 0x5D) {
+ return keysym;
+ } else if ((unsigned)(keysym - 0xA1) <= 0x5E) {
+ return keysym;
+ } else if (keysym == 0x20AC) {
+ return keysym;
+ }
+ return keysym + 0x1000000;
+ }
+ }
+#endif
+#ifdef REDO_KEYSYM_LOOKUP
+ hPtr = Tcl_FindHashEntry(&keySymTable, name);
if (hPtr) {
return (KeySym) Tcl_GetHashValue(hPtr);
}
- assert(name);
- if (strlen(name) == 1u) {
- KeySym keysym = (KeySym) (unsigned char) name[0];
+ if (((unsigned)(name[0]-1) < 0x7F) && !name[1]) {
+ keysym = (unsigned char) name[0];
if (TkKeysymToString(keysym)) {
return keysym;
@@ -5253,16 +5330,37 @@ TkKeysymToString(
KeySym keysym)
{
#ifdef REDO_KEYSYM_LOOKUP
- Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym);
+ Tcl_HashEntry *hPtr;
+#endif
+
+ if ((unsigned)(keysym - 0x21) <= 0x5D) {
+ keysym += 0x1000000;
+ } else if ((unsigned)(keysym - 0xA1) <= 0x5E) {
+ keysym += 0x1000000;
+ } else if (keysym == 0x20AC) {
+ keysym += 0x1000000;
+ }
+ if ((keysym >= 0x1000020) && (keysym <= 0x110FFFF)
+ && ((unsigned)(keysym - 0x100007F) > 0x20)) {
+ char buf[10];
+ if (Tcl_UniCharIsPrint(keysym-0x1000000)) {
+ buf[TkUniCharToUtf(keysym - 0x1000000, buf)] = '\0';
+ } else if (keysym >= 0x1010000) {
+ sprintf(buf, "U%08X", (int)(keysym - 0x1000000));
+ } else {
+ sprintf(buf, "U%04X", (int)(keysym - 0x1000000));
+ }
+ return Tk_GetUid(buf);
+ }
+
+#ifdef REDO_KEYSYM_LOOKUP
+ hPtr = Tcl_FindHashEntry(&nameTable, INT2PTR(keysym));
if (hPtr) {
return (const char *)Tcl_GetHashValue(hPtr);
}
#endif /* REDO_KEYSYM_LOOKUP */
- if (keysym > (KeySym)0x1008FFFF) {
- return NULL;
- }
return XKeysymToString(keysym);
}
@@ -5298,35 +5396,6 @@ TkpGetBindingXEvent(
/*
*----------------------------------------------------------------------
*
- * TkpCancelWarp --
- *
- * This function cancels an outstanding pointer warp and
- * is called during tear down of the display.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpCancelWarp(
- TkDisplay *dispPtr)
-{
- assert(dispPtr);
-
- if (dispPtr->flags & TK_DISPLAY_IN_WARP) {
- Tcl_CancelIdleCall(DoWarp, dispPtr);
- dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpDumpPS --
*
* Dump given pattern sequence to stdout.
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index ccc97a4..9c2fccc 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -5,8 +5,8 @@
* toolkit. This allows bitmaps to be shared between widgets and also
* avoids interactions with the X server.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1998 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -536,7 +536,7 @@ Tk_NameOfBitmap(
Tcl_Panic("Tk_NameOfBitmap received unknown bitmap argument");
}
- idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, (char *) bitmap);
+ idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, bitmap);
if (idHashPtr == NULL) {
goto unknown;
}
@@ -578,7 +578,7 @@ Tk_SizeOfBitmap(
Tcl_Panic("Tk_SizeOfBitmap received unknown bitmap argument");
}
- idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, (char *) bitmap);
+ idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, bitmap);
if (idHashPtr == NULL) {
goto unknownBitmap;
}
@@ -666,7 +666,7 @@ Tk_FreeBitmap(
Tcl_Panic("Tk_FreeBitmap called before Tk_GetBitmap");
}
- idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, (char *) bitmap);
+ idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, bitmap);
if (idHashPtr == NULL) {
Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument");
}
@@ -1155,9 +1155,9 @@ TkDebugBitmap(
for ( ; (bitmapPtr != NULL); bitmapPtr = bitmapPtr->nextPtr) {
objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(bitmapPtr->resourceRefCount));
+ Tcl_NewWideIntObj(bitmapPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(bitmapPtr->objRefCount));
+ Tcl_NewWideIntObj(bitmapPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 6f58c52..f6ae494 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -23,7 +23,7 @@
static const Tk_OptionSpec busyOptionSpecs[] = {
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_BUSY_CURSOR, -1, Tk_Offset(Busy, cursor),
+ DEF_BUSY_CURSOR, TCL_INDEX_NONE, offsetof(Busy, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -340,7 +340,7 @@ DestroyBusy(
RefWinEventProc, busyPtr);
if (busyPtr->tkBusy != NULL) {
- Tk_FreeConfigOptions((char *)data, busyPtr->optionTable, busyPtr->tkBusy);
+ Tk_FreeConfigOptions(data, busyPtr->optionTable, busyPtr->tkBusy);
Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask,
BusyEventProc, busyPtr);
Tk_ManageGeometry(busyPtr->tkBusy, NULL, busyPtr);
@@ -570,7 +570,7 @@ CreateBusy(
busyPtr->cursor = NULL;
Tk_SetClass(tkBusy, "Busy");
busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs);
- if (Tk_InitOptions(interp, (char *) busyPtr, busyPtr->optionTable,
+ if (Tk_InitOptions(interp, busyPtr, busyPtr->optionTable,
tkBusy) != TCL_OK) {
Tk_DestroyWindow(tkBusy);
return NULL;
@@ -637,7 +637,7 @@ ConfigureBusy(
{
Tk_Cursor oldCursor = busyPtr->cursor;
- if (Tk_SetOptions(interp, (char *) busyPtr, busyPtr->optionTable, objc,
+ if (Tk_SetOptions(interp, busyPtr, busyPtr->optionTable, objc,
objv, busyPtr->tkBusy, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
}
@@ -686,7 +686,7 @@ GetBusy(
&tkwin) != TCL_OK) {
return NULL;
}
- hPtr = Tcl_FindHashEntry(busyTablePtr, (char *) tkwin);
+ hPtr = Tcl_FindHashEntry(busyTablePtr, tkwin);
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't find busy window \"%s\"", Tcl_GetString(windowObj)));
@@ -760,6 +760,9 @@ HoldBusy(
} else {
TkpHideBusyWindow(busyPtr);
}
+ if (result == TCL_OK) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), -1));
+ }
return result;
}
@@ -793,15 +796,16 @@ Tk_BusyObjCmd(
Tcl_Obj *objPtr;
int index, result = TCL_OK;
static const char *const optionStrings[] = {
- "cget", "configure", "current", "forget", "hold", "status", NULL
+ "busywindow", "cget", "configure", "current", "forget", "hold",
+ "status", NULL
};
enum options {
- BUSY_CGET, BUSY_CONFIGURE, BUSY_CURRENT, BUSY_FORGET, BUSY_HOLD,
- BUSY_STATUS
+ BUSY_BUSYWINDOW, BUSY_CGET, BUSY_CONFIGURE, BUSY_CURRENT, BUSY_FORGET,
+ BUSY_HOLD, BUSY_STATUS
};
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "options ?arg arg ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "options ?arg ...?");
return TCL_ERROR;
}
@@ -811,7 +815,7 @@ Tk_BusyObjCmd(
if (Tcl_GetString(objv[1])[0] == '.') {
if (objc%2 == 1) {
- Tcl_WrongNumArgs(interp, 1, objv, "window ?option value ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "window ?-option value ...?");
return TCL_ERROR;
}
return HoldBusy(busyTablePtr, interp, objv[1], objc-2, objv+2);
@@ -822,6 +826,19 @@ Tk_BusyObjCmd(
return TCL_ERROR;
}
switch ((enum options) index) {
+ case BUSY_BUSYWINDOW:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window");
+ return TCL_ERROR;
+ }
+ busyPtr = GetBusy(interp, busyTablePtr, objv[2]);
+ if (busyPtr == NULL) {
+ Tcl_ResetResult(interp);
+ return TCL_OK;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), -1));
+ return TCL_OK;
+
case BUSY_CGET:
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window option");
@@ -832,7 +849,7 @@ Tk_BusyObjCmd(
return TCL_ERROR;
}
Tcl_Preserve(busyPtr);
- objPtr = Tk_GetOptionValue(interp, (char *) busyPtr,
+ objPtr = Tk_GetOptionValue(interp, busyPtr,
busyPtr->optionTable, objv[3], busyPtr->tkBusy);
if (objPtr == NULL) {
result = TCL_ERROR;
@@ -844,7 +861,7 @@ Tk_BusyObjCmd(
case BUSY_CONFIGURE:
if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?option? ?value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?");
return TCL_ERROR;
}
busyPtr = GetBusy(interp, busyTablePtr, objv[2]);
@@ -853,7 +870,7 @@ Tk_BusyObjCmd(
}
Tcl_Preserve(busyPtr);
if (objc <= 4) {
- objPtr = Tk_GetOptionInfo(interp, (char *)busyPtr,
+ objPtr = Tk_GetOptionInfo(interp, busyPtr,
busyPtr->optionTable, (objc == 4) ? objv[3] : NULL,
busyPtr->tkBusy);
if (objPtr == NULL) {
@@ -879,7 +896,7 @@ Tk_BusyObjCmd(
if (pattern == NULL ||
Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) {
Tcl_ListObjAppendElement(interp, objPtr,
- TkNewWindowObj(busyPtr->tkRef));
+ Tk_NewWindowObj(busyPtr->tkRef));
}
}
Tcl_SetObjResult(interp, objPtr);
@@ -901,7 +918,7 @@ Tk_BusyObjCmd(
case BUSY_HOLD:
if (objc < 3 || objc%2 != 1) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?option value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?");
return TCL_ERROR;
}
return HoldBusy(busyTablePtr, interp, objv[2], objc-3, objv+3);
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 4b04e9f..03496bb 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -5,8 +5,8 @@
* toolkit. The widgets implemented include buttons, checkbuttons,
* radiobuttons, and labels.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1998 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -70,413 +70,413 @@ char tkDefLabelPady[TCL_INTEGER_SPACE] = DEF_LABCHKRAD_PADY;
static const Tk_OptionSpec labelOptionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
- DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder),
+ DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder),
0, DEF_BUTTON_ACTIVE_BG_MONO, 0},
{TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background",
- DEF_BUTTON_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg),
+ DEF_BUTTON_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg),
TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0},
+ DEF_BUTTON_ANCHOR, TCL_INDEX_NONE, offsetof(TkButton, anchor), 0, 0, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder),
+ DEF_BUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, normalBorder),
0, DEF_BUTTON_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
- DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
+ DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr),
- Tk_Offset(TkButton, borderWidth), 0, 0, 0},
+ tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr),
+ offsetof(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0,
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
compoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor),
+ DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
- -1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK,
+ TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
+ DEF_BUTTON_FONT, TCL_INDEX_NONE, offsetof(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_BUTTON_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0},
+ DEF_BUTTON_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0},
{TK_OPTION_STRING, "-height", "height", "Height",
- DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0},
+ DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR,
- -1, Tk_Offset(TkButton, highlightBorder), 0,
+ TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0,
(ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr),
+ DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness", tkDefLabelHighlightWidth,
- Tk_Offset(TkButton, highlightWidthPtr),
- Tk_Offset(TkButton, highlightWidth), 0, 0, 0},
+ offsetof(TkButton, highlightWidthPtr),
+ offsetof(TkButton, highlightWidth), 0, 0, 0},
{TK_OPTION_STRING, "-image", "image", "Image",
- DEF_BUTTON_IMAGE, Tk_Offset(TkButton, imagePtr), -1,
+ DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0},
+ DEF_BUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkButton, justify), 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
- tkDefLabelPadx, Tk_Offset(TkButton, padXPtr),
- Tk_Offset(TkButton, padX), 0, 0, 0},
+ tkDefLabelPadx, offsetof(TkButton, padXPtr),
+ offsetof(TkButton, padX), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", "padY", "Pad",
- tkDefLabelPady, Tk_Offset(TkButton, padYPtr),
- Tk_Offset(TkButton, padY), 0, 0, 0},
+ tkDefLabelPady, offsetof(TkButton, padYPtr),
+ offsetof(TkButton, padY), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_LABCHKRAD_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0},
+ DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state),
+ DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_LABEL_TAKE_FOCUS, Tk_Offset(TkButton, takeFocusPtr), -1,
+ DEF_LABEL_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-text", "text", "Text",
- DEF_BUTTON_TEXT, Tk_Offset(TkButton, textPtr), -1, 0, 0, 0},
+ DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1,
+ DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0},
{TK_OPTION_STRING, "-width", "width", "Width",
- DEF_BUTTON_WIDTH, Tk_Offset(TkButton, widthPtr), -1, 0, 0, 0},
+ DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
- DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr),
- Tk_Offset(TkButton, wrapLength), 0, 0, 0},
+ DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr),
+ offsetof(TkButton, wrapLength), 0, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
static const Tk_OptionSpec buttonOptionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
- DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder),
+ DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder),
0, DEF_BUTTON_ACTIVE_BG_MONO, 0},
{TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background",
- DEF_BUTTON_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg),
+ DEF_BUTTON_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg),
TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0},
+ DEF_BUTTON_ANCHOR, TCL_INDEX_NONE, offsetof(TkButton, anchor), 0, 0, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder),
+ DEF_BUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, normalBorder),
0, DEF_BUTTON_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
- DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
+ DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr),
- Tk_Offset(TkButton, borderWidth), 0, 0, 0},
+ tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr),
+ offsetof(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
- DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1,
+ DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0,
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
compoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor),
+ DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-default", "default", "Default",
- DEF_BUTTON_DEFAULT, -1, Tk_Offset(TkButton, defaultState),
+ DEF_BUTTON_DEFAULT, TCL_INDEX_NONE, offsetof(TkButton, defaultState),
0, defaultStrings, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
- -1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK,
+ TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
+ DEF_BUTTON_FONT, TCL_INDEX_NONE, offsetof(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_BUTTON_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0},
+ DEF_BUTTON_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0},
{TK_OPTION_STRING, "-height", "height", "Height",
- DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0},
+ DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR,
- -1, Tk_Offset(TkButton, highlightBorder), 0,
+ TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0,
(ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr),
+ DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness", tkDefButtonHighlightWidth,
- Tk_Offset(TkButton, highlightWidthPtr),
- Tk_Offset(TkButton, highlightWidth), 0, 0, 0},
+ offsetof(TkButton, highlightWidthPtr),
+ offsetof(TkButton, highlightWidth), 0, 0, 0},
{TK_OPTION_STRING, "-image", "image", "Image",
- DEF_BUTTON_IMAGE, Tk_Offset(TkButton, imagePtr), -1,
+ DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0},
+ DEF_BUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkButton, justify), 0, 0, 0},
{TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief",
- DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief),
+ DEF_BUTTON_OVER_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, overRelief),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
- tkDefButtonPadx, Tk_Offset(TkButton, padXPtr),
- Tk_Offset(TkButton, padX), 0, 0, 0},
+ tkDefButtonPadx, offsetof(TkButton, padXPtr),
+ offsetof(TkButton, padX), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", "padY", "Pad",
- tkDefButtonPady, Tk_Offset(TkButton, padYPtr),
- Tk_Offset(TkButton, padY), 0, 0, 0},
+ tkDefButtonPady, offsetof(TkButton, padYPtr),
+ offsetof(TkButton, padY), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, relief),
+ DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief),
0, 0, 0},
{TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
- DEF_BUTTON_REPEAT_DELAY, -1, Tk_Offset(TkButton, repeatDelay),
+ DEF_BUTTON_REPEAT_DELAY, TCL_INDEX_NONE, offsetof(TkButton, repeatDelay),
0, 0, 0},
{TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval",
- DEF_BUTTON_REPEAT_INTERVAL, -1, Tk_Offset(TkButton, repeatInterval),
+ DEF_BUTTON_REPEAT_INTERVAL, TCL_INDEX_NONE, offsetof(TkButton, repeatInterval),
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state),
+ DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_BUTTON_TAKE_FOCUS, Tk_Offset(TkButton, takeFocusPtr), -1,
+ DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-text", "text", "Text",
- DEF_BUTTON_TEXT, Tk_Offset(TkButton, textPtr), -1, 0, 0, 0},
+ DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1,
+ DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0},
{TK_OPTION_STRING, "-width", "width", "Width",
- DEF_BUTTON_WIDTH, Tk_Offset(TkButton, widthPtr), -1, 0, 0, 0},
+ DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
- DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr),
- Tk_Offset(TkButton, wrapLength), 0, 0, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
+ DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr),
+ offsetof(TkButton, wrapLength), 0, 0, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
static const Tk_OptionSpec checkbuttonOptionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
- DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder),
+ DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder),
0, DEF_BUTTON_ACTIVE_BG_MONO, 0},
{TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background",
- DEF_CHKRAD_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg),
+ DEF_CHKRAD_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg),
TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0},
+ DEF_BUTTON_ANCHOR, TCL_INDEX_NONE, offsetof(TkButton, anchor), 0, 0, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder),
+ DEF_BUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, normalBorder),
0, DEF_BUTTON_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
- DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
+ DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr),
- Tk_Offset(TkButton, borderWidth), 0, 0, 0},
+ tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr),
+ offsetof(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
- DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1,
+ DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0,
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
compoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor),
+ DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
- -1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK,
+ TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
+ DEF_BUTTON_FONT, TCL_INDEX_NONE, offsetof(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_CHKRAD_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0},
+ DEF_CHKRAD_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0},
{TK_OPTION_STRING, "-height", "height", "Height",
- DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0},
+ DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR,
- -1, Tk_Offset(TkButton, highlightBorder), 0,
+ TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0,
(ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr),
+ DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness", tkDefButtonHighlightWidth,
- Tk_Offset(TkButton, highlightWidthPtr),
- Tk_Offset(TkButton, highlightWidth), 0, 0, 0},
+ offsetof(TkButton, highlightWidthPtr),
+ offsetof(TkButton, highlightWidth), 0, 0, 0},
{TK_OPTION_STRING, "-image", "image", "Image",
- DEF_BUTTON_IMAGE, Tk_Offset(TkButton, imagePtr), -1,
+ DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn",
- DEF_BUTTON_INDICATOR, -1, Tk_Offset(TkButton, indicatorOn), 0, 0, 0},
+ DEF_BUTTON_INDICATOR, TCL_INDEX_NONE, offsetof(TkButton, indicatorOn), 0, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0},
+ DEF_BUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkButton, justify), 0, 0, 0},
{TK_OPTION_RELIEF, "-offrelief", "offRelief", "OffRelief",
- DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, offRelief), 0, 0, 0},
+ DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, offRelief), 0, 0, 0},
{TK_OPTION_STRING, "-offvalue", "offValue", "Value",
- DEF_BUTTON_OFF_VALUE, Tk_Offset(TkButton, offValuePtr), -1, 0, 0, 0},
+ DEF_BUTTON_OFF_VALUE, offsetof(TkButton, offValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING, "-onvalue", "onValue", "Value",
- DEF_BUTTON_ON_VALUE, Tk_Offset(TkButton, onValuePtr), -1, 0, 0, 0},
+ DEF_BUTTON_ON_VALUE, offsetof(TkButton, onValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief",
- DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief),
+ DEF_BUTTON_OVER_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, overRelief),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
- tkDefLabelPadx, Tk_Offset(TkButton, padXPtr),
- Tk_Offset(TkButton, padX), 0, 0, 0},
+ tkDefLabelPadx, offsetof(TkButton, padXPtr),
+ offsetof(TkButton, padX), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", "padY", "Pad",
- tkDefLabelPady, Tk_Offset(TkButton, padYPtr),
- Tk_Offset(TkButton, padY), 0, 0, 0},
+ tkDefLabelPady, offsetof(TkButton, padYPtr),
+ offsetof(TkButton, padY), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_LABCHKRAD_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0},
+ DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-selectcolor", "selectColor", "Background",
- DEF_BUTTON_SELECT_COLOR, -1, Tk_Offset(TkButton, selectBorder),
+ DEF_BUTTON_SELECT_COLOR, TCL_INDEX_NONE, offsetof(TkButton, selectBorder),
TK_OPTION_NULL_OK, DEF_BUTTON_SELECT_MONO, 0},
{TK_OPTION_STRING, "-selectimage", "selectImage", "SelectImage",
- DEF_BUTTON_SELECT_IMAGE, Tk_Offset(TkButton, selectImagePtr), -1,
+ DEF_BUTTON_SELECT_IMAGE, offsetof(TkButton, selectImagePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state),
+ DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_BUTTON_TAKE_FOCUS, Tk_Offset(TkButton, takeFocusPtr), -1,
+ DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-text", "text", "Text",
- DEF_BUTTON_TEXT, Tk_Offset(TkButton, textPtr), -1, 0, 0, 0},
+ DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1,
+ DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage",
- DEF_BUTTON_IMAGE, Tk_Offset(TkButton, tristateImagePtr), -1,
+ DEF_BUTTON_IMAGE, offsetof(TkButton, tristateImagePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue",
- DEF_BUTTON_TRISTATE_VALUE, Tk_Offset(TkButton, tristateValuePtr), -1, 0, 0, 0},
+ DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0},
{TK_OPTION_STRING, "-variable", "variable", "Variable",
- DEF_CHECKBUTTON_VARIABLE, Tk_Offset(TkButton, selVarNamePtr), -1,
+ DEF_CHECKBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-width", "width", "Width",
- DEF_BUTTON_WIDTH, Tk_Offset(TkButton, widthPtr), -1, 0, 0, 0},
+ DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
- DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr),
- Tk_Offset(TkButton, wrapLength), 0, 0, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
+ DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr),
+ offsetof(TkButton, wrapLength), 0, 0, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
static const Tk_OptionSpec radiobuttonOptionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
- DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder),
+ DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder),
0, DEF_BUTTON_ACTIVE_BG_MONO, 0},
{TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background",
- DEF_CHKRAD_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg),
+ DEF_CHKRAD_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg),
TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0},
+ DEF_BUTTON_ANCHOR, TCL_INDEX_NONE, offsetof(TkButton, anchor), 0, 0, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder),
+ DEF_BUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, normalBorder),
0, DEF_BUTTON_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
- DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
+ DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr),
- Tk_Offset(TkButton, borderWidth), 0, 0, 0},
+ tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr),
+ offsetof(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
- DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1,
+ DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0,
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
compoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor),
+ DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
- -1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK,
+ TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
+ DEF_BUTTON_FONT, TCL_INDEX_NONE, offsetof(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_CHKRAD_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0},
+ DEF_CHKRAD_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0},
{TK_OPTION_STRING, "-height", "height", "Height",
- DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0},
+ DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR,
- -1, Tk_Offset(TkButton, highlightBorder), 0,
+ TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0,
(ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr),
+ DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness", tkDefButtonHighlightWidth,
- Tk_Offset(TkButton, highlightWidthPtr),
- Tk_Offset(TkButton, highlightWidth), 0, 0, 0},
+ offsetof(TkButton, highlightWidthPtr),
+ offsetof(TkButton, highlightWidth), 0, 0, 0},
{TK_OPTION_STRING, "-image", "image", "Image",
- DEF_BUTTON_IMAGE, Tk_Offset(TkButton, imagePtr), -1,
+ DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn",
- DEF_BUTTON_INDICATOR, -1, Tk_Offset(TkButton, indicatorOn),
+ DEF_BUTTON_INDICATOR, TCL_INDEX_NONE, offsetof(TkButton, indicatorOn),
0, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0},
+ DEF_BUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkButton, justify), 0, 0, 0},
{TK_OPTION_RELIEF, "-offrelief", "offRelief", "OffRelief",
- DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, offRelief), 0, 0, 0},
+ DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, offRelief), 0, 0, 0},
{TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief",
- DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief),
+ DEF_BUTTON_OVER_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, overRelief),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
- tkDefLabelPadx, Tk_Offset(TkButton, padXPtr),
- Tk_Offset(TkButton, padX), 0, 0, 0},
+ tkDefLabelPadx, offsetof(TkButton, padXPtr),
+ offsetof(TkButton, padX), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", "padY", "Pad",
- tkDefLabelPady, Tk_Offset(TkButton, padYPtr),
- Tk_Offset(TkButton, padY), 0, 0, 0},
+ tkDefLabelPady, offsetof(TkButton, padYPtr),
+ offsetof(TkButton, padY), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_LABCHKRAD_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0},
+ DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-selectcolor", "selectColor", "Background",
- DEF_BUTTON_SELECT_COLOR, -1, Tk_Offset(TkButton, selectBorder),
+ DEF_BUTTON_SELECT_COLOR, TCL_INDEX_NONE, offsetof(TkButton, selectBorder),
TK_OPTION_NULL_OK, DEF_BUTTON_SELECT_MONO, 0},
{TK_OPTION_STRING, "-selectimage", "selectImage", "SelectImage",
- DEF_BUTTON_SELECT_IMAGE, Tk_Offset(TkButton, selectImagePtr), -1,
+ DEF_BUTTON_SELECT_IMAGE, offsetof(TkButton, selectImagePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state),
+ DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_BUTTON_TAKE_FOCUS, Tk_Offset(TkButton, takeFocusPtr), -1,
+ DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-text", "text", "Text",
- DEF_BUTTON_TEXT, Tk_Offset(TkButton, textPtr), -1, 0, 0, 0},
+ DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1,
+ DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage",
- DEF_BUTTON_IMAGE, Tk_Offset(TkButton, tristateImagePtr), -1,
+ DEF_BUTTON_IMAGE, offsetof(TkButton, tristateImagePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue",
- DEF_BUTTON_TRISTATE_VALUE, Tk_Offset(TkButton, tristateValuePtr), -1, 0, 0, 0},
+ DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0},
{TK_OPTION_STRING, "-value", "value", "Value",
- DEF_BUTTON_VALUE, Tk_Offset(TkButton, onValuePtr), -1, 0, 0, 0},
+ DEF_BUTTON_VALUE, offsetof(TkButton, onValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING, "-variable", "variable", "Variable",
- DEF_RADIOBUTTON_VARIABLE, Tk_Offset(TkButton, selVarNamePtr), -1,
+ DEF_RADIOBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), TCL_INDEX_NONE,
0, 0, 0},
{TK_OPTION_STRING, "-width", "width", "Width",
- DEF_BUTTON_WIDTH, Tk_Offset(TkButton, widthPtr), -1, 0, 0, 0},
+ DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
- DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr),
- Tk_Offset(TkButton, wrapLength), 0, 0, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
+ DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr),
+ offsetof(TkButton, wrapLength), 0, 0, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
/*
@@ -628,7 +628,7 @@ Tk_RadiobuttonObjCmd(
static int
ButtonCreate(
- ClientData clientData, /* NULL. */
+ ClientData dummy, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument values. */
@@ -639,8 +639,9 @@ ButtonCreate(
TkButton *butPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ (void)dummy;
if (!tsdPtr->defaultsInitialized) {
TkpButtonSetDefaults();
@@ -749,7 +750,7 @@ ButtonCreate(
ExposureMask|StructureNotifyMask|FocusChangeMask,
ButtonEventProc, butPtr);
- if (Tk_InitOptions(interp, (char *) butPtr, optionTable, tkwin)
+ if (Tk_InitOptions(interp, butPtr, optionTable, tkwin)
!= TCL_OK) {
Tk_DestroyWindow(butPtr->tkwin);
return TCL_ERROR;
@@ -759,7 +760,7 @@ ButtonCreate(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(butPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(butPtr->tkwin));
return TCL_OK;
}
@@ -788,7 +789,7 @@ ButtonWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
{
- TkButton *butPtr = clientData;
+ TkButton *butPtr = (TkButton *)clientData;
int index;
int result;
Tcl_Obj *objPtr;
@@ -810,7 +811,7 @@ ButtonWidgetObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "cget option");
goto error;
}
- objPtr = Tk_GetOptionValue(interp, (char *) butPtr,
+ objPtr = Tk_GetOptionValue(interp, butPtr,
butPtr->optionTable, objv[2], butPtr->tkwin);
if (objPtr == NULL) {
goto error;
@@ -820,7 +821,7 @@ ButtonWidgetObjCmd(
case COMMAND_CONFIGURE:
if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) butPtr,
+ objPtr = Tk_GetOptionInfo(interp, butPtr,
butPtr->optionTable, (objc == 3) ? objv[2] : NULL,
butPtr->tkwin);
if (objPtr == NULL) {
@@ -1074,7 +1075,7 @@ ConfigureButton(
* First pass: set options to new values.
*/
- if (Tk_SetOptions(interp, (char *) butPtr,
+ if (Tk_SetOptions(interp, butPtr,
butPtr->optionTable, objc, objv,
butPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
@@ -1126,7 +1127,7 @@ ConfigureButton(
if (butPtr->selVarNamePtr == NULL) {
butPtr->selVarNamePtr = Tcl_NewStringObj(
- Tk_Name(butPtr->tkwin), -1);
+ Tk_Name(butPtr->tkwin), TCL_INDEX_NONE);
Tcl_IncrRefCount(butPtr->selVarNamePtr);
}
namePtr = butPtr->selVarNamePtr;
@@ -1348,7 +1349,7 @@ TkButtonWorldChanged(
XGCValues gcValues;
GC newGC;
unsigned long mask;
- TkButton *butPtr = instanceData;
+ TkButton *butPtr = (TkButton *)instanceData;
/*
* Recompute GCs.
@@ -1459,7 +1460,7 @@ ButtonEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkButton *butPtr = clientData;
+ TkButton *butPtr = (TkButton *)clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
goto redraw;
} else if (eventPtr->type == ConfigureNotify) {
@@ -1517,7 +1518,7 @@ static void
ButtonCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkButton *butPtr = clientData;
+ TkButton *butPtr = (TkButton *)clientData;
/*
* This function could be invoked either because the window was destroyed
@@ -1603,7 +1604,6 @@ TkInvokeButton(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static char *
ButtonVarProc(
ClientData clientData, /* Information about button. */
@@ -1612,9 +1612,11 @@ ButtonVarProc(
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- TkButton *butPtr = clientData;
+ TkButton *butPtr = (TkButton *)clientData;
const char *value;
Tcl_Obj *valuePtr;
+ (void)name1;
+ (void)name2;
/*
* If the variable is being unset, then just re-establish the trace unless
@@ -1713,7 +1715,6 @@ ButtonVarProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static char *
ButtonTextVarProc(
ClientData clientData, /* Information about button. */
@@ -1722,8 +1723,10 @@ ButtonTextVarProc(
const char *name2, /* Not used. */
int flags) /* Information about what happened. */
{
- TkButton *butPtr = clientData;
+ TkButton *butPtr = (TkButton *)clientData;
Tcl_Obj *valuePtr;
+ (void)name1;
+ (void)name2;
if (butPtr->flags & BUTTON_DELETED) {
return NULL;
@@ -1817,7 +1820,13 @@ ButtonImageProc(
* <= 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- TkButton *butPtr = clientData;
+ TkButton *butPtr = (TkButton *)clientData;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imgWidth;
+ (void)imgHeight;
if (butPtr->tkwin != NULL) {
TkpComputeButtonGeometry(butPtr);
@@ -1855,7 +1864,13 @@ ButtonSelectImageProc(
* <= 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- TkButton *butPtr = clientData;
+ TkButton *butPtr = (TkButton *)clientData;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imgWidth;
+ (void)imgHeight;
#ifdef MAC_OSX_TK
if (butPtr->tkwin != NULL) {
@@ -1902,7 +1917,13 @@ ButtonTristateImageProc(
* <= 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- TkButton *butPtr = clientData;
+ TkButton *butPtr = (TkButton *)clientData;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imgWidth;
+ (void)imgHeight;
#ifdef MAC_OSX_TK
if (butPtr->tkwin != NULL) {
diff --git a/generic/tkButton.h b/generic/tkButton.h
index edf7efe..fb45bb0 100644
--- a/generic/tkButton.h
+++ b/generic/tkButton.h
@@ -4,7 +4,7 @@
* Declarations of types and functions used to implement button-like
* widgets.
*
- * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
+ * Copyright © 1996-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index ccfe116..b9cc335 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -3,8 +3,8 @@
*
* This file implements arc items for canvas widgets.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,6 +14,8 @@
#include "tkCanvas.h"
#include "default.h"
+#include "float.h"
+
/*
* The structure below defines the record for each arc item.
*/
@@ -63,6 +65,12 @@ typedef struct ArcItem {
* start (see ComputeArcOutline). */
double center2[2]; /* Coordinates of center of arc outline at
* start+extent (see ComputeArcOutline). */
+ double height; /* Distance from the arc's chord to its
+ * mid-point. */
+ double startPoint[2]; /* Start point of arc used when specifying
+ * height. */
+ double endPoint[2]; /* End point of arc used when specifying
+ * height. */
} ArcItem;
/*
@@ -80,9 +88,9 @@ typedef struct ArcItem {
static int StyleParseProc(ClientData clientData, Tcl_Interp *interp,
Tk_Window tkwin, const char *value,
- char *widgRec, int offset);
+ char *widgRec, TkSizeT offset);
static const char * StylePrintProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
+ char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr);
static const Tk_CustomOption stateOption = {
TkStateParseProc, TkStatePrintProc, INT2PTR(2)
@@ -91,7 +99,7 @@ static const Tk_CustomOption styleOption = {
StyleParseProc, StylePrintProc, NULL
};
static const Tk_CustomOption tagsOption = {
- Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
+ TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL
};
static const Tk_CustomOption dashOption = {
TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL
@@ -105,65 +113,67 @@ static const Tk_CustomOption pixelOption = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
- NULL, Tk_Offset(ArcItem, outline.activeDash),
+ NULL, offsetof(ArcItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-activefill", NULL, NULL,
- NULL, Tk_Offset(ArcItem, activeFillColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, activeFillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-activeoutline", NULL, NULL,
- NULL, Tk_Offset(ArcItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL,
- NULL, Tk_Offset(ArcItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
- NULL, Tk_Offset(ArcItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
- "0.0", Tk_Offset(ArcItem, outline.activeWidth),
+ "0.0", offsetof(ArcItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
- NULL, Tk_Offset(ArcItem, outline.dash),
+ NULL, offsetof(ArcItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
- "0", Tk_Offset(ArcItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "0", offsetof(ArcItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
- NULL, Tk_Offset(ArcItem, outline.disabledDash),
+ NULL, offsetof(ArcItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
- NULL, Tk_Offset(ArcItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
- NULL, Tk_Offset(ArcItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL,
- NULL, Tk_Offset(ArcItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
- NULL, Tk_Offset(ArcItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL,
- "0.0", Tk_Offset(ArcItem, outline.disabledWidth),
+ "0.0", offsetof(ArcItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_DOUBLE, "-extent", NULL, NULL,
- "90", Tk_Offset(ArcItem, extent), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "90", offsetof(ArcItem, extent), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
- NULL, Tk_Offset(ArcItem, fillColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, fillColor), TK_CONFIG_NULL_OK, NULL},
+ {TK_CONFIG_DOUBLE, "-height", NULL, NULL,
+ 0, offsetof(ArcItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
- "0,0", Tk_Offset(ArcItem, tsoffset),
+ "0,0", offsetof(ArcItem, tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
{TK_CONFIG_COLOR, "-outline", NULL, NULL,
- DEF_CANVITEM_OUTLINE, Tk_Offset(ArcItem, outline.color), TK_CONFIG_NULL_OK, NULL},
+ DEF_CANVITEM_OUTLINE, offsetof(ArcItem, outline.color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL,
- "0,0", Tk_Offset(ArcItem, outline.tsoffset),
+ "0,0", offsetof(ArcItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
{TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL,
- NULL, Tk_Offset(ArcItem, outline.stipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, outline.stipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_DOUBLE, "-start", NULL, NULL,
- "0", Tk_Offset(ArcItem, start), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "0", offsetof(ArcItem, start), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
- NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
{TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
- NULL, Tk_Offset(ArcItem, fillStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ArcItem, fillStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-style", NULL, NULL,
- NULL, Tk_Offset(ArcItem, style), TK_CONFIG_DONT_SET_DEFAULT,
+ NULL, offsetof(ArcItem, style), TK_CONFIG_DONT_SET_DEFAULT,
&styleOption},
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
{TK_CONFIG_CUSTOM, "-width", NULL, NULL,
- "1.0", Tk_Offset(ArcItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT,
+ "1.0", offsetof(ArcItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT,
&pixelOption},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -176,6 +186,7 @@ static void ComputeArcBbox(Tk_Canvas canvas, ArcItem *arcPtr);
static int ConfigureArc(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
Tcl_Obj *const objv[], int flags);
+static void ComputeArcParametersFromHeight(ArcItem *arcPtr);
static int CreateArc(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
int objc, Tcl_Obj *const objv[]);
@@ -206,6 +217,8 @@ static int HorizLineToArc(double x1, double x2,
static int VertLineToArc(double x, double y1,
double y2, double rx, double ry,
double start, double extent);
+static void RotateArc(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRad);
/*
* The structures below defines the arc item types by means of functions that
@@ -233,7 +246,8 @@ Tk_ItemType tkArcType = {
NULL, /* insertProc */
NULL, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotateArc, /* rotateProc */
+ 0, NULL, NULL
};
/*
@@ -292,6 +306,7 @@ CreateArc(
arcPtr->disabledFillStipple = None;
arcPtr->style = PIESLICE_STYLE;
arcPtr->fillGC = NULL;
+ arcPtr->height = 0;
/*
* Process the arguments to fill in the item record.
@@ -375,6 +390,17 @@ ArcCoords(
&arcPtr->bbox[3]) != TCL_OK)) {
return TCL_ERROR;
}
+
+ /*
+ * Store bbox as start and end points so they can be used if either
+ * radius or height is specified.
+ */
+
+ arcPtr->startPoint[0] = arcPtr->bbox[0];
+ arcPtr->startPoint[1] = arcPtr->bbox[1];
+ arcPtr->endPoint[0] = arcPtr->bbox[2];
+ arcPtr->endPoint[1] = arcPtr->bbox[3];
+
ComputeArcBbox(canvas, arcPtr);
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -448,6 +474,22 @@ ConfigureArc(
itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT;
}
+ /*
+ * Override the start and extent if the height is given.
+ */
+
+ ComputeArcParametersFromHeight(arcPtr);
+
+ ComputeArcBbox(canvas, arcPtr);
+
+ i = (int) (arcPtr->start/360.0);
+ arcPtr->start -= i*360.0;
+ if (arcPtr->start < 0) {
+ arcPtr->start += 360.0;
+ }
+ i = (int) (arcPtr->extent/360.0);
+ arcPtr->extent -= i*360.0;
+
tsoffset = &arcPtr->outline.tsoffset;
flags = tsoffset->flags;
if (flags & TK_OFFSET_LEFT) {
@@ -465,14 +507,6 @@ ConfigureArc(
tsoffset->yoffset = (int) (arcPtr->bbox[2] + 0.5);
}
- i = (int) (arcPtr->start/360.0);
- arcPtr->start -= i*360.0;
- if (arcPtr->start < 0) {
- arcPtr->start += 360.0;
- }
- i = (int) (arcPtr->extent/360.0);
- arcPtr->extent -= i*360.0;
-
mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(arcPtr->outline));
if (mask) {
gcValues.cap_style = CapButt;
@@ -560,6 +594,103 @@ ConfigureArc(
/*
*--------------------------------------------------------------
*
+ * ComputeArcParametersFromHeight --
+ *
+ * This function calculates the arc parameters given start-point,
+ * end-point and height (!= 0).
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The height parameter is set to 0 on exit.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+ComputeArcParametersFromHeight(
+ ArcItem* arcPtr)
+{
+ double chordLen, chordDir[2], chordCen[2], arcCen[2], d, radToDeg, radius;
+
+ /*
+ * Do nothing if no height has been specified.
+ */
+
+ if (arcPtr->height == 0)
+ return;
+
+ /*
+ * Calculate the chord length, return early if it is too small.
+ */
+
+ chordLen = hypot(arcPtr->endPoint[1] - arcPtr->startPoint[1],
+ arcPtr->startPoint[0] - arcPtr->endPoint[0]);
+
+ if (chordLen < DBL_EPSILON) {
+ arcPtr->start = arcPtr->extent = arcPtr->height = 0;
+ return;
+ }
+
+ chordDir[0] = (arcPtr->endPoint[0] - arcPtr->startPoint[0]) / chordLen;
+ chordDir[1] = (arcPtr->endPoint[1] - arcPtr->startPoint[1]) / chordLen;
+ chordCen[0] = (arcPtr->startPoint[0] + arcPtr->endPoint[0]) / 2;
+ chordCen[1] = (arcPtr->startPoint[1] + arcPtr->endPoint[1]) / 2;
+
+ /*
+ * Calculate the radius (assumes height != 0).
+ */
+
+ radius = (4*pow(arcPtr->height, 2) + pow(chordLen, 2))
+ / (8 * arcPtr->height);
+
+ /*
+ * The arc centre.
+ */
+
+ d = radius - arcPtr->height;
+ arcCen[0] = chordCen[0] - d * chordDir[1];
+ arcCen[1] = chordCen[1] + d * chordDir[0];
+
+ /*
+ * The arc start and span. Angles are negated because the coordinate
+ * system is left-handed.
+ */
+
+ radToDeg = 45 / atan(1);
+ arcPtr->start = atan2(arcCen[1] - arcPtr->startPoint[1],
+ arcPtr->startPoint[0] - arcCen[0]) * radToDeg;
+ arcPtr->extent = -2 * asin(chordLen / (2 * radius)) * radToDeg;
+
+ /*
+ * Handle spans > 180.
+ */
+
+ if (fabs(2 * arcPtr->height) > chordLen) {
+ arcPtr->extent = arcPtr->extent > 0 ? (360 - arcPtr->extent)
+ : -(360 + arcPtr->extent);
+ }
+
+ /*
+ * Create the bounding box.
+ */
+
+ arcPtr->bbox[0] = arcCen[0] - radius;
+ arcPtr->bbox[1] = arcCen[1] - radius;
+ arcPtr->bbox[2] = arcCen[0] + radius;
+ arcPtr->bbox[3] = arcCen[1] + radius;
+
+ /*
+ * Set the height to 0 so that itemcget -height returns 0.
+ */
+
+ arcPtr->height = 0;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* DeleteArc --
*
* This function is called to clean up the data structure associated with
@@ -1379,6 +1510,60 @@ ScaleArc(
/*
*--------------------------------------------------------------
*
+ * RotateArc --
+ *
+ * This function is called to rotate an arc by a given amount.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The position of the arc is rotated by angleRad radians about (originX,
+ * originY), and the bounding box is updated in the generic part of the
+ * item structure.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+RotateArc(
+ Tk_Canvas canvas,
+ Tk_Item *itemPtr,
+ double originX,
+ double originY,
+ double angleRad)
+{
+ ArcItem *arcPtr = (ArcItem *) itemPtr;
+ double newX, newY, oldX, oldY;
+
+ /*
+ * Compute the centre of the box, then rotate that about the origin.
+ */
+
+ newX = oldX = (arcPtr->bbox[0] + arcPtr->bbox[2]) / 2.0;
+ newY = oldY = (arcPtr->bbox[1] + arcPtr->bbox[3]) / 2.0;
+ TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad),
+ &newX, &newY);
+
+ /*
+ * Apply the translation to the box.
+ */
+
+ arcPtr->bbox[0] += newX - oldX;
+ arcPtr->bbox[1] += newY - oldY;
+ arcPtr->bbox[2] += newX - oldX;
+ arcPtr->bbox[3] += newY - oldY;
+
+ /*
+ * TODO: update the arc endpoints?
+ */
+
+ ComputeArcBbox(canvas, arcPtr);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* TranslateArc --
*
* This function is called to move an arc by a given amount.
@@ -1898,18 +2083,14 @@ ArcToPostscript(
ang1, ang2);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, fillColor);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (fillStipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsStipple(interp, canvas, fillStipple);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (arcPtr->outline.gc != NULL) {
@@ -1935,9 +2116,7 @@ ArcToPostscript(
ang1, ang2);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsOutline(canvas, itemPtr, &arcPtr->outline) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsOutline(canvas, itemPtr, &arcPtr->outline);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (arcPtr->style != ARC_STYLE) {
@@ -1950,18 +2129,14 @@ ArcToPostscript(
} else {
Tk_CanvasPsPath(interp, canvas, arcPtr->outlinePtr,
PIE_OUTLINE1_PTS);
- if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, color);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (stipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsStipple(interp, canvas, stipple) !=TCL_OK){
- goto error;
- }
+ Tk_CanvasPsStipple(interp, canvas, stipple);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
} else {
Tcl_AppendToObj(psObj, "fill\n", -1);
@@ -1973,18 +2148,14 @@ ArcToPostscript(
arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
PIE_OUTLINE2_PTS);
}
- if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, color);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (stipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsStipple(interp, canvas, stipple);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
} else {
Tcl_AppendToObj(psObj, "fill\n", -1);
@@ -2000,11 +2171,6 @@ ArcToPostscript(
Tcl_AppendObjToObj(Tcl_GetObjResult(interp), psObj);
Tcl_DecrRefCount(psObj);
return TCL_OK;
-
- error:
- Tcl_DiscardInterpState(interpState);
- Tcl_DecrRefCount(psObj);
- return TCL_ERROR;
}
/*
@@ -2032,7 +2198,7 @@ StyleParseProc(
TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
- int offset) /* Offset into item. */
+ TkSizeT offset) /* Offset into item. */
{
int c;
size_t length;
@@ -2093,7 +2259,7 @@ StylePrintProc(
TCL_UNUSED(void *), /* Ignored. */
TCL_UNUSED(Tk_Window), /* Ignored. */
char *widgRec, /* Pointer to record for item. */
- int offset, /* Offset into item. */
+ TkSizeT offset, /* Offset into item. */
TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c
index 01d875c..18618b3 100644
--- a/generic/tkCanvBmap.c
+++ b/generic/tkCanvBmap.c
@@ -3,8 +3,8 @@
*
* This file implements bitmap items for canvas widgets.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -45,35 +45,35 @@ static const Tk_CustomOption stateOption = {
TkStateParseProc, TkStatePrintProc, INT2PTR(2)
};
static const Tk_CustomOption tagsOption = {
- Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
+ TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL
};
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_COLOR, "-activebackground", NULL, NULL,
- NULL, Tk_Offset(BitmapItem, activeBgColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapItem, activeBgColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activebitmap", NULL, NULL,
- NULL, Tk_Offset(BitmapItem, activeBitmap), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapItem, activeBitmap), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-activeforeground", NULL, NULL,
- NULL, Tk_Offset(BitmapItem, activeFgColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapItem, activeFgColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
- "center", Tk_Offset(BitmapItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "center", offsetof(BitmapItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_COLOR, "-background", NULL, NULL,
- NULL, Tk_Offset(BitmapItem, bgColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapItem, bgColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-bitmap", NULL, NULL,
- NULL, Tk_Offset(BitmapItem, bitmap), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapItem, bitmap), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-disabledbackground", NULL, NULL,
- NULL, Tk_Offset(BitmapItem, disabledBgColor),
+ NULL, offsetof(BitmapItem, disabledBgColor),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledbitmap", NULL, NULL,
- NULL, Tk_Offset(BitmapItem, disabledBitmap),
+ NULL, offsetof(BitmapItem, disabledBitmap),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-disabledforeground", NULL, NULL,
- NULL, Tk_Offset(BitmapItem, disabledFgColor),
+ NULL, offsetof(BitmapItem, disabledFgColor),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-foreground", NULL, NULL,
- DEF_CANVBMAP_FG, Tk_Offset(BitmapItem, fgColor), 0, NULL},
+ DEF_CANVBMAP_FG, offsetof(BitmapItem, fgColor), 0, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
- NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
+ NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK,
&stateOption},
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
@@ -106,6 +106,8 @@ static void DeleteBitmap(Tk_Canvas canvas,
static void DisplayBitmap(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
int x, int y, int width, int height);
+static void RotateBitmap(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRad);
static void ScaleBitmap(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
double scaleX, double scaleY);
@@ -138,7 +140,8 @@ Tk_ItemType tkBitmapType = {
NULL, /* insertProc */
NULL, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotateBitmap, /* rotateProc */
+ 0, NULL, NULL
};
/*
@@ -419,6 +422,7 @@ DeleteBitmap(
Display *display) /* Display containing window for canvas. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
+ (void)canvas;
if (bmapPtr->bitmap != None) {
Tk_FreeBitmap(display, bmapPtr->bitmap);
@@ -470,7 +474,6 @@ DeleteBitmap(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
ComputeBitmapBbox(
Tk_Canvas canvas, /* Canvas that contains item. */
@@ -668,7 +671,6 @@ DisplayBitmap(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static double
BitmapToPoint(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -677,6 +679,7 @@ BitmapToPoint(
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
double x1, x2, y1, y2, xDiff, yDiff;
+ (void)canvas;
x1 = bmapPtr->header.x1;
y1 = bmapPtr->header.y1;
@@ -725,7 +728,6 @@ BitmapToPoint(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
BitmapToArea(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -735,6 +737,7 @@ BitmapToArea(
* area. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
+ (void)canvas;
if ((rectPtr[2] <= bmapPtr->header.x1)
|| (rectPtr[0] >= bmapPtr->header.x2)
@@ -791,6 +794,39 @@ ScaleBitmap(
/*
*--------------------------------------------------------------
*
+ * RotateBitmap --
+ *
+ * This function is called to rotate a bitmap's origin by a given amount.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The position of the bitmap is rotated by angleRad radians about
+ * (originX, originY), and the bounding box is updated in the generic
+ * part of the item structure.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+RotateBitmap(
+ Tk_Canvas canvas,
+ Tk_Item *itemPtr,
+ double originX,
+ double originY,
+ double angleRad)
+{
+ BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
+
+ TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad),
+ &bmapPtr->x, &bmapPtr->y);
+ ComputeBitmapBbox(canvas, bmapPtr);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* TranslateBitmap --
*
* This function is called to move an item by a given amount.
@@ -857,6 +893,7 @@ BitmapToPostscript(
Tk_State state = itemPtr->state;
Tcl_Obj *psObj;
Tcl_InterpState interpState;
+ (void)prepass;
if (state == TK_STATE_NULL) {
state = Canvas(canvas)->canvas_state;
@@ -929,9 +966,7 @@ BitmapToPostscript(
x, y, width, height, -width);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsColor(interp, canvas, bgColor) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, bgColor);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
Tcl_AppendToObj(psObj, "fill\n", -1);
@@ -946,9 +981,7 @@ BitmapToPostscript(
if (fgColor != NULL) {
Tcl_ResetResult(interp);
- if (Tk_CanvasPsColor(interp, canvas, fgColor) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, fgColor);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (width > 60000) {
@@ -977,10 +1010,8 @@ BitmapToPostscript(
(double) rowsThisTime, width, rowsThisTime);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsBitmap(interp, canvas, bitmap,
- 0, curRow, width, rowsThisTime) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsBitmap(interp, canvas, bitmap, 0, curRow, width,
+ rowsThisTime);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
Tcl_AppendToObj(psObj, "\n} imagemask\n", -1);
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index 70b9c79..fcdebf0 100644
--- a/generic/tkCanvImg.c
+++ b/generic/tkCanvImg.c
@@ -3,8 +3,8 @@
*
* This file implements image items for canvas widgets.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -47,20 +47,20 @@ static const Tk_CustomOption stateOption = {
TkStateParseProc, TkStatePrintProc, INT2PTR(2)
};
static const Tk_CustomOption tagsOption = {
- Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
+ TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL
};
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_STRING, "-activeimage", NULL, NULL,
- NULL, Tk_Offset(ImageItem, activeImageString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ImageItem, activeImageString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
- "center", Tk_Offset(ImageItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "center", offsetof(ImageItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_STRING, "-disabledimage", NULL, NULL,
- NULL, Tk_Offset(ImageItem, disabledImageString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ImageItem, disabledImageString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_STRING, "-image", NULL, NULL,
- NULL, Tk_Offset(ImageItem, imageString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(ImageItem, imageString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
- NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
@@ -94,6 +94,8 @@ static void DeleteImage(Tk_Canvas canvas,
static void DisplayImage(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
int x, int y, int width, int height);
+static void RotateImage(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRad);
static void ScaleImage(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
double scaleX, double scaleY);
@@ -126,7 +128,8 @@ Tk_ItemType tkImageType = {
NULL, /* insertProc */
NULL, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotateImage, /* rotateProc */
+ 0, NULL, NULL
};
/*
@@ -382,6 +385,8 @@ DeleteImage(
Display *display) /* Display containing window for canvas. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
+ (void)canvas;
+ (void)display;
if (imgPtr->imageString != NULL) {
ckfree(imgPtr->imageString);
@@ -421,7 +426,6 @@ DeleteImage(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
ComputeImageBbox(
Tk_Canvas canvas, /* Canvas that contains item. */
@@ -534,6 +538,7 @@ DisplayImage(
short drawableX, drawableY;
Tk_Image image;
Tk_State state = itemPtr->state;
+ (void)display;
if (state == TK_STATE_NULL) {
state = Canvas(canvas)->canvas_state;
@@ -592,6 +597,7 @@ ImageToPoint(
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
double x1, x2, y1, y2, xDiff, yDiff;
+ (void)canvas;
x1 = imgPtr->header.x1;
y1 = imgPtr->header.y1;
@@ -649,6 +655,7 @@ ImageToArea(
* area. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
+ (void)canvas;
if ((rectPtr[2] <= imgPtr->header.x1)
|| (rectPtr[0] >= imgPtr->header.x2)
@@ -761,6 +768,40 @@ ImageToPostscript(
/*
*--------------------------------------------------------------
*
+ * RotateImage --
+ *
+ * This function is called to rotate an image's origin by a given amount.
+ * This does *not* rotate the contents of the image.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The position of the image anchor is rotated by angleRad radians about
+ * (originX, originY), and the bounding box is updated in the generic
+ * part of the item structure.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+RotateImage(
+ Tk_Canvas canvas,
+ Tk_Item *itemPtr,
+ double originX,
+ double originY,
+ double angleRad)
+{
+ ImageItem *imgPtr = (ImageItem *) itemPtr;
+
+ TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad),
+ &imgPtr->x, &imgPtr->y);
+ ComputeImageBbox(canvas, imgPtr);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* ScaleImage --
*
* This function is invoked to rescale an item.
@@ -851,7 +892,7 @@ ImageChangedProc(
* 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- ImageItem *imgPtr = clientData;
+ ImageItem *imgPtr = (ImageItem *)clientData;
/*
* If the image's size changed and it's not anchored at its northwest
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index ba4cda1..07dbb70 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -3,9 +3,9 @@
*
* This file implements line items for canvas widgets.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -92,14 +92,14 @@ static void DisplayLine(Tk_Canvas canvas,
int x, int y, int width, int height);
static int GetLineIndex(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- Tcl_Obj *obj, int *indexPtr);
+ Tcl_Obj *obj, TkSizeT *indexPtr);
static int LineCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
int objc, Tcl_Obj *const objv[]);
static void LineDeleteCoords(Tk_Canvas canvas,
- Tk_Item *itemPtr, int first, int last);
+ Tk_Item *itemPtr, TkSizeT first, TkSizeT last);
static void LineInsert(Tk_Canvas canvas,
- Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj);
+ Tk_Item *itemPtr, TkSizeT beforeThis, Tcl_Obj *obj);
static int LineToArea(Tk_Canvas canvas,
Tk_Item *itemPtr, double *rectPtr);
static double LineToPoint(Tk_Canvas canvas,
@@ -108,16 +108,18 @@ static int LineToPostscript(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
static int ArrowParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- const char *value, char *recordPtr, int offset);
+ const char *value, char *recordPtr, TkSizeT offset);
static const char * ArrowPrintProc(ClientData clientData,
- Tk_Window tkwin, char *recordPtr, int offset,
+ Tk_Window tkwin, char *recordPtr, TkSizeT offset,
Tcl_FreeProc **freeProcPtr);
static int ParseArrowShape(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- const char *value, char *recordPtr, int offset);
+ const char *value, char *recordPtr, TkSizeT offset);
static const char * PrintArrowShape(ClientData clientData,
- Tk_Window tkwin, char *recordPtr, int offset,
+ Tk_Window tkwin, char *recordPtr, TkSizeT offset,
Tcl_FreeProc **freeProcPtr);
+static void RotateLine(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRad);
static void ScaleLine(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
double scaleX, double scaleY);
@@ -143,7 +145,7 @@ static const Tk_CustomOption stateOption = {
TkStateParseProc, TkStatePrintProc, INT2PTR(2)
};
static const Tk_CustomOption tagsOption = {
- Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
+ TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL
};
static const Tk_CustomOption dashOption = {
TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL
@@ -158,58 +160,58 @@ static const Tk_CustomOption pixelOption = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.activeDash),
+ NULL, offsetof(LineItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-activefill", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(LineItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(LineItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
- "0.0", Tk_Offset(LineItem, outline.activeWidth),
+ "0.0", offsetof(LineItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_CUSTOM, "-arrow", NULL, NULL,
- "none", Tk_Offset(LineItem, arrow),
+ "none", offsetof(LineItem, arrow),
TK_CONFIG_DONT_SET_DEFAULT, &arrowOption},
{TK_CONFIG_CUSTOM, "-arrowshape", NULL, NULL,
- "8 10 3", Tk_Offset(LineItem, arrowShapeA),
+ "8 10 3", offsetof(LineItem, arrowShapeA),
TK_CONFIG_DONT_SET_DEFAULT, &arrowShapeOption},
{TK_CONFIG_CAP_STYLE, "-capstyle", NULL, NULL,
- "butt", Tk_Offset(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "butt", offsetof(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
- DEF_CANVITEM_OUTLINE, Tk_Offset(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL},
+ DEF_CANVITEM_OUTLINE, offsetof(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.dash),
+ NULL, offsetof(LineItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
- "0", Tk_Offset(LineItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "0", offsetof(LineItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.disabledDash),
+ NULL, offsetof(LineItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL,
- "0.0", Tk_Offset(LineItem, outline.disabledWidth),
+ "0.0", offsetof(LineItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL,
- "round", Tk_Offset(LineItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "round", offsetof(LineItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
- "0,0", Tk_Offset(LineItem, outline.tsoffset),
+ "0,0", offsetof(LineItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
{TK_CONFIG_CUSTOM, "-smooth", NULL, NULL,
- "0", Tk_Offset(LineItem, smooth),
+ "0", offsetof(LineItem, smooth),
TK_CONFIG_DONT_SET_DEFAULT, &smoothOption},
{TK_CONFIG_INT, "-splinesteps", NULL, NULL,
- "12", Tk_Offset(LineItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "12", offsetof(LineItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
- NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
{TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.stipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(LineItem, outline.stipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
{TK_CONFIG_CUSTOM, "-width", NULL, NULL,
- "1.0", Tk_Offset(LineItem, outline.width),
+ "1.0", offsetof(LineItem, outline.width),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -240,7 +242,8 @@ Tk_ItemType tkLineType = {
LineInsert, /* insertProc */
LineDeleteCoords, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotateLine, /* rotateProc */
+ 0, NULL, NULL
};
/*
@@ -835,7 +838,7 @@ DisplayLine(
TCL_UNUSED(int),
TCL_UNUSED(int))
{
- LineItem *linePtr = (LineItem *) itemPtr;
+ LineItem *linePtr = (LineItem *)itemPtr;
XPoint staticPoints[MAX_STATIC_POINTS*3];
XPoint *pointPtr;
double linewidth;
@@ -952,7 +955,7 @@ static void
LineInsert(
Tk_Canvas canvas, /* Canvas containing text item. */
Tk_Item *itemPtr, /* Line item to be modified. */
- int beforeThis, /* Index before which new coordinates are to
+ TkSizeT beforeThis, /* Index before which new coordinates are to
* be inserted. */
Tcl_Obj *obj) /* New coordinates to be inserted. */
{
@@ -971,10 +974,10 @@ LineInsert(
return;
}
length = 2*linePtr->numPoints;
- if (beforeThis < 0) {
+ if (beforeThis == TCL_INDEX_NONE) {
beforeThis = 0;
}
- if (beforeThis > length) {
+ if (beforeThis + 1 > (TkSizeT)length + 1) {
beforeThis = length;
}
if (linePtr->firstArrowPtr != NULL) {
@@ -986,7 +989,7 @@ LineInsert(
linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1];
}
newCoordPtr = (double *)ckalloc(sizeof(double) * (length + objc));
- for (i=0; i<beforeThis; i++) {
+ for (i=0; i<(int)beforeThis; i++) {
newCoordPtr[i] = linePtr->coordPtr[i];
}
for (i=0; i<objc; i++) {
@@ -1020,25 +1023,25 @@ LineInsert(
itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW;
- if (beforeThis > 0) {
+ if ((int)beforeThis > 0) {
beforeThis -= 2;
objc += 2;
}
- if (beforeThis+objc < length) {
+ if ((int)beforeThis+objc < length) {
objc += 2;
}
if (linePtr->smooth) {
- if (beforeThis > 0) {
+ if ((int)beforeThis > 0) {
beforeThis -= 2;
objc += 2;
}
- if (beforeThis+objc+2 < length) {
+ if ((int)beforeThis+objc+2 < length) {
objc += 2;
}
}
itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[beforeThis];
itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[beforeThis+1];
- if ((linePtr->firstArrowPtr != NULL) && (beforeThis < 1)) {
+ if ((linePtr->firstArrowPtr != NULL) && ((int)beforeThis < 1)) {
/*
* Include old first arrow.
*/
@@ -1048,7 +1051,7 @@ LineInsert(
TkIncludePoint(itemPtr, coordPtr);
}
}
- if ((linePtr->lastArrowPtr != NULL) && (beforeThis+objc >= length)) {
+ if ((linePtr->lastArrowPtr != NULL) && ((int)beforeThis+objc >= length)) {
/*
* Include old last arrow.
*/
@@ -1080,7 +1083,7 @@ LineInsert(
double width;
int intWidth;
- if ((linePtr->firstArrowPtr != NULL) && (beforeThis > 2)) {
+ if ((linePtr->firstArrowPtr != NULL) && ((int)beforeThis > 2)) {
/*
* Include new first arrow.
*/
@@ -1090,7 +1093,7 @@ LineInsert(
TkIncludePoint(itemPtr, coordPtr);
}
}
- if ((linePtr->lastArrowPtr != NULL) && (beforeThis+objc < length-2)) {
+ if ((linePtr->lastArrowPtr != NULL) && ((int)beforeThis+objc < length-2)) {
/*
* Include new right arrow.
*/
@@ -1146,8 +1149,8 @@ static void
LineDeleteCoords(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Item in which to delete characters. */
- int first, /* Index of first character to delete. */
- int last) /* Index of last character to delete. */
+ TkSizeT first, /* Index of first character to delete. */
+ TkSizeT last) /* Index of last character to delete. */
{
LineItem *linePtr = (LineItem *) itemPtr;
int count, i, first1, last1;
@@ -1162,13 +1165,13 @@ LineDeleteCoords(
first &= -2;
last &= -2;
- if (first < 0) {
+ if ((int)first < 0) {
first = 0;
}
- if (last >= length) {
+ if ((int)last >= length) {
last = length-2;
}
- if (first > last) {
+ if ((int)first > (int)last) {
return;
}
if (linePtr->firstArrowPtr != NULL) {
@@ -1738,18 +1741,28 @@ GetLineIndex(
* specified. */
Tcl_Obj *obj, /* Specification of a particular coord in
* itemPtr's line. */
- int *indexPtr) /* Where to store converted index. */
+ TkSizeT *indexPtr) /* Where to store converted index. */
{
+ TkSizeT idx, length;
LineItem *linePtr = (LineItem *) itemPtr;
- const char *string = Tcl_GetString(obj);
-
- if (string[0] == 'e') {
- if (strncmp(string, "end", obj->length) == 0) {
- *indexPtr = 2*linePtr->numPoints;
+ const char *string;
+ (void)canvas;
+
+ if (TCL_OK == TkGetIntForIndex(obj, 2*linePtr->numPoints - 1, 1, &idx)) {
+ if (idx == TCL_INDEX_NONE) {
+ idx = 0;
+ } else if (idx > (2*(TkSizeT)linePtr->numPoints)) {
+ idx = 2*linePtr->numPoints;
} else {
- goto badIndex;
+ idx &= (TkSizeT)-2; /* If index is odd, make it even. */
}
- } else if (string[0] == '@') {
+ *indexPtr = idx;
+ return TCL_OK;
+ }
+
+ string = Tcl_GetStringFromObj(obj, &length);
+
+ if (string[0] == '@') {
int i;
double x, y, bestDist, dist, *coordPtr;
char *end;
@@ -1777,28 +1790,18 @@ GetLineIndex(
coordPtr += 2;
}
} else {
- if (Tcl_GetIntFromObj(interp, obj, indexPtr) != TCL_OK) {
- goto badIndex;
- }
- *indexPtr &= -2; /* If index is odd, make it even. */
- if (*indexPtr < 0){
- *indexPtr = 0;
- } else if (*indexPtr > (2*linePtr->numPoints)) {
- *indexPtr = (2*linePtr->numPoints);
- }
- }
- return TCL_OK;
- /*
- * Some of the paths here leave messages in interp->result, so we have to
- * clear it out before storing our own message.
- */
+ /*
+ * Some of the paths here leave messages in interp->result, so we have to
+ * clear it out before storing our own message.
+ */
- badIndex:
- Tcl_ResetResult(interp);
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string));
- Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "LINE", NULL);
- return TCL_ERROR;
+ badIndex:
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string));
+ Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "LINE", NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
}
/*
@@ -1854,6 +1857,56 @@ TranslateLine(
/*
*--------------------------------------------------------------
*
+ * RotateLine --
+ *
+ * This function is called to rotate a line by a given amount about a
+ * point.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The position of the line is rotated by angleRad about (originX,
+ * originY), and the bounding box is updated in the generic part of the
+ * item structure.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+RotateLine(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double originX, double originY,
+ double angleRad) /* Amount by which item is to be rotated. */
+{
+ LineItem *linePtr = (LineItem *) itemPtr;
+ double *coordPtr;
+ int i;
+ double s = sin(angleRad), c = cos(angleRad);
+
+ for (i = 0, coordPtr = linePtr->coordPtr; i < linePtr->numPoints;
+ i++, coordPtr += 2) {
+ TkRotatePoint(originX, originY, s, c, &coordPtr[0], &coordPtr[1]);
+ }
+ if (linePtr->firstArrowPtr != NULL) {
+ for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW;
+ i++, coordPtr += 2) {
+ TkRotatePoint(originX, originY, s, c, &coordPtr[0], &coordPtr[1]);
+ }
+ }
+ if (linePtr->lastArrowPtr != NULL) {
+ for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW;
+ i++, coordPtr += 2) {
+ TkRotatePoint(originX, originY, s, c, &coordPtr[0], &coordPtr[1]);
+ }
+ }
+ ComputeLineBbox(canvas, linePtr);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* ParseArrowShape --
*
* This function is called back during option parsing to parse arrow
@@ -1878,7 +1931,7 @@ ParseArrowShape(
const char *value, /* Textual specification of arrow shape. */
char *recordPtr, /* Pointer to item record in which to store
* arrow information. */
- int offset) /* Offset of shape information in widget
+ TkSizeT offset) /* Offset of shape information in widget
* record. */
{
LineItem *linePtr = (LineItem *) recordPtr;
@@ -1886,7 +1939,7 @@ ParseArrowShape(
int argc;
const char **argv = NULL;
- if (offset != Tk_Offset(LineItem, arrowShapeA)) {
+ if ((size_t)offset != offsetof(LineItem, arrowShapeA)) {
Tcl_Panic("ParseArrowShape received bogus offset");
}
@@ -1944,7 +1997,7 @@ PrintArrowShape(
TCL_UNUSED(Tk_Window), /* Window associated with linePtr's widget. */
char *recordPtr, /* Pointer to item record containing current
* shape information. */
- TCL_UNUSED(int), /* Offset of arrow information in record. */
+ TCL_UNUSED(TkSizeT), /* Offset of arrow information in record. */
Tcl_FreeProc **freeProcPtr) /* Store address of function to call to free
* string here. */
{
@@ -1982,7 +2035,7 @@ ArrowParseProc(
TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
- int offset) /* Offset into item. */
+ TkSizeT offset) /* Offset into item. */
{
int c;
size_t length;
@@ -2047,7 +2100,7 @@ ArrowPrintProc(
TCL_UNUSED(void *), /* Ignored. */
TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
- int offset, /* Offset into item. */
+ TkSizeT offset, /* Offset into item. */
TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
@@ -2313,17 +2366,13 @@ LineToPostscript(
" scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, color);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (stipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsStipple(interp, canvas, stipple);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
} else {
Tcl_AppendToObj(psObj, "fill\n", -1);
@@ -2392,9 +2441,7 @@ LineToPostscript(
Tcl_AppendPrintfToObj(psObj, "%d setlinejoin\n", style);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsOutline(canvas, itemPtr, &linePtr->outline) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsOutline(canvas, itemPtr, &linePtr->outline);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
/*
@@ -2405,19 +2452,15 @@ LineToPostscript(
if (stipple != None) {
Tcl_AppendToObj(psObj, "grestore gsave\n", -1);
}
- if (ArrowheadPostscript(interp, canvas, linePtr,
- linePtr->firstArrowPtr, psObj) != TCL_OK) {
- goto error;
- }
+ ArrowheadPostscript(interp, canvas, linePtr,
+ linePtr->firstArrowPtr, psObj);
}
if (linePtr->lastArrowPtr != NULL) {
if (stipple != None) {
Tcl_AppendToObj(psObj, "grestore gsave\n", -1);
}
- if (ArrowheadPostscript(interp, canvas, linePtr,
- linePtr->lastArrowPtr, psObj) != TCL_OK) {
- goto error;
- }
+ ArrowheadPostscript(interp, canvas, linePtr,
+ linePtr->lastArrowPtr, psObj);
}
/*
@@ -2429,11 +2472,6 @@ LineToPostscript(
Tcl_AppendObjToObj(Tcl_GetObjResult(interp), psObj);
Tcl_DecrRefCount(psObj);
return TCL_OK;
-
- error:
- Tcl_DiscardInterpState(interpState);
- Tcl_DecrRefCount(psObj);
- return TCL_ERROR;
}
/*
@@ -2493,9 +2531,7 @@ ArrowheadPostscript(
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
- return TCL_ERROR;
- }
+ Tk_CanvasPsStipple(interp, canvas, stipple);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
} else {
Tcl_AppendToObj(psObj, "fill\n", -1);
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index 513613d..90b2896 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -3,9 +3,9 @@
*
* This file implements polygon items for canvas widgets.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 Ajuba Solutions.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Ajuba Solutions.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -62,7 +62,7 @@ static const Tk_CustomOption stateOption = {
TkStateParseProc, TkStatePrintProc, INT2PTR(2)
};
static const Tk_CustomOption tagsOption = {
- Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
+ TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL
};
static const Tk_CustomOption dashOption = {
TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL
@@ -77,70 +77,69 @@ static const Tk_CustomOption pixelOption = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, outline.activeDash),
+ NULL, offsetof(PolygonItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-activefill", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, activeFillColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PolygonItem, activeFillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-activeoutline", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PolygonItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, outline.activeStipple),
+ NULL, offsetof(PolygonItem, outline.activeStipple),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PolygonItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
- "0.0", Tk_Offset(PolygonItem, outline.activeWidth),
+ "0.0", offsetof(PolygonItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, outline.dash),
+ NULL, offsetof(PolygonItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
- "0", Tk_Offset(PolygonItem, outline.offset),
+ "0", offsetof(PolygonItem, outline.offset),
TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, outline.disabledDash),
+ NULL, offsetof(PolygonItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, outline.disabledColor),
+ NULL, offsetof(PolygonItem, outline.disabledColor),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, outline.disabledStipple),
+ NULL, offsetof(PolygonItem, outline.disabledStipple),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PolygonItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL,
- "0.0", Tk_Offset(PolygonItem, outline.disabledWidth),
+ "0.0", offsetof(PolygonItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- /* Remark: Default for -fill should be NULL, see [2860519]. Will be fixed in Tk 8.7 */
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
- DEF_CANVITEM_OUTLINE, Tk_Offset(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL,
- "round", Tk_Offset(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "round", offsetof(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
- "0,0", Tk_Offset(PolygonItem, tsoffset),
+ "0,0", offsetof(PolygonItem, tsoffset),
TK_CONFIG_NULL_OK, &offsetOption},
{TK_CONFIG_COLOR, "-outline", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, outline.color), TK_CONFIG_NULL_OK, NULL},
+ DEF_CANVITEM_OUTLINE, offsetof(PolygonItem, outline.color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL,
- "0,0", Tk_Offset(PolygonItem, outline.tsoffset),
+ "0,0", offsetof(PolygonItem, outline.tsoffset),
TK_CONFIG_NULL_OK, &offsetOption},
{TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, outline.stipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PolygonItem, outline.stipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-smooth", NULL, NULL,
- "0", Tk_Offset(PolygonItem, smooth),
+ "0", offsetof(PolygonItem, smooth),
TK_CONFIG_DONT_SET_DEFAULT, &smoothOption},
{TK_CONFIG_INT, "-splinesteps", NULL, NULL,
- "12", Tk_Offset(PolygonItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "12", offsetof(PolygonItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
- NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
{TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
- NULL, Tk_Offset(PolygonItem, fillStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PolygonItem, fillStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
{TK_CONFIG_CUSTOM, "-width", NULL, NULL,
- "1.0", Tk_Offset(PolygonItem, outline.width),
+ "1.0", offsetof(PolygonItem, outline.width),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -164,20 +163,22 @@ static void DisplayPolygon(Tk_Canvas canvas,
int x, int y, int width, int height);
static int GetPolygonIndex(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- Tcl_Obj *obj, int *indexPtr);
+ Tcl_Obj *obj, TkSizeT *indexPtr);
static int PolygonCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
int objc, Tcl_Obj *const objv[]);
static void PolygonDeleteCoords(Tk_Canvas canvas,
- Tk_Item *itemPtr, int first, int last);
+ Tk_Item *itemPtr, TkSizeT first, TkSizeT last);
static void PolygonInsert(Tk_Canvas canvas,
- Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj);
+ Tk_Item *itemPtr, TkSizeT beforeThis, Tcl_Obj *obj);
static int PolygonToArea(Tk_Canvas canvas,
Tk_Item *itemPtr, double *rectPtr);
static double PolygonToPoint(Tk_Canvas canvas,
Tk_Item *itemPtr, double *pointPtr);
static int PolygonToPostscript(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static void RotatePolygon(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRad);
static void ScalePolygon(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
double scaleX, double scaleY);
@@ -210,7 +211,8 @@ Tk_ItemType tkPolygonType = {
PolygonInsert, /* insertProc */
PolygonDeleteCoords, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotatePolygon, /* rotateProc */
+ 0, NULL, NULL
};
/*
@@ -1014,7 +1016,7 @@ static void
PolygonInsert(
Tk_Canvas canvas, /* Canvas containing text item. */
Tk_Item *itemPtr, /* Line item to be modified. */
- int beforeThis, /* Index before which new coordinates are to
+ TkSizeT beforeThis, /* Index before which new coordinates are to
* be inserted. */
Tcl_Obj *obj) /* New coordinates to be inserted. */
{
@@ -1033,14 +1035,14 @@ PolygonInsert(
return;
}
length = 2*(polyPtr->numPoints - polyPtr->autoClosed);
- while (beforeThis > length) {
+ while ((int)beforeThis > length) {
beforeThis -= length;
}
- while (beforeThis < 0) {
+ while ((int)beforeThis < 0) {
beforeThis += length;
}
newCoordPtr = (double *)ckalloc(sizeof(double) * (length + 2 + objc));
- for (i=0; i<beforeThis; i++) {
+ for (i=0; i<(int)beforeThis; i++) {
newCoordPtr[i] = polyPtr->coordPtr[i];
}
for (i=0; i<objc; i++) {
@@ -1051,7 +1053,7 @@ PolygonInsert(
}
}
- for (i=beforeThis; i<length; i++) {
+ for (i=(int)beforeThis; i<length; i++) {
newCoordPtr[i+objc] = polyPtr->coordPtr[i];
}
if (polyPtr->coordPtr) {
@@ -1117,7 +1119,7 @@ PolygonInsert(
* Be careful; beforeThis could now be negative
*/
- for (i=beforeThis; i<beforeThis+objc; i+=2) {
+ for (i=beforeThis; i<(int)beforeThis+objc; i+=2) {
j = i;
if (j < 0) {
j += length;
@@ -1168,23 +1170,23 @@ static void
PolygonDeleteCoords(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Item in which to delete characters. */
- int first, /* Index of first character to delete. */
- int last) /* Index of last character to delete. */
+ TkSizeT first, /* Index of first character to delete. */
+ TkSizeT last) /* Index of last character to delete. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int count, i;
int length = 2*(polyPtr->numPoints - polyPtr->autoClosed);
- while (first >= length) {
+ while ((int)first >= length) {
first -= length;
}
- while (first < 0) {
+ while ((int)first < 0) {
first += length;
}
- while (last >= length) {
+ while ((int)last >= length) {
last -= length;
}
- while (last < 0) {
+ while ((int)last < 0) {
last += length;
}
@@ -1211,7 +1213,7 @@ PolygonDeleteCoords(
polyPtr->coordPtr[i-count] = polyPtr->coordPtr[i];
}
} else {
- for (i=last; i<=first; i++) {
+ for (i=last; i<=(int)first; i++) {
polyPtr->coordPtr[i-last] = polyPtr->coordPtr[i];
}
}
@@ -1671,17 +1673,28 @@ GetPolygonIndex(
* specified. */
Tcl_Obj *obj, /* Specification of a particular coord in
* itemPtr's line. */
- int *indexPtr) /* Where to store converted index. */
+ TkSizeT *indexPtr) /* Where to store converted index. */
{
+ TkSizeT length, idx;
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
- const char *string = Tcl_GetString(obj);
-
- if (string[0] == 'e') {
- if (strncmp(string, "end", obj->length) != 0) {
- goto badIndex;
+ const char *string;
+ TkSizeT count = 2*(polyPtr->numPoints - polyPtr->autoClosed);
+
+ if (TCL_OK == TkGetIntForIndex(obj, (INT_MAX - 1) - ((INT_MAX) % count), 1, &idx)) {
+ if (idx == TCL_INDEX_NONE) {
+ idx = 0;
+ } else if (idx >= INT_MAX - ((INT_MAX) % count)) {
+ idx = count;
+ } else {
+ idx = (idx & (TkSizeT)-2) % count;
}
- *indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed);
- } else if (string[0] == '@') {
+ *indexPtr = idx;
+ return TCL_OK;
+ }
+
+ string = Tcl_GetStringFromObj(obj, &length);
+
+ if (string[0] == '@') {
int i;
double x, y, bestDist, dist, *coordPtr;
char *end;
@@ -1709,31 +1722,55 @@ GetPolygonIndex(
coordPtr += 2;
}
} else {
- int count = 2*(polyPtr->numPoints - polyPtr->autoClosed);
+ /*
+ * Some of the paths here leave messages in interp->result, so we have to
+ * clear it out before storing our own message.
+ */
- if (Tcl_GetIntFromObj(interp, obj, indexPtr) != TCL_OK) {
- goto badIndex;
- }
- *indexPtr &= -2; /* if odd, make it even */
- if (!count) {
- *indexPtr = 0;
- } else if (*indexPtr > 0) {
- *indexPtr = ((*indexPtr - 2) % count) + 2;
- } else {
- *indexPtr = -((-(*indexPtr)) % count);
- }
+ badIndex:
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string));
+ Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "POLY", NULL);
+ return TCL_ERROR;
}
return TCL_OK;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * RotatePolygon --
+ *
+ * This function is called to rotate a polygon by a given amount about a
+ * point.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The position of the polygon is rotated by angleRad about (originX,
+ * originY), and the bounding box is updated in the generic part of the
+ * item structure.
+ *
+ *--------------------------------------------------------------
+ */
- /*
- * Some of the paths here leave messages in interp->result, so we have to
- * clear it out before storing our own message.
- */
+static void
+RotatePolygon(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double originX, double originY,
+ double angleRad) /* Amount by which item is to be rotated. */
+{
+ PolygonItem *polyPtr = (PolygonItem *) itemPtr;
+ double *coordPtr;
+ int i;
+ double s = sin(angleRad), c = cos(angleRad);
- badIndex:
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string));
- Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "POLY", NULL);
- return TCL_ERROR;
+ for (i = 0, coordPtr = polyPtr->coordPtr; i < polyPtr->numPoints;
+ i++, coordPtr += 2) {
+ TkRotatePoint(originX, originY, s, c, &coordPtr[0], &coordPtr[1]);
+ }
+ ComputePolygonBbox(canvas, polyPtr);
}
/*
@@ -1890,18 +1927,14 @@ PolygonToPostscript(
*/
Tcl_ResetResult(interp);
- if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, color);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (stipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsStipple(interp, canvas, stipple);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
} else {
Tcl_AppendToObj(psObj, "fill\n", -1);
@@ -1922,18 +1955,14 @@ PolygonToPostscript(
polyPtr->smooth->postscriptProc(interp, canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps);
}
- if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, fillColor);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (fillStipple != None) {
Tcl_AppendToObj(psObj, "eoclip ", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsStipple(interp, canvas, fillStipple);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (color != NULL) {
@@ -1969,9 +1998,7 @@ PolygonToPostscript(
Tcl_AppendPrintfToObj(psObj, "%d setlinejoin 1 setlinecap\n", style);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsOutline(canvas, itemPtr, &polyPtr->outline) != TCL_OK){
- goto error;
- }
+ Tk_CanvasPsOutline(canvas, itemPtr, &polyPtr->outline);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
}
@@ -1984,11 +2011,6 @@ PolygonToPostscript(
Tcl_AppendObjToObj(Tcl_GetObjResult(interp), psObj);
Tcl_DecrRefCount(psObj);
return TCL_OK;
-
- error:
- Tcl_DiscardInterpState(interpState);
- Tcl_DecrRefCount(psObj);
- return TCL_ERROR;
}
/*
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 1a8b3d3..b1e7b72 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -5,8 +5,8 @@
* the "postscript" widget command plus a few utility functions used for
* generating Postscript.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -94,37 +94,37 @@ typedef struct TkPostscriptInfo {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_STRING, "-colormap", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, colorVar), 0, NULL},
+ "", offsetof(TkPostscriptInfo, colorVar), 0, NULL},
{TK_CONFIG_STRING, "-colormode", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, colorMode), 0, NULL},
+ "", offsetof(TkPostscriptInfo, colorMode), 0, NULL},
{TK_CONFIG_STRING, "-file", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, fileName), 0, NULL},
+ "", offsetof(TkPostscriptInfo, fileName), 0, NULL},
{TK_CONFIG_STRING, "-channel", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, channelName), 0, NULL},
+ "", offsetof(TkPostscriptInfo, channelName), 0, NULL},
{TK_CONFIG_STRING, "-fontmap", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, fontVar), 0, NULL},
+ "", offsetof(TkPostscriptInfo, fontVar), 0, NULL},
{TK_CONFIG_PIXELS, "-height", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, height), 0, NULL},
+ "", offsetof(TkPostscriptInfo, height), 0, NULL},
{TK_CONFIG_ANCHOR, "-pageanchor", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, pageAnchor), 0, NULL},
+ "", offsetof(TkPostscriptInfo, pageAnchor), 0, NULL},
{TK_CONFIG_STRING, "-pageheight", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, pageHeightString), 0, NULL},
+ "", offsetof(TkPostscriptInfo, pageHeightString), 0, NULL},
{TK_CONFIG_STRING, "-pagewidth", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, pageWidthString), 0, NULL},
+ "", offsetof(TkPostscriptInfo, pageWidthString), 0, NULL},
{TK_CONFIG_STRING, "-pagex", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, pageXString), 0, NULL},
+ "", offsetof(TkPostscriptInfo, pageXString), 0, NULL},
{TK_CONFIG_STRING, "-pagey", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, pageYString), 0, NULL},
+ "", offsetof(TkPostscriptInfo, pageYString), 0, NULL},
{TK_CONFIG_BOOLEAN, "-prolog", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, prolog), 0, NULL},
+ "", offsetof(TkPostscriptInfo, prolog), 0, NULL},
{TK_CONFIG_BOOLEAN, "-rotate", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, rotate), 0, NULL},
+ "", offsetof(TkPostscriptInfo, rotate), 0, NULL},
{TK_CONFIG_PIXELS, "-width", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, width), 0, NULL},
+ "", offsetof(TkPostscriptInfo, width), 0, NULL},
{TK_CONFIG_PIXELS, "-x", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, x), 0, NULL},
+ "", offsetof(TkPostscriptInfo, x), 0, NULL},
{TK_CONFIG_PIXELS, "-y", NULL, NULL,
- "", Tk_Offset(TkPostscriptInfo, y), 0, NULL},
+ "", offsetof(TkPostscriptInfo, y), 0, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -157,7 +157,6 @@ static inline Tcl_Obj * GetPostscriptBuffer(Tcl_Interp *interp);
*--------------------------------------------------------------
*/
- /* ARGSUSED */
int
TkCanvPostscriptCmd(
TkCanvas *canvasPtr, /* Information about canvas widget. */
@@ -491,7 +490,7 @@ TkCanvPostscriptCmd(
Tcl_AppendObjToObj(psObj, preambleObj);
if (psInfo.chan != NULL) {
- if (Tcl_WriteObj(psInfo.chan, psObj) == -1) {
+ if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) {
channelWriteFailed:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"problem writing postscript data to channel: %s",
@@ -545,7 +544,7 @@ TkCanvPostscriptCmd(
psInfo.x, Tk_PostscriptY((double)psInfo.y2,
(Tk_PostscriptInfo)psInfoPtr));
if (psInfo.chan != NULL) {
- if (Tcl_WriteObj(psInfo.chan, psObj) == -1) {
+ if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) {
goto channelWriteFailed;
}
Tcl_DecrRefCount(psObj);
@@ -577,7 +576,7 @@ TkCanvPostscriptCmd(
if (result != TCL_OK) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (generating Postscript for item %d)",
- itemPtr->id));
+ (int)itemPtr->id));
goto cleanup;
}
@@ -587,7 +586,7 @@ TkCanvPostscriptCmd(
Tcl_ResetResult(interp);
if (psInfo.chan != NULL) {
- if (Tcl_WriteObj(psInfo.chan, psObj) == -1) {
+ if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) {
goto channelWriteFailed;
}
Tcl_DecrRefCount(psObj);
@@ -608,7 +607,7 @@ TkCanvPostscriptCmd(
"%%EOF\n", -1);
if (psInfo.chan != NULL) {
- if (Tcl_WriteObj(psInfo.chan, psObj) == -1) {
+ if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) {
goto channelWriteFailed;
}
}
@@ -1194,6 +1193,8 @@ TkImageGetColor(
double *red, double *green, double *blue)
/* Color data to return */
{
+ (void)cdata;
+
*red = (double) GetRValue(pixel) / 255.0;
*green = (double) GetGValue(pixel) / 255.0;
*blue = (double) GetBValue(pixel) / 255.0;
@@ -1262,6 +1263,7 @@ TkPostscriptImage(
Visual *visual;
TkColormapData cdata;
Tcl_Obj *psObj;
+ (void)y;
if (psInfoPtr->prepass) {
return TCL_OK;
@@ -1276,7 +1278,7 @@ TkPostscriptImage(
*/
ncolors = visual->map_entries;
- cdata.colors = ckalloc(sizeof(XColor) * ncolors);
+ cdata.colors = (XColor *)ckalloc(sizeof(XColor) * ncolors);
cdata.ncolors = ncolors;
if (visual->c_class == DirectColor || visual->c_class == TrueColor) {
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 0945857..3f4a3a9 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -3,8 +3,8 @@
*
* This file implements text items for canvas widgets.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -32,7 +32,7 @@ typedef struct TextItem {
*/
double x, y; /* Positioning point for text. */
- int insertPos; /* Character index of character just before
+ TkSizeT insertPos; /* Character index of character just before
* which the insertion cursor is displayed. */
/*
@@ -62,8 +62,8 @@ typedef struct TextItem {
* configuration settings above.
*/
- int numChars; /* Length of text in characters. */
- int numBytes; /* Length of text in bytes. */
+ TkSizeT numChars; /* Length of text in characters. */
+ TkSizeT numBytes; /* Length of text in bytes. */
Tk_TextLayout textLayout; /* Cached text layout information. */
int actualWidth; /* Width of text as computed. Used to make
* selections of wrapped text display
@@ -87,7 +87,7 @@ static const Tk_CustomOption stateOption = {
TkStateParseProc, TkStatePrintProc, INT2PTR(2)
};
static const Tk_CustomOption tagsOption = {
- Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
+ TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL
};
static const Tk_CustomOption offsetOption = {
TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE)
@@ -95,38 +95,38 @@ static const Tk_CustomOption offsetOption = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_COLOR, "-activefill", NULL, NULL,
- NULL, Tk_Offset(TextItem, activeColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(TextItem, activeColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
- NULL, Tk_Offset(TextItem, activeStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(TextItem, activeStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
- "center", Tk_Offset(TextItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "center", offsetof(TextItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_DOUBLE, "-angle", NULL, NULL,
- "0.0", Tk_Offset(TextItem, angle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "0.0", offsetof(TextItem, angle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
- NULL, Tk_Offset(TextItem, disabledColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(TextItem, disabledColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
- NULL, Tk_Offset(TextItem, disabledStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(TextItem, disabledStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
- DEF_CANVITEM_OUTLINE, Tk_Offset(TextItem, color), TK_CONFIG_NULL_OK, NULL},
+ DEF_CANVITEM_OUTLINE, offsetof(TextItem, color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_FONT, "-font", NULL, NULL,
- DEF_CANVTEXT_FONT, Tk_Offset(TextItem, tkfont), 0, NULL},
+ DEF_CANVTEXT_FONT, offsetof(TextItem, tkfont), 0, NULL},
{TK_CONFIG_JUSTIFY, "-justify", NULL, NULL,
- "left", Tk_Offset(TextItem, justify), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "left", offsetof(TextItem, justify), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
- "0,0", Tk_Offset(TextItem, tsoffset),
+ "0,0", offsetof(TextItem, tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
- NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
{TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
- NULL, Tk_Offset(TextItem, stipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(TextItem, stipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
{TK_CONFIG_STRING, "-text", NULL, NULL,
- "", Tk_Offset(TextItem, text), 0, NULL},
+ "", offsetof(TextItem, text), 0, NULL},
{TK_CONFIG_INT, "-underline", NULL, NULL,
- "-1", Tk_Offset(TextItem, underline), 0, NULL},
+ "-1", offsetof(TextItem, underline), 0, NULL},
{TK_CONFIG_PIXELS, "-width", NULL, NULL,
- "0", Tk_Offset(TextItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "0", offsetof(TextItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -146,30 +146,32 @@ static void DeleteText(Tk_Canvas canvas,
static void DisplayCanvText(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
int x, int y, int width, int height);
-static int GetSelText(Tk_Canvas canvas,
- Tk_Item *itemPtr, int offset, char *buffer,
- int maxBytes);
+static TkSizeT GetSelText(Tk_Canvas canvas,
+ Tk_Item *itemPtr, TkSizeT offset, char *buffer,
+ TkSizeT maxBytes);
static int GetTextIndex(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- Tcl_Obj *obj, int *indexPtr);
+ Tcl_Obj *obj, TkSizeT *indexPtr);
static void ScaleText(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
double scaleX, double scaleY);
static void SetTextCursor(Tk_Canvas canvas,
- Tk_Item *itemPtr, int index);
+ Tk_Item *itemPtr, TkSizeT index);
static int TextCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
int argc, Tcl_Obj *const objv[]);
static void TextDeleteChars(Tk_Canvas canvas,
- Tk_Item *itemPtr, int first, int last);
+ Tk_Item *itemPtr, TkSizeT first, TkSizeT last);
static void TextInsert(Tk_Canvas canvas,
- Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj);
+ Tk_Item *itemPtr, TkSizeT beforeThis, Tcl_Obj *obj);
static int TextToArea(Tk_Canvas canvas,
Tk_Item *itemPtr, double *rectPtr);
static double TextToPoint(Tk_Canvas canvas,
Tk_Item *itemPtr, double *pointPtr);
static int TextToPostscript(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static void RotateText(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRad);
static void TranslateText(Tk_Canvas canvas,
Tk_Item *itemPtr, double deltaX, double deltaY);
@@ -199,7 +201,8 @@ Tk_ItemType tkTextType = {
TextInsert, /* insertProc */
TextDeleteChars, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotateText, /* rotateProc */
+ 0, NULL, NULL
};
#define ROUND(d) ((int) floor((d) + 0.5))
@@ -507,19 +510,19 @@ ConfigureText(
textPtr->numChars = Tcl_NumUtfChars(textPtr->text, textPtr->numBytes);
if (textInfoPtr->selItemPtr == itemPtr) {
- if (textInfoPtr->selectFirst >= textPtr->numChars) {
+ if (textInfoPtr->selectFirst + 1 >= textPtr->numChars + 1) {
textInfoPtr->selItemPtr = NULL;
} else {
- if (textInfoPtr->selectLast >= textPtr->numChars) {
+ if (textInfoPtr->selectLast + 1 >= textPtr->numChars + 1) {
textInfoPtr->selectLast = textPtr->numChars - 1;
}
if ((textInfoPtr->anchorItemPtr == itemPtr)
- && (textInfoPtr->selectAnchor >= textPtr->numChars)) {
+ && (textInfoPtr->selectAnchor + 1 >= textPtr->numChars + 1)) {
textInfoPtr->selectAnchor = textPtr->numChars - 1;
}
}
}
- if (textPtr->insertPos >= textPtr->numChars) {
+ if (textPtr->insertPos + 1 >= textPtr->numChars + 1) {
textPtr->insertPos = textPtr->numChars;
}
@@ -567,6 +570,7 @@ DeleteText(
Display *display) /* Display containing window for canvas. */
{
TextItem *textPtr = (TextItem *) itemPtr;
+ (void)canvas;
if (textPtr->color != NULL) {
Tk_FreeColor(textPtr->color);
@@ -798,7 +802,7 @@ DisplayCanvText(
{
TextItem *textPtr;
Tk_CanvasTextInfo *textInfoPtr;
- int selFirstChar, selLastChar;
+ TkSizeT selFirstChar, selLastChar;
short drawableX, drawableY;
Pixmap stipple;
Tk_State state = itemPtr->state;
@@ -834,18 +838,18 @@ DisplayCanvText(
Tk_CanvasSetOffset(canvas, textPtr->gc, &textPtr->tsoffset);
}
- selFirstChar = -1;
- selLastChar = 0; /* lint. */
+ selFirstChar = TCL_INDEX_NONE;
+ selLastChar = 0;
Tk_CanvasDrawableCoords(canvas, textPtr->drawOrigin[0],
textPtr->drawOrigin[1], &drawableX, &drawableY);
if (textInfoPtr->selItemPtr == itemPtr) {
selFirstChar = textInfoPtr->selectFirst;
selLastChar = textInfoPtr->selectLast;
- if (selLastChar > textPtr->numChars) {
+ if (selLastChar + 1 > textPtr->numChars + 1 ) {
selLastChar = textPtr->numChars - 1;
}
- if ((selFirstChar >= 0) && (selFirstChar <= selLastChar)) {
+ if (((int)selFirstChar >= 0) && (selFirstChar + 1 <= selLastChar + 1 )) {
int xFirst, yFirst, hFirst;
int xLast, yLast, wLast;
@@ -956,7 +960,7 @@ DisplayCanvText(
* anti-aliasing colors would blend together.
*/
- if ((selFirstChar >= 0) && (textPtr->selTextGC != textPtr->gc)) {
+ if ((selFirstChar != TCL_INDEX_NONE) && (textPtr->selTextGC != textPtr->gc)) {
if (0 < selFirstChar) {
TkDrawAngledTextLayout(display, drawable, textPtr->gc,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
@@ -1005,12 +1009,13 @@ static void
TextInsert(
Tk_Canvas canvas, /* Canvas containing text item. */
Tk_Item *itemPtr, /* Text item to be modified. */
- int index, /* Character index before which string is to
+ TkSizeT index, /* Character index before which string is to
* be inserted. */
Tcl_Obj *obj) /* New characters to be inserted. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- int byteIndex, byteCount, charsAdded;
+ int byteIndex, charsAdded;
+ TkSizeT byteCount;
char *newStr, *text;
const char *string;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
@@ -1019,13 +1024,13 @@ TextInsert(
text = textPtr->text;
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
index = 0;
}
- if (index > textPtr->numChars) {
+ if (index + 1 > textPtr->numChars + 1) {
index = textPtr->numChars;
}
- byteIndex = TkUtfAtIndex(text, index) - text;
+ byteIndex = Tcl_UtfAtIndex(text, index) - text;
byteCount = strlen(string);
if (byteCount == 0) {
return;
@@ -1048,18 +1053,18 @@ TextInsert(
*/
if (textInfoPtr->selItemPtr == itemPtr) {
- if (textInfoPtr->selectFirst >= index) {
+ if (textInfoPtr->selectFirst + 1 >= index + 1) {
textInfoPtr->selectFirst += charsAdded;
}
- if (textInfoPtr->selectLast >= index) {
+ if (textInfoPtr->selectLast + 1 >= index + 1) {
textInfoPtr->selectLast += charsAdded;
}
if ((textInfoPtr->anchorItemPtr == itemPtr)
- && (textInfoPtr->selectAnchor >= index)) {
+ && (textInfoPtr->selectAnchor + 1 >= index + 1)) {
textInfoPtr->selectAnchor += charsAdded;
}
}
- if (textPtr->insertPos >= index) {
+ if (textPtr->insertPos + 1 >= index + 1) {
textPtr->insertPos += charsAdded;
}
ComputeTextBbox(canvas, textPtr);
@@ -1086,9 +1091,9 @@ static void
TextDeleteChars(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Item in which to delete characters. */
- int first, /* Character index of first character to
+ TkSizeT first, /* Character index of first character to
* delete. */
- int last) /* Character index of last character to delete
+ TkSizeT last) /* Character index of last character to delete
* (inclusive). */
{
TextItem *textPtr = (TextItem *) itemPtr;
@@ -1097,19 +1102,19 @@ TextDeleteChars(
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
text = textPtr->text;
- if (first < 0) {
+ if ((int)first < 0) {
first = 0;
}
- if (last >= textPtr->numChars) {
+ if (last + 1 >= textPtr->numChars + 1) {
last = textPtr->numChars - 1;
}
- if (first > last) {
+ if (first + 1 > last + 1) {
return;
}
charsRemoved = last + 1 - first;
- byteIndex = TkUtfAtIndex(text, first) - text;
- byteCount = TkUtfAtIndex(text + byteIndex, charsRemoved)
+ byteIndex = Tcl_UtfAtIndex(text, first) - text;
+ byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved)
- (text + byteIndex);
newStr = (char *)ckalloc(textPtr->numBytes + 1 - byteCount);
@@ -1127,32 +1132,32 @@ TextDeleteChars(
*/
if (textInfoPtr->selItemPtr == itemPtr) {
- if (textInfoPtr->selectFirst > first) {
+ if (textInfoPtr->selectFirst + 1 > first + 1) {
textInfoPtr->selectFirst -= charsRemoved;
- if (textInfoPtr->selectFirst < first) {
+ if ((int)textInfoPtr->selectFirst + 1 < (int)first + 1) {
textInfoPtr->selectFirst = first;
}
}
- if (textInfoPtr->selectLast >= first) {
+ if (textInfoPtr->selectLast + 1 >= first + 1) {
textInfoPtr->selectLast -= charsRemoved;
- if (textInfoPtr->selectLast < first - 1) {
+ if (textInfoPtr->selectLast + 1 < first) {
textInfoPtr->selectLast = first - 1;
}
}
- if (textInfoPtr->selectFirst > textInfoPtr->selectLast) {
+ if ((int)textInfoPtr->selectFirst + 1 > (int)textInfoPtr->selectLast + 1) {
textInfoPtr->selItemPtr = NULL;
}
if ((textInfoPtr->anchorItemPtr == itemPtr)
- && (textInfoPtr->selectAnchor > first)) {
+ && (textInfoPtr->selectAnchor + 1 > first + 1)) {
textInfoPtr->selectAnchor -= charsRemoved;
- if (textInfoPtr->selectAnchor < first) {
+ if (textInfoPtr->selectAnchor + 1 < first + 1) {
textInfoPtr->selectAnchor = first;
}
}
}
- if (textPtr->insertPos > first) {
+ if (textPtr->insertPos + 1 > first + 1) {
textPtr->insertPos -= charsRemoved;
- if (textPtr->insertPos < first) {
+ if ((int)textPtr->insertPos + 1 < (int)first + 1) {
textPtr->insertPos = first;
}
}
@@ -1253,6 +1258,39 @@ TextToArea(
/*
*--------------------------------------------------------------
*
+ * RotateText --
+ *
+ * This function is called to rotate a text item by a given amount about a
+ * point. Note that this does *not* rotate the text of the item.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The position of the text anchor is rotated by angleRad about (originX,
+ * originY), and the bounding box is updated in the generic part of the
+ * item structure.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+RotateText(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being rotated. */
+ double originX, double originY,
+ double angleRad) /* Amount by which item is to be rotated. */
+{
+ TextItem *textPtr = (TextItem *) itemPtr;
+
+ TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad),
+ &textPtr->x, &textPtr->y);
+ ComputeTextBbox(canvas, textPtr);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* ScaleText --
*
* This function is invoked to rescale a text item.
@@ -1342,20 +1380,29 @@ GetTextIndex(
* specified. */
Tcl_Obj *obj, /* Specification of a particular character in
* itemPtr's text. */
- int *indexPtr) /* Where to store converted character
+ TkSizeT *indexPtr) /* Where to store converted character
* index. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- int length;
+ TkSizeT length, idx;
int c;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
- const char *string = Tcl_GetStringFromObj(obj, &length);
+ const char *string;
+
+ if (TCL_OK == TkGetIntForIndex(obj, textPtr->numChars - 1, 1, &idx)) {
+ if (idx == TCL_INDEX_NONE) {
+ idx = 0;
+ } else if (idx > textPtr->numChars) {
+ idx = textPtr->numChars;
+ }
+ *indexPtr = idx;
+ return TCL_OK;
+ }
+ string = Tcl_GetStringFromObj(obj, &length);
c = string[0];
- if ((c == 'e') && (strncmp(string, "end", length) == 0)) {
- *indexPtr = textPtr->numChars;
- } else if ((c == 'i')
+ if ((c == 'i')
&& (strncmp(string, "insert", length) == 0)) {
*indexPtr = textPtr->insertPos;
} else if ((c == 's') && (length >= 5)
@@ -1398,12 +1445,6 @@ GetTextIndex(
y -= (int) textPtr->drawOrigin[1];
*indexPtr = Tk_PointToChar(textPtr->textLayout,
(int) (x*cs - y*s), (int) (y*cs + x*s));
- } else if (Tcl_GetIntFromObj(NULL, obj, indexPtr) == TCL_OK) {
- if (*indexPtr < 0) {
- *indexPtr = 0;
- } else if (*indexPtr > textPtr->numChars) {
- *indexPtr = textPtr->numChars;
- }
} else {
/*
* Some of the paths here leave messages in the interp's result, so we
@@ -1439,12 +1480,12 @@ SetTextCursor(
TCL_UNUSED(Tk_Canvas), /* Record describing canvas widget. */
Tk_Item *itemPtr, /* Text item in which cursor position is to be
* set. */
- int index) /* Character index of character just before
+ TkSizeT index) /* Character index of character just before
* which cursor is to be positioned. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
textPtr->insertPos = 0;
} else if (index > textPtr->numChars) {
textPtr->insertPos = textPtr->numChars;
@@ -1473,39 +1514,39 @@ SetTextCursor(
*--------------------------------------------------------------
*/
-static int
+static TkSizeT
GetSelText(
TCL_UNUSED(Tk_Canvas), /* Canvas containing selection. */
Tk_Item *itemPtr, /* Text item containing selection. */
- int offset, /* Byte offset within selection of first
+ TkSizeT offset, /* Byte offset within selection of first
* character to be returned. */
char *buffer, /* Location in which to place selection. */
- int maxBytes) /* Maximum number of bytes to place at buffer,
+ TkSizeT maxBytes) /* Maximum number of bytes to place at buffer,
* not including terminating NULL
* character. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- int byteCount;
+ TkSizeT byteCount;
char *text;
const char *selStart, *selEnd;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
- if ((textInfoPtr->selectFirst < 0) ||
- (textInfoPtr->selectFirst > textInfoPtr->selectLast)) {
+ if (((int)textInfoPtr->selectFirst < 0) ||
+ (textInfoPtr->selectFirst + 1 > textInfoPtr->selectLast + 1)) {
return 0;
}
text = textPtr->text;
- selStart = TkUtfAtIndex(text, textInfoPtr->selectFirst);
- selEnd = TkUtfAtIndex(selStart,
+ selStart = Tcl_UtfAtIndex(text, textInfoPtr->selectFirst);
+ selEnd = Tcl_UtfAtIndex(selStart,
textInfoPtr->selectLast + 1 - textInfoPtr->selectFirst);
+ if (selEnd <= selStart + offset) {
+ return 0;
+ }
byteCount = selEnd - selStart - offset;
if (byteCount > maxBytes) {
byteCount = maxBytes;
}
- if (byteCount <= 0) {
- return 0;
- }
- memcpy(buffer, selStart + offset, (size_t) byteCount);
+ memcpy(buffer, selStart + offset, byteCount);
buffer[byteCount] = '\0';
return byteCount;
}
@@ -1594,9 +1635,7 @@ TextToPostscript(
}
Tcl_ResetResult(interp);
- if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, color);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (stipple != None) {
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index 65af3da..121bfe8 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -4,7 +4,7 @@
* This file contains a collection of utility functions used by the
* implementations of various canvas item types.
*
- * Copyright (c) 1994 Sun Microsystems, Inc.
+ * Copyright © 1994 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -231,12 +231,14 @@ Tk_CanvasWindowCoords(
int
Tk_CanvasGetCoord(
- Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tcl_Interp *dummy, /* Interpreter for error reporting. */
Tk_Canvas canvas, /* Canvas to which coordinate applies. */
const char *string, /* Describes coordinate (any screen coordinate
* form may be used here). */
double *doublePtr) /* Place to store converted coordinate. */
{
+ (void)dummy;
+
if (Tk_GetScreenMM(Canvas(canvas)->interp, Canvas(canvas)->tkwin, string,
doublePtr) != TCL_OK) {
return TCL_ERROR;
@@ -267,12 +269,14 @@ Tk_CanvasGetCoord(
int
Tk_CanvasGetCoordFromObj(
- Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tcl_Interp *dummy, /* Interpreter for error reporting. */
Tk_Canvas canvas, /* Canvas to which coordinate applies. */
Tcl_Obj *obj, /* Describes coordinate (any screen coordinate
* form may be used here). */
double *doublePtr) /* Place to store converted coordinate. */
{
+ (void)dummy;
+
return Tk_GetDoublePixelsFromObj(Canvas(canvas)->interp, Canvas(canvas)->tkwin, obj, doublePtr);
}
@@ -398,18 +402,21 @@ Tk_CanvasGetTextInfo(
*/
int
-Tk_CanvasTagsParseProc(
- ClientData clientData, /* Not used.*/
+TkCanvasTagsParseProc(
+ ClientData dummy, /* Not used.*/
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
const char *value, /* Value of option (list of tag names). */
char *widgRec, /* Pointer to record for item. */
- int offset) /* Offset into item (ignored). */
+ TkSizeT offset) /* Offset into item (ignored). */
{
Tk_Item *itemPtr = (Tk_Item *) widgRec;
int argc, i;
const char **argv;
Tk_Uid *newPtr;
+ (void)dummy;
+ (void)tkwin;
+ (void)offset;
/*
* Break the value up into the individual tag names.
@@ -423,9 +430,9 @@ Tk_CanvasTagsParseProc(
* Make sure that there's enough space in the item to hold the tag names.
*/
- if (itemPtr->tagSpace < argc) {
- newPtr = ckalloc(argc * sizeof(Tk_Uid));
- for (i = itemPtr->numTags-1; i >= 0; i--) {
+ if ((int)itemPtr->tagSpace < argc) {
+ newPtr = (Tk_Uid *)ckalloc(argc * sizeof(Tk_Uid));
+ for (i = (int)itemPtr->numTags - 1; i >= 0; i--) {
newPtr[i] = itemPtr->tagPtr[i];
}
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
@@ -465,16 +472,19 @@ Tk_CanvasTagsParseProc(
*/
const char *
-Tk_CanvasTagsPrintProc(
- ClientData clientData, /* Ignored. */
+TkCanvasTagsPrintProc(
+ ClientData dummy, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
- int offset, /* Ignored. */
+ TkSizeT offset, /* Ignored. */
Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
Tk_Item *itemPtr = (Tk_Item *) widgRec;
+ (void)dummy;
+ (void)tkwin;
+ (void)offset;
if (itemPtr->numTags == 0) {
*freeProcPtr = NULL;
@@ -508,13 +518,16 @@ Tk_CanvasTagsPrintProc(
int
TkCanvasDashParseProc(
- ClientData clientData, /* Not used.*/
+ ClientData dummy, /* Not used.*/
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
- int offset) /* Offset into item. */
+ TkSizeT offset) /* Offset into item. */
{
+ (void)dummy;
+ (void)tkwin;
+
return Tk_GetDash(interp, value, (Tk_Dash *) (widgRec+offset));
}
@@ -542,10 +555,10 @@ TkCanvasDashParseProc(
const char *
TkCanvasDashPrintProc(
- ClientData clientData, /* Ignored. */
+ ClientData dummy, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
- int offset, /* Offset in record for item. */
+ TkSizeT offset, /* Offset in record for item. */
Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
@@ -553,11 +566,13 @@ TkCanvasDashPrintProc(
Tk_Dash *dash = (Tk_Dash *) (widgRec+offset);
char *buffer, *p;
int i = dash->number;
+ (void)dummy;
+ (void)tkwin;
if (i < 0) {
i = -i;
*freeProcPtr = TCL_DYNAMIC;
- buffer = ckalloc(i + 1);
+ buffer = (char *)ckalloc(i + 1);
p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
memcpy(buffer, p, (unsigned int) i);
buffer[i] = 0;
@@ -566,7 +581,7 @@ TkCanvasDashPrintProc(
*freeProcPtr = NULL;
return "";
}
- buffer = ckalloc(4 * i);
+ buffer = (char *)ckalloc(4 * i);
*freeProcPtr = TCL_DYNAMIC;
p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
@@ -602,12 +617,12 @@ InitSmoothMethods(
{
SmoothAssocData *methods, *ptr;
- methods = ckalloc(sizeof(SmoothAssocData));
+ methods = (SmoothAssocData *)ckalloc(sizeof(SmoothAssocData));
methods->smooth.name = tkRawSmoothMethod.name;
methods->smooth.coordProc = tkRawSmoothMethod.coordProc;
methods->smooth.postscriptProc = tkRawSmoothMethod.postscriptProc;
- ptr = methods->nextPtr = ckalloc(sizeof(SmoothAssocData));
+ ptr = methods->nextPtr = (SmoothAssocData *)ckalloc(sizeof(SmoothAssocData));
ptr->smooth.name = tkBezierSmoothMethod.name;
ptr->smooth.coordProc = tkBezierSmoothMethod.coordProc;
ptr->smooth.postscriptProc = tkBezierSmoothMethod.postscriptProc;
@@ -641,7 +656,7 @@ Tk_CreateSmoothMethod(
const Tk_SmoothMethod *smooth)
{
SmoothAssocData *methods, *typePtr2, *prevPtr, *ptr;
- methods = Tcl_GetAssocData(interp, "smoothMethod", NULL);
+ methods = (SmoothAssocData *)Tcl_GetAssocData(interp, "smoothMethod", NULL);
/*
* Initialize if we were not previously initialized.
@@ -667,7 +682,7 @@ Tk_CreateSmoothMethod(
break;
}
}
- ptr = ckalloc(sizeof(SmoothAssocData));
+ ptr = (SmoothAssocData *)ckalloc(sizeof(SmoothAssocData));
ptr->smooth.name = smooth->name;
ptr->smooth.coordProc = smooth->coordProc;
ptr->smooth.postscriptProc = smooth->postscriptProc;
@@ -696,9 +711,10 @@ static void
SmoothMethodCleanupProc(
ClientData clientData, /* Points to "smoothMethod" AssocData for the
* interpreter. */
- Tcl_Interp *interp) /* Interpreter that is being deleted. */
+ Tcl_Interp *dummy) /* Interpreter that is being deleted. */
{
- SmoothAssocData *ptr, *methods = clientData;
+ SmoothAssocData *ptr, *methods = (SmoothAssocData *)clientData;
+ (void)dummy;
while (methods != NULL) {
ptr = methods;
@@ -726,12 +742,12 @@ SmoothMethodCleanupProc(
int
TkSmoothParseProc(
- ClientData clientData, /* Ignored. */
+ ClientData dummy, /* Ignored. */
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
- int offset) /* Offset into item. */
+ TkSizeT offset) /* Offset into item. */
{
const Tk_SmoothMethod **smoothPtr =
(const Tk_SmoothMethod **) (widgRec + offset);
@@ -739,13 +755,15 @@ TkSmoothParseProc(
int b;
size_t length;
SmoothAssocData *methods;
+ (void)dummy;
+ (void)tkwin;
if (value == NULL || *value == 0) {
*smoothPtr = NULL;
return TCL_OK;
}
length = strlen(value);
- methods = Tcl_GetAssocData(interp, "smoothMethod", NULL);
+ methods = (SmoothAssocData *)Tcl_GetAssocData(interp, "smoothMethod", NULL);
/*
* Not initialized yet; fix that now.
@@ -818,16 +836,19 @@ TkSmoothParseProc(
const char *
TkSmoothPrintProc(
- ClientData clientData, /* Ignored. */
+ ClientData dummy, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
- int offset, /* Offset into item. */
+ TkSizeT offset, /* Offset into item. */
Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
const Tk_SmoothMethod *smoothPtr =
* (Tk_SmoothMethod **) (widgRec + offset);
+ (void)dummy;
+ (void)tkwin;
+ (void)freeProcPtr;
return smoothPtr ? smoothPtr->name : "0";
}
@@ -877,7 +898,7 @@ Tk_GetDash(
}
i = strlen(value);
if (i > (int) sizeof(char *)) {
- dash->pattern.pt = pt = ckalloc(strlen(value));
+ dash->pattern.pt = pt = (char *)ckalloc(strlen(value));
} else {
pt = dash->pattern.array;
}
@@ -895,7 +916,7 @@ Tk_GetDash(
ckfree(dash->pattern.pt);
}
if (argc > (int) sizeof(char *)) {
- dash->pattern.pt = pt = ckalloc(argc);
+ dash->pattern.pt = pt = (char *)ckalloc(argc);
} else {
pt = dash->pattern.array;
}
@@ -1226,7 +1247,7 @@ Tk_ChangeOutlineGC(
int i = -dash->number;
p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
- q = ckalloc(2 * i);
+ q = (char *)ckalloc(2 * i);
i = DashConvert(q, p, i, width);
XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, q,i);
ckfree(q);
@@ -1265,7 +1286,6 @@ Tk_ChangeOutlineGC(
}
return 0;
}
-
/*
*--------------------------------------------------------------
@@ -1448,7 +1468,7 @@ Tk_CanvasPsOutline(
Tcl_AppendPrintfToObj(psObj, "] %d setdash\n", outline->offset);
} else if (dash->number < 0) {
if (dash->number < -5) {
- lptr = ckalloc(1 - 2*dash->number);
+ lptr = (char *)ckalloc(1 - 2*dash->number);
}
i = DashConvert(lptr, ptr, -dash->number, width);
if (i > 0) {
@@ -1469,19 +1489,11 @@ Tk_CanvasPsOutline(
Tcl_AppendToObj(psObj, "] 0 setdash\n", -1);
}
- if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
- return TCL_ERROR;
- }
-
- /*
- * Note that psObj might hold an invalid reference now.
- */
+ Tk_CanvasPsColor(interp, canvas, color);
if (stipple != None) {
Tcl_AppendToObj(GetPostscriptBuffer(interp), "StrokeClip ", -1);
- if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
- return TCL_ERROR;
- }
+ Tk_CanvasPsStipple(interp, canvas, stipple);
} else {
Tcl_AppendToObj(GetPostscriptBuffer(interp), "stroke\n", -1);
}
@@ -1661,6 +1673,7 @@ TkCanvTranslatePath(
int i, j; /* Loop counters */
double limit[4]; /* Boundries at which clipping occurs */
double staticSpace[480]; /* Temp space from the stack */
+ (void)closedPath;
/*
* Constrain all vertices of the path to be within a box that is no larger
@@ -1720,7 +1733,7 @@ TkCanvTranslatePath(
if (numVertex*12 <= (int) (sizeof(staticSpace) / sizeof(double))) {
tempArr = staticSpace;
} else {
- tempArr = ckalloc(numVertex * 12 * sizeof(double));
+ tempArr = (double *)ckalloc(numVertex * 12 * sizeof(double));
}
for (i=0; i<numVertex*2; i++){
tempArr[i] = coordArr[i];
@@ -1865,6 +1878,43 @@ TkCanvTranslatePath(
}
/*
+ *--------------------------------------------------------------
+ *
+ * TkRotatePoint --
+ *
+ * Rotate a point about another point. The angle should be converted into
+ * its sine and cosine before calling this function.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * The point in (*xPtr,*yPtr) is updated to be rotated about
+ * (originX,originY) by the amount given by the sine and cosine of the
+ * angle to rotate.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkRotatePoint(
+ double originX, double originY, /* The point about which to rotate. */
+ double sine, double cosine, /* How much to rotate? */
+ double *xPtr, double *yPtr) /* The point to be rotated. (INOUT) */
+{
+ double x = *xPtr - originX;
+ double y = *yPtr - originY;
+
+ /*
+ * Beware! The canvas coordinate space is flipped vertically, so rotations
+ * go the "wrong" way with respect to mathematics.
+ */
+
+ *xPtr = originX + x * cosine + y * sine;
+ *yPtr = originY - x * sine + y * cosine;
+}
+
+/*
* Local Variables:
* mode: c
* c-basic-offset: 4
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index 4047b0f..9de843a 100644
--- a/generic/tkCanvWind.c
+++ b/generic/tkCanvWind.c
@@ -3,8 +3,8 @@
*
* This file implements window items for canvas widgets.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -41,22 +41,22 @@ static const Tk_CustomOption stateOption = {
TkStateParseProc, TkStatePrintProc, INT2PTR(2)
};
static const Tk_CustomOption tagsOption = {
- Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
+ TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL
};
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
- "center", Tk_Offset(WindowItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "center", offsetof(WindowItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_PIXELS, "-height", NULL, NULL,
- "0", Tk_Offset(WindowItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "0", offsetof(WindowItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
- NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
{TK_CONFIG_PIXELS, "-width", NULL, NULL,
- "0", Tk_Offset(WindowItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL},
+ "0", offsetof(WindowItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_WINDOW, "-window", NULL, NULL,
- NULL, Tk_Offset(WindowItem, tkwin), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(WindowItem, tkwin), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -77,6 +77,8 @@ static void DeleteWinItem(Tk_Canvas canvas,
static void DisplayWinItem(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
int x, int y, int width, int height);
+static void RotateWinItem(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRad);
static void ScaleWinItem(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
double scaleX, double scaleY);
@@ -130,7 +132,8 @@ Tk_ItemType tkWindowType = {
NULL, /* insertProc */
NULL, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotateWinItem, /* rotateProc */
+ 0, NULL, NULL
};
/*
@@ -141,7 +144,7 @@ Tk_ItemType tkWindowType = {
static const Tk_GeomMgr canvasGeomType = {
"canvas", /* name */
WinItemRequestProc, /* requestProc */
- WinItemLostContentProc, /* lostSlaveProc */
+ WinItemLostContentProc, /* lostContentProc */
};
/*
@@ -405,6 +408,7 @@ DeleteWinItem(
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
Tk_Window canvasTkwin = Tk_CanvasTkwin(canvas);
+ (void)display;
if (winItemPtr->tkwin != NULL) {
Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask,
@@ -567,6 +571,11 @@ DisplayWinItem(
short x, y;
Tk_Window canvasTkwin = Tk_CanvasTkwin(canvas);
Tk_State state = itemPtr->state;
+ (void)display;
+ (void)regionX;
+ (void)regionY;
+ (void)regionWidth;
+ (void)regionHeight;
if (winItemPtr->tkwin == NULL) {
return;
@@ -655,6 +664,7 @@ WinItemToPoint(
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
double x1, x2, y1, y2, xDiff, yDiff;
+ (void)canvas;
x1 = winItemPtr->header.x1;
y1 = winItemPtr->header.y1;
@@ -712,6 +722,7 @@ WinItemToArea(
* area. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
+ (void)canvas;
if ((rectPtr[2] <= winItemPtr->header.x1)
|| (rectPtr[0] >= winItemPtr->header.x2)
@@ -748,9 +759,12 @@ WinItemToArea(
#ifdef X_GetImage
static int
xerrorhandler(
- ClientData clientData,
+ ClientData dummy,
XErrorEvent *e)
{
+ (void)dummy;
+ (void)e;
+
return 0;
}
#endif /* X_GetImage */
@@ -915,6 +929,40 @@ CanvasPsWindow(
/*
*--------------------------------------------------------------
*
+ * RotateWinItem --
+ *
+ * This function is called to rotate a window item by a given amount
+ * about a point. Note that this does *not* rotate the window of the
+ * item.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The position of the window anchor is rotated by angleRad about (originX,
+ * originY), and the bounding box is updated in the generic part of the
+ * item structure.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+RotateWinItem(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being rotated. */
+ double originX, double originY,
+ double angleRad) /* Amount by which item is to be rotated. */
+{
+ WindowItem *winItemPtr = (WindowItem *) itemPtr;
+
+ TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad),
+ &winItemPtr->x, &winItemPtr->y);
+ ComputeWindowBbox(canvas, winItemPtr);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* ScaleWinItem --
*
* This function is invoked to rescale a window item.
@@ -1007,7 +1055,7 @@ WinItemStructureProc(
ClientData clientData, /* Pointer to record describing window item. */
XEvent *eventPtr) /* Describes what just happened. */
{
- WindowItem *winItemPtr = clientData;
+ WindowItem *winItemPtr = (WindowItem *)clientData;
if (eventPtr->type == DestroyNotify) {
winItemPtr->tkwin = NULL;
@@ -1037,7 +1085,8 @@ WinItemRequestProc(
ClientData clientData, /* Pointer to record for window item. */
Tk_Window tkwin) /* Window that changed its desired size. */
{
- WindowItem *winItemPtr = clientData;
+ WindowItem *winItemPtr = (WindowItem *)clientData;
+ (void)tkwin;
ComputeWindowBbox(winItemPtr->canvas, winItemPtr);
@@ -1067,15 +1116,15 @@ WinItemRequestProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
WinItemLostContentProc(
- ClientData clientData, /* WindowItem structure for content window that
+ ClientData clientData, /* WindowItem structure for content window window that
* was stolen away. */
Tk_Window tkwin) /* Tk's handle for the content window. */
{
- WindowItem *winItemPtr = clientData;
+ WindowItem *winItemPtr = (WindowItem *)clientData;
Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas);
+ (void)tkwin;
Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask,
WinItemStructureProc, winItemPtr);
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 0e4e872..829d65a 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -5,49 +5,26 @@
* displays a background and a collection of graphical objects such as
* rectangles, lines, and texts.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-/* #define USE_OLD_TAG_SEARCH 1 */
-
-#include "default.h"
#include "tkInt.h"
#include "tkCanvas.h"
-#ifdef TK_NO_DOUBLE_BUFFERING
+#include "default.h"
+#include "tkPort.h"
#ifdef MAC_OSX_TK
#include "tkMacOSXInt.h"
#endif
-#endif /* TK_NO_DOUBLE_BUFFERING */
/*
* See tkCanvas.h for key data structures used to implement canvases.
*/
-#ifdef USE_OLD_TAG_SEARCH
-/*
- * The structure defined below is used to keep track of a tag search in
- * progress. No field should be accessed by anyone other than StartTagSearch
- * and NextItem.
- */
-
-typedef struct TagSearch {
- TkCanvas *canvasPtr; /* Canvas widget being searched. */
- Tk_Uid tag; /* Tag to search for. 0 means return all
- * items. */
- Tk_Item *currentPtr; /* Pointer to last item returned. */
- Tk_Item *lastPtr; /* The item right before the currentPtr is
- * tracked so if the currentPtr is deleted we
- * don't have to start from the beginning. */
- int searchOver; /* Non-zero means NextItem should always
- * return NULL. */
-} TagSearch;
-
-#else /* USE_OLD_TAG_SEARCH */
/*
* The structure defined below is used to keep track of a tag search in
* progress. No field should be accessed by anyone other than TagSearchScan,
@@ -74,7 +51,7 @@ typedef struct TagSearch {
int searchOver; /* Non-zero means NextItem should always
* return NULL. */
int type; /* Search type (see #defs below) */
- int id; /* Item id for searches by id */
+ TkSizeT id; /* Item id for searches by id */
const char *string; /* Tag expression string */
int stringIndex; /* Current position in string scan */
int stringLength; /* Length of tag expression string */
@@ -94,8 +71,6 @@ typedef struct TagSearch {
#define SEARCH_TYPE_TAG 3 /* Looking for an item by simple tag */
#define SEARCH_TYPE_EXPR 4 /* Compound search */
-#endif /* USE_OLD_TAG_SEARCH */
-
/*
* Custom option for handling "-state" and "-offset"
*/
@@ -115,92 +90,92 @@ static const Tk_CustomOption offsetOption = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_BORDER, "-background", "background", "Background",
- DEF_CANVAS_BG_COLOR, Tk_Offset(TkCanvas, bgBorder),
+ DEF_CANVAS_BG_COLOR, offsetof(TkCanvas, bgBorder),
TK_CONFIG_COLOR_ONLY, NULL},
{TK_CONFIG_BORDER, "-background", "background", "Background",
- DEF_CANVAS_BG_MONO, Tk_Offset(TkCanvas, bgBorder),
+ DEF_CANVAS_BG_MONO, offsetof(TkCanvas, bgBorder),
TK_CONFIG_MONO_ONLY, NULL},
{TK_CONFIG_SYNONYM, "-bd", "borderWidth", NULL, NULL, 0, 0, NULL},
{TK_CONFIG_SYNONYM, "-bg", "background", NULL, NULL, 0, 0, NULL},
{TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_CANVAS_BORDER_WIDTH, Tk_Offset(TkCanvas, borderWidth), 0, NULL},
+ DEF_CANVAS_BORDER_WIDTH, offsetof(TkCanvas, borderWidth), 0, NULL},
{TK_CONFIG_DOUBLE, "-closeenough", "closeEnough", "CloseEnough",
- DEF_CANVAS_CLOSE_ENOUGH, Tk_Offset(TkCanvas, closeEnough), 0, NULL},
+ DEF_CANVAS_CLOSE_ENOUGH, offsetof(TkCanvas, closeEnough), 0, NULL},
{TK_CONFIG_BOOLEAN, "-confine", "confine", "Confine",
- DEF_CANVAS_CONFINE, Tk_Offset(TkCanvas, confine), 0, NULL},
+ DEF_CANVAS_CONFINE, offsetof(TkCanvas, confine), 0, NULL},
{TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_CANVAS_CURSOR, Tk_Offset(TkCanvas, cursor), TK_CONFIG_NULL_OK, NULL},
+ DEF_CANVAS_CURSOR, offsetof(TkCanvas, cursor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_PIXELS, "-height", "height", "Height",
- DEF_CANVAS_HEIGHT, Tk_Offset(TkCanvas, height), 0, NULL},
+ DEF_CANVAS_HEIGHT, offsetof(TkCanvas, height), 0, NULL},
{TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_CANVAS_HIGHLIGHT_BG,
- Tk_Offset(TkCanvas, highlightBgColorPtr), 0, NULL},
+ offsetof(TkCanvas, highlightBgColorPtr), 0, NULL},
{TK_CONFIG_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_CANVAS_HIGHLIGHT, Tk_Offset(TkCanvas, highlightColorPtr), 0, NULL},
+ DEF_CANVAS_HIGHLIGHT, offsetof(TkCanvas, highlightColorPtr), 0, NULL},
{TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness",
- DEF_CANVAS_HIGHLIGHT_WIDTH, Tk_Offset(TkCanvas, highlightWidth), 0, NULL},
+ DEF_CANVAS_HIGHLIGHT_WIDTH, offsetof(TkCanvas, highlightWidth), 0, NULL},
{TK_CONFIG_BORDER, "-insertbackground", "insertBackground", "Foreground",
- DEF_CANVAS_INSERT_BG, Tk_Offset(TkCanvas, textInfo.insertBorder), 0, NULL},
+ DEF_CANVAS_INSERT_BG, offsetof(TkCanvas, textInfo.insertBorder), 0, NULL},
{TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth",
DEF_CANVAS_INSERT_BD_COLOR,
- Tk_Offset(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_COLOR_ONLY, NULL},
+ offsetof(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_COLOR_ONLY, NULL},
{TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth",
DEF_CANVAS_INSERT_BD_MONO,
- Tk_Offset(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_MONO_ONLY, NULL},
+ offsetof(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_MONO_ONLY, NULL},
{TK_CONFIG_INT, "-insertofftime", "insertOffTime", "OffTime",
- DEF_CANVAS_INSERT_OFF_TIME, Tk_Offset(TkCanvas, insertOffTime), 0, NULL},
+ DEF_CANVAS_INSERT_OFF_TIME, offsetof(TkCanvas, insertOffTime), 0, NULL},
{TK_CONFIG_INT, "-insertontime", "insertOnTime", "OnTime",
- DEF_CANVAS_INSERT_ON_TIME, Tk_Offset(TkCanvas, insertOnTime), 0, NULL},
+ DEF_CANVAS_INSERT_ON_TIME, offsetof(TkCanvas, insertOnTime), 0, NULL},
{TK_CONFIG_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
- DEF_CANVAS_INSERT_WIDTH, Tk_Offset(TkCanvas, textInfo.insertWidth), 0, NULL},
+ DEF_CANVAS_INSERT_WIDTH, offsetof(TkCanvas, textInfo.insertWidth), 0, NULL},
{TK_CONFIG_CUSTOM, "-offset", "offset", "Offset", "0,0",
- Tk_Offset(TkCanvas, tsoffset),TK_CONFIG_DONT_SET_DEFAULT,
+ offsetof(TkCanvas, tsoffset),TK_CONFIG_DONT_SET_DEFAULT,
&offsetOption},
{TK_CONFIG_RELIEF, "-relief", "relief", "Relief",
- DEF_CANVAS_RELIEF, Tk_Offset(TkCanvas, relief), 0, NULL},
+ DEF_CANVAS_RELIEF, offsetof(TkCanvas, relief), 0, NULL},
{TK_CONFIG_STRING, "-scrollregion", "scrollRegion", "ScrollRegion",
- DEF_CANVAS_SCROLL_REGION, Tk_Offset(TkCanvas, regionString),
+ DEF_CANVAS_SCROLL_REGION, offsetof(TkCanvas, regionString),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_CANVAS_SELECT_COLOR, Tk_Offset(TkCanvas, textInfo.selBorder),
+ DEF_CANVAS_SELECT_COLOR, offsetof(TkCanvas, textInfo.selBorder),
TK_CONFIG_COLOR_ONLY, NULL},
{TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_CANVAS_SELECT_MONO, Tk_Offset(TkCanvas, textInfo.selBorder),
+ DEF_CANVAS_SELECT_MONO, offsetof(TkCanvas, textInfo.selBorder),
TK_CONFIG_MONO_ONLY, NULL},
{TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth",
DEF_CANVAS_SELECT_BD_COLOR,
- Tk_Offset(TkCanvas, textInfo.selBorderWidth), TK_CONFIG_COLOR_ONLY, NULL},
+ offsetof(TkCanvas, textInfo.selBorderWidth), TK_CONFIG_COLOR_ONLY, NULL},
{TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth",
- DEF_CANVAS_SELECT_BD_MONO, Tk_Offset(TkCanvas, textInfo.selBorderWidth),
+ DEF_CANVAS_SELECT_BD_MONO, offsetof(TkCanvas, textInfo.selBorderWidth),
TK_CONFIG_MONO_ONLY, NULL},
{TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background",
- DEF_CANVAS_SELECT_FG_COLOR, Tk_Offset(TkCanvas, textInfo.selFgColorPtr),
+ DEF_CANVAS_SELECT_FG_COLOR, offsetof(TkCanvas, textInfo.selFgColorPtr),
TK_CONFIG_COLOR_ONLY|TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background",
- DEF_CANVAS_SELECT_FG_MONO, Tk_Offset(TkCanvas, textInfo.selFgColorPtr),
+ DEF_CANVAS_SELECT_FG_MONO, offsetof(TkCanvas, textInfo.selFgColorPtr),
TK_CONFIG_MONO_ONLY|TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-state", "state", "State",
- "normal", Tk_Offset(TkCanvas, canvas_state), TK_CONFIG_DONT_SET_DEFAULT,
+ "normal", offsetof(TkCanvas, canvas_state), TK_CONFIG_DONT_SET_DEFAULT,
&stateOption},
{TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_CANVAS_TAKE_FOCUS, Tk_Offset(TkCanvas, takeFocus),
+ DEF_CANVAS_TAKE_FOCUS, offsetof(TkCanvas, takeFocus),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_PIXELS, "-width", "width", "Width",
- DEF_CANVAS_WIDTH, Tk_Offset(TkCanvas, width), 0, NULL},
+ DEF_CANVAS_WIDTH, offsetof(TkCanvas, width), 0, NULL},
{TK_CONFIG_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
- DEF_CANVAS_X_SCROLL_CMD, Tk_Offset(TkCanvas, xScrollCmd),
+ DEF_CANVAS_X_SCROLL_CMD, offsetof(TkCanvas, xScrollCmd),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_PIXELS, "-xscrollincrement", "xScrollIncrement",
"ScrollIncrement",
- DEF_CANVAS_X_SCROLL_INCREMENT, Tk_Offset(TkCanvas, xScrollIncrement),
+ DEF_CANVAS_X_SCROLL_INCREMENT, offsetof(TkCanvas, xScrollIncrement),
0, NULL},
{TK_CONFIG_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand",
- DEF_CANVAS_Y_SCROLL_CMD, Tk_Offset(TkCanvas, yScrollCmd),
+ DEF_CANVAS_Y_SCROLL_CMD, offsetof(TkCanvas, yScrollCmd),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_PIXELS, "-yscrollincrement", "yScrollIncrement",
"ScrollIncrement",
- DEF_CANVAS_Y_SCROLL_INCREMENT, Tk_Offset(TkCanvas, yScrollIncrement),
+ DEF_CANVAS_Y_SCROLL_INCREMENT, offsetof(TkCanvas, yScrollIncrement),
0, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -215,7 +190,6 @@ static Tk_ItemType *typeList = NULL;
* yet. */
TCL_DECLARE_MUTEX(typeListMutex)
-#ifndef USE_OLD_TAG_SEARCH
/*
* Uids for operands in compiled advanced tag search expressions.
* Initialization is done by GetStaticUids()
@@ -236,7 +210,6 @@ typedef struct {
static Tcl_ThreadDataKey dataKey;
static SearchUids * GetStaticUids(void);
-#endif /* USE_OLD_TAG_SEARCH */
/*
* Prototypes for functions defined later in this file:
@@ -249,14 +222,14 @@ static void CanvasCmdDeletedProc(ClientData clientData);
static void CanvasDoEvent(TkCanvas *canvasPtr, XEvent *eventPtr);
static void CanvasEventProc(ClientData clientData,
XEvent *eventPtr);
-static int CanvasFetchSelection(ClientData clientData, int offset,
- char *buffer, int maxBytes);
+static TkSizeT CanvasFetchSelection(ClientData clientData, TkSizeT offset,
+ char *buffer, TkSizeT maxBytes);
static Tk_Item * CanvasFindClosest(TkCanvas *canvasPtr,
double coords[2]);
static void CanvasFocusProc(TkCanvas *canvasPtr, int gotFocus);
static void CanvasLostSelection(ClientData clientData);
static void CanvasSelectTo(TkCanvas *canvasPtr,
- Tk_Item *itemPtr, int index);
+ Tk_Item *itemPtr, TkSizeT index);
static void CanvasSetOrigin(TkCanvas *canvasPtr,
int xOrigin, int yOrigin);
static void CanvasUpdateScrollbars(TkCanvas *canvasPtr);
@@ -267,39 +240,28 @@ static void CanvasWorldChanged(ClientData instanceData);
static int ConfigureCanvas(Tcl_Interp *interp,
TkCanvas *canvasPtr, int argc,
Tcl_Obj *const *argv, int flags);
-static void DestroyCanvas(char *memPtr);
+static void DefaultRotateImplementation(TkCanvas *canvasPtr,
+ Tk_Item *itemPtr, double x, double y,
+ double angleRadians);
+static void DestroyCanvas(void *memPtr);
+static int DrawCanvas(Tcl_Interp *interp, ClientData clientData, Tk_PhotoHandle photohandle, int subsample, int zoom);
static void DisplayCanvas(ClientData clientData);
static void DoItem(Tcl_Obj *accumObj,
Tk_Item *itemPtr, Tk_Uid tag);
static void EventuallyRedrawItem(TkCanvas *canvasPtr,
Tk_Item *itemPtr);
-#ifdef USE_OLD_TAG_SEARCH
-static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr,
- int argc, Tcl_Obj *const *argv,
- Tcl_Obj *newTagObj, int first);
-#else /* USE_OLD_TAG_SEARCH */
static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr,
int argc, Tcl_Obj *const *argv,
Tcl_Obj *newTagObj, int first,
TagSearch **searchPtrPtr);
-#endif /* USE_OLD_TAG_SEARCH */
static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr,
Tcl_Obj *const *argv, Tk_Uid uid, int enclosed);
static double GridAlign(double coord, double spacing);
static const char** TkGetStringsFromObjs(int argc, Tcl_Obj *const *objv);
static void InitCanvas(void);
-#ifdef USE_OLD_TAG_SEARCH
-static Tk_Item * NextItem(TagSearch *searchPtr);
-#endif /* USE_OLD_TAG_SEARCH */
static void PickCurrentItem(TkCanvas *canvasPtr, XEvent *eventPtr);
static Tcl_Obj * ScrollFractions(int screen1,
int screen2, int object1, int object2);
-#ifdef USE_OLD_TAG_SEARCH
-static void RelinkItems(TkCanvas *canvasPtr,
- Tcl_Obj *tag, Tk_Item *prevPtr);
-static Tk_Item * StartTagSearch(TkCanvas *canvasPtr,
- Tcl_Obj *tag, TagSearch *searchPtr);
-#else /* USE_OLD_TAG_SEARCH */
static int RelinkItems(TkCanvas *canvasPtr, Tcl_Obj *tag,
Tk_Item *prevPtr, TagSearch **searchPtrPtr);
static void TagSearchExprInit(TagSearchExpr **exprPtrPtr);
@@ -313,7 +275,6 @@ static int TagSearchEvalExpr(TagSearchExpr *expr,
Tk_Item *itemPtr);
static Tk_Item * TagSearchFirst(TagSearch *searchPtr);
static Tk_Item * TagSearchNext(TagSearch *searchPtr);
-#endif /* USE_OLD_TAG_SEARCH */
/*
* The structure below defines canvas class behavior by means of functions
@@ -331,17 +292,6 @@ static const Tk_ClassProcs canvasClass = {
* Macros that significantly simplify all code that finds items.
*/
-#ifdef USE_OLD_TAG_SEARCH
-#define FIRST_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \
- itemPtr = StartTagSearch(canvasPtr,(objPtr),&search)
-#define FOR_EVERY_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \
- for (itemPtr = StartTagSearch(canvasPtr, (objPtr), &search); \
- itemPtr != NULL; itemPtr = NextItem(&search))
-#define FIND_ITEMS(objPtr, n) \
- FindItems(interp, canvasPtr, objc, objv, (objPtr), (n))
-#define RELINK_ITEMS(objPtr, itemPtr) \
- RelinkItems(canvasPtr, (objPtr), (itemPtr))
-#else /* USE_OLD_TAG_SEARCH */
#define FIRST_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \
if ((result=TagSearchScan(canvasPtr,(objPtr),(searchPtrPtr))) != TCL_OK){ \
errorExitClause; \
@@ -357,7 +307,6 @@ static const Tk_ClassProcs canvasClass = {
FindItems(interp, canvasPtr, objc, objv, (objPtr), (n), &searchPtr)
#define RELINK_ITEMS(objPtr, itemPtr) \
result = RelinkItems(canvasPtr, (objPtr), (itemPtr), &searchPtr)
-#endif /* USE_OLD_TAG_SEARCH */
/*
* ----------------------------------------------------------------------
@@ -522,7 +471,7 @@ ItemIndex(
TkCanvas *canvasPtr,
Tk_Item *itemPtr,
Tcl_Obj *objPtr,
- int *indexPtr)
+ TkSizeT *indexPtr)
{
Tcl_Interp *interp = canvasPtr->interp;
@@ -613,6 +562,102 @@ ItemTranslate(
itemPtr->typePtr->translateProc((Tk_Canvas) canvasPtr, itemPtr,
xDelta, yDelta);
}
+
+static inline void
+ItemRotate(
+ TkCanvas *canvasPtr,
+ Tk_Item *itemPtr,
+ double x,
+ double y,
+ double angleRadians)
+{
+ if (itemPtr->typePtr->rotateProc != NULL) {
+ itemPtr->typePtr->rotateProc((Tk_Canvas) canvasPtr,
+ itemPtr, x, y, angleRadians);
+ } else {
+ DefaultRotateImplementation(canvasPtr, itemPtr, x, y, angleRadians);
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * DefaultRotateImplementation --
+ *
+ * The default implementation of the rotation operation, used when items
+ * do not provide their own version.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+DefaultRotateImplementation(
+ TkCanvas *canvasPtr,
+ Tk_Item *itemPtr,
+ double x,
+ double y,
+ double angleRadians)
+{
+ int objc, i, ok = 1;
+ Tcl_Obj **objv, **newObjv;
+ double *coordv;
+ double s = sin(angleRadians);
+ double c = cos(angleRadians);
+ Tcl_Interp *interp = canvasPtr->interp;
+
+ /*
+ * Get the coordinates out of the item.
+ */
+
+ if (ItemCoords(canvasPtr, itemPtr, 0, NULL) == TCL_OK &&
+ Tcl_ListObjGetElements(NULL, Tcl_GetObjResult(interp),
+ &objc, &objv) == TCL_OK) {
+ coordv = (double *) ckalloc(sizeof(double) * objc);
+ for (i=0 ; i<objc ; i++) {
+ if (Tcl_GetDoubleFromObj(NULL, objv[i], &coordv[i]) != TCL_OK) {
+ ok = 0;
+ break;
+ }
+ }
+ if (ok) {
+ /*
+ * Apply the rotation.
+ */
+
+ for (i=0 ; i<objc ; i+=2) {
+ double px = coordv[i+0] - x;
+ double py = coordv[i+1] - y;
+ double nx = px * c - py * s;
+ double ny = px * s + py * c;
+
+ coordv[i+0] = nx + x;
+ coordv[i+1] = ny + y;
+ }
+
+ /*
+ * Write the coordinates back into the item.
+ */
+
+ newObjv = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj *) * objc);
+ for (i=0 ; i<objc ; i++) {
+ newObjv[i] = Tcl_NewDoubleObj(coordv[i]);
+ Tcl_IncrRefCount(newObjv[i]);
+ }
+ ItemCoords(canvasPtr, itemPtr, objc, newObjv);
+ for (i=0 ; i<objc ; i++) {
+ Tcl_DecrRefCount(newObjv[i]);
+ }
+ ckfree((char *) newObjv);
+ }
+ ckfree((char *) coordv);
+ }
+
+ /*
+ * The interpreter result was (probably) modified above; reset it.
+ */
+
+ Tcl_ResetResult(interp);
+}
/*
*--------------------------------------------------------------
@@ -686,8 +731,8 @@ Tk_CanvasObjCmd(
canvasPtr->textInfo.selBorderWidth = 0;
canvasPtr->textInfo.selFgColorPtr = NULL;
canvasPtr->textInfo.selItemPtr = NULL;
- canvasPtr->textInfo.selectFirst = -1;
- canvasPtr->textInfo.selectLast = -1;
+ canvasPtr->textInfo.selectFirst = TCL_INDEX_NONE;
+ canvasPtr->textInfo.selectLast = TCL_INDEX_NONE;
canvasPtr->textInfo.anchorItemPtr = NULL;
canvasPtr->textInfo.selectAnchor = 0;
canvasPtr->textInfo.insertBorder = NULL;
@@ -735,9 +780,7 @@ Tk_CanvasObjCmd(
canvasPtr->tsoffset.flags = 0;
canvasPtr->tsoffset.xoffset = 0;
canvasPtr->tsoffset.yoffset = 0;
-#ifndef USE_OLD_TAG_SEARCH
canvasPtr->bindTagExprs = NULL;
-#endif
Tcl_InitHashTable(&canvasPtr->idTable, TCL_ONE_WORD_KEYS);
Tk_SetClass(canvasPtr->tkwin, "Canvas");
@@ -755,7 +798,7 @@ Tk_CanvasObjCmd(
goto error;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(canvasPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(canvasPtr->tkwin));
return TCL_OK;
error:
@@ -792,50 +835,47 @@ CanvasWidgetCmd(
int c, result;
Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent
* compiler warning. */
-#ifdef USE_OLD_TAG_SEARCH
- TagSearch search;
-#else /* USE_OLD_TAG_SEARCH */
TagSearch *searchPtr = NULL;/* Allocated by first TagSearchScan, freed by
* TagSearchDestroy */
-#endif /* USE_OLD_TAG_SEARCH */
- int index;
- static const char *const optionStrings[] = {
+ int idx;
+ static const char *const canvasOptionStrings[] = {
"addtag", "bbox", "bind", "canvasx",
"canvasy", "cget", "configure", "coords",
"create", "dchars", "delete", "dtag",
"find", "focus", "gettags", "icursor",
- "imove", "index", "insert", "itemcget",
- "itemconfigure",
+ "image", "imove", "index", "insert",
+ "itemcget", "itemconfigure",
"lower", "move", "moveto", "postscript",
- "raise", "rchars", "scale", "scan",
- "select", "type", "xview", "yview",
- NULL
+ "raise", "rchars", "rotate", "scale",
+ "scan", "select", "type", "xview",
+ "yview", NULL
};
- enum options {
+ enum canvasOptionStringsEnum {
CANV_ADDTAG, CANV_BBOX, CANV_BIND, CANV_CANVASX,
CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS,
CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG,
CANV_FIND, CANV_FOCUS, CANV_GETTAGS, CANV_ICURSOR,
- CANV_IMOVE, CANV_INDEX, CANV_INSERT, CANV_ITEMCGET,
- CANV_ITEMCONFIGURE,
+ CANV_IMAGE, CANV_IMOVE, CANV_INDEX, CANV_INSERT,
+ CANV_ITEMCGET, CANV_ITEMCONFIGURE,
CANV_LOWER, CANV_MOVE, CANV_MOVETO, CANV_POSTSCRIPT,
- CANV_RAISE, CANV_RCHARS, CANV_SCALE, CANV_SCAN,
- CANV_SELECT, CANV_TYPE, CANV_XVIEW, CANV_YVIEW
+ CANV_RAISE, CANV_RCHARS, CANV_ROTATE, CANV_SCALE,
+ CANV_SCAN, CANV_SELECT, CANV_TYPE, CANV_XVIEW,
+ CANV_YVIEW
};
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
- &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], canvasOptionStrings, "option", 0,
+ &idx) != TCL_OK) {
return TCL_ERROR;
}
Tcl_Preserve(canvasPtr);
result = TCL_OK;
- switch ((enum options)index) {
+ switch ((enum canvasOptionStringsEnum)idx) {
case CANV_ADDTAG:
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tag searchCommand ?arg ...?");
@@ -888,10 +928,10 @@ CanvasWidgetCmd(
if (gotAny) {
Tcl_Obj *resultObjs[4];
- resultObjs[0] = Tcl_NewIntObj(x1);
- resultObjs[1] = Tcl_NewIntObj(y1);
- resultObjs[2] = Tcl_NewIntObj(x2);
- resultObjs[3] = Tcl_NewIntObj(y2);
+ resultObjs[0] = Tcl_NewWideIntObj(x1);
+ resultObjs[1] = Tcl_NewWideIntObj(y1);
+ resultObjs[2] = Tcl_NewWideIntObj(x2);
+ resultObjs[3] = Tcl_NewWideIntObj(y2);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, resultObjs));
}
break;
@@ -911,35 +951,6 @@ CanvasWidgetCmd(
*/
object = NULL;
-#ifdef USE_OLD_TAG_SEARCH
- if (isdigit(UCHAR(Tcl_GetString(objv[2])[0]))) {
- int id;
- char *end;
- Tcl_HashEntry *entryPtr;
-
- id = strtoul(Tcl_GetString(objv[2]), &end, 0);
- if (*end != 0) {
- goto bindByTag;
- }
- entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, (char *) id);
- if (entryPtr != NULL) {
- itemPtr = Tcl_GetHashValue(entryPtr);
- object = itemPtr;
- }
-
- if (object == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "item \"%s\" doesn't exist", Tcl_GetString(objv[2])));
- Tcl_SetErrorCode(interp, "TK", "LOOKUP", "CANVAS_ITEM",
- Tcl_GetString(objv[2]), NULL);
- result = TCL_ERROR;
- goto done;
- }
- } else {
- bindByTag:
- object = Tk_GetUid(Tcl_GetString(objv[2]));
- }
-#else /* USE_OLD_TAG_SEARCH */
result = TagSearchScan(canvasPtr, objv[2], &searchPtr);
if (result != TCL_OK) {
goto done;
@@ -963,9 +974,8 @@ CanvasWidgetCmd(
goto done;
}
} else {
- object = (ClientData) searchPtr->expr->uid;
+ object = (char *)searchPtr->expr->uid;
}
-#endif /* USE_OLD_TAG_SEARCH */
/*
* Make a binding table if the canvas doesn't already have one.
@@ -985,7 +995,6 @@ CanvasWidgetCmd(
object, Tcl_GetString(objv[3]));
goto done;
}
-#ifndef USE_OLD_TAG_SEARCH
if (searchPtr->type == SEARCH_TYPE_EXPR) {
/*
* If new tag expression, then insert in linked list.
@@ -1016,7 +1025,6 @@ CanvasWidgetCmd(
searchPtr->expr = NULL;
}
}
-#endif /* not USE_OLD_TAG_SEARCH */
if (argv4[0] == '+') {
argv4++;
append = 1;
@@ -1185,6 +1193,7 @@ CanvasWidgetCmd(
tmpObj = Tcl_NewListObj(2, objv+4);
FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) {
+ TkSizeT index;
int x1, x2, y1, y2;
int dontRedraw1, dontRedraw2;
@@ -1240,15 +1249,14 @@ CanvasWidgetCmd(
int isNew = 0;
Tcl_HashEntry *entryPtr;
const char *arg;
- size_t length;
+ TkSizeT length;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg ...?");
result = TCL_ERROR;
goto done;
}
- arg = Tcl_GetString(objv[2]);
- length = objv[2]->length;
+ arg = Tcl_GetStringFromObj(objv[2], &length);
c = arg[0];
/*
@@ -1326,11 +1334,11 @@ CanvasWidgetCmd(
itemPtr->redraw_flags |= FORCE_REDRAW;
EventuallyRedrawItem(canvasPtr, itemPtr);
canvasPtr->flags |= REPICK_NEEDED;
- Tcl_SetObjResult(interp, Tcl_NewIntObj(itemPtr->id));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(itemPtr->id));
break;
}
case CANV_DCHARS: {
- int first, last;
+ TkSizeT first, last;
int x1, x2, y1, y2;
if ((objc != 4) && (objc != 5)) {
@@ -1446,7 +1454,7 @@ CanvasWidgetCmd(
tag = Tk_GetUid(Tcl_GetString(objv[2]));
}
FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
- for (i = itemPtr->numTags-1; i >= 0; i--) {
+ for (i = (int)itemPtr->numTags-1; i >= 0; i--) {
if (itemPtr->tagPtr[i] == tag) {
/*
@@ -1485,7 +1493,7 @@ CanvasWidgetCmd(
itemPtr = canvasPtr->textInfo.focusItemPtr;
if (objc == 2) {
if (itemPtr != NULL) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(itemPtr->id));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(itemPtr->id));
}
goto done;
}
@@ -1520,7 +1528,7 @@ CanvasWidgetCmd(
int i;
Tcl_Obj *resultObj = Tcl_NewObj();
- for (i = 0; i < itemPtr->numTags; i++) {
+ for (i = 0; i < (int)itemPtr->numTags; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewStringObj(itemPtr->tagPtr[i], -1));
}
@@ -1528,6 +1536,7 @@ CanvasWidgetCmd(
}
break;
case CANV_ICURSOR: {
+ TkSizeT index;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId index");
@@ -1552,6 +1561,7 @@ CanvasWidgetCmd(
break;
}
case CANV_INDEX: {
+ TkSizeT index;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId string");
@@ -1575,11 +1585,11 @@ CanvasWidgetCmd(
if (result != TCL_OK) {
goto done;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
break;
}
case CANV_INSERT: {
- int beforeThis;
+ TkSizeT beforeThis;
int x1, x2, y1, y2;
if (objc != 5) {
@@ -1667,11 +1677,6 @@ CanvasWidgetCmd(
} else {
FIRST_CANVAS_ITEM_MATCHING(objv[3], &searchPtr, goto done);
if (itemPtr == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "tagOrId \"%s\" doesn't match any items",
- Tcl_GetString(objv[3])));
- Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM", NULL);
- result = TCL_ERROR;
goto done;
}
itemPtr = itemPtr->prevPtr;
@@ -1794,11 +1799,6 @@ CanvasWidgetCmd(
prevPtr = itemPtr;
}
if (prevPtr == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "tagOrId \"%s\" doesn't match any items",
- Tcl_GetString(objv[3])));
- Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM", NULL);
- result = TCL_ERROR;
goto done;
}
}
@@ -1806,7 +1806,7 @@ CanvasWidgetCmd(
break;
}
case CANV_RCHARS: {
- int first, last;
+ TkSizeT first, last;
int x1, x2, y1, y2;
int dontRedraw1, dontRedraw2;
@@ -1857,6 +1857,30 @@ CanvasWidgetCmd(
}
break;
}
+ case CANV_ROTATE: {
+ double x, y, angle;
+ Tk_Canvas canvas = (Tk_Canvas) canvasPtr;
+
+ if (objc != 6) {
+ Tcl_WrongNumArgs(interp, 2, objv, "tagOrId x y angle");
+ result = TCL_ERROR;
+ goto done;
+ }
+ if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[3], &x) != TCL_OK ||
+ Tk_CanvasGetCoordFromObj(interp, canvas, objv[4], &y) != TCL_OK ||
+ Tcl_GetDoubleFromObj(interp, objv[5], &angle) != TCL_OK) {
+ result = TCL_ERROR;
+ goto done;
+ }
+ angle = angle * 3.1415927 / 180.0;
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
+ EventuallyRedrawItem(canvasPtr, itemPtr);
+ ItemRotate(canvasPtr, itemPtr, x, y, angle);
+ EventuallyRedrawItem(canvasPtr, itemPtr);
+ canvasPtr->flags |= REPICK_NEEDED;
+ }
+ break;
+ }
case CANV_SCALE: {
double xOrigin, yOrigin, xScale, yScale;
@@ -1900,10 +1924,10 @@ CanvasWidgetCmd(
Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x y ?dragGain?");
result = TCL_ERROR;
} else if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings,
- "scan option", 0, &index) != TCL_OK) {
+ "scan option", 0, &idx) != TCL_OK) {
result = TCL_ERROR;
- } else if ((objc != 5) && (objc != 5+index)) {
- Tcl_WrongNumArgs(interp, 3, objv, index?"x y ?gain?":"x y");
+ } else if ((objc != 5) && (objc != 5+idx)) {
+ Tcl_WrongNumArgs(interp, 3, objv, idx?"x y ?gain?":"x y");
result = TCL_ERROR;
} else if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)){
@@ -1911,7 +1935,7 @@ CanvasWidgetCmd(
} else if ((objc == 6) &&
(Tcl_GetIntFromObj(interp, objv[5], &gain) != TCL_OK)) {
result = TCL_ERROR;
- } else if (!index) {
+ } else if (!idx) {
canvasPtr->scanX = x;
canvasPtr->scanXOrigin = canvasPtr->xOrigin;
canvasPtr->scanY = y;
@@ -1935,6 +1959,7 @@ CanvasWidgetCmd(
break;
}
case CANV_SELECT: {
+ TkSizeT index;
int optionindex;
static const char *const optionStrings[] = {
"adjust", "clear", "from", "item", "to", NULL
@@ -1984,8 +2009,8 @@ CanvasWidgetCmd(
goto done;
}
if (canvasPtr->textInfo.selItemPtr == itemPtr) {
- if (index < (canvasPtr->textInfo.selectFirst
- + canvasPtr->textInfo.selectLast)/2) {
+ if (index + 1 <= ((canvasPtr->textInfo.selectFirst
+ + canvasPtr->textInfo.selectLast)/2)) {
canvasPtr->textInfo.selectAnchor =
canvasPtr->textInfo.selectLast + 1;
} else {
@@ -2021,7 +2046,7 @@ CanvasWidgetCmd(
}
if (canvasPtr->textInfo.selItemPtr != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewIntObj(canvasPtr->textInfo.selItemPtr->id));
+ Tcl_NewWideIntObj(canvasPtr->textInfo.selItemPtr->id));
}
break;
case CANV_TO:
@@ -2138,12 +2163,50 @@ CanvasWidgetCmd(
CanvasSetOrigin(canvasPtr, canvasPtr->xOrigin, newY);
break;
}
+ case CANV_IMAGE: {
+ Tk_PhotoHandle photohandle;
+ int subsample = 1, zoom = 1;
+
+ if (objc < 3 || objc > 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "imagename ?subsample? ?zoom?");
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ if ((photohandle = Tk_FindPhoto(interp, Tcl_GetString(objv[2]) )) == 0) {
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ /*
+ * If we are given a subsample or a zoom then grab them.
+ */
+
+ if (objc >= 4 && Tcl_GetIntFromObj(interp, objv[3], &subsample) != TCL_OK) {
+ result = TCL_ERROR;
+ goto done;
+ }
+ if (objc >= 5 && Tcl_GetIntFromObj(interp, objv[4], &zoom) != TCL_OK) {
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ /*
+ * Set the image size to zero, which allows the DrawCanvas() function
+ * to expand the image automatically when it copies the pixmap into it.
+ */
+
+ if (Tk_PhotoSetSize(interp, photohandle, 0, 0) != TCL_OK) {
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ result = DrawCanvas(interp, clientData, photohandle, subsample, zoom);
+ }
}
done:
-#ifndef USE_OLD_TAG_SEARCH
TagSearchDestroy(searchPtr);
-#endif /* not USE_OLD_TAG_SEARCH */
Tcl_Release(canvasPtr);
return result;
}
@@ -2168,13 +2231,11 @@ CanvasWidgetCmd(
static void
DestroyCanvas(
- char *memPtr) /* Info about canvas widget. */
+ void *memPtr) /* Info about canvas widget. */
{
- TkCanvas *canvasPtr = (TkCanvas *) memPtr;
+ TkCanvas *canvasPtr = (TkCanvas *)memPtr;
Tk_Item *itemPtr;
-#ifndef USE_OLD_TAG_SEARCH
TagSearchExpr *expr, *next;
-#endif
/*
* Free up all of the items in the canvas.
@@ -2199,14 +2260,12 @@ DestroyCanvas(
if (canvasPtr->pixmapGC != NULL) {
Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC);
}
-#ifndef USE_OLD_TAG_SEARCH
expr = canvasPtr->bindTagExprs;
while (expr) {
next = expr->next;
TagSearchExprDestroy(expr);
expr = next;
}
-#endif /* USE_OLD_TAG_SEARCH */
Tcl_DeleteTimerHandler(canvasPtr->insertBlinkHandler);
if (canvasPtr->bindingTable != NULL) {
Tk_DeleteBindingTable(canvasPtr->bindingTable);
@@ -2426,6 +2485,533 @@ CanvasWorldChanged(
/*
*----------------------------------------------------------------------
*
+ * DecomposeMaskToShiftAndBits --
+ *
+ * Given a 32 bit pixel mask, we find the position of the lowest bit and the
+ * width of the mask bits.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+* None.
+ *
+ *----------------------------------------------------------------------
+ */
+static void
+DecomposeMaskToShiftAndBits(
+ unsigned int mask, /* The pixel mask to examine */
+ int *shift, /* Where to put the shift count (position of lowest bit) */
+ int *bits) /* Where to put the bit count (width of the pixel mask) */
+{
+ int i;
+
+ *shift = 0;
+ *bits = 0;
+
+ /*
+ * Find the lowest '1' bit in the mask.
+ */
+
+ for (i = 0; i < 32; ++i) {
+ if (mask & 1 << i)
+ break;
+ }
+ if (i < 32) {
+ *shift = i;
+
+ /*
+ * Now find the next '0' bit and the width of the mask.
+ */
+
+ for ( ; i < 32; ++i) {
+ if ((mask & 1 << i) == 0)
+ break;
+ else
+ ++*bits;
+ }
+
+ /*
+ * Limit to the top 8 bits if the mask was wider than 8.
+ */
+
+ if (*bits > 8) {
+ *shift += *bits - 8;
+ *bits = 8;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawCanvas --
+ *
+ * This function draws the contents of a canvas into the given Photo image.
+ * This function is called from the widget "image" subcommand.
+ * The canvas does not need to be mapped (one of it's ancestors must be)
+ * in order for this function to work.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Canvas contents from within the -scrollregion or widget size are rendered
+ * into the Photo. Any errors are left in the result.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#define OVERDRAW_PIXELS 32 /* How much larger we make the pixmap
+ * that the canvas objects are drawn into */
+
+/* From stackoverflow.com/questions/2100331/c-macro-definition-to-determine-big-endian-or-little-endian-machine */
+#define IS_BIG_ENDIAN (*(unsigned short *)"\0\xff" < 0x100)
+
+#define BYTE_SWAP16(n) ((((unsigned short)n)>>8) | (((unsigned short)n)<<8))
+#define BYTE_SWAP32(n) (((n>>24)&0x000000FF) | ((n<<8)&0x00FF0000) | ((n>>8)&0x0000FF00) | ((n<<24)&0xFF000000))
+
+static int
+DrawCanvas(
+ Tcl_Interp *interp, /* As passed to the widget command, and we will leave errors here */
+ ClientData clientData,
+ Tk_PhotoHandle photohandle, /* The photo we are rendering into */
+ int subsample, /* If either subsample or zoom are not 1 then we call Tk_PhotoPutZoomedBlock() */
+ int zoom)
+{
+ TkCanvas *canvasPtr = (TkCanvas *)clientData;
+ Tk_Window tkwin;
+ Display *displayPtr;
+ Tk_PhotoImageBlock blockPtr = {0,0,0,0,0,{0,0,0,0}};
+ Window wid;
+ Tk_Item *itemPtr;
+ Pixmap pixmap = 0;
+ XImage *ximagePtr = NULL;
+ Visual *visualPtr;
+ GC xgc = 0;
+ XGCValues xgcValues;
+ int canvasX1, canvasY1, canvasX2, canvasY2, cWidth, cHeight,
+ pixmapX1, pixmapY1, pixmapX2, pixmapY2, pmWidth, pmHeight,
+ bitsPerPixel, bytesPerPixel, x, y, result = TCL_OK,
+ rshift, gshift, bshift, rbits, gbits, bbits;
+
+#ifdef DEBUG_DRAWCANVAS
+ char buffer[128];
+#endif
+
+ if ((tkwin = canvasPtr->tkwin) == NULL) {
+ Tcl_AppendResult(interp, "canvas tkwin is NULL!", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ /*
+ * If this canvas is unmapped, then we won't have a window id, so we will
+ * try the ancestors of the canvas until we find a window that has a
+ * valid window id. The Tk_GetPixmap() call requires a valid window id.
+ */
+
+ do {
+
+ if ((displayPtr = Tk_Display(tkwin)) == NULL) {
+ Tcl_AppendResult(interp, "canvas (or parent) display is NULL!", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ if ((wid = Tk_WindowId(tkwin)) != 0) {
+ continue;
+ }
+
+ if ((tkwin = Tk_Parent(tkwin)) == NULL) {
+ Tcl_AppendResult(interp, "canvas has no parent with a valid window id! Is the toplevel window mapped?", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ } while (wid == 0);
+
+ bitsPerPixel = Tk_Depth(tkwin);
+ visualPtr = Tk_Visual(tkwin);
+
+ if (subsample == 0) {
+ Tcl_AppendResult(interp, "subsample cannot be zero", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ /*
+ * Scan through the item list, registering the bounding box for all items
+ * that didn't do that for the final coordinates yet. This can be
+ * determined by the FORCE_REDRAW flag.
+ */
+
+ for (itemPtr = canvasPtr -> firstItemPtr; itemPtr != NULL;
+ itemPtr = itemPtr -> nextPtr) {
+ if (itemPtr -> redraw_flags & FORCE_REDRAW) {
+ itemPtr -> redraw_flags &= ~FORCE_REDRAW;
+ EventuallyRedrawItem(canvasPtr, itemPtr);
+ itemPtr -> redraw_flags &= ~FORCE_REDRAW;
+ }
+ }
+
+ /*
+ * The DisplayCanvas() function works out the region that needs redrawing,
+ * but we don't do this. We grab the whole scrollregion or canvas window
+ * area. If we have a defined -scrollregion we use that as the drawing
+ * region, otherwise use the canvas window height and width with an origin
+ * of 0,0.
+ */
+ if (canvasPtr->scrollX1 != 0 || canvasPtr->scrollY1 != 0 ||
+ canvasPtr->scrollX2 != 0 || canvasPtr->scrollY2 != 0) {
+
+ canvasX1 = canvasPtr->scrollX1;
+ canvasY1 = canvasPtr->scrollY1;
+ canvasX2 = canvasPtr->scrollX2;
+ canvasY2 = canvasPtr->scrollY2;
+ cWidth = canvasX2 - canvasX1 + 1;
+ cHeight = canvasY2 - canvasY1 + 1;
+
+ } else {
+
+ cWidth = Tk_Width(tkwin);
+ cHeight = Tk_Height(tkwin);
+ canvasX1 = 0;
+ canvasY1 = 0;
+ canvasX2 = canvasX1 + cWidth - 1;
+ canvasY2 = canvasY1 + cHeight - 1;
+ }
+
+ /*
+ * Allocate a pixmap to draw into. We add OVERDRAW_PIXELS in the same way
+ * that DisplayCanvas() does to avoid problems on some systems when objects
+ * are being drawn too close to the edge.
+ */
+
+ pixmapX1 = canvasX1 - OVERDRAW_PIXELS;
+ pixmapY1 = canvasY1 - OVERDRAW_PIXELS;
+ pixmapX2 = canvasX2 + OVERDRAW_PIXELS;
+ pixmapY2 = canvasY2 + OVERDRAW_PIXELS;
+ pmWidth = pixmapX2 - pixmapX1 + 1;
+ pmHeight = pixmapY2 - pixmapY1 + 1;
+ if ((pixmap = Tk_GetPixmap(displayPtr, Tk_WindowId(tkwin), pmWidth, pmHeight,
+ bitsPerPixel)) == 0) {
+ Tcl_AppendResult(interp, "failed to create drawing Pixmap", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ /*
+ * Before we can draw the canvas objects into the pixmap it's background
+ * should be filled with canvas background colour.
+ */
+
+ xgcValues.function = GXcopy;
+ xgcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel;
+ xgc = XCreateGC(displayPtr, pixmap, GCFunction|GCForeground, &xgcValues);
+ XFillRectangle(displayPtr,pixmap,xgc,0,0,pmWidth,pmHeight);
+
+ /*
+ * Draw all the cavas items into the pixmap
+ */
+
+ canvasPtr->drawableXOrigin = pixmapX1;
+ canvasPtr->drawableYOrigin = pixmapY1;
+ for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
+ itemPtr = itemPtr->nextPtr) {
+ if ((itemPtr->x1 >= pixmapX2) || (itemPtr->y1 >= pixmapY2) ||
+ (itemPtr->x2 < pixmapX1) || (itemPtr->y2 < pixmapY1)) {
+ if (!AlwaysRedraw(itemPtr)) {
+ continue;
+ }
+ }
+ if (itemPtr->state == TK_STATE_HIDDEN ||
+ (itemPtr->state == TK_STATE_NULL && canvasPtr->canvas_state
+ == TK_STATE_HIDDEN)) {
+ continue;
+ }
+ ItemDisplay(canvasPtr, itemPtr, pixmap, pixmapX1, pixmapY1, pmWidth,
+ pmHeight);
+ }
+
+ /*
+ * Copy the Pixmap into an ZPixmap format XImage so we can copy it across
+ * to the photo image. This seems to be the only way to get Pixmap image
+ * data out of an image. Note we have to account for the OVERDRAW_PIXELS
+ * border width.
+ */
+
+ if ((ximagePtr = XGetImage(displayPtr, pixmap, -pixmapX1, -pixmapY1, cWidth,
+ cHeight, AllPlanes, ZPixmap)) == NULL) {
+ Tcl_AppendResult(interp, "failed to copy Pixmap to XImage", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+
+#ifdef DEBUG_DRAWCANVAS
+ Tcl_AppendResult(interp, "ximagePtr {", NULL);
+ sprintf(buffer,"%d",ximagePtr->width); Tcl_AppendResult(interp, " width ", buffer, NULL);
+ sprintf(buffer,"%d",ximagePtr->height); Tcl_AppendResult(interp, " height ", buffer, NULL);
+ sprintf(buffer,"%d",ximagePtr->xoffset); Tcl_AppendResult(interp, " xoffset ", buffer, NULL);
+ sprintf(buffer,"%d",ximagePtr->format); Tcl_AppendResult(interp, " format ", buffer, NULL);
+ Tcl_AppendResult(interp, " ximagePtr->data", NULL);
+ if (ximagePtr->data != NULL) {
+ int ix, iy;
+
+ Tcl_AppendResult(interp, " {", NULL);
+ for (iy = 0; iy < ximagePtr->height; ++ iy) {
+ Tcl_AppendResult(interp, " {", NULL);
+ for (ix = 0; ix < ximagePtr->bytes_per_line; ++ ix) {
+ if (ix > 0) {
+ if (ix % 4 == 0)
+ Tcl_AppendResult(interp, "-", NULL);
+ else
+ Tcl_AppendResult(interp, " ", NULL);
+ }
+ sprintf(buffer,"%2.2x",ximagePtr->data[ximagePtr->bytes_per_line * iy + ix]&0xFF);
+ Tcl_AppendResult(interp, buffer, NULL);
+ }
+ Tcl_AppendResult(interp, " }", NULL);
+ }
+ Tcl_AppendResult(interp, " }", NULL);
+ } else
+ sprintf(buffer," NULL");
+ sprintf(buffer,"%d",ximagePtr->byte_order); Tcl_AppendResult(interp, " byte_order ", buffer, NULL);
+ sprintf(buffer,"%d",ximagePtr->bitmap_unit); Tcl_AppendResult(interp, " bitmap_unit ", buffer, NULL);
+ sprintf(buffer,"%d",ximagePtr->bitmap_bit_order); Tcl_AppendResult(interp, " bitmap_bit_order ", buffer, NULL);
+ sprintf(buffer,"%d",ximagePtr->bitmap_pad); Tcl_AppendResult(interp, " bitmap_pad ", buffer, NULL);
+ sprintf(buffer,"%d",ximagePtr->depth); Tcl_AppendResult(interp, " depth ", buffer, NULL);
+ sprintf(buffer,"%d",ximagePtr->bytes_per_line); Tcl_AppendResult(interp, " bytes_per_line ", buffer, NULL);
+ sprintf(buffer,"%d",ximagePtr->bits_per_pixel); Tcl_AppendResult(interp, " bits_per_pixel ", buffer, NULL);
+ sprintf(buffer,"0x%8.8lx",ximagePtr->red_mask); Tcl_AppendResult(interp, " red_mask ", buffer, NULL);
+ sprintf(buffer,"0x%8.8lx",ximagePtr->green_mask); Tcl_AppendResult(interp, " green_mask ", buffer, NULL);
+ sprintf(buffer,"0x%8.8lx",ximagePtr->blue_mask); Tcl_AppendResult(interp, " blue_mask ", buffer, NULL);
+ Tcl_AppendResult(interp, " }", NULL);
+
+ Tcl_AppendResult(interp, "\nvisualPtr {", NULL);
+ sprintf(buffer,"0x%8.8lx",visualPtr->red_mask); Tcl_AppendResult(interp, " red_mask ", buffer, NULL);
+ sprintf(buffer,"0x%8.8lx",visualPtr->green_mask); Tcl_AppendResult(interp, " green_mask ", buffer, NULL);
+ sprintf(buffer,"0x%8.8lx",visualPtr->blue_mask); Tcl_AppendResult(interp, " blue_mask ", buffer, NULL);
+ Tcl_AppendResult(interp, " }", NULL);
+
+#endif
+
+ /*
+ * Fill in the PhotoImageBlock structure abd allocate a block of memory
+ * for the converted image data. Note we allocate an alpha channel even
+ * though we don't use one, because this layout helps Tk_PhotoPutBlock()
+ * use memcpy() instead of the slow pixel or line copy.
+ */
+
+ blockPtr.width = cWidth;
+ blockPtr.height = cHeight;
+ blockPtr.pixelSize = 4;
+ blockPtr.pitch = blockPtr.pixelSize * blockPtr.width;
+
+#ifdef TK_XGETIMAGE_USES_ABGR32
+ blockPtr.offset[0] = 1;
+ blockPtr.offset[1] = 2;
+ blockPtr.offset[2] = 3;
+ blockPtr.offset[3] = 0;
+#else
+ blockPtr.offset[0] = 0;
+ blockPtr.offset[1] = 1;
+ blockPtr.offset[2] = 2;
+ blockPtr.offset[3] = 3;
+#endif
+
+ blockPtr.pixelPtr = (unsigned char *)ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width);
+
+ /*
+ * Now convert the image data pixel by pixel from XImage to 32bit RGBA
+ * format suitable for Tk_PhotoPutBlock().
+ */
+
+ DecomposeMaskToShiftAndBits(visualPtr->red_mask,&rshift,&rbits);
+ DecomposeMaskToShiftAndBits(visualPtr->green_mask,&gshift,&gbits);
+ DecomposeMaskToShiftAndBits(visualPtr->blue_mask,&bshift,&bbits);
+
+#ifdef DEBUG_DRAWCANVAS
+ sprintf(buffer,"%d",rshift); Tcl_AppendResult(interp, "\nbits { rshift ", buffer, NULL);
+ sprintf(buffer,"%d",gshift); Tcl_AppendResult(interp, " gshift ", buffer, NULL);
+ sprintf(buffer,"%d",bshift); Tcl_AppendResult(interp, " bshift ", buffer, NULL);
+ sprintf(buffer,"%d",rbits); Tcl_AppendResult(interp, " rbits ", buffer, NULL);
+ sprintf(buffer,"%d",gbits); Tcl_AppendResult(interp, " gbits ", buffer, NULL);
+ sprintf(buffer,"%d",bbits); Tcl_AppendResult(interp, " bbits ", buffer, " }", NULL);
+ Tcl_AppendResult(interp, "\nConverted_image {", NULL);
+#endif
+
+ /* Ok, had to use ximagePtr->bits_per_pixel here and in the switch (...)
+ * below to get this to work on Windows. X11 correctly sets the bitmap
+ *_pad and bitmap_unit fields to 32, but on Windows they are 0 and 8
+ * respectively!
+ */
+
+ bytesPerPixel = ximagePtr->bits_per_pixel/8;
+ for (y = 0; y < blockPtr.height; ++y) {
+
+#ifdef DEBUG_DRAWCANVAS
+ Tcl_AppendResult(interp, " {", NULL);
+#endif
+
+ for(x = 0; x < blockPtr.width; ++x) {
+ unsigned int pixel = 0;
+ int pixel_offset = blockPtr.pitch * y + blockPtr.pixelSize * x;
+ switch (ximagePtr->bits_per_pixel) {
+
+ /*
+ * Get an 8 bit pixel from the XImage.
+ */
+
+ case 8 :
+ pixel = *((unsigned char *)(ximagePtr->data + bytesPerPixel * x
+ + ximagePtr->bytes_per_line * y));
+ break;
+
+ /*
+ * Get a 16 bit pixel from the XImage, and correct the
+ * byte order as necessary.
+ */
+
+ case 16 :
+ pixel = *((unsigned short *)(ximagePtr->data + bytesPerPixel * x
+ + ximagePtr->bytes_per_line * y));
+ if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst)
+ || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst))
+ pixel = BYTE_SWAP16(pixel);
+ break;
+
+ /*
+ * Grab a 32 bit pixel from the XImage, and correct the
+ * byte order as necessary.
+ */
+
+ case 32 :
+ pixel = *((unsigned int *)(ximagePtr->data + bytesPerPixel * x
+ + ximagePtr->bytes_per_line * y));
+ if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst)
+ || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst))
+ pixel = BYTE_SWAP32(pixel);
+ break;
+ }
+
+ /*
+ * We have a pixel with the correct byte order, so pull out the
+ * colours and place them in the photo block. Perhaps we could
+ * just not bother with the alpha byte because we are using
+ * TK_PHOTO_COMPOSITE_SET later?
+ * ***Windows: We have to swap the red and blue values. The
+ * XImage storage is B - G - R - A which becomes a 32bit ARGB
+ * quad. However the visual mask is a 32bit ABGR quad. And
+ * Tk_PhotoPutBlock() wants R-G-B-A which is a 32bit ABGR quad.
+ * If the visual mask was correct there would be no need to
+ * swap anything here.
+ */
+
+#ifdef _WIN32
+#define R_OFFSET blockPtr.offset[2]
+#define G_OFFSET blockPtr.offset[1]
+#define B_OFFSET blockPtr.offset[0]
+#define A_OFFSET blockPtr.offset[3]
+#else
+#define R_OFFSET blockPtr.offset[0]
+#define G_OFFSET blockPtr.offset[1]
+#define B_OFFSET blockPtr.offset[2]
+#define A_OFFSET blockPtr.offset[3]
+#endif
+#ifdef TK_XGETIMAGE_USES_ABGR32
+#define COPY_PIXEL (ximagePtr->bits_per_pixel == 32)
+#else
+#define COPY_PIXEL 0
+#endif
+
+ if (COPY_PIXEL) {
+ /*
+ * This platform packs pixels in RGBA byte order, as expected
+ * by Tk_PhotoPutBlock() so we can just copy the pixel as an int.
+ */
+ *((unsigned int *) (blockPtr.pixelPtr + pixel_offset)) = pixel;
+ } else {
+ blockPtr.pixelPtr[pixel_offset + R_OFFSET] =
+ (unsigned char)((pixel & visualPtr->red_mask) >> rshift);
+ blockPtr.pixelPtr[pixel_offset + G_OFFSET] =
+ (unsigned char)((pixel & visualPtr->green_mask) >> gshift);
+ blockPtr.pixelPtr[pixel_offset + B_OFFSET] =
+ (unsigned char)((pixel & visualPtr->blue_mask) >> bshift);
+ blockPtr.pixelPtr[pixel_offset + A_OFFSET] = 0xFF;
+ }
+
+#ifdef DEBUG_DRAWCANVAS
+ fprintf(stderr, "Converted pixel %x to %hhx %hhx %hhx %hhx \n",
+ pixel,
+ blockPtr.pixelPtr[pixel_offset + 0],
+ blockPtr.pixelPtr[pixel_offset + 1],
+ blockPtr.pixelPtr[pixel_offset + 2],
+ blockPtr.pixelPtr[pixel_offset + 3]);
+ {
+ int ix;
+ if (x > 0)
+ Tcl_AppendResult(interp, "-", NULL);
+ for (ix = 0; ix < 4; ++ix) {
+ if (ix > 0)
+ Tcl_AppendResult(interp, " ", NULL);
+ sprintf(buffer,"%2.2x",blockPtr.pixelPtr[blockPtr.pitch * y
+ + blockPtr.pixelSize * x + ix]&0xFF);
+ Tcl_AppendResult(interp, buffer, NULL);
+ }
+ }
+#endif
+
+ }
+
+#ifdef DEBUG_DRAWCANVAS
+ Tcl_AppendResult(interp, " }", NULL);
+#endif
+
+ }
+
+#ifdef DEBUG_DRAWCANVAS
+ Tcl_AppendResult(interp, " }", NULL);
+#endif
+
+ /*
+ * Now put the copied pixmap into the photo.
+ * If either zoom or subsample are not 1, we use the zoom function.
+ */
+
+ if (subsample != 1 || zoom != 1) {
+ if ((result = Tk_PhotoPutZoomedBlock(interp, photohandle, &blockPtr,
+ 0, 0, cWidth * zoom / subsample, cHeight * zoom / subsample,
+ zoom, zoom, subsample, subsample, TK_PHOTO_COMPOSITE_SET))
+ != TCL_OK) {
+ goto done;
+ }
+ } else {
+ if ((result = Tk_PhotoPutBlock(interp, photohandle, &blockPtr, 0, 0,
+ cWidth, cHeight, TK_PHOTO_COMPOSITE_SET)) != TCL_OK) {
+ goto done;
+ }
+ }
+
+ /*
+ * Clean up anything we have allocated and exit.
+ */
+
+done:
+ if (blockPtr.pixelPtr)
+ ckfree(blockPtr.pixelPtr);
+ if (pixmap)
+ Tk_FreePixmap(Tk_Display(tkwin), pixmap);
+ if (ximagePtr)
+ XDestroyImage(ximagePtr);
+ if (xgc)
+ XFreeGC(displayPtr,xgc);
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* DisplayCanvas --
*
* This function redraws the contents of a canvas window. It is invoked
@@ -3061,208 +3647,6 @@ InitCanvas(void)
Tcl_MutexUnlock(&typeListMutex);
}
-#ifdef USE_OLD_TAG_SEARCH
-/*
- *--------------------------------------------------------------
- *
- * StartTagSearch --
- *
- * This function is called to initiate an enumeration of all items in a
- * given canvas that contain a given tag.
- *
- * Results:
- * The return value is a pointer to the first item in canvasPtr that
- * matches tag, or NULL if there is no such item. The information at
- * *searchPtr is initialized such that successive calls to NextItem will
- * return successive items that match tag.
- *
- * Side effects:
- * SearchPtr is linked into a list of searches in progress on canvasPtr,
- * so that elements can safely be deleted while the search is in
- * progress. EndTagSearch must be called at the end of the search to
- * unlink searchPtr from this list.
- *
- *--------------------------------------------------------------
- */
-
-static Tk_Item *
-StartTagSearch(
- TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */
- Tcl_Obj *tagObj, /* Object giving tag value. */
- TagSearch *searchPtr) /* Record describing tag search; will be
- * initialized here. */
-{
- int id;
- Tk_Item *itemPtr, *lastPtr;
- Tk_Uid *tagPtr;
- Tk_Uid uid;
- char *tag = Tcl_GetString(tagObj);
- int count;
- TkWindow *tkwin = (TkWindow *) canvasPtr->tkwin;
- TkDisplay *dispPtr = tkwin->dispPtr;
-
- /*
- * Initialize the search.
- */
-
- searchPtr->canvasPtr = canvasPtr;
- searchPtr->searchOver = 0;
-
- /*
- * Find the first matching item in one of several ways. If the tag is a
- * number then it selects the single item with the matching identifier.
- * In this case see if the item being requested is the hot item, in which
- * case the search can be skipped.
- */
-
- if (isdigit(UCHAR(*tag))) {
- char *end;
- Tcl_HashEntry *entryPtr;
-
- dispPtr->numIdSearches++;
- id = strtoul(tag, &end, 0);
- if (*end == 0) {
- itemPtr = canvasPtr->hotPtr;
- lastPtr = canvasPtr->hotPrevPtr;
- if ((itemPtr == NULL) || (itemPtr->id != id) || (lastPtr == NULL)
- || (lastPtr->nextPtr != itemPtr)) {
- dispPtr->numSlowSearches++;
- entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, (char*) id);
- if (entryPtr != NULL) {
- itemPtr = Tcl_GetHashValue(entryPtr);
- lastPtr = itemPtr->prevPtr;
- } else {
- lastPtr = itemPtr = NULL;
- }
- }
- searchPtr->lastPtr = lastPtr;
- searchPtr->searchOver = 1;
- canvasPtr->hotPtr = itemPtr;
- canvasPtr->hotPrevPtr = lastPtr;
- return itemPtr;
- }
- }
-
- searchPtr->tag = uid = Tk_GetUid(tag);
- if (uid == Tk_GetUid("all")) {
- /*
- * All items match.
- */
-
- searchPtr->tag = NULL;
- searchPtr->lastPtr = NULL;
- searchPtr->currentPtr = canvasPtr->firstItemPtr;
- return canvasPtr->firstItemPtr;
- }
-
- /*
- * None of the above. Search for an item with a matching tag.
- */
-
- for (lastPtr = NULL, itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
- lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
- count > 0; tagPtr++, count--) {
- if (*tagPtr == uid) {
- searchPtr->lastPtr = lastPtr;
- searchPtr->currentPtr = itemPtr;
- return itemPtr;
- }
- }
- }
- searchPtr->lastPtr = lastPtr;
- searchPtr->searchOver = 1;
- return NULL;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * NextItem --
- *
- * This function returns successive items that match a given tag; it
- * should be called only after StartTagSearch has been used to begin a
- * search.
- *
- * Results:
- * The return value is a pointer to the next item that matches the tag
- * specified to StartTagSearch, or NULL if no such item exists.
- * *SearchPtr is updated so that the next call to this function will
- * return the next item.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-static Tk_Item *
-NextItem(
- TagSearch *searchPtr) /* Record describing search in progress. */
-{
- Tk_Item *itemPtr, *lastPtr;
- int count;
- Tk_Uid uid;
- Tk_Uid *tagPtr;
-
- /*
- * Find next item in list (this may not actually be a suitable one to
- * return), and return if there are no items left.
- */
-
- lastPtr = searchPtr->lastPtr;
- if (lastPtr == NULL) {
- itemPtr = searchPtr->canvasPtr->firstItemPtr;
- } else {
- itemPtr = lastPtr->nextPtr;
- }
- if ((itemPtr == NULL) || (searchPtr->searchOver)) {
- searchPtr->searchOver = 1;
- return NULL;
- }
- if (itemPtr != searchPtr->currentPtr) {
- /*
- * The structure of the list has changed. Probably the previously-
- * returned item was removed from the list. In this case, don't
- * advance lastPtr; just return its new successor (i.e. do nothing
- * here).
- */
- } else {
- lastPtr = itemPtr;
- itemPtr = lastPtr->nextPtr;
- }
-
- /*
- * Handle special case of "all" search by returning next item.
- */
-
- uid = searchPtr->tag;
- if (uid == NULL) {
- searchPtr->lastPtr = lastPtr;
- searchPtr->currentPtr = itemPtr;
- return itemPtr;
- }
-
- /*
- * Look for an item with a particular tag.
- */
-
- for ( ; itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
- count > 0; tagPtr++, count--) {
- if (*tagPtr == uid) {
- searchPtr->lastPtr = lastPtr;
- searchPtr->currentPtr = itemPtr;
- return itemPtr;
- }
- }
- }
- searchPtr->lastPtr = lastPtr;
- searchPtr->searchOver = 1;
- return NULL;
-}
-
-#else /* !USE_OLD_TAG_SEARCH */
/*
*----------------------------------------------------------------------
*
@@ -3873,7 +4257,7 @@ TagSearchEvalExpr(
* set result 1 if tag is found in item's tags
*/
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (*tagPtr == uid) {
result = 1;
@@ -3893,7 +4277,7 @@ TagSearchEvalExpr(
* set result 1 if tag is found in item's tags.
*/
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (*tagPtr == uid) {
result = 1;
@@ -4059,7 +4443,7 @@ TagSearchFirst(
uid = searchPtr->expr->uid;
for (lastPtr = NULL, itemPtr = searchPtr->canvasPtr->firstItemPtr;
itemPtr != NULL; lastPtr=itemPtr, itemPtr=itemPtr->nextPtr) {
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (*tagPtr == uid) {
searchPtr->lastPtr = lastPtr;
@@ -4161,7 +4545,7 @@ TagSearchNext(
uid = searchPtr->expr->uid;
for (; itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (*tagPtr == uid) {
searchPtr->lastPtr = lastPtr;
@@ -4191,7 +4575,6 @@ TagSearchNext(
searchPtr->searchOver = 1;
return NULL;
}
-#endif /* USE_OLD_TAG_SEARCH */
/*
*--------------------------------------------------------------
@@ -4228,11 +4611,11 @@ DoItem(
*/
if (tag == NULL) {
- Tcl_ListObjAppendElement(NULL, accumObj, Tcl_NewIntObj(itemPtr->id));
+ Tcl_ListObjAppendElement(NULL, accumObj, Tcl_NewWideIntObj(itemPtr->id));
return;
}
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (tag == *tagPtr) {
return;
@@ -4304,14 +4687,9 @@ FindItems(
int first /* For error messages: gives number of
* elements of objv which are already
* handled. */
-#ifndef USE_OLD_TAG_SEARCH
,TagSearch **searchPtrPtr /* From CanvasWidgetCmd local vars*/
-#endif /* not USE_OLD_TAG_SEARCH */
)
{
-#ifdef USE_OLD_TAG_SEARCH
- TagSearch search;
-#endif /* USE_OLD_TAG_SEARCH */
Tk_Item *itemPtr;
Tk_Uid uid;
int index, result;
@@ -4628,16 +5006,6 @@ FindArea(
*--------------------------------------------------------------
*/
-#ifdef USE_OLD_TAG_SEARCH
-static void
-RelinkItems(
- TkCanvas *canvasPtr, /* Canvas to be modified. */
- Tcl_Obj *tag, /* Tag identifying items to be moved in the
- * redisplay list. */
- Tk_Item *prevPtr) /* Reposition the items so that they go just
- * after this item (NULL means put at
- * beginning of list). */
-#else /* USE_OLD_TAG_SEARCH */
static int
RelinkItems(
TkCanvas *canvasPtr, /* Canvas to be modified. */
@@ -4647,12 +5015,8 @@ RelinkItems(
* after this item (NULL means put at
* beginning of list). */
TagSearch **searchPtrPtr) /* From CanvasWidgetCmd local vars */
-#endif /* USE_OLD_TAG_SEARCH */
{
Tk_Item *itemPtr;
-#ifdef USE_OLD_TAG_SEARCH
- TagSearch search;
-#endif /* USE_OLD_TAG_SEARCH */
Tk_Item *firstMovePtr, *lastMovePtr;
int result;
@@ -4704,11 +5068,7 @@ RelinkItems(
*/
if (firstMovePtr == NULL) {
-#ifdef USE_OLD_TAG_SEARCH
- return;
-#else /* USE_OLD_TAG_SEARCH */
return TCL_OK;
-#endif /* USE_OLD_TAG_SEARCH */
}
if (prevPtr == NULL) {
if (canvasPtr->firstItemPtr != NULL) {
@@ -4729,9 +5089,7 @@ RelinkItems(
if (canvasPtr->lastItemPtr == prevPtr) {
canvasPtr->lastItemPtr = lastMovePtr;
}
-#ifndef USE_OLD_TAG_SEARCH
return TCL_OK;
-#endif /* not USE_OLD_TAG_SEARCH */
}
/*
@@ -4771,7 +5129,7 @@ CanvasBindProc(
switch (eventPtr->type) {
case ButtonPress:
case ButtonRelease:
- mask = TkGetButtonMask(eventPtr->xbutton.button);
+ mask = Tk_GetButtonMask(eventPtr->xbutton.button);
/*
* For button press events, repick the current item using the button
@@ -4856,9 +5214,7 @@ PickCurrentItem(
double coords[2];
unsigned int buttonDown;
Tk_Item *prevItemPtr;
-#ifndef USE_OLD_TAG_SEARCH
SearchUids *searchUids = GetStaticUids();
-#endif
/*
* Check whether or not a button is down. If so, we'll log entry and exit
@@ -4979,12 +5335,8 @@ PickCurrentItem(
*/
if ((itemPtr == canvasPtr->currentItemPtr) && !buttonDown) {
- for (i = itemPtr->numTags-1; i >= 0; i--) {
-#ifdef USE_OLD_TAG_SEARCH
- if (itemPtr->tagPtr[i] == Tk_GetUid("current"))
-#else /* USE_OLD_TAG_SEARCH */
+ for (i = (int)itemPtr->numTags-1; i >= 0; i--) {
if (itemPtr->tagPtr[i] == searchUids->currentUid)
-#endif /* USE_OLD_TAG_SEARCH */
/* then */ {
memmove((void *)(itemPtr->tagPtr + i),
itemPtr->tagPtr + i + 1,
@@ -5023,11 +5375,7 @@ PickCurrentItem(
if (canvasPtr->currentItemPtr != NULL) {
XEvent event;
-#ifdef USE_OLD_TAG_SEARCH
- DoItem(NULL, canvasPtr->currentItemPtr, Tk_GetUid("current"));
-#else /* USE_OLD_TAG_SEARCH */
DoItem(NULL, canvasPtr->currentItemPtr, searchUids->currentUid);
-#endif /* USE_OLD_TAG_SEARCH */
if ((canvasPtr->currentItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT
&& prevItemPtr != canvasPtr->currentItemPtr)) {
ItemConfigure(canvasPtr, canvasPtr->currentItemPtr, 0, NULL);
@@ -5125,11 +5473,9 @@ CanvasDoEvent(
void **objectPtr;
int numObjects, i;
Tk_Item *itemPtr;
-#ifndef USE_OLD_TAG_SEARCH
TagSearchExpr *expr;
int numExprs;
SearchUids *searchUids = GetStaticUids();
-#endif /* not USE_OLD_TAG_SEARCH */
if (canvasPtr->bindingTable == NULL) {
return;
@@ -5143,16 +5489,6 @@ CanvasDoEvent(
return;
}
-#ifdef USE_OLD_TAG_SEARCH
- /*
- * Set up an array with all the relevant objects for processing this
- * event. The relevant objects are (a) the event's item, (b) the tags
- * associated with the event's item, and (c) the tag "all". If there are a
- * lot of tags then malloc an array to hold all of the objects.
- */
-
- numObjects = itemPtr->numTags + 2;
-#else /* USE_OLD_TAG_SEARCH */
/*
* Set up an array with all the relevant objects for processing this
* event. The relevant objects are:
@@ -5181,23 +5517,17 @@ CanvasDoEvent(
}
numObjects = itemPtr->numTags + numExprs + 2;
-#endif /* not USE_OLD_TAG_SEARCH */
if (numObjects <= NUM_STATIC) {
objectPtr = staticObjects;
} else {
- objectPtr = ckalloc(numObjects * sizeof(ClientData));
+ objectPtr = (void **)ckalloc(numObjects * sizeof(void *));
}
-#ifdef USE_OLD_TAG_SEARCH
- objectPtr[0] = (ClientData) Tk_GetUid("all");
-#else /* USE_OLD_TAG_SEARCH */
- objectPtr[0] = (ClientData) searchUids->allUid;
-#endif /* USE_OLD_TAG_SEARCH */
- for (i = itemPtr->numTags-1; i >= 0; i--) {
- objectPtr[i+1] = (ClientData) itemPtr->tagPtr[i];
+ objectPtr[0] = (char *)searchUids->allUid;
+ for (i = (int)itemPtr->numTags - 1; i >= 0; i--) {
+ objectPtr[i+1] = (char *)itemPtr->tagPtr[i];
}
- objectPtr[itemPtr->numTags+1] = itemPtr;
+ objectPtr[itemPtr->numTags + 1] = itemPtr;
-#ifndef USE_OLD_TAG_SEARCH
/*
* Copy uids of matching expressions into object array
*/
@@ -5210,7 +5540,6 @@ CanvasDoEvent(
}
expr = expr->next;
}
-#endif /* not USE_OLD_TAG_SEARCH */
/*
* Invoke the binding system, then free up the object array if it was
@@ -5333,10 +5662,10 @@ static void
CanvasSelectTo(
TkCanvas *canvasPtr, /* Information about widget. */
Tk_Item *itemPtr, /* Item that is to hold selection. */
- int index) /* Index of element that is to become the
+ TkSizeT index) /* Index of element that is to become the
* "other" end of the selection. */
{
- int oldFirst, oldLast;
+ TkSizeT oldFirst, oldLast;
Tk_Item *oldSelPtr;
oldFirst = canvasPtr->textInfo.selectFirst;
@@ -5359,11 +5688,11 @@ CanvasSelectTo(
canvasPtr->textInfo.anchorItemPtr = itemPtr;
canvasPtr->textInfo.selectAnchor = index;
}
- if (canvasPtr->textInfo.selectAnchor <= index) {
+ if (canvasPtr->textInfo.selectAnchor + 1 <= index + 1) {
canvasPtr->textInfo.selectFirst = canvasPtr->textInfo.selectAnchor;
canvasPtr->textInfo.selectLast = index;
} else {
- canvasPtr->textInfo.selectFirst = index;
+ canvasPtr->textInfo.selectFirst = ((int)index < 0) ? TCL_INDEX_NONE : index;
canvasPtr->textInfo.selectLast = canvasPtr->textInfo.selectAnchor - 1;
}
if ((canvasPtr->textInfo.selectFirst != oldFirst)
@@ -5394,13 +5723,13 @@ CanvasSelectTo(
*--------------------------------------------------------------
*/
-static int
+static TkSizeT
CanvasFetchSelection(
ClientData clientData, /* Information about canvas widget. */
- int offset, /* Offset within selection of first character
+ TkSizeT offset, /* Offset within selection of first character
* to be returned. */
char *buffer, /* Location in which to place selection. */
- int maxBytes) /* Maximum number of bytes to place at buffer,
+ TkSizeT maxBytes) /* Maximum number of bytes to place at buffer,
* not including terminating NULL
* character. */
{
diff --git a/generic/tkCanvas.h b/generic/tkCanvas.h
index e2221a8..e4fb8fc 100644
--- a/generic/tkCanvas.h
+++ b/generic/tkCanvas.h
@@ -3,9 +3,9 @@
*
* Declarations shared among all the files that implement canvas widgets.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1995 Sun Microsystems, Inc.
- * Copyright (c) 1998 by Scriptics Corporation.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1995 Sun Microsystems, Inc.
+ * Copyright © 1998 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -147,7 +147,7 @@ typedef struct TkCanvas {
* currentItem is based. Must be saved so that
* if the currentItem is deleted, can pick
* another. */
- int state; /* Last known modifier state. Used to defer
+ unsigned int state; /* Last known modifier state. Used to defer
* picking a new current object while buttons
* are down. */
@@ -214,7 +214,7 @@ typedef struct TkCanvas {
* when converting coordinates. */
int flags; /* Various flags; see below for
* definitions. */
- int nextId; /* Number to use as id for next item created
+ TkSizeT nextId; /* Number to use as id for next item created
* in widget. */
Tk_PostscriptInfo psInfo; /* Pointer to information used for generating
* Postscript for the canvas. NULL means no
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index e800da9..1f4298d 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -5,8 +5,8 @@
* collection of data buffers that will be supplied on demand to
* requesting applications.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -19,12 +19,12 @@
* Prototypes for functions used only in this file:
*/
-static int ClipboardAppHandler(ClientData clientData,
- int offset, char *buffer, int maxBytes);
-static int ClipboardHandler(ClientData clientData,
- int offset, char *buffer, int maxBytes);
-static int ClipboardWindowHandler(ClientData clientData,
- int offset, char *buffer, int maxBytes);
+static TkSizeT ClipboardAppHandler(ClientData clientData,
+ TkSizeT offset, char *buffer, TkSizeT maxBytes);
+static TkSizeT ClipboardHandler(ClientData clientData,
+ TkSizeT offset, char *buffer, TkSizeT maxBytes);
+static TkSizeT ClipboardWindowHandler(ClientData clientData,
+ TkSizeT offset, char *buffer, TkSizeT maxBytes);
static void ClipboardLostSel(ClientData clientData);
static int ClipboardGetProc(ClientData clientData,
Tcl_Interp *interp, const char *portion);
@@ -48,20 +48,20 @@ static int ClipboardGetProc(ClientData clientData,
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
ClipboardHandler(
ClientData clientData, /* Information about data to fetch. */
- int offset, /* Return selection bytes starting at this
+ TkSizeT offset, /* Return selection bytes starting at this
* offset. */
char *buffer, /* Place to store converted selection. */
- int maxBytes) /* Maximum # of bytes to store at buffer. */
+ TkSizeT maxBytes) /* Maximum # of bytes to store at buffer. */
{
TkClipboardTarget *targetPtr = (TkClipboardTarget *)clientData;
TkClipboardBuffer *cbPtr;
char *srcPtr, *destPtr;
- size_t count = 0;
- int scanned = 0;
- size_t length, freeCount;
+ TkSizeT count = 0;
+ TkSizeT scanned = 0;
+ TkSizeT length, freeCount;
/*
* Skip to buffer containing offset byte
@@ -102,7 +102,7 @@ ClipboardHandler(
srcPtr = cbPtr->buffer;
length = cbPtr->length;
}
- return (int)count;
+ return count;
}
/*
@@ -126,16 +126,16 @@ ClipboardHandler(
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
ClipboardAppHandler(
ClientData clientData, /* Pointer to TkDisplay structure. */
- int offset, /* Return selection bytes starting at this
+ TkSizeT offset, /* Return selection bytes starting at this
* offset. */
char *buffer, /* Place to store converted selection. */
- int maxBytes) /* Maximum # of bytes to store at buffer. */
+ TkSizeT maxBytes) /* Maximum # of bytes to store at buffer. */
{
TkDisplay *dispPtr = (TkDisplay *)clientData;
- int length;
+ TkSizeT length;
const char *p;
p = dispPtr->clipboardAppPtr->winPtr->nameUid;
@@ -171,13 +171,13 @@ ClipboardAppHandler(
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
ClipboardWindowHandler(
TCL_UNUSED(void *), /* Not used. */
- TCL_UNUSED(int), /* Return selection bytes starting at this
+ TCL_UNUSED(TkSizeT), /* Return selection bytes starting at this
* offset. */
char *buffer, /* Place to store converted selection. */
- TCL_UNUSED(int)) /* Maximum # of bytes to store at buffer. */
+ TCL_UNUSED(TkSizeT)) /* Maximum # of bytes to store at buffer. */
{
buffer[0] = '.';
buffer[1] = 0;
@@ -450,7 +450,8 @@ Tk_ClipboardObjCmd(
"-displayof", "-format", "-type", NULL
};
enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE };
- int subIndex, length;
+ int subIndex;
+ TkSizeT length;
for (i = 2; i < objc - 1; i++) {
string = Tcl_GetStringFromObj(objv[i], &length);
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index c5f0a50..36981af 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -4,9 +4,9 @@
* This file contains a collection of Tk-related Tcl commands that didn't
* fit in any particular file of the toolkit.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2000 Scriptics Corporation.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -744,15 +744,15 @@ CaretCmd(
Tcl_ListObjAppendElement(interp, objPtr,
Tcl_NewStringObj("-height", 7));
Tcl_ListObjAppendElement(interp, objPtr,
- Tcl_NewIntObj(caretPtr->height));
+ Tcl_NewWideIntObj(caretPtr->height));
Tcl_ListObjAppendElement(interp, objPtr,
Tcl_NewStringObj("-x", 2));
Tcl_ListObjAppendElement(interp, objPtr,
- Tcl_NewIntObj(caretPtr->x));
+ Tcl_NewWideIntObj(caretPtr->x));
Tcl_ListObjAppendElement(interp, objPtr,
Tcl_NewStringObj("-y", 2));
Tcl_ListObjAppendElement(interp, objPtr,
- Tcl_NewIntObj(caretPtr->y));
+ Tcl_NewWideIntObj(caretPtr->y));
Tcl_SetObjResult(interp, objPtr);
} else if (objc == 3) {
int value;
@@ -772,7 +772,7 @@ CaretCmd(
} else /* if (index == TK_CARET_HEIGHT) -- last case */ {
value = caretPtr->height;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value));
} else {
int i, value, x = 0, y = 0, height = -1;
@@ -873,11 +873,6 @@ UseinputmethodsCmd(
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if ((objc - skip) == 2) {
- /*
- * In the case where TK_USE_INPUT_METHODS is not defined, this
- * will be ignored and we will always return 0. That will indicate
- * to the user that input methods are just not available.
- */
int boolVal;
@@ -885,13 +880,11 @@ UseinputmethodsCmd(
&boolVal) != TCL_OK) {
return TCL_ERROR;
}
-#ifdef TK_USE_INPUT_METHODS
- if (boolVal) {
+ if (boolVal && (dispPtr->inputMethod != NULL)) {
dispPtr->flags |= TK_DISPLAY_USE_IM;
} else {
dispPtr->flags &= ~TK_DISPLAY_USE_IM;
}
-#endif /* TK_USE_INPUT_METHODS */
} else if ((objc - skip) != 1) {
Tcl_WrongNumArgs(interp, 1, objv,
"?-displayof window? ?boolean?");
@@ -940,11 +933,11 @@ InactiveCmd(
return TCL_ERROR;
}
if (objc - skip == 1) {
- long inactive;
+ Tcl_WideInt inactive;
inactive = (Tcl_IsSafe(interp) ? -1 :
Tk_GetUserInactiveTime(Tk_Display(tkwin)));
- Tcl_SetObjResult(interp, Tcl_NewLongObj(inactive));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(inactive));
} else if (objc - skip == 2) {
const char *string;
@@ -1359,7 +1352,7 @@ Tk_WinfoObjCmd(
switch ((enum options) index) {
case WIN_CELLS:
Tcl_SetObjResult(interp,
- Tcl_NewIntObj(Tk_Visual(tkwin)->map_entries));
+ Tcl_NewWideIntObj(Tk_Visual(tkwin)->map_entries));
break;
case WIN_CHILDREN: {
Tcl_Obj *strPtr, *resultPtr = Tcl_NewObj();
@@ -1382,14 +1375,14 @@ Tk_WinfoObjCmd(
Tcl_NewBooleanObj(TkpCmapStressed(tkwin,Tk_Colormap(tkwin))));
break;
case WIN_DEPTH:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_Depth(tkwin)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Depth(tkwin)));
break;
case WIN_GEOMETRY:
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%dx%d+%d+%d",
Tk_Width(tkwin), Tk_Height(tkwin), Tk_X(tkwin), Tk_Y(tkwin)));
break;
case WIN_HEIGHT:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_Height(tkwin)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Height(tkwin)));
break;
case WIN_ID: {
char buf[TCL_INTEGER_SPACE];
@@ -1440,28 +1433,28 @@ Tk_WinfoObjCmd(
if (useX & useY) {
Tcl_Obj *xyObj[2];
- xyObj[0] = Tcl_NewIntObj(x);
- xyObj[1] = Tcl_NewIntObj(y);
+ xyObj[0] = Tcl_NewWideIntObj(x);
+ xyObj[1] = Tcl_NewWideIntObj(y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, xyObj));
} else if (useX) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(x));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x));
} else {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(y));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(y));
}
break;
case WIN_REQHEIGHT:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_ReqHeight(tkwin)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_ReqHeight(tkwin)));
break;
case WIN_REQWIDTH:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_ReqWidth(tkwin)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_ReqWidth(tkwin)));
break;
case WIN_ROOTX:
Tk_GetRootCoords(tkwin, &x, &y);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(x));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x));
break;
case WIN_ROOTY:
Tk_GetRootCoords(tkwin, &x, &y);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(y));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(y));
break;
case WIN_SCREEN:
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s.%d",
@@ -1469,27 +1462,27 @@ Tk_WinfoObjCmd(
break;
case WIN_SCREENCELLS:
Tcl_SetObjResult(interp,
- Tcl_NewIntObj(CellsOfScreen(Tk_Screen(tkwin))));
+ Tcl_NewWideIntObj(CellsOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENDEPTH:
Tcl_SetObjResult(interp,
- Tcl_NewIntObj(DefaultDepthOfScreen(Tk_Screen(tkwin))));
+ Tcl_NewWideIntObj(DefaultDepthOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENHEIGHT:
Tcl_SetObjResult(interp,
- Tcl_NewIntObj(HeightOfScreen(Tk_Screen(tkwin))));
+ Tcl_NewWideIntObj(HeightOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENWIDTH:
Tcl_SetObjResult(interp,
- Tcl_NewIntObj(WidthOfScreen(Tk_Screen(tkwin))));
+ Tcl_NewWideIntObj(WidthOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENMMHEIGHT:
Tcl_SetObjResult(interp,
- Tcl_NewIntObj(HeightMMOfScreen(Tk_Screen(tkwin))));
+ Tcl_NewWideIntObj(HeightMMOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENMMWIDTH:
Tcl_SetObjResult(interp,
- Tcl_NewIntObj(WidthMMOfScreen(Tk_Screen(tkwin))));
+ Tcl_NewWideIntObj(WidthMMOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENVISUAL:
c_class = DefaultVisualOfScreen(Tk_Screen(tkwin))->c_class;
@@ -1535,28 +1528,28 @@ Tk_WinfoObjCmd(
break;
case WIN_VROOTHEIGHT:
Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(height));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(height));
break;
case WIN_VROOTWIDTH:
Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(width));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(width));
break;
case WIN_VROOTX:
Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(x));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x));
break;
case WIN_VROOTY:
Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(y));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(y));
break;
case WIN_WIDTH:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_Width(tkwin)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Width(tkwin)));
break;
case WIN_X:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_X(tkwin)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_X(tkwin)));
break;
case WIN_Y:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_Y(tkwin)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Y(tkwin)));
break;
/*
@@ -1731,7 +1724,7 @@ Tk_WinfoObjCmd(
if (Tk_GetPixels(interp, tkwin, string, &pixels) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(pixels));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pixels));
break;
}
case WIN_RGB: {
@@ -1824,224 +1817,7 @@ Tk_WinfoObjCmd(
return TCL_OK;
}
-#if 0
-/*
- *----------------------------------------------------------------------
- *
- * Tk_WmObjCmd --
- *
- * This function is invoked to process the "wm" Tcl command. See the user
- * documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
- /* ARGSUSED */
-int
-Tk_WmObjCmd(
- ClientData clientData, /* Main window associated with interpreter. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[]) /* Argument objects. */
-{
- Tk_Window tkwin;
- TkWindow *winPtr;
-
- static const char *const optionStrings[] = {
- "aspect", "client", "command", "deiconify",
- "focusmodel", "frame", "geometry", "grid",
- "group", "iconbitmap", "iconify", "iconmask",
- "iconname", "iconposition", "iconwindow", "maxsize",
- "minsize", "overrideredirect", "positionfrom", "protocol",
- "resizable", "sizefrom", "state", "title",
- "tracing", "transient", "withdraw", NULL
- };
- enum options {
- TKWM_ASPECT, TKWM_CLIENT, TKWM_COMMAND, TKWM_DEICONIFY,
- TKWM_FOCUSMOD, TKWM_FRAME, TKWM_GEOMETRY, TKWM_GRID,
- TKWM_GROUP, TKWM_ICONBMP, TKWM_ICONIFY, TKWM_ICONMASK,
- TKWM_ICONNAME, TKWM_ICONPOS, TKWM_ICONWIN, TKWM_MAXSIZE,
- TKWM_MINSIZE, TKWM_OVERRIDE, TKWM_POSFROM, TKWM_PROTOCOL,
- TKWM_RESIZABLE, TKWM_SIZEFROM, TKWM_STATE, TKWM_TITLE,
- TKWM_TRACING, TKWM_TRANSIENT, TKWM_WITHDRAW
- };
-
- tkwin = (Tk_Window) clientData;
-
- if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg?");
- return TCL_ERROR;
- }
- if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
-
- if (index == TKWM_TRACING) {
- int wmTracing;
- TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
-
- if ((objc != 2) && (objc != 3)) {
- Tcl_WrongNumArgs(interp, 1, objv, "tracing ?boolean?");
- return TCL_ERROR;
- }
- if (objc == 2) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- dispPtr->flags & TK_DISPLAY_WM_TRACING));
- return TCL_OK;
- }
- if (Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing) != TCL_OK) {
- return TCL_ERROR;
- }
- if (wmTracing) {
- dispPtr->flags |= TK_DISPLAY_WM_TRACING;
- } else {
- dispPtr->flags &= ~TK_DISPLAY_WM_TRACING;
- }
- return TCL_OK;
- }
-
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?arg?");
- return TCL_ERROR;
- }
-
- winPtr = (TkWindow *) Tk_NameToWindow(interp,
- Tcl_GetString(objv[2]), tkwin);
- if (winPtr == NULL) {
- return TCL_ERROR;
- }
- if (!(winPtr->flags & TK_TOP_LEVEL)) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "window \"%s\" isn't a top-level window", winPtr->pathName));
- Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TOPLEVEL", winPtr->pathName,
- NULL);
- return TCL_ERROR;
- }
- switch ((enum options) index) {
- case TKWM_ASPECT:
- TkpWmAspectCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_CLIENT:
- TkpWmClientCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_COMMAND:
- TkpWmCommandCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_DEICONIFY:
- TkpWmDeiconifyCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_FOCUSMOD:
- TkpWmFocusmodCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_FRAME:
- TkpWmFrameCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_GEOMETRY:
- TkpWmGeometryCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_GRID:
- TkpWmGridCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_GROUP:
- TkpWmGroupCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_ICONBMP:
- TkpWmIconbitmapCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_ICONIFY:
- TkpWmIconifyCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_ICONMASK:
- TkpWmIconmaskCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_ICONNAME:
- /*
- * Slight Unix variation.
- */
- TkpWmIconnameCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_ICONPOS:
- /*
- * nearly same - 1 line more on Unix.
- */
- TkpWmIconpositionCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_ICONWIN:
- TkpWmIconwindowCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_MAXSIZE:
- /*
- * Nearly same, win diffs.
- */
- TkpWmMaxsizeCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_MINSIZE:
- /*
- * Nearly same, win diffs
- */
- TkpWmMinsizeCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_OVERRIDE:
- /*
- * Almost same.
- */
- TkpWmOverrideCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_POSFROM:
- /*
- * Equal across platforms
- */
- TkpWmPositionfromCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_PROTOCOL:
- /*
- * Equal across platforms
- */
- TkpWmProtocolCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_RESIZABLE:
- /*
- * Almost same
- */
- TkpWmResizableCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_SIZEFROM:
- /*
- * Equal across platforms
- */
- TkpWmSizefromCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_STATE:
- TkpWmStateCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_TITLE:
- TkpWmTitleCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_TRANSIENT:
- TkpWmTransientCmd(interp, tkwin, winPtr, objc, objv);
- break;
- case TKWM_WITHDRAW:
- TkpWmWithdrawCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
-
- updateGeom:
- if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
- wmPtr->flags |= WM_UPDATE_PENDING;
- }
- return TCL_OK;
-}
-#endif
-
/*
*----------------------------------------------------------------------
*
@@ -2083,7 +1859,7 @@ TkGetDisplayOf(
* present. */
{
const char *string;
- int length;
+ TkSizeT length;
if (objc < 1) {
return 0;
diff --git a/generic/tkColor.c b/generic/tkColor.c
index 6b6405a..0f57b8c 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -5,8 +5,8 @@
* order to avoid round-trips to the server to map color names to pixel
* values.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -818,9 +818,9 @@ TkDebugColor(
Tcl_Obj *objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(tkColPtr->resourceRefCount));
+ Tcl_NewWideIntObj(tkColPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(tkColPtr->objRefCount));
+ Tcl_NewWideIntObj(tkColPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
diff --git a/generic/tkColor.h b/generic/tkColor.h
index 54e8cdc..59344c1 100644
--- a/generic/tkColor.h
+++ b/generic/tkColor.h
@@ -3,7 +3,7 @@
*
* Declarations of data types and functions used by the Tk color module.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -38,7 +38,7 @@ typedef struct TkColor {
Colormap colormap; /* Colormap from which this entry was
* allocated. */
Visual *visual; /* Visual associated with colormap. */
- int resourceRefCount; /* Number of active uses of this color (each
+ TkSizeT resourceRefCount; /* Number of active uses of this color (each
* active use corresponds to a call to
* Tk_AllocColorFromObj or Tk_GetColor). If
* this count is 0, then this TkColor
@@ -48,7 +48,7 @@ typedef struct TkColor {
* referring to it. The structure is freed
* when resourceRefCount and objRefCount are
* both 0. */
- int objRefCount; /* The number of Tcl objects that reference
+ TkSizeT objRefCount; /* The number of Tcl objects that reference
* this structure. */
int type; /* TK_COLOR_BY_NAME or TK_COLOR_BY_VALUE. */
Tcl_HashEntry *hashPtr; /* Pointer to hash table entry for this
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 6a0ffd8..a3ccb50 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -4,7 +4,7 @@
* This file contains functions that manage configuration options for
* widgets and other things.
*
- * Copyright (c) 1997-1998 Sun Microsystems, Inc.
+ * Copyright © 1997-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -91,7 +91,7 @@ typedef struct TkOption {
*/
typedef struct OptionTable {
- int refCount; /* Counts the number of uses of this table
+ size_t refCount; /* Counts the number of uses of this table
* (the number of times Tk_CreateOptionTable
* has returned it). This can be greater than
* 1 if it is shared along several option
@@ -103,7 +103,7 @@ typedef struct OptionTable {
* templates, this points to the table
* corresponding to the next template in the
* chain. */
- int numOptions; /* The number of items in the options array
+ size_t numOptions; /* The number of items in the options array
* below. */
Option options[1]; /* Information about the individual options in
* the table. This must be the last field in
@@ -115,14 +115,14 @@ typedef struct OptionTable {
* Forward declarations for functions defined later in this file:
*/
-static int DoObjConfig(Tcl_Interp *interp, char *recordPtr,
+static int DoObjConfig(Tcl_Interp *interp, void *recordPtr,
Option *optionPtr, Tcl_Obj *valuePtr,
Tk_Window tkwin, Tk_SavedOption *savePtr);
static void FreeResources(Option *optionPtr, Tcl_Obj *objPtr,
- char *internalPtr, Tk_Window tkwin);
-static Tcl_Obj * GetConfigList(char *recordPtr,
+ void *internalPtr, Tk_Window tkwin);
+static Tcl_Obj * GetConfigList(void *recordPtr,
Option *optionPtr, Tk_Window tkwin);
-static Tcl_Obj * GetObjectForOption(char *recordPtr,
+static Tcl_Obj * GetObjectForOption(void *recordPtr,
Option *optionPtr, Tk_Window tkwin);
static Option * GetOption(const char *name, OptionTable *tablePtr);
static Option * GetOptionFromObj(Tcl_Interp *interp,
@@ -177,7 +177,7 @@ Tk_CreateOptionTable(
OptionTable *tablePtr;
const Tk_OptionSpec *specPtr, *specPtr2;
Option *optionPtr;
- int numOptions, i;
+ size_t numOptions, i;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -279,7 +279,7 @@ Tk_CreateOptionTable(
}
}
if (((specPtr->type == TK_OPTION_STRING)
- && (specPtr->internalOffset >= 0))
+ && (specPtr->internalOffset != TCL_INDEX_NONE))
|| (specPtr->type == TK_OPTION_COLOR)
|| (specPtr->type == TK_OPTION_FONT)
|| (specPtr->type == TK_OPTION_BITMAP)
@@ -330,7 +330,7 @@ Tk_DeleteOptionTable(
{
OptionTable *tablePtr = (OptionTable *) optionTable;
Option *optionPtr;
- int count;
+ size_t count;
if (tablePtr->refCount-- > 1) {
return;
@@ -381,7 +381,7 @@ int
Tk_InitOptions(
Tcl_Interp *interp, /* Interpreter for error reporting. NULL means
* don't leave an error message. */
- char *recordPtr, /* Pointer to the record to configure. Note:
+ void *recordPtr, /* Pointer to the record to configure. Note:
* the caller should have properly initialized
* the record with NULL pointers for each
* option value. */
@@ -552,7 +552,7 @@ DoObjConfig(
Tcl_Interp *interp, /* Interpreter for error reporting. If NULL,
* then no message is left if an error
* occurs. */
- char *recordPtr, /* The record to modify to hold the new option
+ void *recordPtr, /* The record to modify to hold the new option
* value. */
Option *optionPtr, /* Pointer to information about the option. */
Tcl_Obj *valuePtr, /* New value for option. */
@@ -568,10 +568,10 @@ DoObjConfig(
* free the old value). */
{
Tcl_Obj **slotPtrPtr, *oldPtr;
- char *internalPtr; /* Points to location in record where internal
+ void *internalPtr; /* Points to location in record where internal
* representation of value should be stored,
* or NULL. */
- char *oldInternalPtr; /* Points to location in which to save old
+ void *oldInternalPtr; /* Points to location in which to save old
* internal representation of value. */
Tk_SavedOption internal; /* Used to save the old internal
* representation of the value if
@@ -584,8 +584,8 @@ DoObjConfig(
*/
specPtr = optionPtr->specPtr;
- if (specPtr->objOffset >= 0) {
- slotPtrPtr = (Tcl_Obj **) (recordPtr + specPtr->objOffset);
+ if (specPtr->objOffset != TCL_INDEX_NONE) {
+ slotPtrPtr = (Tcl_Obj **) ((char *)recordPtr + specPtr->objOffset);
oldPtr = *slotPtrPtr;
} else {
slotPtrPtr = NULL;
@@ -597,8 +597,8 @@ DoObjConfig(
* object and internal forms, if they exist.
*/
- if (specPtr->internalOffset >= 0) {
- internalPtr = recordPtr + specPtr->internalOffset;
+ if (specPtr->internalOffset != TCL_INDEX_NONE) {
+ internalPtr = (char *)recordPtr + specPtr->internalOffset;
} else {
internalPtr = NULL;
}
@@ -656,7 +656,7 @@ DoObjConfig(
case TK_OPTION_STRING: {
char *newStr;
const char *value;
- int length;
+ TkSizeT length;
if (nullOK && ObjectIsEmpty(valuePtr)) {
valuePtr = NULL;
@@ -883,7 +883,7 @@ DoObjConfig(
const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
if (custom->setProc(custom->clientData, interp, tkwin,
- &valuePtr, recordPtr, optionPtr->specPtr->internalOffset,
+ &valuePtr, (char *)recordPtr, optionPtr->specPtr->internalOffset,
(char *)oldInternalPtr, optionPtr->specPtr->flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -979,7 +979,7 @@ GetOption(
Option *bestPtr, *optionPtr;
OptionTable *tablePtr2;
const char *p1, *p2;
- int count;
+ size_t count;
/*
* Search through all of the option tables in the chain to find the best
@@ -1227,7 +1227,7 @@ int
Tk_SetOptions(
Tcl_Interp *interp, /* Interpreter for error reporting. If NULL,
* then no error message is returned.*/
- char *recordPtr, /* The record to configure. */
+ void *recordPtr, /* The record to configure. */
Tk_OptionTable optionTable, /* Describes valid options. */
int objc, /* The number of elements in objv. */
Tcl_Obj *const objv[], /* Contains one or more name-value pairs. */
@@ -1345,12 +1345,12 @@ Tk_RestoreSavedOptions(
Tk_SavedOptions *savePtr) /* Holds saved option information; must have
* been passed to Tk_SetOptions. */
{
- int i;
+ size_t i;
Option *optionPtr;
Tcl_Obj *newPtr; /* New object value of option, which we
* replace with old value and free. Taken from
* record. */
- char *internalPtr; /* Points to internal value of option in
+ void *internalPtr; /* Points to internal value of option in
* record. */
const Tk_OptionSpec *specPtr;
@@ -1365,7 +1365,7 @@ Tk_RestoreSavedOptions(
ckfree(savePtr->nextPtr);
savePtr->nextPtr = NULL;
}
- for (i = savePtr->numItems - 1; i >= 0; i--) {
+ for (i = savePtr->numItems - 1; i != (size_t)-1; i--) {
optionPtr = savePtr->items[i].optionPtr;
specPtr = optionPtr->specPtr;
@@ -1374,13 +1374,13 @@ Tk_RestoreSavedOptions(
* record.
*/
- if (specPtr->objOffset >= 0) {
- newPtr = *((Tcl_Obj **) (savePtr->recordPtr + specPtr->objOffset));
+ if (specPtr->objOffset != TCL_INDEX_NONE) {
+ newPtr = *((Tcl_Obj **) ((char *)savePtr->recordPtr + specPtr->objOffset));
} else {
newPtr = NULL;
}
- if (specPtr->internalOffset >= 0) {
- internalPtr = savePtr->recordPtr + specPtr->internalOffset;
+ if (specPtr->internalOffset != TCL_INDEX_NONE) {
+ internalPtr = (char *)savePtr->recordPtr + specPtr->internalOffset;
} else {
internalPtr = NULL;
}
@@ -1395,18 +1395,16 @@ Tk_RestoreSavedOptions(
* Now restore the old value of the option.
*/
- if (specPtr->objOffset >= 0) {
- *((Tcl_Obj **) (savePtr->recordPtr + specPtr->objOffset))
+ if (specPtr->objOffset != TCL_INDEX_NONE) {
+ *((Tcl_Obj **) ((char *)savePtr->recordPtr + specPtr->objOffset))
= savePtr->items[i].valuePtr;
}
- if (specPtr->internalOffset >= 0) {
+ if (specPtr->internalOffset != TCL_INDEX_NONE) {
char *ptr = (char *) &savePtr->items[i].internalForm;
CLANG_ASSERT(internalPtr);
switch (specPtr->type) {
case TK_OPTION_BOOLEAN:
- *((int *) internalPtr) = *((int *) ptr);
- break;
case TK_OPTION_INT:
*((int *) internalPtr) = *((int *) ptr);
break;
@@ -1458,7 +1456,7 @@ Tk_RestoreSavedOptions(
if (custom->restoreProc != NULL) {
custom->restoreProc(custom->clientData, savePtr->tkwin,
- internalPtr, ptr);
+ (char *)internalPtr, ptr);
}
break;
}
@@ -1492,7 +1490,7 @@ Tk_FreeSavedOptions(
Tk_SavedOptions *savePtr) /* Contains options saved in a previous call
* to Tk_SetOptions. */
{
- int count;
+ size_t count;
Tk_SavedOption *savedOptionPtr;
if (savePtr->nextPtr != NULL) {
@@ -1530,7 +1528,7 @@ Tk_FreeSavedOptions(
void
Tk_FreeConfigOptions(
- char *recordPtr, /* Record whose fields contain current values
+ void *recordPtr, /* Record whose fields contain current values
* for options. */
Tk_OptionTable optionTable, /* Describes legal options. */
Tk_Window tkwin) /* Window associated with recordPtr; needed
@@ -1538,9 +1536,9 @@ Tk_FreeConfigOptions(
{
OptionTable *tablePtr;
Option *optionPtr;
- int count;
+ size_t count;
Tcl_Obj **oldPtrPtr, *oldPtr;
- char *oldInternalPtr;
+ void *oldInternalPtr;
const Tk_OptionSpec *specPtr;
for (tablePtr = (OptionTable *) optionTable; tablePtr != NULL;
@@ -1551,15 +1549,15 @@ Tk_FreeConfigOptions(
if (specPtr->type == TK_OPTION_SYNONYM) {
continue;
}
- if (specPtr->objOffset >= 0) {
- oldPtrPtr = (Tcl_Obj **) (recordPtr + specPtr->objOffset);
+ if (specPtr->objOffset != TCL_INDEX_NONE) {
+ oldPtrPtr = (Tcl_Obj **) ((char *)recordPtr + specPtr->objOffset);
oldPtr = *oldPtrPtr;
*oldPtrPtr = NULL;
} else {
oldPtr = NULL;
}
- if (specPtr->internalOffset >= 0) {
- oldInternalPtr = recordPtr + specPtr->internalOffset;
+ if (specPtr->internalOffset != TCL_INDEX_NONE) {
+ oldInternalPtr = (char *)recordPtr + specPtr->internalOffset;
} else {
oldInternalPtr = NULL;
}
@@ -1596,10 +1594,10 @@ FreeResources(
Option *optionPtr, /* Description of the configuration option. */
Tcl_Obj *objPtr, /* The current value of the option, specified
* as an object. */
- char *internalPtr, /* A pointer to an internal representation for
+ void *internalPtr, /* A pointer to an internal representation for
* the option's value, such as an int or
* (XColor *). Only valid if
- * optionPtr->specPtr->internalOffset >= 0. */
+ * optionPtr->specPtr->internalOffset != -1. */
Tk_Window tkwin) /* The window in which this option is used. */
{
int internalFormExists;
@@ -1610,7 +1608,7 @@ FreeResources(
* form, then use the object form.
*/
- internalFormExists = optionPtr->specPtr->internalOffset >= 0;
+ internalFormExists = optionPtr->specPtr->internalOffset != TCL_INDEX_NONE;
switch (optionPtr->specPtr->type) {
case TK_OPTION_STRING:
if (internalFormExists) {
@@ -1642,8 +1640,6 @@ FreeResources(
if (internalFormExists) {
Tk_FreeStyle(*((Tk_Style *) internalPtr));
*((Tk_Style *) internalPtr) = NULL;
- } else if (objPtr != NULL) {
- Tk_FreeStyleFromObj(objPtr);
}
break;
case TK_OPTION_BITMAP:
@@ -1679,7 +1675,7 @@ FreeResources(
case TK_OPTION_CUSTOM: {
const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
if (internalFormExists && custom->freeProc != NULL) {
- custom->freeProc(custom->clientData, tkwin, internalPtr);
+ custom->freeProc(custom->clientData, tkwin, (char *)internalPtr);
}
break;
}
@@ -1718,7 +1714,7 @@ Tcl_Obj *
Tk_GetOptionInfo(
Tcl_Interp *interp, /* Interpreter for error reporting. If NULL,
* then no error message is created. */
- char *recordPtr, /* Record whose fields contain current values
+ void *recordPtr, /* Record whose fields contain current values
* for options. */
Tk_OptionTable optionTable, /* Describes all the legal options. */
Tcl_Obj *namePtr, /* If non-NULL, the string value selects a
@@ -1732,7 +1728,7 @@ Tk_GetOptionInfo(
Tcl_Obj *resultPtr;
OptionTable *tablePtr = (OptionTable *) optionTable;
Option *optionPtr;
- int count;
+ size_t count;
/*
* If information is only wanted for a single configuration spec, then
@@ -1786,7 +1782,7 @@ Tk_GetOptionInfo(
static Tcl_Obj *
GetConfigList(
- char *recordPtr, /* Pointer to record holding current values of
+ void *recordPtr, /* Pointer to record holding current values of
* configuration options. */
Option *optionPtr, /* Pointer to information describing a
* particular option. */
@@ -1829,8 +1825,8 @@ GetConfigList(
}
Tcl_ListObjAppendElement(NULL, listPtr, elementPtr);
- if (optionPtr->specPtr->objOffset >= 0) {
- elementPtr = *((Tcl_Obj **) (recordPtr
+ if (optionPtr->specPtr->objOffset != TCL_INDEX_NONE) {
+ elementPtr = *((Tcl_Obj **) ((char *)recordPtr
+ optionPtr->specPtr->objOffset));
if (elementPtr == NULL) {
elementPtr = Tcl_NewObj();
@@ -1864,7 +1860,7 @@ GetConfigList(
static Tcl_Obj *
GetObjectForOption(
- char *recordPtr, /* Pointer to record holding current values of
+ void *recordPtr, /* Pointer to record holding current values of
* configuration options. */
Option *optionPtr, /* Pointer to information describing an option
* whose internal value is stored in
@@ -1872,109 +1868,109 @@ GetObjectForOption(
Tk_Window tkwin) /* Window corresponding to recordPtr. */
{
Tcl_Obj *objPtr;
- char *internalPtr; /* Points to internal value of option in
+ void *internalPtr; /* Points to internal value of option in
* record. */
- internalPtr = recordPtr + optionPtr->specPtr->internalOffset;
objPtr = NULL;
- switch (optionPtr->specPtr->type) {
- case TK_OPTION_BOOLEAN:
- objPtr = Tcl_NewIntObj(*((int *)internalPtr));
- break;
- case TK_OPTION_INT:
- objPtr = Tcl_NewIntObj(*((int *)internalPtr));
- break;
- case TK_OPTION_DOUBLE:
- objPtr = Tcl_NewDoubleObj(*((double *)internalPtr));
- break;
- case TK_OPTION_STRING:
- objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1);
- break;
- case TK_OPTION_STRING_TABLE:
- objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
- *((int *) internalPtr)], -1);
- break;
- case TK_OPTION_COLOR: {
- XColor *colorPtr = *((XColor **)internalPtr);
+ if (optionPtr->specPtr->internalOffset != TCL_INDEX_NONE) {
+ internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset;
+ switch (optionPtr->specPtr->type) {
+ case TK_OPTION_BOOLEAN:
+ case TK_OPTION_INT:
+ objPtr = Tcl_NewWideIntObj(*((int *)internalPtr));
+ break;
+ case TK_OPTION_DOUBLE:
+ objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
+ break;
+ case TK_OPTION_STRING:
+ objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1);
+ break;
+ case TK_OPTION_STRING_TABLE:
+ objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
+ *((int *) internalPtr)], -1);
+ break;
+ case TK_OPTION_COLOR: {
+ XColor *colorPtr = *((XColor **)internalPtr);
- if (colorPtr != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
+ if (colorPtr != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_FONT: {
- Tk_Font tkfont = *((Tk_Font *)internalPtr);
+ case TK_OPTION_FONT: {
+ Tk_Font tkfont = *((Tk_Font *)internalPtr);
- if (tkfont != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
+ if (tkfont != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_STYLE: {
- Tk_Style style = *((Tk_Style *)internalPtr);
+ case TK_OPTION_STYLE: {
+ Tk_Style style = *((Tk_Style *)internalPtr);
- if (style != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
+ if (style != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_BITMAP: {
- Pixmap pixmap = *((Pixmap *)internalPtr);
+ case TK_OPTION_BITMAP: {
+ Pixmap pixmap = *((Pixmap *)internalPtr);
- if (pixmap != None) {
- objPtr = Tcl_NewStringObj(
+ if (pixmap != None) {
+ objPtr = Tcl_NewStringObj(
Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_BORDER: {
- Tk_3DBorder border = *((Tk_3DBorder *)internalPtr);
+ case TK_OPTION_BORDER: {
+ Tk_3DBorder border = *((Tk_3DBorder *)internalPtr);
- if (border != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
+ if (border != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_RELIEF:
- objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1);
- break;
- case TK_OPTION_CURSOR: {
- Tk_Cursor cursor = *((Tk_Cursor *)internalPtr);
+ case TK_OPTION_RELIEF:
+ objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1);
+ break;
+ case TK_OPTION_CURSOR: {
+ Tk_Cursor cursor = *((Tk_Cursor *)internalPtr);
- if (cursor != NULL) {
- objPtr = Tcl_NewStringObj(
- Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
+ if (cursor != NULL) {
+ objPtr = Tcl_NewStringObj(
+ Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_JUSTIFY:
- objPtr = Tcl_NewStringObj(Tk_NameOfJustify(
- *((Tk_Justify *)internalPtr)), -1);
- break;
- case TK_OPTION_ANCHOR:
- objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(
- *((Tk_Anchor *) internalPtr)), -1);
- break;
- case TK_OPTION_PIXELS:
- objPtr = Tcl_NewIntObj(*((int *)internalPtr));
- break;
- case TK_OPTION_WINDOW: {
- tkwin = *((Tk_Window *)internalPtr);
+ case TK_OPTION_JUSTIFY:
+ objPtr = Tcl_NewStringObj(Tk_NameOfJustify(
+ *((Tk_Justify *)internalPtr)), -1);
+ break;
+ case TK_OPTION_ANCHOR:
+ objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(
+ *((Tk_Anchor *)internalPtr)), -1);
+ break;
+ case TK_OPTION_PIXELS:
+ objPtr = Tcl_NewWideIntObj(*((int *)internalPtr));
+ break;
+ case TK_OPTION_WINDOW: {
+ tkwin = *((Tk_Window *) internalPtr);
- if (tkwin != NULL) {
- objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
+ if (tkwin != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_CUSTOM: {
- const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
+ case TK_OPTION_CUSTOM: {
+ const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
- objPtr = custom->getProc(custom->clientData, tkwin, recordPtr,
- optionPtr->specPtr->internalOffset);
- break;
- }
- default:
- Tcl_Panic("bad option type in GetObjectForOption");
+ objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr,
+ optionPtr->specPtr->internalOffset);
+ break;
+ }
+ default:
+ Tcl_Panic("bad option type in GetObjectForOption");
+ }
}
if (objPtr == NULL) {
objPtr = Tcl_NewObj();
@@ -2006,7 +2002,7 @@ Tk_GetOptionValue(
Tcl_Interp *interp, /* Interpreter for error reporting. If NULL
* then no messages are provided for
* errors. */
- char *recordPtr, /* Record whose fields contain current values
+ void *recordPtr, /* Record whose fields contain current values
* for options. */
Tk_OptionTable optionTable, /* Describes legal options. */
Tcl_Obj *namePtr, /* Gives the command-line name for the option
@@ -2024,8 +2020,8 @@ Tk_GetOptionValue(
if (optionPtr->specPtr->type == TK_OPTION_SYNONYM) {
optionPtr = optionPtr->extra.synonymPtr;
}
- if (optionPtr->specPtr->objOffset >= 0) {
- resultPtr = *((Tcl_Obj **) (recordPtr+optionPtr->specPtr->objOffset));
+ if (optionPtr->specPtr->objOffset != TCL_INDEX_NONE) {
+ resultPtr = *((Tcl_Obj **) ((char *)recordPtr+optionPtr->specPtr->objOffset));
if (resultPtr == NULL) {
/*
* This option has a null value and is represented by a null
@@ -2095,9 +2091,9 @@ TkDebugConfig(
if (tablePtr == (OptionTable *) Tcl_GetHashValue(hashEntryPtr)) {
for ( ; tablePtr != NULL; tablePtr = tablePtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(tablePtr->refCount));
+ Tcl_NewWideIntObj(tablePtr->refCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(tablePtr->numOptions));
+ Tcl_NewWideIntObj(tablePtr->numOptions));
Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj(
tablePtr->options[0].specPtr->optionName, -1));
}
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 095d132..15f4490 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -5,7 +5,7 @@
* have access to a console. It uses the Text widget and provides special
* access via a console command.
*
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * Copyright © 1995-1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -24,7 +24,7 @@
typedef struct ConsoleInfo {
Tcl_Interp *consoleInterp; /* Interpreter displaying the console. */
Tcl_Interp *interp; /* Interpreter controlled by console. */
- int refCount;
+ size_t refCount;
} ConsoleInfo;
/*
@@ -68,7 +68,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp,
static const Tcl_ChannelType consoleChannelType = {
"console", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
- ConsoleClose, /* Close proc. */
+ (Tcl_DriverCloseProc *)ConsoleClose, /* Close proc. */
ConsoleInput, /* Input proc. */
ConsoleOutput, /* Output proc. */
NULL, /* Seek proc. */
@@ -224,7 +224,7 @@ Tk_InitConsoleChannels(
* Ensure that we are getting a compatible version of Tcl.
*/
- if (Tcl_InitStubs(interp, "8.6", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
return;
}
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 902472b..5849706 100644
--- a/generic/tkCursor.c
+++ b/generic/tkCursor.c
@@ -5,8 +5,8 @@
* toolkit. This allows cursors to be shared between widgets and also
* avoids round-trips to the X server.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -428,7 +428,7 @@ Tk_NameOfCursor(
sprintf(dispPtr->cursorString, "cursor id 0x%" TCL_Z_MODIFIER "x", (size_t)cursor);
return dispPtr->cursorString;
}
- idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor);
+ idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, cursor);
if (idHashPtr == NULL) {
goto printid;
}
@@ -517,7 +517,7 @@ Tk_FreeCursor(
Tcl_Panic("Tk_FreeCursor called before Tk_GetCursor");
}
- idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor);
+ idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, cursor);
if (idHashPtr == NULL) {
Tcl_Panic("Tk_FreeCursor received unknown cursor argument");
}
@@ -862,9 +862,9 @@ TkDebugCursor(
for ( ; (cursorPtr != NULL); cursorPtr = cursorPtr->nextPtr) {
objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(cursorPtr->resourceRefCount));
+ Tcl_NewWideIntObj(cursorPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(cursorPtr->objRefCount));
+ Tcl_NewWideIntObj(cursorPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
diff --git a/generic/tkDList.h b/generic/tkDList.h
index 2448439..f6c70d9 100644
--- a/generic/tkDList.h
+++ b/generic/tkDList.h
@@ -7,7 +7,7 @@
* before or after an existing element or at the head/tail of the list.
* A list may be traversed in the forward or backward direction.
*
- * Copyright (c) 2018 by Gregor Cramer.
+ * Copyright © 2018 Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -28,8 +28,8 @@
* MyList listHdr = TK_DLIST_LIST_INITIALIZER; // or MyList_Init(&listHdr)
* MyListEntry *p;
* int i = 0;
- * MyList_Append(&listHdr, ckalloc(sizeof(MyListEntry)));
- * MyList_Append(&listHdr, ckalloc(sizeof(MyListEntry)));
+ * MyList_Append(&listHdr, (MyListEntry *)ckalloc(sizeof(MyListEntry)));
+ * MyList_Append(&listHdr, (MyListEntry *)ckalloc(sizeof(MyListEntry)));
* TK_DLIST_FOREACH(p, &listHdr) { p->value = i++; }
* // ...
* MyList_RemoveHead(&listHdr);
@@ -361,9 +361,9 @@ LT##_Prepend(LT *head, struct ElemType *elem) \
{ \
assert(head); \
assert(elem); \
- elem->_dl_.prev = (void *) head; \
+ elem->_dl_.prev = (PSEntry *) head; \
if (!head->first) { \
- elem->_dl_.next = (void *) head; \
+ elem->_dl_.next = (PSEntry *) head; \
head->last = elem; \
} else { \
elem->_dl_.next = head->first; \
@@ -378,9 +378,9 @@ LT##_Append(LT *head, struct ElemType *elem) \
{ \
assert(head); \
assert(elem); \
- elem->_dl_.next = (void *) head; \
+ elem->_dl_.next = (PSEntry *) head; \
if (!head->first) { \
- elem->_dl_.prev = (void *) head; \
+ elem->_dl_.prev = (PSEntry *) head; \
head->first = elem; \
} else { \
elem->_dl_.prev = head->last; \
@@ -402,9 +402,9 @@ LT##_Move(LT *dst, LT *src) \
dst->last = src->last; \
} else { \
*dst = *src; \
- dst->first->_dl_.prev = (void *) dst; \
+ dst->first->_dl_.prev = (PSEntry *) dst; \
} \
- dst->last->_dl_.next = (void *) dst; \
+ dst->last->_dl_.next = (PSEntry *) dst; \
LT##_Init(src); \
} \
} \
@@ -528,11 +528,11 @@ LT##_Traverse(LT *head, LT##_Func func) \
#define TK_DLIST_FOREACH(var, head) \
assert(head); \
- for (var = head->first ? head->first : (void *) head; var != (void *) head; var = var->_dl_.next)
+ for (var = head->first ? head->first : (PSEntry *) head; var != (PSEntry *) head; var = var->_dl_.next)
#define TK_DLIST_FOREACH_REVERSE(var, head) \
assert(head); \
- for (var = head->last ? head->last : (void *) head; var != (void *) head; var = var->_dl_.prev)
+ for (var = head->last ? head->last : (PSEntry *) head; var != (PSEntry *) head; var = var->_dl_.prev)
#endif /* TK_DLIST_DEFINED */
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index 2072930..b7b0c14 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -3,7 +3,7 @@
*
* Declarations of functions in the platform independent public Tcl API.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -17,6 +17,14 @@
#define TCL_STORAGE_CLASS DLLEXPORT
#endif
+#if !defined(BUILD_tk)
+# define TK_DEPRECATED(msg) EXTERN TCL_DEPRECATED_API(msg)
+#elif defined(TK_NO_DEPRECATED)
+# define TK_DEPRECATED(msg) MODULE_SCOPE
+#else
+# define TK_DEPRECATED(msg) EXTERN
+#endif
+
/*
* WARNING: This file is automatically generated by the tools/genStubs.tcl
* script. Any modifications to the function declarations below should be made
@@ -95,7 +103,7 @@ EXTERN int Tk_CanvasTagsParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *widgRec, int offset);
/* 19 */
-EXTERN CONST86 char * Tk_CanvasTagsPrintProc(ClientData clientData,
+EXTERN const char * Tk_CanvasTagsPrintProc(ClientData clientData,
Tk_Window tkwin, char *widgRec, int offset,
Tcl_FreeProc **freeProcPtr);
/* 20 */
@@ -133,7 +141,7 @@ EXTERN int Tk_ConfigureValue(Tcl_Interp *interp,
/* 29 */
EXTERN int Tk_ConfigureWidget(Tcl_Interp *interp,
Tk_Window tkwin, const Tk_ConfigSpec *specs,
- int argc, CONST84 char **argv, char *widgRec,
+ int argc, const char **argv, char *widgRec,
int flags);
/* 30 */
EXTERN void Tk_ConfigureWindow(Tk_Window tkwin,
@@ -215,7 +223,7 @@ EXTERN void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection,
/* 54 */
EXTERN void Tk_DestroyWindow(Tk_Window tkwin);
/* 55 */
-EXTERN CONST84_RETURN char * Tk_DisplayName(Tk_Window tkwin);
+EXTERN const char * Tk_DisplayName(Tk_Window tkwin);
/* 56 */
EXTERN int Tk_DistanceToTextLayout(Tk_TextLayout layout, int x,
int y);
@@ -281,7 +289,8 @@ EXTERN void Tk_FreePixmap(Display *display, Pixmap pixmap);
/* 76 */
EXTERN void Tk_FreeTextLayout(Tk_TextLayout textLayout);
/* 77 */
-EXTERN void Tk_FreeXId(Display *display, XID xid);
+TK_DEPRECATED("function does nothing, call can be removed")
+void Tk_FreeXId(Display *display, XID xid);
/* 78 */
EXTERN GC Tk_GCForColor(XColor *colorPtr, Drawable drawable);
/* 79 */
@@ -298,9 +307,9 @@ EXTERN void Tk_GetAllBindings(Tcl_Interp *interp,
EXTERN int Tk_GetAnchor(Tcl_Interp *interp, const char *str,
Tk_Anchor *anchorPtr);
/* 83 */
-EXTERN CONST84_RETURN char * Tk_GetAtomName(Tk_Window tkwin, Atom atom);
+EXTERN const char * Tk_GetAtomName(Tk_Window tkwin, Atom atom);
/* 84 */
-EXTERN CONST84_RETURN char * Tk_GetBinding(Tcl_Interp *interp,
+EXTERN const char * Tk_GetBinding(Tcl_Interp *interp,
Tk_BindingTable bindingTable,
ClientData object, const char *eventStr);
/* 85 */
@@ -346,9 +355,9 @@ EXTERN Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin,
Tk_ImageChangedProc *changeProc,
ClientData clientData);
/* 98 */
-EXTERN ClientData Tk_GetImageMasterData(Tcl_Interp *interp,
+EXTERN ClientData Tk_GetImageModelData(Tcl_Interp *interp,
const char *name,
- CONST86 Tk_ImageType **typePtrPtr);
+ const Tk_ImageType **typePtrPtr);
/* 99 */
EXTERN Tk_ItemType * Tk_GetItemTypes(void);
/* 100 */
@@ -376,7 +385,7 @@ EXTERN void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr,
int *yPtr);
/* 108 */
EXTERN int Tk_GetScrollInfo(Tcl_Interp *interp, int argc,
- CONST84 char **argv, double *dblPtr,
+ const char **argv, double *dblPtr,
int *intPtr);
/* 109 */
EXTERN int Tk_GetScreenMM(Tcl_Interp *interp, Tk_Window tkwin,
@@ -402,7 +411,7 @@ EXTERN void Tk_HandleEvent(XEvent *eventPtr);
/* 116 */
EXTERN Tk_Window Tk_IdToWindow(Display *display, Window window);
/* 117 */
-EXTERN void Tk_ImageChanged(Tk_ImageMaster model, int x, int y,
+EXTERN void Tk_ImageChanged(Tk_ImageModel model, int x, int y,
int width, int height, int imageWidth,
int imageHeight);
/* 118 */
@@ -438,28 +447,27 @@ EXTERN void Tk_MoveWindow(Tk_Window tkwin, int x, int y);
/* 129 */
EXTERN void Tk_MoveToplevelWindow(Tk_Window tkwin, int x, int y);
/* 130 */
-EXTERN CONST84_RETURN char * Tk_NameOf3DBorder(Tk_3DBorder border);
+EXTERN const char * Tk_NameOf3DBorder(Tk_3DBorder border);
/* 131 */
-EXTERN CONST84_RETURN char * Tk_NameOfAnchor(Tk_Anchor anchor);
+EXTERN const char * Tk_NameOfAnchor(Tk_Anchor anchor);
/* 132 */
-EXTERN CONST84_RETURN char * Tk_NameOfBitmap(Display *display, Pixmap bitmap);
+EXTERN const char * Tk_NameOfBitmap(Display *display, Pixmap bitmap);
/* 133 */
-EXTERN CONST84_RETURN char * Tk_NameOfCapStyle(int cap);
+EXTERN const char * Tk_NameOfCapStyle(int cap);
/* 134 */
-EXTERN CONST84_RETURN char * Tk_NameOfColor(XColor *colorPtr);
+EXTERN const char * Tk_NameOfColor(XColor *colorPtr);
/* 135 */
-EXTERN CONST84_RETURN char * Tk_NameOfCursor(Display *display,
- Tk_Cursor cursor);
+EXTERN const char * Tk_NameOfCursor(Display *display, Tk_Cursor cursor);
/* 136 */
-EXTERN CONST84_RETURN char * Tk_NameOfFont(Tk_Font font);
+EXTERN const char * Tk_NameOfFont(Tk_Font font);
/* 137 */
-EXTERN CONST84_RETURN char * Tk_NameOfImage(Tk_ImageMaster model);
+EXTERN const char * Tk_NameOfImage(Tk_ImageModel model);
/* 138 */
-EXTERN CONST84_RETURN char * Tk_NameOfJoinStyle(int join);
+EXTERN const char * Tk_NameOfJoinStyle(int join);
/* 139 */
-EXTERN CONST84_RETURN char * Tk_NameOfJustify(Tk_Justify justify);
+EXTERN const char * Tk_NameOfJustify(Tk_Justify justify);
/* 140 */
-EXTERN CONST84_RETURN char * Tk_NameOfRelief(int relief);
+EXTERN const char * Tk_NameOfRelief(int relief);
/* 141 */
EXTERN Tk_Window Tk_NameToWindow(Tcl_Interp *interp,
const char *pathName, Tk_Window tkwin);
@@ -468,14 +476,16 @@ EXTERN void Tk_OwnSelection(Tk_Window tkwin, Atom selection,
Tk_LostSelProc *proc, ClientData clientData);
/* 143 */
EXTERN int Tk_ParseArgv(Tcl_Interp *interp, Tk_Window tkwin,
- int *argcPtr, CONST84 char **argv,
+ int *argcPtr, const char **argv,
const Tk_ArgvInfo *argTable, int flags);
/* 144 */
-EXTERN void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle,
+TK_DEPRECATED("function signature changed")
+void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height);
/* 145 */
-EXTERN void Tk_PhotoPutZoomedBlock_NoComposite(
+TK_DEPRECATED("function signature changed")
+void Tk_PhotoPutZoomedBlock_NoComposite(
Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height, int zoomX, int zoomY,
@@ -486,13 +496,15 @@ EXTERN int Tk_PhotoGetImage(Tk_PhotoHandle handle,
/* 147 */
EXTERN void Tk_PhotoBlank(Tk_PhotoHandle handle);
/* 148 */
-EXTERN void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle,
+TK_DEPRECATED("function signature changed")
+void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle,
int width, int height);
/* 149 */
EXTERN void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr,
int *heightPtr);
/* 150 */
-EXTERN void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle,
+TK_DEPRECATED("function signature changed")
+void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle,
int width, int height);
/* 151 */
EXTERN int Tk_PointToChar(Tk_TextLayout layout, int x, int y);
@@ -620,7 +632,7 @@ EXTERN void Tk_FreeBitmapFromObj(Tk_Window tkwin,
/* 194 */
EXTERN void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
/* 195 */
-EXTERN void Tk_FreeConfigOptions(char *recordPtr,
+EXTERN void Tk_FreeConfigOptions(void *recordPtr,
Tk_OptionTable optionToken, Tk_Window tkwin);
/* 196 */
EXTERN void Tk_FreeSavedOptions(Tk_SavedOptions *savePtr);
@@ -642,12 +654,12 @@ EXTERN XColor * Tk_GetColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
/* 203 */
EXTERN Tk_Cursor Tk_GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
/* 204 */
-EXTERN Tcl_Obj * Tk_GetOptionInfo(Tcl_Interp *interp, char *recordPtr,
+EXTERN Tcl_Obj * Tk_GetOptionInfo(Tcl_Interp *interp, void *recordPtr,
Tk_OptionTable optionTable, Tcl_Obj *namePtr,
Tk_Window tkwin);
/* 205 */
EXTERN Tcl_Obj * Tk_GetOptionValue(Tcl_Interp *interp,
- char *recordPtr, Tk_OptionTable optionTable,
+ void *recordPtr, Tk_OptionTable optionTable,
Tcl_Obj *namePtr, Tk_Window tkwin);
/* 206 */
EXTERN int Tk_GetJustifyFromObj(Tcl_Interp *interp,
@@ -667,7 +679,7 @@ EXTERN int Tk_GetScrollInfoObj(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], double *dblPtr,
int *intPtr);
/* 211 */
-EXTERN int Tk_InitOptions(Tcl_Interp *interp, char *recordPtr,
+EXTERN int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr,
Tk_OptionTable optionToken, Tk_Window tkwin);
/* 212 */
EXTERN void Tk_MainEx(int argc, char **argv,
@@ -676,7 +688,7 @@ EXTERN void Tk_MainEx(int argc, char **argv,
/* 213 */
EXTERN void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr);
/* 214 */
-EXTERN int Tk_SetOptions(Tcl_Interp *interp, char *recordPtr,
+EXTERN int Tk_SetOptions(Tcl_Interp *interp, void *recordPtr,
Tk_OptionTable optionTable, int objc,
Tcl_Obj *const objv[], Tk_Window tkwin,
Tk_SavedOptions *savePtr, int *maskPtr);
@@ -776,11 +788,13 @@ EXTERN void Tk_SetMinimumRequestSize(Tk_Window tkwin,
EXTERN void Tk_SetCaretPos(Tk_Window tkwin, int x, int y,
int height);
/* 246 */
-EXTERN void Tk_PhotoPutBlock_Panic(Tk_PhotoHandle handle,
+TK_DEPRECATED("function signature changed")
+void Tk_PhotoPutBlock_Panic(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height, int compRule);
/* 247 */
-EXTERN void Tk_PhotoPutZoomedBlock_Panic(Tk_PhotoHandle handle,
+TK_DEPRECATED("function signature changed")
+void Tk_PhotoPutZoomedBlock_Panic(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height, int zoomX, int zoomY,
int subsampleX, int subsampleY, int compRule);
@@ -818,22 +832,22 @@ EXTERN Tk_StyledElement Tk_GetStyledElement(Tk_Style style, int elementId,
Tk_OptionTable optionTable);
/* 261 */
EXTERN void Tk_GetElementSize(Tk_Style style,
- Tk_StyledElement element, char *recordPtr,
+ Tk_StyledElement element, void *recordPtr,
Tk_Window tkwin, int width, int height,
int inner, int *widthPtr, int *heightPtr);
/* 262 */
EXTERN void Tk_GetElementBox(Tk_Style style,
- Tk_StyledElement element, char *recordPtr,
+ Tk_StyledElement element, void *recordPtr,
Tk_Window tkwin, int x, int y, int width,
int height, int inner, int *xPtr, int *yPtr,
int *widthPtr, int *heightPtr);
/* 263 */
EXTERN int Tk_GetElementBorderWidth(Tk_Style style,
- Tk_StyledElement element, char *recordPtr,
+ Tk_StyledElement element, void *recordPtr,
Tk_Window tkwin);
/* 264 */
EXTERN void Tk_DrawElement(Tk_Style style,
- Tk_StyledElement element, char *recordPtr,
+ Tk_StyledElement element, void *recordPtr,
Tk_Window tkwin, Drawable d, int x, int y,
int width, int height, int state);
/* 265 */
@@ -864,14 +878,24 @@ EXTERN void Tk_CreateOldImageType(const Tk_ImageType *typePtr);
/* 273 */
EXTERN void Tk_CreateOldPhotoImageFormat(
const Tk_PhotoImageFormat *formatPtr);
-/* Slot 274 is reserved */
-/* Slot 275 is reserved */
-/* Slot 276 is reserved */
-/* Slot 277 is reserved */
-/* Slot 278 is reserved */
-/* Slot 279 is reserved */
+/* 274 */
+EXTERN int Tk_AlwaysShowSelection(Tk_Window tkwin);
+/* 275 */
+EXTERN unsigned Tk_GetButtonMask(unsigned button);
+/* 276 */
+EXTERN int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr,
+ double *doublePtr);
+/* 277 */
+EXTERN Tcl_Obj * Tk_NewWindowObj(Tk_Window tkwin);
+/* 278 */
+EXTERN void Tk_SendVirtualEvent(Tk_Window tkwin,
+ const char *eventName, Tcl_Obj *detail);
+/* 279 */
+EXTERN Tcl_Obj * Tk_FontGetDescription(Tk_Font tkfont);
/* 280 */
-EXTERN void TkUnusedStubEntry(void);
+EXTERN void Tk_CreatePhotoImageFormatVersion3(
+ const Tk_PhotoImageFormatVersion3 *formatPtr);
typedef struct {
const struct TkPlatStubs *tkPlatStubs;
@@ -903,7 +927,7 @@ typedef struct TkStubs {
double (*tk_CanvasPsY) (Tk_Canvas canvas, double y); /* 16 */
void (*tk_CanvasSetStippleOrigin) (Tk_Canvas canvas, GC gc); /* 17 */
int (*tk_CanvasTagsParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 18 */
- CONST86 char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 19 */
+ const char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 19 */
Tk_Window (*tk_CanvasTkwin) (Tk_Canvas canvas); /* 20 */
void (*tk_CanvasWindowCoords) (Tk_Canvas canvas, double x, double y, short *screenXPtr, short *screenYPtr); /* 21 */
void (*tk_ChangeWindowAttributes) (Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 22 */
@@ -913,7 +937,7 @@ typedef struct TkStubs {
int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */
int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 27 */
int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 28 */
- int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, int argc, CONST84 char **argv, char *widgRec, int flags); /* 29 */
+ int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, int argc, const char **argv, char *widgRec, int flags); /* 29 */
void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 30 */
Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, const char *str, int numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 31 */
Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */
@@ -939,7 +963,7 @@ typedef struct TkStubs {
void (*tk_DeleteImage) (Tcl_Interp *interp, const char *name); /* 52 */
void (*tk_DeleteSelHandler) (Tk_Window tkwin, Atom selection, Atom target); /* 53 */
void (*tk_DestroyWindow) (Tk_Window tkwin); /* 54 */
- CONST84_RETURN char * (*tk_DisplayName) (Tk_Window tkwin); /* 55 */
+ const char * (*tk_DisplayName) (Tk_Window tkwin); /* 55 */
int (*tk_DistanceToTextLayout) (Tk_TextLayout layout, int x, int y); /* 56 */
void (*tk_Draw3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, int numPoints, int borderWidth, int leftRelief); /* 57 */
void (*tk_Draw3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 58 */
@@ -961,14 +985,14 @@ typedef struct TkStubs {
void (*tk_FreeOptions) (const Tk_ConfigSpec *specs, char *widgRec, Display *display, int needFlags); /* 74 */
void (*tk_FreePixmap) (Display *display, Pixmap pixmap); /* 75 */
void (*tk_FreeTextLayout) (Tk_TextLayout textLayout); /* 76 */
- void (*tk_FreeXId) (Display *display, XID xid); /* 77 */
+ TCL_DEPRECATED_API("function does nothing, call can be removed") void (*tk_FreeXId) (Display *display, XID xid); /* 77 */
GC (*tk_GCForColor) (XColor *colorPtr, Drawable drawable); /* 78 */
void (*tk_GeometryRequest) (Tk_Window tkwin, int reqWidth, int reqHeight); /* 79 */
Tk_3DBorder (*tk_Get3DBorder) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid colorName); /* 80 */
void (*tk_GetAllBindings) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object); /* 81 */
int (*tk_GetAnchor) (Tcl_Interp *interp, const char *str, Tk_Anchor *anchorPtr); /* 82 */
- CONST84_RETURN char * (*tk_GetAtomName) (Tk_Window tkwin, Atom atom); /* 83 */
- CONST84_RETURN char * (*tk_GetBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr); /* 84 */
+ const char * (*tk_GetAtomName) (Tk_Window tkwin, Atom atom); /* 83 */
+ const char * (*tk_GetBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr); /* 84 */
Pixmap (*tk_GetBitmap) (Tcl_Interp *interp, Tk_Window tkwin, const char *str); /* 85 */
Pixmap (*tk_GetBitmapFromData) (Tcl_Interp *interp, Tk_Window tkwin, const void *source, int width, int height); /* 86 */
int (*tk_GetCapStyle) (Tcl_Interp *interp, const char *str, int *capPtr); /* 87 */
@@ -982,7 +1006,7 @@ typedef struct TkStubs {
void (*tk_GetFontMetrics) (Tk_Font font, Tk_FontMetrics *fmPtr); /* 95 */
GC (*tk_GetGC) (Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr); /* 96 */
Tk_Image (*tk_GetImage) (Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, ClientData clientData); /* 97 */
- ClientData (*tk_GetImageMasterData) (Tcl_Interp *interp, const char *name, CONST86 Tk_ImageType **typePtrPtr); /* 98 */
+ ClientData (*tk_GetImageModelData) (Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 98 */
Tk_ItemType * (*tk_GetItemTypes) (void); /* 99 */
int (*tk_GetJoinStyle) (Tcl_Interp *interp, const char *str, int *joinPtr); /* 100 */
int (*tk_GetJustify) (Tcl_Interp *interp, const char *str, Tk_Justify *justifyPtr); /* 101 */
@@ -992,7 +1016,7 @@ typedef struct TkStubs {
Pixmap (*tk_GetPixmap) (Display *display, Drawable d, int width, int height, int depth); /* 105 */
int (*tk_GetRelief) (Tcl_Interp *interp, const char *name, int *reliefPtr); /* 106 */
void (*tk_GetRootCoords) (Tk_Window tkwin, int *xPtr, int *yPtr); /* 107 */
- int (*tk_GetScrollInfo) (Tcl_Interp *interp, int argc, CONST84 char **argv, double *dblPtr, int *intPtr); /* 108 */
+ int (*tk_GetScrollInfo) (Tcl_Interp *interp, int argc, const char **argv, double *dblPtr, int *intPtr); /* 108 */
int (*tk_GetScreenMM) (Tcl_Interp *interp, Tk_Window tkwin, const char *str, double *doublePtr); /* 109 */
int (*tk_GetSelection) (Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, ClientData clientData); /* 110 */
Tk_Uid (*tk_GetUid) (const char *str); /* 111 */
@@ -1001,7 +1025,7 @@ typedef struct TkStubs {
int (*tk_Grab) (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal); /* 114 */
void (*tk_HandleEvent) (XEvent *eventPtr); /* 115 */
Tk_Window (*tk_IdToWindow) (Display *display, Window window); /* 116 */
- void (*tk_ImageChanged) (Tk_ImageMaster model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */
+ void (*tk_ImageChanged) (Tk_ImageModel model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */
int (*tk_Init) (Tcl_Interp *interp); /* 118 */
Atom (*tk_InternAtom) (Tk_Window tkwin, const char *name); /* 119 */
int (*tk_IntersectTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height); /* 120 */
@@ -1014,27 +1038,27 @@ typedef struct TkStubs {
void (*tk_MoveResizeWindow) (Tk_Window tkwin, int x, int y, int width, int height); /* 127 */
void (*tk_MoveWindow) (Tk_Window tkwin, int x, int y); /* 128 */
void (*tk_MoveToplevelWindow) (Tk_Window tkwin, int x, int y); /* 129 */
- CONST84_RETURN char * (*tk_NameOf3DBorder) (Tk_3DBorder border); /* 130 */
- CONST84_RETURN char * (*tk_NameOfAnchor) (Tk_Anchor anchor); /* 131 */
- CONST84_RETURN char * (*tk_NameOfBitmap) (Display *display, Pixmap bitmap); /* 132 */
- CONST84_RETURN char * (*tk_NameOfCapStyle) (int cap); /* 133 */
- CONST84_RETURN char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */
- CONST84_RETURN char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */
- CONST84_RETURN char * (*tk_NameOfFont) (Tk_Font font); /* 136 */
- CONST84_RETURN char * (*tk_NameOfImage) (Tk_ImageMaster model); /* 137 */
- CONST84_RETURN char * (*tk_NameOfJoinStyle) (int join); /* 138 */
- CONST84_RETURN char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */
- CONST84_RETURN char * (*tk_NameOfRelief) (int relief); /* 140 */
+ const char * (*tk_NameOf3DBorder) (Tk_3DBorder border); /* 130 */
+ const char * (*tk_NameOfAnchor) (Tk_Anchor anchor); /* 131 */
+ const char * (*tk_NameOfBitmap) (Display *display, Pixmap bitmap); /* 132 */
+ const char * (*tk_NameOfCapStyle) (int cap); /* 133 */
+ const char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */
+ const char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */
+ const char * (*tk_NameOfFont) (Tk_Font font); /* 136 */
+ const char * (*tk_NameOfImage) (Tk_ImageModel model); /* 137 */
+ const char * (*tk_NameOfJoinStyle) (int join); /* 138 */
+ const char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */
+ const char * (*tk_NameOfRelief) (int relief); /* 140 */
Tk_Window (*tk_NameToWindow) (Tcl_Interp *interp, const char *pathName, Tk_Window tkwin); /* 141 */
void (*tk_OwnSelection) (Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, ClientData clientData); /* 142 */
- int (*tk_ParseArgv) (Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, CONST84 char **argv, const Tk_ArgvInfo *argTable, int flags); /* 143 */
- void (*tk_PhotoPutBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height); /* 144 */
- void (*tk_PhotoPutZoomedBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY); /* 145 */
+ int (*tk_ParseArgv) (Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags); /* 143 */
+ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height); /* 144 */
+ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutZoomedBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY); /* 145 */
int (*tk_PhotoGetImage) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr); /* 146 */
void (*tk_PhotoBlank) (Tk_PhotoHandle handle); /* 147 */
- void (*tk_PhotoExpand_Panic) (Tk_PhotoHandle handle, int width, int height); /* 148 */
+ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoExpand_Panic) (Tk_PhotoHandle handle, int width, int height); /* 148 */
void (*tk_PhotoGetSize) (Tk_PhotoHandle handle, int *widthPtr, int *heightPtr); /* 149 */
- void (*tk_PhotoSetSize_Panic) (Tk_PhotoHandle handle, int width, int height); /* 150 */
+ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoSetSize_Panic) (Tk_PhotoHandle handle, int width, int height); /* 150 */
int (*tk_PointToChar) (Tk_TextLayout layout, int x, int y); /* 151 */
int (*tk_PostscriptFontName) (Tk_Font tkfont, Tcl_DString *dsPtr); /* 152 */
void (*tk_PreserveColormap) (Display *display, Colormap colormap); /* 153 */
@@ -1079,7 +1103,7 @@ typedef struct TkStubs {
void (*tk_Free3DBorderFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 192 */
void (*tk_FreeBitmapFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 193 */
void (*tk_FreeColorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 194 */
- void (*tk_FreeConfigOptions) (char *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 195 */
+ void (*tk_FreeConfigOptions) (void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 195 */
void (*tk_FreeSavedOptions) (Tk_SavedOptions *savePtr); /* 196 */
void (*tk_FreeCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 197 */
void (*tk_FreeFontFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 198 */
@@ -1088,17 +1112,17 @@ typedef struct TkStubs {
Pixmap (*tk_GetBitmapFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 201 */
XColor * (*tk_GetColorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 202 */
Tk_Cursor (*tk_GetCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 203 */
- Tcl_Obj * (*tk_GetOptionInfo) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 204 */
- Tcl_Obj * (*tk_GetOptionValue) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */
+ Tcl_Obj * (*tk_GetOptionInfo) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 204 */
+ Tcl_Obj * (*tk_GetOptionValue) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */
int (*tk_GetJustifyFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Justify *justifyPtr); /* 206 */
int (*tk_GetMMFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 207 */
int (*tk_GetPixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 208 */
int (*tk_GetReliefFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 209 */
int (*tk_GetScrollInfoObj) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 210 */
- int (*tk_InitOptions) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */
- void (*tk_MainEx) (int argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); /* 212 */
+ int (*tk_InitOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */
+ TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") void (*tk_MainEx) (int argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); /* 212 */
void (*tk_RestoreSavedOptions) (Tk_SavedOptions *savePtr); /* 213 */
- int (*tk_SetOptions) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 214 */
+ int (*tk_SetOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 214 */
void (*tk_InitConsoleChannels) (Tcl_Interp *interp); /* 215 */
int (*tk_CreateConsoleWindow) (Tcl_Interp *interp); /* 216 */
void (*tk_CreateSmoothMethod) (Tcl_Interp *interp, const Tk_SmoothMethod *method); /* 217 */
@@ -1130,8 +1154,8 @@ typedef struct TkStubs {
void (*tk_SetInternalBorderEx) (Tk_Window tkwin, int left, int right, int top, int bottom); /* 243 */
void (*tk_SetMinimumRequestSize) (Tk_Window tkwin, int minWidth, int minHeight); /* 244 */
void (*tk_SetCaretPos) (Tk_Window tkwin, int x, int y, int height); /* 245 */
- void (*tk_PhotoPutBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 246 */
- void (*tk_PhotoPutZoomedBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 247 */
+ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 246 */
+ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutZoomedBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 247 */
int (*tk_CollapseMotionEvents) (Display *display, int collapse); /* 248 */
Tk_StyleEngine (*tk_RegisterStyleEngine) (const char *name, Tk_StyleEngine parent); /* 249 */
Tk_StyleEngine (*tk_GetStyleEngine) (const char *name); /* 250 */
@@ -1145,10 +1169,10 @@ typedef struct TkStubs {
Tk_Style (*tk_GetStyleFromObj) (Tcl_Obj *objPtr); /* 258 */
void (*tk_FreeStyleFromObj) (Tcl_Obj *objPtr); /* 259 */
Tk_StyledElement (*tk_GetStyledElement) (Tk_Style style, int elementId, Tk_OptionTable optionTable); /* 260 */
- void (*tk_GetElementSize) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 261 */
- void (*tk_GetElementBox) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 262 */
- int (*tk_GetElementBorderWidth) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin); /* 263 */
- void (*tk_DrawElement) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); /* 264 */
+ void (*tk_GetElementSize) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 261 */
+ void (*tk_GetElementBox) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 262 */
+ int (*tk_GetElementBorderWidth) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin); /* 263 */
+ void (*tk_DrawElement) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); /* 264 */
int (*tk_PhotoExpand) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 265 */
int (*tk_PhotoPutBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 266 */
int (*tk_PhotoPutZoomedBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 267 */
@@ -1158,13 +1182,14 @@ typedef struct TkStubs {
Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */
void (*tk_CreateOldImageType) (const Tk_ImageType *typePtr); /* 272 */
void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 273 */
- void (*reserved274)(void);
- void (*reserved275)(void);
- void (*reserved276)(void);
- void (*reserved277)(void);
- void (*reserved278)(void);
- void (*reserved279)(void);
- void (*tkUnusedStubEntry) (void); /* 280 */
+ int (*tk_AlwaysShowSelection) (Tk_Window tkwin); /* 274 */
+ unsigned (*tk_GetButtonMask) (unsigned button); /* 275 */
+ int (*tk_GetDoublePixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 276 */
+ Tcl_Obj * (*tk_NewWindowObj) (Tk_Window tkwin); /* 277 */
+ void (*tk_SendVirtualEvent) (Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 278 */
+ Tcl_Obj * (*tk_FontGetDescription) (Tk_Font tkfont); /* 279 */
+ void (*tk_CreatePhotoImageFormatVersion3) (
+ const Tk_PhotoImageFormatVersion3 *formatPtr); /* 280 */
} TkStubs;
extern const TkStubs *tkStubsPtr;
@@ -1375,8 +1400,8 @@ extern const TkStubs *tkStubsPtr;
(tkStubsPtr->tk_GetGC) /* 96 */
#define Tk_GetImage \
(tkStubsPtr->tk_GetImage) /* 97 */
-#define Tk_GetImageMasterData \
- (tkStubsPtr->tk_GetImageMasterData) /* 98 */
+#define Tk_GetImageModelData \
+ (tkStubsPtr->tk_GetImageModelData) /* 98 */
#define Tk_GetItemTypes \
(tkStubsPtr->tk_GetItemTypes) /* 99 */
#define Tk_GetJoinStyle \
@@ -1725,14 +1750,20 @@ extern const TkStubs *tkStubsPtr;
(tkStubsPtr->tk_CreateOldImageType) /* 272 */
#define Tk_CreateOldPhotoImageFormat \
(tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */
-/* Slot 274 is reserved */
-/* Slot 275 is reserved */
-/* Slot 276 is reserved */
-/* Slot 277 is reserved */
-/* Slot 278 is reserved */
-/* Slot 279 is reserved */
-#define TkUnusedStubEntry \
- (tkStubsPtr->tkUnusedStubEntry) /* 280 */
+#define Tk_AlwaysShowSelection \
+ (tkStubsPtr->tk_AlwaysShowSelection) /* 274 */
+#define Tk_GetButtonMask \
+ (tkStubsPtr->tk_GetButtonMask) /* 275 */
+#define Tk_GetDoublePixelsFromObj \
+ (tkStubsPtr->tk_GetDoublePixelsFromObj) /* 276 */
+#define Tk_NewWindowObj \
+ (tkStubsPtr->tk_NewWindowObj) /* 277 */
+#define Tk_SendVirtualEvent \
+ (tkStubsPtr->tk_SendVirtualEvent) /* 278 */
+#define Tk_FontGetDescription \
+ (tkStubsPtr->tk_FontGetDescription) /* 279 */
+#define Tk_CreatePhotoImageFormatVersion3 \
+ (tkStubsPtr->tk_CreatePhotoImageFormatVersion3) /* 280 */
#endif /* defined(USE_TK_STUBS) */
@@ -1743,7 +1774,14 @@ extern const TkStubs *tkStubsPtr;
#undef Tk_Init
#undef Tk_SafeInit
#undef Tk_CreateConsoleWindow
-#define Tk_GetImageModelData Tk_GetImageMasterData
+
+#undef Tk_FreeXId
+#define Tk_FreeXId(display,xid)
+#undef Tk_GetStyleFromObj
+#undef Tk_FreeStyleFromObj
+#define Tk_GetStyleFromObj(obj) Tk_AllocStyleFromObj(NULL, obj)
+#define Tk_FreeStyleFromObj(obj) /* no-op */
+#define Tk_GetImageMasterData Tk_GetImageModelData
#if defined(_WIN32) && defined(UNICODE)
# define Tk_MainEx Tk_MainExW
@@ -1751,6 +1789,17 @@ extern const TkStubs *tkStubsPtr;
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
#endif
+
+#if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
+#undef Tk_PhotoPutBlock_NoComposite
+#undef Tk_PhotoPutZoomedBlock_NoComposite
+#undef Tk_PhotoExpand_Panic
+#undef Tk_PhotoPutBlock_Panic
+#undef Tk_PhotoPutZoomedBlock_Panic
+#undef Tk_PhotoSetSize_Panic
+#undef Tk_CreateOldPhotoImageFormat
+#endif /* TK_NO_DEPRECATED */
+
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index a6684c7..0e7f87c 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -6,18 +6,18 @@
* spinbox expands on the entry by adding up/down buttons that control
* the value of the entry widget.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2000 Ajuba Solutions.
- * Copyright (c) 2002 ActiveState Corporation.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Ajuba Solutions.
+ * Copyright © 2002 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "default.h"
#include "tkEntry.h"
+#include "default.h"
/*
* The following macro defines how many extra pixels to leave on each side of
@@ -63,102 +63,108 @@ enum validateType {
static const Tk_OptionSpec entryOptSpec[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_ENTRY_BG_COLOR, -1, Tk_Offset(Entry, normalBorder),
+ DEF_ENTRY_BG_COLOR, TCL_INDEX_NONE, offsetof(Entry, normalBorder),
0, DEF_ENTRY_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0},
+ DEF_ENTRY_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Entry, borderWidth), 0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_ENTRY_CURSOR, -1, Tk_Offset(Entry, cursor),
+ DEF_ENTRY_CURSOR, TCL_INDEX_NONE, offsetof(Entry, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BORDER, "-disabledbackground", "disabledBackground",
- "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1,
- Tk_Offset(Entry, disabledBorder), TK_OPTION_NULL_OK,
+ "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, TCL_INDEX_NONE,
+ offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK,
(ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
- "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1,
- Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
+ "DisabledForeground", DEF_ENTRY_DISABLED_FG, TCL_INDEX_NONE,
+ offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
- "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1,
- Tk_Offset(Entry, exportSelection), 0, 0, 0},
+ "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, TCL_INDEX_NONE,
+ offsetof(Entry, exportSelection), 0, 0, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_ENTRY_FONT, -1, Tk_Offset(Entry, tkfont), 0, 0, 0},
+ DEF_ENTRY_FONT, TCL_INDEX_NONE, offsetof(Entry, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0, 0, 0},
+ DEF_ENTRY_FG, TCL_INDEX_NONE, offsetof(Entry, fgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG,
- -1, Tk_Offset(Entry, highlightBgColorPtr), 0, 0, 0},
+ TCL_INDEX_NONE, offsetof(Entry, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr), 0, 0, 0},
+ DEF_ENTRY_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Entry, highlightColorPtr), 0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1,
- Tk_Offset(Entry, highlightWidth), 0, 0, 0},
+ "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, TCL_INDEX_NONE,
+ offsetof(Entry, highlightWidth), 0, 0, 0},
{TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground",
- DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder), 0, 0, 0},
+ DEF_ENTRY_INSERT_BG, TCL_INDEX_NONE, offsetof(Entry, insertBorder), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
- "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1,
- Tk_Offset(Entry, insertBorderWidth), 0,
+ "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, TCL_INDEX_NONE,
+ offsetof(Entry, insertBorderWidth), 0,
(ClientData) DEF_ENTRY_INSERT_BD_MONO, 0},
{TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime",
- DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime),
+ DEF_ENTRY_INSERT_OFF_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOffTime),
0, 0, 0},
{TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime",
- DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime), 0, 0, 0},
+ DEF_ENTRY_INSERT_ON_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOnTime), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
- DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth), 0, 0, 0},
+ DEF_ENTRY_INSERT_WIDTH, TCL_INDEX_NONE, offsetof(Entry, insertWidth), 0, 0, 0},
{TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand",
- DEF_ENTRY_INVALIDCMD, -1, Tk_Offset(Entry, invalidCmd),
+ DEF_ENTRY_INVALIDCMD, TCL_INDEX_NONE, offsetof(Entry, invalidCmd),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_SYNONYM, "-invcmd", NULL, NULL,
- NULL, 0, -1, 0, "-invalidcommand", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-invalidcommand", 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_ENTRY_JUSTIFY, -1, Tk_Offset(Entry, justify), 0, 0, 0},
+ DEF_ENTRY_JUSTIFY, TCL_INDEX_NONE, offsetof(Entry, justify), 0, 0, 0},
+ {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder",
+ DEF_ENTRY_PLACEHOLDER, TCL_INDEX_NONE, offsetof(Entry, placeholderString),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground",
+ "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, TCL_INDEX_NONE,
+ offsetof(Entry, placeholderColorPtr), 0, 0, 0},
{TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground",
- "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1,
- Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK,
+ "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, TCL_INDEX_NONE,
+ offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK,
(ClientData) DEF_ENTRY_READONLY_BG_MONO, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief), 0, 0, 0},
+ DEF_ENTRY_RELIEF, TCL_INDEX_NONE, offsetof(Entry, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_ENTRY_SELECT_COLOR, -1, Tk_Offset(Entry, selBorder),
+ DEF_ENTRY_SELECT_COLOR, TCL_INDEX_NONE, offsetof(Entry, selBorder),
0, DEF_ENTRY_SELECT_MONO, 0},
{TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth",
- "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1,
- Tk_Offset(Entry, selBorderWidth),
+ "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, TCL_INDEX_NONE,
+ offsetof(Entry, selBorderWidth),
0, DEF_ENTRY_SELECT_BD_MONO, 0},
{TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
- DEF_ENTRY_SELECT_FG_COLOR, -1, Tk_Offset(Entry, selFgColorPtr),
+ DEF_ENTRY_SELECT_FG_COLOR, TCL_INDEX_NONE, offsetof(Entry, selFgColorPtr),
TK_OPTION_NULL_OK, DEF_ENTRY_SELECT_FG_MONO, 0},
{TK_OPTION_STRING, "-show", "show", "Show",
- DEF_ENTRY_SHOW, -1, Tk_Offset(Entry, showChar),
+ DEF_ENTRY_SHOW, TCL_INDEX_NONE, offsetof(Entry, showChar),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_ENTRY_STATE, -1, Tk_Offset(Entry, state),
+ DEF_ENTRY_STATE, TCL_INDEX_NONE, offsetof(Entry, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_ENTRY_TAKE_FOCUS, -1, Tk_Offset(Entry, takeFocus),
+ DEF_ENTRY_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Entry, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- DEF_ENTRY_TEXT_VARIABLE, -1, Tk_Offset(Entry, textVarName),
+ DEF_ENTRY_TEXT_VARIABLE, TCL_INDEX_NONE, offsetof(Entry, textVarName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
- DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate),
+ DEF_ENTRY_VALIDATE, TCL_INDEX_NONE, offsetof(Entry, validate),
0, validateStrings, 0},
{TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand",
- NULL, -1, Tk_Offset(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_SYNONYM, "-vcmd", NULL, NULL,
- NULL, 0, -1, 0, "-validatecommand", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-validatecommand", 0},
{TK_OPTION_INT, "-width", "width", "Width",
- DEF_ENTRY_WIDTH, -1, Tk_Offset(Entry, prefWidth), 0, 0, 0},
+ DEF_ENTRY_WIDTH, TCL_INDEX_NONE, offsetof(Entry, prefWidth), 0, 0, 0},
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
- DEF_ENTRY_SCROLL_COMMAND, -1, Tk_Offset(Entry, scrollCmd),
+ DEF_ENTRY_SCROLL_COMMAND, TCL_INDEX_NONE, offsetof(Entry, scrollCmd),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
/*
@@ -180,135 +186,141 @@ static const Tk_OptionSpec entryOptSpec[] = {
static const Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Background",
- DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(Spinbox, activeBorder),
+ DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(Spinbox, activeBorder),
0, DEF_BUTTON_ACTIVE_BG_MONO, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_ENTRY_BG_COLOR, -1, Tk_Offset(Entry, normalBorder),
+ DEF_ENTRY_BG_COLOR, TCL_INDEX_NONE, offsetof(Entry, normalBorder),
0, DEF_ENTRY_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0},
+ DEF_ENTRY_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Entry, borderWidth), 0, 0, 0},
{TK_OPTION_BORDER, "-buttonbackground", "buttonBackground", "Background",
- DEF_BUTTON_BG_COLOR, -1, Tk_Offset(Spinbox, buttonBorder),
+ DEF_BUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(Spinbox, buttonBorder),
0, DEF_BUTTON_BG_MONO, 0},
{TK_OPTION_CURSOR, "-buttoncursor", "buttonCursor", "Cursor",
- DEF_BUTTON_CURSOR, -1, Tk_Offset(Spinbox, bCursor),
+ DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(Spinbox, bCursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-buttondownrelief", "buttonDownRelief", "Relief",
- DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, bdRelief), 0, 0, 0},
+ DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(Spinbox, bdRelief), 0, 0, 0},
{TK_OPTION_RELIEF, "-buttonuprelief", "buttonUpRelief", "Relief",
- DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, buRelief), 0, 0, 0},
+ DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(Spinbox, buRelief), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
- DEF_SPINBOX_CMD, -1, Tk_Offset(Spinbox, command),
+ DEF_SPINBOX_CMD, TCL_INDEX_NONE, offsetof(Spinbox, command),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_ENTRY_CURSOR, -1, Tk_Offset(Entry, cursor),
+ DEF_ENTRY_CURSOR, TCL_INDEX_NONE, offsetof(Entry, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BORDER, "-disabledbackground", "disabledBackground",
- "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1,
- Tk_Offset(Entry, disabledBorder), TK_OPTION_NULL_OK,
+ "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, TCL_INDEX_NONE,
+ offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK,
(ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
- "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1,
- Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
+ "DisabledForeground", DEF_ENTRY_DISABLED_FG, TCL_INDEX_NONE,
+ offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
- "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1,
- Tk_Offset(Entry, exportSelection), 0, 0, 0},
+ "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, TCL_INDEX_NONE,
+ offsetof(Entry, exportSelection), 0, 0, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_ENTRY_FONT, -1, Tk_Offset(Entry, tkfont), 0, 0, 0},
+ DEF_ENTRY_FONT, TCL_INDEX_NONE, offsetof(Entry, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0, 0, 0},
+ DEF_ENTRY_FG, TCL_INDEX_NONE, offsetof(Entry, fgColorPtr), 0, 0, 0},
{TK_OPTION_STRING, "-format", "format", "Format",
- DEF_SPINBOX_FORMAT, -1, Tk_Offset(Spinbox, reqFormat),
+ DEF_SPINBOX_FORMAT, TCL_INDEX_NONE, offsetof(Spinbox, reqFormat),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-from", "from", "From",
- DEF_SPINBOX_FROM, -1, Tk_Offset(Spinbox, fromValue), 0, 0, 0},
+ DEF_SPINBOX_FROM, TCL_INDEX_NONE, offsetof(Spinbox, fromValue), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG,
- -1, Tk_Offset(Entry, highlightBgColorPtr), 0, 0, 0},
+ TCL_INDEX_NONE, offsetof(Entry, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr), 0, 0, 0},
+ DEF_ENTRY_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Entry, highlightColorPtr), 0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1,
- Tk_Offset(Entry, highlightWidth), 0, 0, 0},
+ "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, TCL_INDEX_NONE,
+ offsetof(Entry, highlightWidth), 0, 0, 0},
{TK_OPTION_DOUBLE, "-increment", "increment", "Increment",
- DEF_SPINBOX_INCREMENT, -1, Tk_Offset(Spinbox, increment), 0, 0, 0},
+ DEF_SPINBOX_INCREMENT, TCL_INDEX_NONE, offsetof(Spinbox, increment), 0, 0, 0},
{TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground",
- DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder), 0, 0, 0},
+ DEF_ENTRY_INSERT_BG, TCL_INDEX_NONE, offsetof(Entry, insertBorder), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
- "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1,
- Tk_Offset(Entry, insertBorderWidth), 0,
+ "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, TCL_INDEX_NONE,
+ offsetof(Entry, insertBorderWidth), 0,
(ClientData) DEF_ENTRY_INSERT_BD_MONO, 0},
{TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime",
- DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime),
+ DEF_ENTRY_INSERT_OFF_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOffTime),
0, 0, 0},
{TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime",
- DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime), 0, 0, 0},
+ DEF_ENTRY_INSERT_ON_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOnTime), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
- DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth), 0, 0, 0},
+ DEF_ENTRY_INSERT_WIDTH, TCL_INDEX_NONE, offsetof(Entry, insertWidth), 0, 0, 0},
{TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand",
- DEF_ENTRY_INVALIDCMD, -1, Tk_Offset(Entry, invalidCmd),
+ DEF_ENTRY_INVALIDCMD, TCL_INDEX_NONE, offsetof(Entry, invalidCmd),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_SYNONYM, "-invcmd", NULL, NULL,
- NULL, 0, -1, 0, "-invalidcommand", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-invalidcommand", 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_ENTRY_JUSTIFY, -1, Tk_Offset(Entry, justify), 0, 0, 0},
+ DEF_ENTRY_JUSTIFY, TCL_INDEX_NONE, offsetof(Entry, justify), 0, 0, 0},
+ {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder",
+ DEF_ENTRY_PLACEHOLDER, TCL_INDEX_NONE, offsetof(Entry, placeholderString),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground",
+ "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, TCL_INDEX_NONE,
+ offsetof(Entry, placeholderColorPtr), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief), 0, 0, 0},
+ DEF_ENTRY_RELIEF, TCL_INDEX_NONE, offsetof(Entry, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground",
- "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1,
- Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK,
+ "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, TCL_INDEX_NONE,
+ offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK,
(ClientData) DEF_ENTRY_READONLY_BG_MONO, 0},
{TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
- DEF_SPINBOX_REPEAT_DELAY, -1, Tk_Offset(Spinbox, repeatDelay),
+ DEF_SPINBOX_REPEAT_DELAY, TCL_INDEX_NONE, offsetof(Spinbox, repeatDelay),
0, 0, 0},
{TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval",
- DEF_SPINBOX_REPEAT_INTERVAL, -1, Tk_Offset(Spinbox, repeatInterval),
+ DEF_SPINBOX_REPEAT_INTERVAL, TCL_INDEX_NONE, offsetof(Spinbox, repeatInterval),
0, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_ENTRY_SELECT_COLOR, -1, Tk_Offset(Entry, selBorder),
+ DEF_ENTRY_SELECT_COLOR, TCL_INDEX_NONE, offsetof(Entry, selBorder),
0, DEF_ENTRY_SELECT_MONO, 0},
{TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth",
- "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1,
- Tk_Offset(Entry, selBorderWidth),
+ "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, TCL_INDEX_NONE,
+ offsetof(Entry, selBorderWidth),
0, DEF_ENTRY_SELECT_BD_MONO, 0},
{TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
- DEF_ENTRY_SELECT_FG_COLOR, -1, Tk_Offset(Entry, selFgColorPtr),
+ DEF_ENTRY_SELECT_FG_COLOR, TCL_INDEX_NONE, offsetof(Entry, selFgColorPtr),
TK_OPTION_NULL_OK, DEF_ENTRY_SELECT_FG_MONO, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_ENTRY_STATE, -1, Tk_Offset(Entry, state),
+ DEF_ENTRY_STATE, TCL_INDEX_NONE, offsetof(Entry, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_ENTRY_TAKE_FOCUS, -1, Tk_Offset(Entry, takeFocus),
+ DEF_ENTRY_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Entry, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- DEF_ENTRY_TEXT_VARIABLE, -1, Tk_Offset(Entry, textVarName),
+ DEF_ENTRY_TEXT_VARIABLE, TCL_INDEX_NONE, offsetof(Entry, textVarName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-to", "to", "To",
- DEF_SPINBOX_TO, -1, Tk_Offset(Spinbox, toValue), 0, 0, 0},
+ DEF_SPINBOX_TO, TCL_INDEX_NONE, offsetof(Spinbox, toValue), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
- DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate),
+ DEF_ENTRY_VALIDATE, TCL_INDEX_NONE, offsetof(Entry, validate),
0, validateStrings, 0},
{TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand",
- NULL, -1, Tk_Offset(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-values", "values", "Values",
- DEF_SPINBOX_VALUES, -1, Tk_Offset(Spinbox, valueStr),
+ DEF_SPINBOX_VALUES, TCL_INDEX_NONE, offsetof(Spinbox, valueStr),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_SYNONYM, "-vcmd", NULL, NULL,
- NULL, 0, -1, 0, "-validatecommand", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-validatecommand", 0},
{TK_OPTION_INT, "-width", "width", "Width",
- DEF_ENTRY_WIDTH, -1, Tk_Offset(Entry, prefWidth), 0, 0, 0},
+ DEF_ENTRY_WIDTH, TCL_INDEX_NONE, offsetof(Entry, prefWidth), 0, 0, 0},
{TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap",
- DEF_SPINBOX_WRAP, -1, Tk_Offset(Spinbox, wrap), 0, 0, 0},
+ DEF_SPINBOX_WRAP, TCL_INDEX_NONE, offsetof(Spinbox, wrap), 0, 0, 0},
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
- DEF_ENTRY_SCROLL_COMMAND, -1, Tk_Offset(Entry, scrollCmd),
+ DEF_ENTRY_SCROLL_COMMAND, TCL_INDEX_NONE, offsetof(Entry, scrollCmd),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
/*
@@ -391,7 +403,7 @@ static const char *const selElementNames[] = {
static int ConfigureEntry(Tcl_Interp *interp, Entry *entryPtr,
int objc, Tcl_Obj *const objv[]);
-static int DeleteChars(Entry *entryPtr, int index, int count);
+static int DeleteChars(Entry *entryPtr, TkSizeT index, TkSizeT count);
static void DestroyEntry(void *memPtr);
static void DisplayEntry(ClientData clientData);
static void EntryBlinkProc(ClientData clientData);
@@ -400,22 +412,22 @@ static void EntryComputeGeometry(Entry *entryPtr);
static void EntryEventProc(ClientData clientData,
XEvent *eventPtr);
static void EntryFocusProc(Entry *entryPtr, int gotFocus);
-static int EntryFetchSelection(ClientData clientData, int offset,
- char *buffer, int maxBytes);
+static TkSizeT EntryFetchSelection(ClientData clientData, TkSizeT offset,
+ char *buffer, TkSizeT maxBytes);
static void EntryLostSelection(ClientData clientData);
static void EventuallyRedraw(Entry *entryPtr);
static void EntryScanTo(Entry *entryPtr, int y);
static void EntrySetValue(Entry *entryPtr, const char *value);
-static void EntrySelectTo(Entry *entryPtr, int index);
+static void EntrySelectTo(Entry *entryPtr, TkSizeT index);
static char * EntryTextVarProc(ClientData clientData,
Tcl_Interp *interp, const char *name1,
const char *name2, int flags);
static void EntryUpdateScrollbar(Entry *entryPtr);
static int EntryValidate(Entry *entryPtr, char *cmd);
static int EntryValidateChange(Entry *entryPtr, const char *change,
- const char *newStr, int index, int type);
+ const char *newStr, TkSizeT index, int type);
static void ExpandPercents(Entry *entryPtr, const char *before,
- const char *change, const char *newStr, int index,
+ const char *change, const char *newStr, TkSizeT index,
int type, Tcl_DString *dsPtr);
static int EntryValueChanged(Entry *entryPtr,
const char *newValue);
@@ -426,8 +438,8 @@ static int EntryWidgetObjCmd(ClientData clientData,
Tcl_Obj *const objv[]);
static void EntryWorldChanged(ClientData instanceData);
static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr,
- Tcl_Obj *indexObj, int *indexPtr);
-static int InsertChars(Entry *entryPtr, int index, const char *string);
+ Tcl_Obj *indexObj, TkSizeT *indexPtr);
+static int InsertChars(Entry *entryPtr, TkSizeT index, const char *string);
/*
* These forward declarations are the spinbox specific ones:
@@ -472,7 +484,7 @@ static const Tk_ClassProcs entryClass = {
int
Tk_EntryObjCmd(
- ClientData clientData, /* NULL. */
+ ClientData dummy, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -481,6 +493,7 @@ Tk_EntryObjCmd(
Tk_OptionTable optionTable;
Tk_Window tkwin;
char *tmp;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -507,7 +520,7 @@ Tk_EntryObjCmd(
* initialized as memset covers the rest.
*/
- entryPtr = ckalloc(sizeof(Entry));
+ entryPtr = (Entry *)ckalloc(sizeof(Entry));
memset(entryPtr, 0, sizeof(Entry));
entryPtr->tkwin = tkwin;
@@ -518,11 +531,11 @@ Tk_EntryObjCmd(
EntryCmdDeletedProc);
entryPtr->optionTable = optionTable;
entryPtr->type = TK_ENTRY;
- tmp = ckalloc(1);
+ tmp = (char *)ckalloc(1);
tmp[0] = '\0';
entryPtr->string = tmp;
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
+ entryPtr->selectFirst = TCL_INDEX_NONE;
+ entryPtr->selectLast = TCL_INDEX_NONE;
entryPtr->cursor = NULL;
entryPtr->exportSelection = 1;
@@ -537,6 +550,8 @@ Tk_EntryObjCmd(
entryPtr->avgWidth = 1;
entryPtr->validate = VALIDATE_NONE;
+ entryPtr->placeholderGC = NULL;
+
/*
* Keep a hold of the associated tkwin until we destroy the entry,
* otherwise Tk might free it while we still need it.
@@ -552,14 +567,14 @@ Tk_EntryObjCmd(
Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING,
EntryFetchSelection, entryPtr, XA_STRING);
- if ((Tk_InitOptions(interp, (char *) entryPtr, optionTable, tkwin)
+ if ((Tk_InitOptions(interp, entryPtr, optionTable, tkwin)
!= TCL_OK) ||
(ConfigureEntry(interp, entryPtr, objc-2, objv+2) != TCL_OK)) {
Tk_DestroyWindow(entryPtr->tkwin);
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(entryPtr->tkwin));
return TCL_OK;
}
@@ -588,7 +603,7 @@ EntryWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Entry *entryPtr = clientData;
+ Entry *entryPtr = (Entry *)clientData;
int cmdIndex, selIndex, result;
Tcl_Obj *objPtr;
@@ -611,7 +626,8 @@ EntryWidgetObjCmd(
Tcl_Preserve(entryPtr);
switch ((enum entryCmd) cmdIndex) {
case COMMAND_BBOX: {
- int index, x, y, width, height;
+ TkSizeT index;
+ int x, y, width, height;
Tcl_Obj *bbox[4];
if (objc != 3) {
@@ -622,14 +638,14 @@ EntryWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- if ((index == entryPtr->numChars) && (index > 0)) {
+ if ((index == entryPtr->numChars) && (index + 1 > 1)) {
index--;
}
Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height);
- bbox[0] = Tcl_NewIntObj(x + entryPtr->layoutX);
- bbox[1] = Tcl_NewIntObj(y + entryPtr->layoutY);
- bbox[2] = Tcl_NewIntObj(width);
- bbox[3] = Tcl_NewIntObj(height);
+ bbox[0] = Tcl_NewWideIntObj(x + entryPtr->layoutX);
+ bbox[1] = Tcl_NewWideIntObj(y + entryPtr->layoutY);
+ bbox[2] = Tcl_NewWideIntObj(width);
+ bbox[3] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, bbox));
break;
}
@@ -640,7 +656,7 @@ EntryWidgetObjCmd(
goto error;
}
- objPtr = Tk_GetOptionValue(interp, (char *) entryPtr,
+ objPtr = Tk_GetOptionValue(interp, entryPtr,
entryPtr->optionTable, objv[2], entryPtr->tkwin);
if (objPtr == NULL) {
goto error;
@@ -650,7 +666,7 @@ EntryWidgetObjCmd(
case COMMAND_CONFIGURE:
if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr,
+ objPtr = Tk_GetOptionInfo(interp, entryPtr,
entryPtr->optionTable,
(objc == 3) ? objv[2] : NULL,
entryPtr->tkwin);
@@ -664,7 +680,8 @@ EntryWidgetObjCmd(
break;
case COMMAND_DELETE: {
- int first, last, code;
+ TkSizeT first, last;
+ int code;
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
@@ -680,7 +697,7 @@ EntryWidgetObjCmd(
&last) != TCL_OK) {
goto error;
}
- if ((last >= first) && (entryPtr->state == STATE_NORMAL)) {
+ if ((last + 1 >= first + 1 ) && (entryPtr->state == STATE_NORMAL)) {
code = DeleteChars(entryPtr, first, last - first);
if (code != TCL_OK) {
goto error;
@@ -694,7 +711,7 @@ EntryWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, NULL);
goto error;
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, TCL_INDEX_NONE));
break;
case COMMAND_ICURSOR:
@@ -710,7 +727,7 @@ EntryWidgetObjCmd(
break;
case COMMAND_INDEX: {
- int index;
+ TkSizeT index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "string");
@@ -720,12 +737,13 @@ EntryWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
break;
}
case COMMAND_INSERT: {
- int index, code;
+ TkSizeT index;
+ int code;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "index text");
@@ -776,7 +794,7 @@ EntryWidgetObjCmd(
}
case COMMAND_SELECTION: {
- int index, index2;
+ TkSizeT index, index2;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option ?index?");
@@ -814,14 +832,14 @@ EntryWidgetObjCmd(
objv[3], &index) != TCL_OK) {
goto error;
}
- if (entryPtr->selectFirst >= 0) {
- int half1, half2;
+ if (entryPtr->selectFirst != TCL_INDEX_NONE) {
+ TkSizeT half1, half2;
half1 = (entryPtr->selectFirst + entryPtr->selectLast)/2;
half2 = (entryPtr->selectFirst + entryPtr->selectLast + 1)/2;
- if (index < half1) {
+ if (index + 1 < half1 + 1 ) {
entryPtr->selectAnchor = entryPtr->selectLast;
- } else if (index > half2) {
+ } else if (index + 1 > half2 + 1 ) {
entryPtr->selectAnchor = entryPtr->selectFirst;
} else {
/*
@@ -838,9 +856,9 @@ EntryWidgetObjCmd(
Tcl_WrongNumArgs(interp, 3, objv, NULL);
goto error;
}
- if (entryPtr->selectFirst >= 0) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
+ if (entryPtr->selectFirst != TCL_INDEX_NONE) {
+ entryPtr->selectFirst = TCL_INDEX_NONE;
+ entryPtr->selectLast = TCL_INDEX_NONE;
EventuallyRedraw(entryPtr);
}
goto done;
@@ -863,7 +881,7 @@ EntryWidgetObjCmd(
goto error;
}
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(entryPtr->selectFirst >= 0));
+ Tcl_NewWideIntObj(entryPtr->selectFirst != TCL_INDEX_NONE));
goto done;
case SELECTION_RANGE:
@@ -879,9 +897,9 @@ EntryWidgetObjCmd(
&index2) != TCL_OK) {
goto error;
}
- if (index >= index2) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
+ if (index + 1 >= index2 + 1 ) {
+ entryPtr->selectFirst = TCL_INDEX_NONE;
+ entryPtr->selectLast = TCL_INDEX_NONE;
} else {
entryPtr->selectFirst = index;
entryPtr->selectLast = index2;
@@ -930,7 +948,7 @@ EntryWidgetObjCmd(
}
case COMMAND_XVIEW: {
- int index;
+ TkSizeT index;
if (objc == 2) {
double first, last;
@@ -974,10 +992,10 @@ EntryWidgetObjCmd(
break;
}
}
- if (index >= entryPtr->numChars) {
+ if (index + 1 >= entryPtr->numChars + 1) {
index = entryPtr->numChars - 1;
}
- if (index < 0) {
+ if ((int)index < 0) {
index = 0;
}
entryPtr->leftIndex = index;
@@ -1019,7 +1037,7 @@ static void
DestroyEntry(
void *memPtr) /* Info about entry widget. */
{
- Entry *entryPtr = memPtr;
+ Entry *entryPtr = (Entry *)memPtr;
/*
* Free up all the stuff that requires special handling, then let
@@ -1097,13 +1115,13 @@ ConfigureEntry(
Spinbox *sbPtr = (Spinbox *) entryPtr;
/* Only used when this widget is of type
* TK_SPINBOX */
- char *oldValues = NULL; /* lint initialization */
- char *oldFormat = NULL; /* lint initialization */
+ char *oldValues = NULL;
+ char *oldFormat = NULL;
int error;
- int oldExport = 0; /* lint initialization */
- int valuesChanged = 0; /* lint initialization */
- double oldFrom = 0.0; /* lint initialization */
- double oldTo = 0.0; /* lint initialization */
+ int oldExport = 0;
+ int valuesChanged = 0;
+ double oldFrom = 0.0;
+ double oldTo = 0.0;
int code;
/*
@@ -1137,7 +1155,7 @@ ConfigureEntry(
* First pass: set options to new values.
*/
- if (Tk_SetOptions(interp, (char *) entryPtr,
+ if (Tk_SetOptions(interp, entryPtr,
entryPtr->optionTable, objc, objv,
entryPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
@@ -1177,13 +1195,15 @@ ConfigureEntry(
if (entryPtr->type == TK_SPINBOX) {
if (sbPtr->fromValue > sbPtr->toValue) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "-to value must be greater than -from value",
- -1));
- Tcl_SetErrorCode(interp, "TK", "SPINBOX", "RANGE_SANITY",
- NULL);
- continue;
- }
+ /*
+ * Swap -from and -to values.
+ */
+
+ double tmpFromTo = sbPtr->fromValue;
+
+ sbPtr->fromValue = sbPtr->toValue;
+ sbPtr->toValue = tmpFromTo;
+ }
if (sbPtr->reqFormat && (oldFormat != sbPtr->reqFormat)) {
/*
@@ -1220,7 +1240,7 @@ ConfigureEntry(
if (formatSpace < TCL_DOUBLE_SPACE) {
formatSpace = TCL_DOUBLE_SPACE;
}
- sbPtr->formatBuf = ckrealloc(sbPtr->formatBuf, formatSpace);
+ sbPtr->formatBuf = (char *)ckrealloc(sbPtr->formatBuf, formatSpace);
/*
* We perturb the value of oldFrom to allow us to go into the
@@ -1243,7 +1263,7 @@ ConfigureEntry(
Tcl_Obj *newObjPtr;
int nelems;
- newObjPtr = Tcl_NewStringObj(sbPtr->valueStr, -1);
+ newObjPtr = Tcl_NewStringObj(sbPtr->valueStr, TCL_INDEX_NONE);
if (Tcl_ListObjLength(interp, newObjPtr, &nelems)
!= TCL_OK) {
valuesChanged = -1;
@@ -1278,7 +1298,7 @@ ConfigureEntry(
if (entryPtr->exportSelection && (!oldExport)
&& (!Tcl_IsSafe(entryPtr->interp))
- && (entryPtr->selectFirst != -1)
+ && (entryPtr->selectFirst != TCL_INDEX_NONE)
&& !(entryPtr->flags & GOT_SELECTION)) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection,
entryPtr);
@@ -1434,7 +1454,7 @@ EntryWorldChanged(
unsigned long mask;
Tk_3DBorder border;
XColor *colorPtr;
- Entry *entryPtr = instanceData;
+ Entry *entryPtr = (Entry *)instanceData;
entryPtr->avgWidth = Tk_TextWidth(entryPtr->tkfont, "0", 1);
if (entryPtr->avgWidth == 0) {
@@ -1487,8 +1507,20 @@ EntryWorldChanged(
}
entryPtr->textGC = gc;
+ if (entryPtr->placeholderColorPtr != NULL) {
+ gcValues.foreground = entryPtr->placeholderColorPtr->pixel;
+ }
+ mask = GCForeground | GCFont | GCGraphicsExposures;
+ gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues);
+ if (entryPtr->placeholderGC != NULL) {
+ Tk_FreeGC(entryPtr->display, entryPtr->placeholderGC);
+ }
+ entryPtr->placeholderGC = gc;
+
if (entryPtr->selFgColorPtr != NULL) {
gcValues.foreground = entryPtr->selFgColorPtr->pixel;
+ } else {
+ gcValues.foreground = colorPtr->pixel;
}
gcValues.font = Tk_FontId(entryPtr->tkfont);
mask = GCForeground | GCFont;
@@ -1532,6 +1564,10 @@ TkpDrawEntryBorderAndFocus(
Drawable pixmap,
int isSpinbox)
{
+ (void)entryPtr;
+ (void)pixmap;
+ (void)isSpinbox;
+
return 0;
}
@@ -1558,6 +1594,9 @@ TkpDrawSpinboxButtons(
Spinbox *sbPtr,
Pixmap pixmap)
{
+ (void)sbPtr;
+ (void)pixmap;
+
return 0;
}
#endif /* Not MAC_OSX_TK */
@@ -1582,7 +1621,7 @@ static void
DisplayEntry(
ClientData clientData) /* Information about window. */
{
- Entry *entryPtr = clientData;
+ Entry *entryPtr = (Entry *)clientData;
Tk_Window tkwin = entryPtr->tkwin;
int baseY, selStartX, selEndX, cursorX;
int showSelection, xBound;
@@ -1645,7 +1684,7 @@ DisplayEntry(
* Hide the selection whenever we don't have the focus, unless we
* always want to show selection.
*/
- if (TkpAlwaysShowSelection(entryPtr->tkwin)) {
+ if (Tk_AlwaysShowSelection(entryPtr->tkwin)) {
showSelection = 1;
} else {
showSelection = (entryPtr->flags & GOT_FOCUS);
@@ -1670,7 +1709,7 @@ DisplayEntry(
0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
if (showSelection && (entryPtr->state != STATE_DISABLED)
- && (entryPtr->selectLast > entryPtr->leftIndex)) {
+ && (entryPtr->selectLast + 1 > entryPtr->leftIndex + 1)) {
if (entryPtr->selectFirst <= entryPtr->leftIndex) {
selStartX = entryPtr->leftX;
} else {
@@ -1713,7 +1752,7 @@ DisplayEntry(
cursorX -= (entryPtr->insertWidth == 1) ? 1 : (entryPtr->insertWidth)/2;
Tk_SetCaretPos(entryPtr->tkwin, cursorX, baseY - fm.ascent,
fm.ascent + fm.descent);
- if (entryPtr->insertPos >= entryPtr->leftIndex && cursorX < xBound) {
+ if ((entryPtr->insertPos + 1 >= entryPtr->leftIndex + 1) && cursorX < xBound) {
if (entryPtr->flags & CURSOR_ON) {
Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->insertBorder,
cursorX, baseY - fm.ascent, entryPtr->insertWidth,
@@ -1727,43 +1766,56 @@ DisplayEntry(
}
}
- if (showSelection && (entryPtr->state != STATE_DISABLED)
- && (entryPtr->selTextGC != entryPtr->textGC)
- && (entryPtr->selectFirst < entryPtr->selectLast)) {
+ if ((entryPtr->numChars == 0) && (entryPtr->placeholderChars != 0)) {
- /*
- * Draw the selected and unselected portions separately.
- */
+ /*
+ * Draw the placeholder text.
+ */
- int selFirst;
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->placeholderGC,
+ entryPtr->placeholderLayout, entryPtr->placeholderX, entryPtr->layoutY,
+ entryPtr->placeholderLeftIndex, entryPtr->placeholderChars);
- if (entryPtr->selectFirst < entryPtr->leftIndex) {
- selFirst = entryPtr->leftIndex;
- } else {
- selFirst = entryPtr->selectFirst;
- }
- if (entryPtr->leftIndex < selFirst) {
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
- entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
- entryPtr->leftIndex, selFirst);
- }
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->selTextGC,
- entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
- selFirst, entryPtr->selectLast);
- if (entryPtr->selectLast < entryPtr->numChars) {
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
- entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
- entryPtr->selectLast, entryPtr->numChars);
- }
} else {
- /*
- * Draw the entire visible text
- */
+ if (showSelection && (entryPtr->state != STATE_DISABLED)
+ && (entryPtr->selTextGC != entryPtr->textGC)
+ && (entryPtr->selectFirst + 1 < entryPtr->selectLast + 1)) {
+
+ /*
+ * Draw the selected and unselected portions separately.
+ */
+
+ TkSizeT selFirst;
+
+ if (entryPtr->selectFirst + 1 < entryPtr->leftIndex + 1) {
+ selFirst = entryPtr->leftIndex;
+ } else {
+ selFirst = entryPtr->selectFirst;
+ }
+ if (entryPtr->leftIndex < selFirst) {
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->leftIndex, selFirst);
+ }
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->selTextGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ selFirst, entryPtr->selectLast);
+ if (entryPtr->selectLast < entryPtr->numChars) {
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->selectLast, entryPtr->numChars);
+ }
+ } else {
+
+ /*
+ * Draw the entire visible text
+ */
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
- entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
- entryPtr->leftIndex, entryPtr->numChars);
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->leftIndex, entryPtr->numChars);
+ }
}
if (entryPtr->type == TK_SPINBOX) {
@@ -1920,7 +1972,8 @@ static void
EntryComputeGeometry(
Entry *entryPtr) /* Widget record for entry. */
{
- int totalLength, overflow, maxOffScreen, rightX;
+ int totalLength, overflow, rightX;
+ TkSizeT maxOffScreen;
int height, width, i;
Tk_FontMetrics fm;
char *p;
@@ -1952,16 +2005,68 @@ EntryComputeGeometry(
size = TkUniCharToUtf(ch, buf);
entryPtr->numDisplayBytes = entryPtr->numChars * size;
- p = ckalloc(entryPtr->numDisplayBytes + 1);
+ p = (char *)ckalloc(entryPtr->numDisplayBytes + 1);
entryPtr->displayString = p;
- for (i = entryPtr->numChars; --i >= 0; ) {
+ for (i = entryPtr->numChars; i-- > 0; ) {
memcpy(p, buf, size);
p += size;
}
*p = '\0';
}
+ /* Recompute layout of placeholder text.
+ * Only the placeholderX and placeholderLeftIndex value is needed.
+ * We use the same font so we can use the layoutY value from below.
+ */
+
+ Tk_FreeTextLayout(entryPtr->placeholderLayout);
+ if (entryPtr->placeholderString) {
+ entryPtr->placeholderChars = strlen(entryPtr->placeholderString);
+ entryPtr->placeholderLayout = Tk_ComputeTextLayout(entryPtr->tkfont,
+ entryPtr->placeholderString, entryPtr->placeholderChars, 0,
+ entryPtr->justify, TK_IGNORE_NEWLINES, &totalLength, NULL);
+ overflow = totalLength -
+ (Tk_Width(entryPtr->tkwin) - 2*entryPtr->inset - entryPtr->xWidth);
+ if (overflow <= 0) {
+ entryPtr->placeholderLeftIndex = 0;
+ if (entryPtr->justify == TK_JUSTIFY_LEFT) {
+ entryPtr->placeholderX = entryPtr->inset;
+ } else if (entryPtr->justify == TK_JUSTIFY_RIGHT) {
+ entryPtr->placeholderX = Tk_Width(entryPtr->tkwin) - entryPtr->inset
+ - entryPtr->xWidth - totalLength;
+ } else {
+ entryPtr->placeholderX = (Tk_Width(entryPtr->tkwin)
+ - entryPtr->xWidth - totalLength)/2;
+ }
+ } else {
+
+ /*
+ * The whole string can't fit in the window. Compute the maximum
+ * number of characters that may be off-screen to the left without
+ * leaving empty space on the right of the window, then don't let
+ * placeholderLeftIndex be any greater than that.
+ */
+
+ maxOffScreen = Tk_PointToChar(entryPtr->placeholderLayout, overflow, 0);
+ Tk_CharBbox(entryPtr->placeholderLayout, maxOffScreen,
+ &rightX, NULL, NULL, NULL);
+ if (rightX < overflow) {
+ maxOffScreen++;
+ }
+ entryPtr->placeholderLeftIndex = maxOffScreen;
+ Tk_CharBbox(entryPtr->placeholderLayout, entryPtr->placeholderLeftIndex, &rightX,
+ NULL, NULL, NULL);
+ entryPtr->placeholderX = entryPtr->inset -rightX;
+ }
+ } else {
+ entryPtr->placeholderChars = 0;
+ entryPtr->placeholderLayout = Tk_ComputeTextLayout(entryPtr->tkfont,
+ entryPtr->placeholderString, 0, 0,
+ entryPtr->justify, TK_IGNORE_NEWLINES, NULL, NULL);
+ entryPtr->placeholderX = entryPtr->inset;
+ }
+
Tk_FreeTextLayout(entryPtr->textLayout);
entryPtr->textLayout = Tk_ComputeTextLayout(entryPtr->tkfont,
entryPtr->displayString, entryPtr->numChars, 0,
@@ -2004,7 +2109,7 @@ EntryComputeGeometry(
if (rightX < overflow) {
maxOffScreen++;
}
- if (entryPtr->leftIndex > maxOffScreen) {
+ if (entryPtr->leftIndex + 1 > maxOffScreen + 1) {
entryPtr->leftIndex = maxOffScreen;
}
Tk_CharBbox(entryPtr->textLayout, entryPtr->leftIndex, &rightX,
@@ -2052,26 +2157,24 @@ EntryComputeGeometry(
static int
InsertChars(
Entry *entryPtr, /* Entry that is to get the new elements. */
- int index, /* Add the new elements before this character
+ TkSizeT index, /* Add the new elements before this character
* index. */
const char *value) /* New characters to add (NULL-terminated
* string). */
{
- ptrdiff_t byteIndex;
- size_t byteCount, newByteCount;
- int oldChars, charsAdded;
+ size_t byteIndex, byteCount, newByteCount, oldChars, charsAdded;
const char *string;
char *newStr;
string = entryPtr->string;
- byteIndex = TkUtfAtIndex(string, index) - string;
+ byteIndex = Tcl_UtfAtIndex(string, index) - string;
byteCount = strlen(value);
if (byteCount == 0) {
return TCL_OK;
}
newByteCount = entryPtr->numBytes + byteCount + 1;
- newStr = ckalloc(newByteCount);
+ newStr = (char *)ckalloc(newByteCount);
memcpy(newStr, string, byteIndex);
strcpy(newStr + byteIndex, value);
strcpy(newStr + byteIndex + byteCount, string + byteIndex);
@@ -2088,8 +2191,6 @@ InsertChars(
entryPtr->string = newStr;
/*
- * ??? Is this construction still needed with Tcl_NumUtfChars ???
- *
* The following construction is used because inserting improperly formed
* UTF-8 sequences between other improperly formed UTF-8 sequences could
* result in actually forming valid UTF-8 sequences; the number of
@@ -2099,7 +2200,7 @@ InsertChars(
*/
oldChars = entryPtr->numChars;
- entryPtr->numChars = Tcl_NumUtfChars(newStr, -1);
+ entryPtr->numChars = Tcl_NumUtfChars(newStr, TCL_INDEX_NONE);
charsAdded = entryPtr->numChars - oldChars;
entryPtr->numBytes += byteCount;
@@ -2116,19 +2217,19 @@ InsertChars(
* selection.
*/
- if (entryPtr->selectFirst >= index) {
+ if (entryPtr->selectFirst + 1 >= index + 1) {
entryPtr->selectFirst += charsAdded;
}
- if (entryPtr->selectLast > index) {
+ if (entryPtr->selectLast + 1 > index + 1) {
entryPtr->selectLast += charsAdded;
}
- if ((entryPtr->selectAnchor > index) || (entryPtr->selectFirst >= index)) {
+ if ((entryPtr->selectAnchor + 1 > index + 1) || (entryPtr->selectFirst + 1 >= index + 1)) {
entryPtr->selectAnchor += charsAdded;
}
- if (entryPtr->leftIndex > index) {
+ if (entryPtr->leftIndex + 1 > index + 1) {
entryPtr->leftIndex += charsAdded;
}
- if (entryPtr->insertPos >= index) {
+ if (entryPtr->insertPos + 1 >= index + 1) {
entryPtr->insertPos += charsAdded;
}
return EntryValueChanged(entryPtr, NULL);
@@ -2155,30 +2256,30 @@ InsertChars(
static int
DeleteChars(
Entry *entryPtr, /* Entry widget to modify. */
- int index, /* Index of first character to delete. */
- int count) /* How many characters to delete. */
+ TkSizeT index, /* Index of first character to delete. */
+ TkSizeT count) /* How many characters to delete. */
{
int byteIndex, byteCount, newByteCount;
const char *string;
char *newStr, *toDelete;
- if ((index + count) > entryPtr->numChars) {
+ if (index + count + 1 > entryPtr->numChars + 1) {
count = entryPtr->numChars - index;
}
- if (count <= 0) {
+ if ((int)count <= 0) {
return TCL_OK;
}
string = entryPtr->string;
- byteIndex = TkUtfAtIndex(string, index) - string;
- byteCount = TkUtfAtIndex(string + byteIndex, count) - (string+byteIndex);
+ byteIndex = Tcl_UtfAtIndex(string, index) - string;
+ byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex);
newByteCount = entryPtr->numBytes + 1 - byteCount;
- newStr = ckalloc(newByteCount);
+ newStr = (char *)ckalloc(newByteCount);
memcpy(newStr, string, (size_t) byteIndex);
strcpy(newStr + byteIndex, string + byteIndex + byteCount);
- toDelete = ckalloc(byteCount + 1);
+ toDelete = (char *)ckalloc(byteCount + 1);
memcpy(toDelete, string + byteIndex, (size_t) byteCount);
toDelete[byteCount] = '\0';
@@ -2208,40 +2309,40 @@ DeleteChars(
* change.
*/
- if (entryPtr->selectFirst >= index) {
- if (entryPtr->selectFirst >= (index + count)) {
+ if (entryPtr->selectFirst + 1 >= index + 1) {
+ if (entryPtr->selectFirst + 1 >= index + count + 1) {
entryPtr->selectFirst -= count;
} else {
entryPtr->selectFirst = index;
}
}
- if (entryPtr->selectLast >= index) {
- if (entryPtr->selectLast >= (index + count)) {
+ if (entryPtr->selectLast + 1 >= index + 1) {
+ if (entryPtr->selectLast + 1 >= index + count + 1) {
entryPtr->selectLast -= count;
} else {
entryPtr->selectLast = index;
}
}
- if (entryPtr->selectLast <= entryPtr->selectFirst) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
+ if (entryPtr->selectLast + 1 <= entryPtr->selectFirst + 1) {
+ entryPtr->selectFirst = TCL_INDEX_NONE;
+ entryPtr->selectLast = TCL_INDEX_NONE;
}
- if (entryPtr->selectAnchor >= index) {
- if (entryPtr->selectAnchor >= (index+count)) {
+ if (entryPtr->selectAnchor + 1 >= index + 1) {
+ if (entryPtr->selectAnchor + 1 >= index + count + 1) {
entryPtr->selectAnchor -= count;
} else {
entryPtr->selectAnchor = index;
}
}
- if (entryPtr->leftIndex > index) {
- if (entryPtr->leftIndex >= (index + count)) {
+ if (entryPtr->leftIndex + 1 > index + 1) {
+ if (entryPtr->leftIndex + 1 >= index + count + 1) {
entryPtr->leftIndex -= count;
} else {
entryPtr->leftIndex = index;
}
}
- if (entryPtr->insertPos >= index) {
- if (entryPtr->insertPos >= (index + count)) {
+ if (entryPtr->insertPos + 1 >= index + 1) {
+ if (entryPtr->insertPos + 1 >= index + count + 1) {
entryPtr->insertPos -= count;
} else {
entryPtr->insertPos = index;
@@ -2364,7 +2465,7 @@ EntrySetValue(
* during validation
*/
- char *tmp = ckalloc(valueLen + 1);
+ char *tmp = (char *)ckalloc(valueLen + 1);
strcpy(tmp, value);
value = tmp;
@@ -2393,7 +2494,7 @@ EntrySetValue(
if (malloced) {
entryPtr->string = value;
} else {
- char *tmp = ckalloc(valueLen + 1);
+ char *tmp = (char *)ckalloc(valueLen + 1);
strcpy(tmp, value);
entryPtr->string = tmp;
@@ -2406,22 +2507,22 @@ EntrySetValue(
entryPtr->numDisplayBytes = entryPtr->numBytes;
}
- if (entryPtr->selectFirst >= 0) {
- if (entryPtr->selectFirst >= entryPtr->numChars) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
- } else if (entryPtr->selectLast > entryPtr->numChars) {
+ if (entryPtr->selectFirst != TCL_INDEX_NONE) {
+ if (entryPtr->selectFirst + 1 >= entryPtr->numChars + 1) {
+ entryPtr->selectFirst = TCL_INDEX_NONE;
+ entryPtr->selectLast = TCL_INDEX_NONE;
+ } else if (entryPtr->selectLast + 1 > entryPtr->numChars + 1) {
entryPtr->selectLast = entryPtr->numChars;
}
}
- if (entryPtr->leftIndex >= entryPtr->numChars) {
- if (entryPtr->numChars > 0) {
+ if (entryPtr->leftIndex + 1 >= entryPtr->numChars + 1) {
+ if (entryPtr->numChars + 1 > 1) {
entryPtr->leftIndex = entryPtr->numChars - 1;
} else {
entryPtr->leftIndex = 0;
}
}
- if (entryPtr->insertPos > entryPtr->numChars) {
+ if (entryPtr->insertPos + 1 > entryPtr->numChars + 1) {
entryPtr->insertPos = entryPtr->numChars;
}
@@ -2453,10 +2554,10 @@ EntryEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- Entry *entryPtr = clientData;
+ Entry *entryPtr = (Entry *)clientData;
if ((entryPtr->type == TK_SPINBOX) && (eventPtr->type == MotionNotify)) {
- Spinbox *sbPtr = clientData;
+ Spinbox *sbPtr = (Spinbox *)clientData;
int elem;
elem = GetSpinboxElement(sbPtr, eventPtr->xmotion.x,
@@ -2534,7 +2635,7 @@ static void
EntryCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- Entry *entryPtr = clientData;
+ Entry *entryPtr = (Entry *)clientData;
/*
* This function could be invoked either because the window was destroyed
@@ -2574,10 +2675,22 @@ GetEntryIndex(
Entry *entryPtr, /* Entry for which the index is being
* specified. */
Tcl_Obj *indexObj, /* Specifies character in entryPtr. */
- int *indexPtr) /* Where to store converted character index */
+ TkSizeT *indexPtr) /* Where to store converted character index */
{
- const char *string = Tcl_GetString(indexObj);
- size_t length = indexObj->length;
+ TkSizeT length, idx;
+ const char *string;
+
+ if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->numChars - 1, 1, &idx)) {
+ if (idx == TCL_INDEX_NONE) {
+ idx = 0;
+ } else if (idx > entryPtr->numChars) {
+ idx = entryPtr->numChars;
+ }
+ *indexPtr = idx;
+ return TCL_OK;
+ }
+
+ string = Tcl_GetStringFromObj(indexObj, &length);
switch (string[0]) {
case 'a':
@@ -2586,12 +2699,6 @@ GetEntryIndex(
}
*indexPtr = entryPtr->selectAnchor;
break;
- case 'e':
- if (strncmp(string, "end", length) != 0) {
- goto badIndex;
- }
- *indexPtr = entryPtr->numChars;
- break;
case 'i':
if (strncmp(string, "insert", length) != 0) {
goto badIndex;
@@ -2599,7 +2706,7 @@ GetEntryIndex(
*indexPtr = entryPtr->insertPos;
break;
case 's':
- if (entryPtr->selectFirst < 0) {
+ if (entryPtr->selectFirst == TCL_INDEX_NONE) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"selection isn't in widget %s",
@@ -2646,30 +2753,21 @@ GetEntryIndex(
* be selected, for example.
*/
- if (roundUp && (*indexPtr < entryPtr->numChars)) {
+ if (roundUp && (*indexPtr + 1 < entryPtr->numChars + 1)) {
*indexPtr += 1;
}
break;
}
default:
- if (Tcl_GetIntFromObj(NULL, indexObj, indexPtr) != TCL_OK) {
- goto badIndex;
- }
- if (*indexPtr < 0){
- *indexPtr = 0;
- } else if (*indexPtr > entryPtr->numChars) {
- *indexPtr = entryPtr->numChars;
- }
+ badIndex:
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad %s index \"%s\"",
+ (entryPtr->type == TK_ENTRY) ? "entry" : "spinbox", string));
+ Tcl_SetErrorCode(interp, "TK",
+ (entryPtr->type == TK_ENTRY) ? "ENTRY" : "SPINBOX",
+ "BAD_INDEX", NULL);
+ return TCL_ERROR;
}
return TCL_OK;
-
- badIndex:
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad %s index \"%s\"",
- (entryPtr->type == TK_ENTRY) ? "entry" : "spinbox", string));
- Tcl_SetErrorCode(interp, "TK",
- (entryPtr->type == TK_ENTRY) ? "ENTRY" : "SPINBOX",
- "BAD_INDEX", NULL);
- return TCL_ERROR;
}
/*
@@ -2694,7 +2792,7 @@ EntryScanTo(
Entry *entryPtr, /* Information about widget. */
int x) /* X-coordinate to use for scan operation. */
{
- int newLeftIndex;
+ TkSizeT newLeftIndex;
/*
* Compute new leftIndex for entry by amplifying the difference between
@@ -2709,11 +2807,11 @@ EntryScanTo(
newLeftIndex = entryPtr->scanMarkIndex
- (10 * (x - entryPtr->scanMarkX)) / entryPtr->avgWidth;
- if (newLeftIndex >= entryPtr->numChars) {
+ if (newLeftIndex + 1 >= entryPtr->numChars + 1) {
newLeftIndex = entryPtr->scanMarkIndex = entryPtr->numChars - 1;
entryPtr->scanMarkX = x;
}
- if (newLeftIndex < 0) {
+ if (newLeftIndex == TCL_INDEX_NONE) {
newLeftIndex = entryPtr->scanMarkIndex = 0;
entryPtr->scanMarkX = x;
}
@@ -2750,10 +2848,10 @@ EntryScanTo(
static void
EntrySelectTo(
Entry *entryPtr, /* Information about widget. */
- int index) /* Character index of element that is to
+ TkSizeT index) /* Character index of element that is to
* become the "other" end of the selection. */
{
- int newFirst, newLast;
+ TkSizeT newFirst, newLast;
/*
* Grab the selection if we don't own it already.
@@ -2770,17 +2868,17 @@ EntrySelectTo(
* Pick new starting and ending points for the selection.
*/
- if (entryPtr->selectAnchor > entryPtr->numChars) {
+ if (entryPtr->selectAnchor + 1 > entryPtr->numChars + 1) {
entryPtr->selectAnchor = entryPtr->numChars;
}
- if (entryPtr->selectAnchor <= index) {
+ if (entryPtr->selectAnchor + 1 <= index + 1) {
newFirst = entryPtr->selectAnchor;
newLast = index;
} else {
newFirst = index;
newLast = entryPtr->selectAnchor;
- if (newLast < 0) {
- newFirst = newLast = -1;
+ if (newLast == TCL_INDEX_NONE) {
+ newFirst = newLast = TCL_INDEX_NONE;
}
}
if ((entryPtr->selectFirst == newFirst)
@@ -2813,36 +2911,36 @@ EntrySelectTo(
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
EntryFetchSelection(
ClientData clientData, /* Information about entry widget. */
- int offset, /* Byte offset within selection of first
+ TkSizeT offset, /* Byte offset within selection of first
* character to be returned. */
char *buffer, /* Location in which to place selection. */
- int maxBytes) /* Maximum number of bytes to place at buffer,
+ TkSizeT maxBytes) /* Maximum number of bytes to place at buffer,
* not including terminating NUL character. */
{
- Entry *entryPtr = clientData;
- int byteCount;
+ Entry *entryPtr = (Entry *)clientData;
+ TkSizeT byteCount;
const char *string;
const char *selStart, *selEnd;
- if ((entryPtr->selectFirst < 0) || (!entryPtr->exportSelection)
+ if ((entryPtr->selectFirst == TCL_INDEX_NONE) || (!entryPtr->exportSelection)
|| Tcl_IsSafe(entryPtr->interp)) {
return -1;
}
string = entryPtr->displayString;
- selStart = TkUtfAtIndex(string, entryPtr->selectFirst);
- selEnd = TkUtfAtIndex(selStart,
+ selStart = Tcl_UtfAtIndex(string, entryPtr->selectFirst);
+ selEnd = Tcl_UtfAtIndex(selStart,
entryPtr->selectLast - entryPtr->selectFirst);
+ if (selEnd <= selStart + offset) {
+ return 0;
+ }
byteCount = selEnd - selStart - offset;
if (byteCount > maxBytes) {
byteCount = maxBytes;
}
- if (byteCount <= 0) {
- return 0;
- }
- memcpy(buffer, selStart + offset, (size_t) byteCount);
+ memcpy(buffer, selStart + offset, byteCount);
buffer[byteCount] = '\0';
return byteCount;
}
@@ -2869,7 +2967,7 @@ static void
EntryLostSelection(
ClientData clientData) /* Information about entry widget. */
{
- Entry *entryPtr = clientData;
+ Entry *entryPtr = (Entry *)clientData;
entryPtr->flags &= ~GOT_SELECTION;
@@ -2880,11 +2978,11 @@ EntryLostSelection(
* This is controlled by ::tk::AlwaysShowSelection.
*/
- if (TkpAlwaysShowSelection(entryPtr->tkwin)
- && (entryPtr->selectFirst >= 0) && entryPtr->exportSelection
+ if (Tk_AlwaysShowSelection(entryPtr->tkwin)
+ && (entryPtr->selectFirst != TCL_INDEX_NONE) && entryPtr->exportSelection
&& (!Tcl_IsSafe(entryPtr->interp))) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
+ entryPtr->selectFirst = TCL_INDEX_NONE;
+ entryPtr->selectLast = TCL_INDEX_NONE;
EventuallyRedraw(entryPtr);
}
}
@@ -2963,7 +3061,7 @@ EntryVisibleRange(
charsInWindow = Tk_PointToChar(entryPtr->textLayout,
Tk_Width(entryPtr->tkwin) - entryPtr->inset
- entryPtr->xWidth - entryPtr->layoutX - 1, 0);
- if (charsInWindow < entryPtr->numChars) {
+ if (charsInWindow < (int)entryPtr->numChars) {
charsInWindow++;
}
charsInWindow -= entryPtr->leftIndex;
@@ -3017,12 +3115,12 @@ EntryUpdateScrollbar(
Tcl_PrintDouble(NULL, first, firstStr);
Tcl_PrintDouble(NULL, last, lastStr);
Tcl_DStringInit(&buf);
- Tcl_DStringAppend(&buf, entryPtr->scrollCmd, -1);
- Tcl_DStringAppend(&buf, " ", -1);
- Tcl_DStringAppend(&buf, firstStr, -1);
- Tcl_DStringAppend(&buf, " ", -1);
- Tcl_DStringAppend(&buf, lastStr, -1);
- code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
+ Tcl_DStringAppend(&buf, entryPtr->scrollCmd, TCL_INDEX_NONE);
+ Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE);
+ Tcl_DStringAppend(&buf, firstStr, TCL_INDEX_NONE);
+ Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE);
+ Tcl_DStringAppend(&buf, lastStr, TCL_INDEX_NONE);
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (code != TCL_OK) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
@@ -3056,7 +3154,7 @@ static void
EntryBlinkProc(
ClientData clientData) /* Pointer to record describing entry. */
{
- Entry *entryPtr = clientData;
+ Entry *entryPtr = (Entry *)clientData;
if ((entryPtr->state == STATE_DISABLED) ||
(entryPtr->state == STATE_READONLY) ||
@@ -3142,7 +3240,6 @@ EntryFocusProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static char *
EntryTextVarProc(
ClientData clientData, /* Information about button. */
@@ -3151,8 +3248,10 @@ EntryTextVarProc(
const char *name2, /* Not used. */
int flags) /* Information about what happened. */
{
- Entry *entryPtr = clientData;
+ Entry *entryPtr = (Entry *)clientData;
const char *value;
+ (void)name1;
+ (void)name2;
if (entryPtr->flags & ENTRY_DELETED) {
/*
@@ -3241,7 +3340,7 @@ EntryValidate(
Tcl_Interp *interp = entryPtr->interp;
int code, isOK;
- code = Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
+ code = Tcl_EvalEx(interp, cmd, TCL_INDEX_NONE, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
/*
* We accept TCL_OK and TCL_RETURN as valid return codes from the command
@@ -3298,7 +3397,7 @@ EntryValidateChange(
const char *change, /* Characters to be added/deleted
* (NUL-terminated string). */
const char *newValue, /* Potential new value of entry string */
- int index, /* index of insert/delete, -1 otherwise */
+ TkSizeT index, /* index of insert/delete, -1 otherwise */
int type) /* forced, delete, insert, focusin or
* focusout */
{
@@ -3444,7 +3543,7 @@ ExpandPercents(
const char *change, /* Characters to added/deleted (NUL-terminated
* string). */
const char *newValue, /* Potential new value of entry string */
- int index, /* index of insert/delete */
+ TkSizeT index, /* index of insert/delete */
int type, /* INSERT or DELETE */
Tcl_DString *dsPtr) /* Dynamic string in which to append new
* command. */
@@ -3533,7 +3632,7 @@ ExpandPercents(
string = numStorage;
break;
case 'i': /* index of insert/delete */
- sprintf(numStorage, "%d", index);
+ sprintf(numStorage, "%d", (int)index);
string = numStorage;
break;
case 'P': /* 'Peeked' new value of the string */
@@ -3602,7 +3701,7 @@ ExpandPercents(
int
Tk_SpinboxObjCmd(
- ClientData clientData, /* NULL. */
+ ClientData dummy, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3612,6 +3711,7 @@ Tk_SpinboxObjCmd(
Tk_OptionTable optionTable;
Tk_Window tkwin;
char *tmp;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -3638,7 +3738,7 @@ Tk_SpinboxObjCmd(
* initialized as memset covers the rest.
*/
- sbPtr = ckalloc(sizeof(Spinbox));
+ sbPtr = (Spinbox *)ckalloc(sizeof(Spinbox));
entryPtr = (Entry *) sbPtr;
memset(sbPtr, 0, sizeof(Spinbox));
@@ -3650,11 +3750,11 @@ Tk_SpinboxObjCmd(
EntryCmdDeletedProc);
entryPtr->optionTable = optionTable;
entryPtr->type = TK_SPINBOX;
- tmp = ckalloc(1);
+ tmp = (char *)ckalloc(1);
tmp[0] = '\0';
entryPtr->string = tmp;
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
+ entryPtr->selectFirst = TCL_INDEX_NONE;
+ entryPtr->selectLast = TCL_INDEX_NONE;
entryPtr->cursor = NULL;
entryPtr->exportSelection = 1;
@@ -3677,10 +3777,12 @@ Tk_SpinboxObjCmd(
sbPtr->fromValue = 0.0;
sbPtr->toValue = 100.0;
sbPtr->increment = 1.0;
- sbPtr->formatBuf = ckalloc(TCL_DOUBLE_SPACE);
+ sbPtr->formatBuf = (char *)ckalloc(TCL_DOUBLE_SPACE);
sbPtr->bdRelief = TK_RELIEF_FLAT;
sbPtr->buRelief = TK_RELIEF_FLAT;
+ entryPtr->placeholderGC = NULL;
+
/*
* Keep a hold of the associated tkwin until we destroy the spinbox,
* otherwise Tk might free it while we still need it.
@@ -3696,7 +3798,7 @@ Tk_SpinboxObjCmd(
Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING,
EntryFetchSelection, entryPtr, XA_STRING);
- if (Tk_InitOptions(interp, (char *) sbPtr, optionTable, tkwin)
+ if (Tk_InitOptions(interp, sbPtr, optionTable, tkwin)
!= TCL_OK) {
Tk_DestroyWindow(entryPtr->tkwin);
return TCL_ERROR;
@@ -3705,7 +3807,7 @@ Tk_SpinboxObjCmd(
goto error;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(entryPtr->tkwin));
return TCL_OK;
error:
@@ -3738,8 +3840,8 @@ SpinboxWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Entry *entryPtr = clientData;
- Spinbox *sbPtr = clientData;
+ Entry *entryPtr = (Entry *)clientData;
+ Spinbox *sbPtr = (Spinbox *)clientData;
int cmdIndex, selIndex, result;
Tcl_Obj *objPtr;
@@ -3762,7 +3864,8 @@ SpinboxWidgetObjCmd(
Tcl_Preserve(entryPtr);
switch ((enum sbCmd) cmdIndex) {
case SB_CMD_BBOX: {
- int index, x, y, width, height;
+ TkSizeT index;
+ int x, y, width, height;
Tcl_Obj *bbox[4];
if (objc != 3) {
@@ -3773,14 +3876,14 @@ SpinboxWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- if ((index == entryPtr->numChars) && (index > 0)) {
+ if ((index == entryPtr->numChars) && (index + 1 > 1)) {
index--;
}
Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height);
- bbox[0] = Tcl_NewIntObj(x + entryPtr->layoutX);
- bbox[1] = Tcl_NewIntObj(y + entryPtr->layoutY);
- bbox[2] = Tcl_NewIntObj(width);
- bbox[3] = Tcl_NewIntObj(height);
+ bbox[0] = Tcl_NewWideIntObj(x + entryPtr->layoutX);
+ bbox[1] = Tcl_NewWideIntObj(y + entryPtr->layoutY);
+ bbox[2] = Tcl_NewWideIntObj(width);
+ bbox[3] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, bbox));
break;
}
@@ -3791,7 +3894,7 @@ SpinboxWidgetObjCmd(
goto error;
}
- objPtr = Tk_GetOptionValue(interp, (char *) entryPtr,
+ objPtr = Tk_GetOptionValue(interp, entryPtr,
entryPtr->optionTable, objv[2], entryPtr->tkwin);
if (objPtr == NULL) {
goto error;
@@ -3801,7 +3904,7 @@ SpinboxWidgetObjCmd(
case SB_CMD_CONFIGURE:
if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr,
+ objPtr = Tk_GetOptionInfo(interp, entryPtr,
entryPtr->optionTable, (objc == 3) ? objv[2] : NULL,
entryPtr->tkwin);
if (objPtr == NULL) {
@@ -3814,7 +3917,8 @@ SpinboxWidgetObjCmd(
break;
case SB_CMD_DELETE: {
- int first, last, code;
+ TkSizeT first, last;
+ int code;
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
@@ -3832,7 +3936,7 @@ SpinboxWidgetObjCmd(
goto error;
}
}
- if ((last >= first) && (entryPtr->state == STATE_NORMAL)) {
+ if ((last + 1 >= first + 1) && (entryPtr->state == STATE_NORMAL)) {
code = DeleteChars(entryPtr, first, last - first);
if (code != TCL_OK) {
goto error;
@@ -3881,7 +3985,7 @@ SpinboxWidgetObjCmd(
}
case SB_CMD_INDEX: {
- int index;
+ TkSizeT index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "string");
@@ -3891,12 +3995,13 @@ SpinboxWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
break;
}
case SB_CMD_INSERT: {
- int index, code;
+ TkSizeT index;
+ int code;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "index text");
@@ -3964,7 +4069,7 @@ SpinboxWidgetObjCmd(
}
case SB_CMD_SELECTION: {
- int index, index2;
+ TkSizeT index, index2;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option ?index?");
@@ -4002,14 +4107,14 @@ SpinboxWidgetObjCmd(
objv[3], &index) != TCL_OK) {
goto error;
}
- if (entryPtr->selectFirst >= 0) {
- int half1, half2;
+ if (entryPtr->selectFirst != TCL_INDEX_NONE) {
+ TkSizeT half1, half2;
half1 = (entryPtr->selectFirst + entryPtr->selectLast)/2;
half2 = (entryPtr->selectFirst + entryPtr->selectLast + 1)/2;
- if (index < half1) {
+ if (index + 1 < half1 + 1) {
entryPtr->selectAnchor = entryPtr->selectLast;
- } else if (index > half2) {
+ } else if (index + 1 > half2 + 1) {
entryPtr->selectAnchor = entryPtr->selectFirst;
} else {
/*
@@ -4026,9 +4131,9 @@ SpinboxWidgetObjCmd(
Tcl_WrongNumArgs(interp, 3, objv, NULL);
goto error;
}
- if (entryPtr->selectFirst >= 0) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
+ if (entryPtr->selectFirst != TCL_INDEX_NONE) {
+ entryPtr->selectFirst = TCL_INDEX_NONE;
+ entryPtr->selectLast = TCL_INDEX_NONE;
EventuallyRedraw(entryPtr);
}
goto done;
@@ -4051,7 +4156,7 @@ SpinboxWidgetObjCmd(
goto error;
}
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- entryPtr->selectFirst >= 0));
+ entryPtr->selectFirst != TCL_INDEX_NONE));
goto done;
case SB_SEL_RANGE:
@@ -4067,9 +4172,9 @@ SpinboxWidgetObjCmd(
objv[4],& index2) != TCL_OK) {
goto error;
}
- if (index >= index2) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
+ if (index + 1 >= index2 + 1) {
+ entryPtr->selectFirst = TCL_INDEX_NONE;
+ entryPtr->selectLast = TCL_INDEX_NONE;
} else {
entryPtr->selectFirst = index;
entryPtr->selectLast = index2;
@@ -4158,7 +4263,7 @@ SpinboxWidgetObjCmd(
}
case SB_CMD_XVIEW: {
- int index;
+ TkSizeT index;
if (objc == 2) {
double first, last;
@@ -4184,7 +4289,7 @@ SpinboxWidgetObjCmd(
case TK_SCROLL_ERROR:
goto error;
case TK_SCROLL_MOVETO:
- index = (int) ((fraction * entryPtr->numChars) + 0.5);
+ index = ((fraction * entryPtr->numChars) + 0.5);
break;
case TK_SCROLL_PAGES: {
int charsPerPage;
@@ -4203,10 +4308,10 @@ SpinboxWidgetObjCmd(
break;
}
}
- if (index >= entryPtr->numChars) {
+ if (index + 1 >= entryPtr->numChars + 1) {
index = entryPtr->numChars - 1;
}
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
index = 0;
}
entryPtr->leftIndex = index;
@@ -4321,7 +4426,8 @@ SpinboxInvoke(
* there. If not, move to the first element of the list.
*/
- int i, listc, elemLen, length = entryPtr->numChars;
+ int i, listc;
+ TkSizeT elemLen, length = entryPtr->numChars;
const char *bytes;
Tcl_Obj **listv;
@@ -4330,7 +4436,7 @@ SpinboxInvoke(
bytes = Tcl_GetStringFromObj(listv[i], &elemLen);
if ((length == elemLen) &&
(memcmp(bytes, entryPtr->string,
- (size_t) length) == 0)) {
+ length) == 0)) {
sbPtr->eIndex = i;
break;
}
diff --git a/generic/tkEntry.h b/generic/tkEntry.h
index 6b1bf87..fe0f2f7 100644
--- a/generic/tkEntry.h
+++ b/generic/tkEntry.h
@@ -6,7 +6,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * Copyright (c) 2002 Apple Inc.
+ * Copyright © 2002 Apple Inc.
*/
#ifndef _TKENTRY
@@ -45,18 +45,18 @@ typedef struct {
const char *string; /* Pointer to storage for string;
* NULL-terminated; malloc-ed. */
- int insertPos; /* Character index before which next typed
+ TkSizeT insertPos; /* Character index before which next typed
* character will be inserted. */
/*
* Information about what's selected, if any.
*/
- int selectFirst; /* Character index of first selected character
+ TkSizeT selectFirst; /* Character index of first selected character
* (-1 means nothing selected. */
- int selectLast; /* Character index just after last selected
+ TkSizeT selectLast; /* Character index just after last selected
* character (-1 means nothing selected. */
- int selectAnchor; /* Fixed end of selection (i.e. "select to"
+ TkSizeT selectAnchor; /* Fixed end of selection (i.e. "select to"
* operation will use this as one end of the
* selection). */
@@ -129,6 +129,19 @@ typedef struct {
* only used by the Entry widget. */
/*
+ * Fields used in displaying help text if entry value is empty
+ */
+
+ Tk_TextLayout placeholderLayout;/* Cached placeholder text layout information. */
+ char *placeholderString; /* String value of placeholder. */
+ TkSizeT placeholderChars; /* Number of chars in placeholder. */
+ XColor *placeholderColorPtr;/* Color value of placeholder foreground. */
+ GC placeholderGC; /* For drawing placeholder text. */
+ int placeholderX; /* Origin for layout. */
+ int placeholderLeftIndex; /* Character index of left-most character
+ * visible in window. */
+
+ /*
* Fields whose values are derived from the current values of the
* configuration settings above.
*/
@@ -138,13 +151,13 @@ typedef struct {
* malloced memory with the same character
* length as string but whose characters are
* all equal to showChar. */
- int numBytes; /* Length of string in bytes. */
- int numChars; /* Length of string in characters. Both string
+ TkSizeT numBytes; /* Length of string in bytes. */
+ TkSizeT numChars; /* Length of string in characters. Both string
* and displayString have the same character
* length, but may have different byte lengths
* due to being made from different UTF-8
* characters. */
- int numDisplayBytes; /* Length of displayString in bytes. */
+ TkSizeT numDisplayBytes; /* Length of displayString in bytes. */
int inset; /* Number of pixels on the left and right
* sides that are taken up by XPAD,
* borderWidth (if any), and highlightWidth
@@ -153,7 +166,7 @@ typedef struct {
int layoutX, layoutY; /* Origin for layout. */
int leftX; /* X position at which character at leftIndex
* is drawn (varies depending on justify). */
- int leftIndex; /* Character index of left-most character
+ TkSizeT leftIndex; /* Character index of left-most character
* visible in window. */
Tcl_TimerToken insertBlinkHandler;
/* Timer handler used to blink cursor on and
diff --git a/generic/tkError.c b/generic/tkError.c
index 6ff5475..ec72d1b 100644
--- a/generic/tkError.c
+++ b/generic/tkError.c
@@ -6,8 +6,8 @@
* useful, for example, when communicating with a window that may not
* exist.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1995 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -164,11 +164,10 @@ Tk_DeleteErrorHandler(
* there are many handlers that stay around forever).
*/
- dispPtr->deleteCount += 1;
- if (dispPtr->deleteCount >= 10) {
+ if (dispPtr->deleteCount++ >= 9) {
TkErrorHandler *prevPtr;
TkErrorHandler *nextPtr;
- int lastSerial = LastKnownRequestProcessed(dispPtr->display);
+ unsigned long lastSerial = LastKnownRequestProcessed(dispPtr->display);
/*
* Last chance to catch errors for this handler: if no event/error
@@ -176,7 +175,7 @@ Tk_DeleteErrorHandler(
* we need a round trip with the X server now.
*/
- if (errorPtr->lastRequest > (unsigned long) lastSerial) {
+ if (errorPtr->lastRequest > lastSerial) {
XSync(dispPtr->display, False);
}
dispPtr->deleteCount = 0;
@@ -184,7 +183,7 @@ Tk_DeleteErrorHandler(
for (prevPtr = NULL; errorPtr != NULL; errorPtr = nextPtr) {
nextPtr = errorPtr->nextPtr;
if ((errorPtr->lastRequest != (unsigned long) -1)
- && (errorPtr->lastRequest <= (unsigned long) lastSerial)) {
+ && (errorPtr->lastRequest <= lastSerial)) {
if (prevPtr == NULL) {
dispPtr->errorPtr = nextPtr;
} else {
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 456b86d..698e9e1 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -4,10 +4,10 @@
* This file provides basic low-level facilities for managing X events in
* Tk.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1995 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 Ajuba Solutions.
- * Copyright (c) 2004 George Peter Staplin
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1995 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Ajuba Solutions.
+ * Copyright © 2004 George Peter Staplin
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -15,6 +15,14 @@
#include "tkInt.h"
+#ifdef _WIN32
+#include "tkWinInt.h"
+#elif defined(MAC_OSX_TK)
+#include "tkMacOSXInt.h"
+#else
+#include "tkUnixInt.h"
+#endif
+
/*
* There's a potential problem if a handler is deleted while it's current
* (i.e. its function is executing), since Tk_HandleEvent will need to read
@@ -205,9 +213,7 @@ static int RefreshKeyboardMappingIfNeeded(XEvent *eventPtr);
static int TkXErrorHandler(ClientData clientData,
XErrorEvent *errEventPtr);
static int WindowEventProc(Tcl_Event *evPtr, int flags);
-#ifdef TK_USE_INPUT_METHODS
static void CreateXIC(TkWindow *winPtr);
-#endif /* TK_USE_INPUT_METHODS */
/*
*----------------------------------------------------------------------
@@ -315,7 +321,6 @@ InvokeMouseHandlers(
*----------------------------------------------------------------------
*/
-#ifdef TK_USE_INPUT_METHODS
static void
CreateXIC(
TkWindow *winPtr)
@@ -362,7 +367,6 @@ CreateXIC(
XSelectInput(winPtr->display, winPtr->window, winPtr->atts.event_mask);
}
}
-#endif
/*
*----------------------------------------------------------------------
@@ -509,9 +513,12 @@ RefreshKeyboardMappingIfNeeded(
/*
*----------------------------------------------------------------------
*
- * TkGetButtonMask --
+ * Tk_GetButtonMask --
*
- * Return the proper Button${n}Mask for the button.
+ * Return the proper Button${n}Mask for the button. Don't care about
+ * Button4 - Button7, because those are not actually buttons: Those
+ * are used for the horizontal or vertical mouse wheels. Button4Mask
+ * and higher is actually used for Button 8 and higher.
*
* Results:
* A button mask.
@@ -523,14 +530,15 @@ RefreshKeyboardMappingIfNeeded(
*/
static const unsigned buttonMasks[] = {
- 0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask
+ 0, Button1Mask, Button2Mask, Button3Mask, 0, 0, 0, 0, Button4Mask, \
+ Button5Mask, Button6Mask, Button7Mask, Button8Mask, Button9Mask
};
unsigned
-TkGetButtonMask(
+Tk_GetButtonMask(
unsigned button)
{
- return (button > Button5) ? 0 : buttonMasks[button];
+ return (button > Button9) ? 0 : buttonMasks[button];
}
/*
@@ -1132,11 +1140,20 @@ Tk_HandleEvent(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-#if !defined(MAC_OSX_TK) && !defined(_WIN32)
- if (((eventPtr->type == ButtonPress) || (eventPtr->type == ButtonRelease))
- && ((eventPtr->xbutton.button - 6) < 2)) {
- eventPtr->xbutton.button -= 2;
- eventPtr->xbutton.state ^= ShiftMask;
+
+#if !defined(_WIN32) && !defined(MAC_OSX_TK)
+ if ((eventPtr->xbutton.button >= Button4) && (eventPtr->xbutton.button < Button8)) {
+ if (eventPtr->type == ButtonRelease) {
+ return;
+ } else if (eventPtr->type == ButtonPress) {
+ int but = eventPtr->xbutton.button;
+ eventPtr->type = MouseWheelEvent;
+ eventPtr->xany.send_event = -1;
+ eventPtr->xkey.keycode = (but & 1) ? -120 : 120;
+ if (but > Button5) {
+ eventPtr->xkey.state |= ShiftMask;
+ }
+ }
}
#endif
@@ -1206,7 +1223,6 @@ Tk_HandleEvent(
* ever active for X11.
*/
-#ifdef TK_USE_INPUT_METHODS
/*
* If the XIC has been invalidated, it must be recreated.
*/
@@ -1228,7 +1244,6 @@ Tk_HandleEvent(
XSetICFocus(winPtr->inputContext);
}
}
-#endif /*TK_USE_INPUT_METHODS*/
/*
* For events where it hasn't already been done, update the current time
diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c
index c8dbc52..8a84f8e 100644
--- a/generic/tkFileFilter.c
+++ b/generic/tkFileFilter.c
@@ -4,7 +4,7 @@
* Process the -filetypes option for the file dialogs on Windows and the
* Mac.
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -262,7 +262,7 @@ AddClause(
*/
for (i=0; i<ostypeCount; i++) {
- int len;
+ TkSizeT len;
const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
/*
@@ -305,7 +305,7 @@ AddClause(
* Add the clause into the list of clauses
*/
- clausePtr = ckalloc(sizeof(FileFilterClause));
+ clausePtr = (FileFilterClause *)ckalloc(sizeof(FileFilterClause));
clausePtr->patterns = NULL;
clausePtr->patternsTail = NULL;
clausePtr->macTypes = NULL;
@@ -321,8 +321,8 @@ AddClause(
if (globCount > 0 && globList != NULL) {
for (i=0; i<globCount; i++) {
- GlobPattern *globPtr = ckalloc(sizeof(GlobPattern));
- int len;
+ GlobPattern *globPtr = (GlobPattern *)ckalloc(sizeof(GlobPattern));
+ TkSizeT len;
const char *str = Tcl_GetStringFromObj(globList[i], &len);
len = (len + 1) * sizeof(char);
@@ -331,12 +331,12 @@ AddClause(
* Prepend a "*" to patterns that do not have a leading "*"
*/
- globPtr->pattern = ckalloc(len + 1);
+ globPtr->pattern = (char *)ckalloc(len + 1);
globPtr->pattern[0] = '*';
strcpy(globPtr->pattern+1, str);
} else if (isWindows) {
if (strcmp(str, "*") == 0) {
- globPtr->pattern = ckalloc(4);
+ globPtr->pattern = (char *)ckalloc(4);
strcpy(globPtr->pattern, "*.*");
} else if (strcmp(str, "") == 0) {
/*
@@ -345,14 +345,14 @@ AddClause(
* TODO: "*." actually matches with all files on Win95
*/
- globPtr->pattern = ckalloc(3);
+ globPtr->pattern = (char *)ckalloc(3);
strcpy(globPtr->pattern, "*.");
} else {
- globPtr->pattern = ckalloc(len);
+ globPtr->pattern = (char *)ckalloc(len);
strcpy(globPtr->pattern, str);
}
} else {
- globPtr->pattern = ckalloc(len);
+ globPtr->pattern = (char *)ckalloc(len);
strcpy(globPtr->pattern, str);
}
@@ -375,8 +375,8 @@ AddClause(
}
for (i=0; i<ostypeCount; i++) {
Tcl_DString osTypeDS;
- int len;
- MacFileType *mfPtr = ckalloc(sizeof(MacFileType));
+ TkSizeT len;
+ MacFileType *mfPtr = (MacFileType *)ckalloc(sizeof(MacFileType));
const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
char *string;
@@ -445,11 +445,11 @@ GetFilter(
}
}
- filterPtr = ckalloc(sizeof(FileFilter));
+ filterPtr = (FileFilter *)ckalloc(sizeof(FileFilter));
filterPtr->clauses = NULL;
filterPtr->clausesTail = NULL;
len = strlen(name) + 1;
- filterPtr->name = ckalloc(len);
+ filterPtr->name = (char *)ckalloc(len);
memcpy(filterPtr->name, name, len);
if (flistPtr->filters == NULL) {
diff --git a/generic/tkFileFilter.h b/generic/tkFileFilter.h
index 131e423..07d4d33 100644
--- a/generic/tkFileFilter.h
+++ b/generic/tkFileFilter.h
@@ -4,7 +4,7 @@
* Declarations for the file filter processing routines needed by the
* file selection dialogs.
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -13,6 +13,10 @@
#ifndef _TK_FILE_FILTER
#define _TK_FILE_FILTER
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define OSType long
typedef struct GlobPattern {
@@ -75,4 +79,8 @@ MODULE_SCOPE int TkGetFileFilters(Tcl_Interp *interp,
FileFilterList *flistPtr, Tcl_Obj *valuePtr,
int isWindows);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _TK_FILE_FILTER */
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 8066afd..5dc542a 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -3,8 +3,8 @@
*
* This file contains functions that manage the input focus for Tk.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -128,7 +128,7 @@ Tk_FocusObjCmd(
Tk_Window focusWin = (Tk_Window) TkGetFocusWin(winPtr);
if (focusWin != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(focusWin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(focusWin));
}
return TCL_OK;
}
@@ -179,7 +179,7 @@ Tk_FocusObjCmd(
}
newPtr = TkGetFocusWin(newPtr);
if (newPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) newPtr));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) newPtr));
}
break;
case 1: /* -force */
@@ -212,12 +212,12 @@ Tk_FocusObjCmd(
for (tlFocusPtr = newPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL;
tlFocusPtr = tlFocusPtr->nextPtr) {
if (tlFocusPtr->topLevelPtr == topLevelPtr) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window)
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window)
tlFocusPtr->focusWinPtr));
return TCL_OK;
}
}
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) topLevelPtr));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) topLevelPtr));
return TCL_OK;
}
break;
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 9c157db..6664cbb 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -4,8 +4,8 @@
* This file maintains a database of fonts for the Tk toolkit. It also
* provides several utility functions for measuring and displaying text.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1998 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -44,7 +44,7 @@ typedef struct TkFontInfo {
*/
typedef struct NamedFont {
- int refCount; /* Number of users of named font. */
+ size_t refCount; /* Number of users of named font. */
int deletePending; /* Non-zero if font should be deleted when
* last reference goes away. */
TkFontAttributes fa; /* Desired attributes for named font. */
@@ -354,7 +354,7 @@ const Tcl_ObjType tkFontObjType = {
FreeFontObjProc, /* freeIntRepProc */
DupFontObjProc, /* dupIntRepProc */
NULL, /* updateStringProc */
- SetFontFromAny /* setFromAnyProc */
+ NULL /* setFromAnyProc */
};
/*
@@ -556,7 +556,7 @@ Tk_FontObjCmd(
if (objc < 3 || n < objc) {
Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option? ?--? ?char?");
+ "font ?-displayof window? ?-option? ?--? ?char?");
return TCL_ERROR;
}
@@ -566,9 +566,9 @@ Tk_FontObjCmd(
if (charPtr != NULL) {
const char *string = Tcl_GetString(charPtr);
- int len = TkUtfToUniChar(string, &uniChar);
+ size_t len = TkUtfToUniChar(string, &uniChar);
- if (len != charPtr->length) {
+ if (len != (size_t)charPtr->length) {
resultPtr = Tcl_NewStringObj(
"expected a single character but got \"", -1);
Tcl_AppendLimitedToObj(resultPtr, string,
@@ -715,7 +715,8 @@ Tk_FontObjCmd(
case FONT_MEASURE: {
const char *string;
Tk_Font tkfont;
- int length = 0, skip = 0;
+ TkSizeT length = 0;
+ int skip = 0;
if (objc > 4) {
skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin);
@@ -733,7 +734,7 @@ Tk_FontObjCmd(
return TCL_ERROR;
}
string = Tcl_GetStringFromObj(objv[3 + skip], &length);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
Tk_TextWidth(tkfont, string, length)));
Tk_FreeFont(tkfont);
break;
@@ -752,7 +753,7 @@ Tk_FontObjCmd(
}
if ((objc < 3) || ((objc - skip) > 4)) {
Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option?");
+ "font ?-displayof window? ?-option?");
return TCL_ERROR;
}
tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
@@ -780,7 +781,7 @@ Tk_FontObjCmd(
case 2: i = fmPtr->ascent + fmPtr->descent; break;
case 3: i = fmPtr->fixed; break;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(i));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(i));
}
Tk_FreeFont(tkfont);
break;
@@ -1447,8 +1448,7 @@ Tk_FreeFont(
*/
nfPtr = (NamedFont *)Tcl_GetHashValue(fontPtr->namedHashPtr);
- nfPtr->refCount--;
- if ((nfPtr->refCount == 0) && nfPtr->deletePending) {
+ if ((nfPtr->refCount-- <= 1) && nfPtr->deletePending) {
Tcl_DeleteHashEntry(fontPtr->namedHashPtr);
ckfree(nfPtr);
}
@@ -1535,8 +1535,7 @@ FreeFontObj(
TkFont *fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1;
if (fontPtr != NULL) {
- fontPtr->objRefCount--;
- if ((fontPtr->resourceRefCount == 0) && (fontPtr->objRefCount == 0)) {
+ if ((fontPtr->objRefCount-- <= 1) && (fontPtr->resourceRefCount == 0)) {
ckfree(fontPtr);
}
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
@@ -1728,15 +1727,11 @@ Tk_PostscriptFontName(
upper = 1;
}
src += TkUtfToUniChar(src, &ch);
- if (ch <= 0xffff) {
- if (upper) {
- ch = Tcl_UniCharToUpper(ch);
- upper = 0;
- } else {
- ch = Tcl_UniCharToLower(ch);
- }
- } else {
+ if (upper) {
+ ch = Tcl_UniCharToUpper(ch);
upper = 0;
+ } else {
+ ch = Tcl_UniCharToLower(ch);
}
dest += TkUniCharToUtf(ch, dest);
}
@@ -2006,7 +2001,7 @@ Tk_ComputeTextLayout(
maxChunks = 1;
- layoutPtr = (TextLayout *)ckalloc(Tk_Offset(TextLayout, chunks)
+ layoutPtr = (TextLayout *)ckalloc(offsetof(TextLayout, chunks)
+ maxChunks * sizeof(LayoutChunk));
layoutPtr->tkfont = tkfont;
layoutPtr->string = string;
@@ -2021,7 +2016,7 @@ Tk_ComputeTextLayout(
curX = 0;
- endp = TkUtfAtIndex(string, numChars);
+ endp = Tcl_UtfAtIndex(string, numChars);
special = string;
flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES;
@@ -2329,15 +2324,15 @@ Tk_DrawTextLayout(
firstChar = 0;
firstByte = chunkPtr->start;
} else {
- firstByte = TkUtfAtIndex(chunkPtr->start, firstChar);
+ firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar);
Tk_MeasureChars(layoutPtr->tkfont, chunkPtr->start,
firstByte - chunkPtr->start, -1, 0, &drawX);
}
if (lastChar < numDisplayChars) {
numDisplayChars = lastChar;
}
- lastByte = TkUtfAtIndex(chunkPtr->start, numDisplayChars);
-#if TK_DRAW_IN_CONTEXT
+ lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
+#ifdef TK_DRAW_IN_CONTEXT
TkpDrawCharsInContext(display, drawable, gc, layoutPtr->tkfont,
chunkPtr->start, chunkPtr->numBytes,
firstByte - chunkPtr->start, lastByte - firstByte,
@@ -2399,15 +2394,15 @@ TkDrawAngledTextLayout(
firstChar = 0;
firstByte = chunkPtr->start;
} else {
- firstByte = TkUtfAtIndex(chunkPtr->start, firstChar);
+ firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar);
Tk_MeasureChars(layoutPtr->tkfont, chunkPtr->start,
firstByte - chunkPtr->start, -1, 0, &drawX);
}
if (lastChar < numDisplayChars) {
numDisplayChars = lastChar;
}
- lastByte = TkUtfAtIndex(chunkPtr->start, numDisplayChars);
-#if TK_DRAW_IN_CONTEXT
+ lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
+#ifdef TK_DRAW_IN_CONTEXT
dx = cosA * (chunkPtr->x) + sinA * (chunkPtr->y);
dy = -sinA * (chunkPtr->x) + cosA * (chunkPtr->y);
if (angle == 0.0) {
@@ -2742,7 +2737,7 @@ Tk_CharBbox(
* index, if non-NULL. */
{
TextLayout *layoutPtr = (TextLayout *) layout;
- LayoutChunk *chunkPtr;
+ LayoutChunk *chunkPtr = layoutPtr->chunks;
int i, x = 0, w;
Tk_Font tkfont;
TkFont *fontPtr;
@@ -2752,7 +2747,6 @@ Tk_CharBbox(
return 0;
}
- chunkPtr = layoutPtr->chunks;
tkfont = layoutPtr->tkfont;
fontPtr = (TkFont *) tkfont;
@@ -2764,7 +2758,7 @@ Tk_CharBbox(
goto check;
}
} else if (index < chunkPtr->numChars) {
- end = TkUtfAtIndex(chunkPtr->start, index);
+ end = Tcl_UtfAtIndex(chunkPtr->start, index);
if (xPtr != NULL) {
Tk_MeasureChars(tkfont, chunkPtr->start,
end - chunkPtr->start, -1, 0, &x);
@@ -3291,7 +3285,8 @@ Tk_TextLayoutToPostscript(
LayoutChunk *chunkPtr = layoutPtr->chunks;
int baseline = chunkPtr->y;
Tcl_Obj *psObj = Tcl_NewObj();
- int i, j, len;
+ int i, j;
+ TkSizeT len;
const char *p, *glyphname;
char uindex[5], c, *ps;
int ch;
@@ -3404,7 +3399,7 @@ noMapping: ;
static int
ConfigAttributesObj(
Tcl_Interp *interp, /* Interp for error return. */
- TCL_UNUSED(Tk_Window), /* For display on which font will be used. */
+ TCL_UNUSED(Tk_Window), /* For display on which font will be used. */
int objc, /* Number of elements in argv. */
Tcl_Obj *const objv[], /* Command line options. */
TkFontAttributes *faPtr) /* Font attributes structure whose fields are
@@ -3540,9 +3535,9 @@ GetAttributeInfoObj(
case FONT_SIZE:
if (faPtr->size >= 0.0) {
- valuePtr = Tcl_NewIntObj((int)(faPtr->size + 0.5));
+ valuePtr = Tcl_NewWideIntObj((Tcl_WideInt)(faPtr->size + 0.5));
} else {
- valuePtr = Tcl_NewIntObj(-(int)(-faPtr->size + 0.5));
+ valuePtr = Tcl_NewWideIntObj(-(Tcl_WideInt)(-faPtr->size + 0.5));
}
break;
@@ -3579,6 +3574,57 @@ GetAttributeInfoObj(
/*
*---------------------------------------------------------------------------
*
+ * Tk_FontGetDescription --
+ *
+ * Return information about the font description as a Tcl list. One
+ * possible result is "{{DejaVu Sans} -16 bold underline}".
+ *
+ * Results:
+ * The list of descriptions.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+Tcl_Obj *
+Tk_FontGetDescription(
+ Tk_Font tkfont) /* Font whose description is desired. */
+{
+ const TkFontAttributes *faPtr = GetFontAttributes(tkfont);
+ Tcl_Obj *resultPtr = Tcl_NewObj();
+ const char *str;
+
+ str = faPtr->family;
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, str ? -1 : 0));
+ if (faPtr->size >= 0.0) {
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj((int)(faPtr->size + 0.5)));
+ } else {
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj(-(int)(-faPtr->size + 0.5)));
+ }
+ if (faPtr->weight != TK_FW_NORMAL) {
+ str = TkFindStateString(weightMap, faPtr->weight);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ if (faPtr->slant != TK_FS_ROMAN) {
+ str = TkFindStateString(slantMap, faPtr->slant);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ if (faPtr->underline) {
+ str = TkFindStateString(underlineMap, faPtr->underline);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ if (faPtr->overstrike) {
+ str = TkFindStateString(overstrikeMap, faPtr->overstrike);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ return resultPtr;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* ParseFontNameObj --
*
* Converts a object into a set of font attributes that can be used to
@@ -3779,7 +3825,7 @@ NewChunk(
maxChunks = *maxPtr;
if (layoutPtr->numChunks == maxChunks) {
maxChunks *= 2;
- s = Tk_Offset(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk));
+ s = offsetof(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk));
layoutPtr = (TextLayout *)ckrealloc(layoutPtr, s);
*layoutPtrPtr = layoutPtr;
@@ -4250,9 +4296,9 @@ TkDebugFont(
for ( ; (fontPtr != NULL); fontPtr = fontPtr->nextPtr) {
objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(fontPtr->resourceRefCount));
+ Tcl_NewWideIntObj(fontPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(fontPtr->objRefCount));
+ Tcl_NewWideIntObj(fontPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
diff --git a/generic/tkFont.h b/generic/tkFont.h
index de479bf..892d8da 100644
--- a/generic/tkFont.h
+++ b/generic/tkFont.h
@@ -5,7 +5,7 @@
* parts of the font package. This information is not visible outside of
* the font package.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,6 +14,10 @@
#ifndef _TKFONT
#define _TKFONT
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* The following structure keeps track of the attributes of a font. It can be
* used to keep track of either the desired attributes or the actual
@@ -85,7 +89,7 @@ typedef struct TkFont {
* Fields used and maintained exclusively by generic code.
*/
- int resourceRefCount; /* Number of active uses of this font (each
+ TkSizeT resourceRefCount; /* Number of active uses of this font (each
* active use corresponds to a call to
* Tk_AllocFontFromTable or Tk_GetFont). If
* this count is 0, then this TkFont structure
@@ -95,7 +99,7 @@ typedef struct TkFont {
* The structure is freed when
* resourceRefCount and objRefCount are both
* 0. */
- int objRefCount; /* The number of Tcl objects that reference
+ TkSizeT objRefCount; /* The number of Tcl objects that reference
* this structure. */
Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure,
* used when deleting it. */
@@ -221,4 +225,8 @@ MODULE_SCOPE void TkpGetFontFamilies(Tcl_Interp *interp,
Tk_Window tkwin);
MODULE_SCOPE TkFont * TkpGetNativeFont(Tk_Window tkwin, const char *name);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _TKFONT */
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index b5c20e8..9dbee48 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -5,15 +5,15 @@
* for the Tk toolkit. Frames are windows with a background color and
* possibly a 3-D effect, but not much else in the way of attributes.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
+#include "default.h"
/*
* The following enum is used to define the type of the frame.
@@ -94,6 +94,16 @@ typedef struct {
* pixels of extra space to leave above and
* below child area. */
int padY; /* Integer value corresponding to padYPtr. */
+ Tcl_Obj *bgimgPtr; /* Value of -backgroundimage option: specifies
+ * image to display on window's background, or
+ * NULL if none. */
+ Tk_Image bgimg; /* Derived from bgimgPtr by calling
+ * Tk_GetImage, or NULL if bgimgPtr is
+ * NULL. */
+ int tile; /* Whether to tile the bgimg. */
+#ifndef TK_NO_DOUBLE_BUFFERING
+ GC copyGC; /* GC for copying when double-buffering. */
+#endif /* TK_NO_DOUBLE_BUFFERING */
} Frame;
/*
@@ -174,80 +184,94 @@ static const char *const labelAnchorStrings[] = {
static const Tk_OptionSpec commonOptSpec[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_FRAME_BG_COLOR, -1, Tk_Offset(Frame, border),
+ DEF_FRAME_BG_COLOR, TCL_INDEX_NONE, offsetof(Frame, border),
TK_OPTION_NULL_OK, DEF_FRAME_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_STRING, "-colormap", "colormap", "Colormap",
- DEF_FRAME_COLORMAP, -1, Tk_Offset(Frame, colormapName),
+ DEF_FRAME_COLORMAP, TCL_INDEX_NONE, offsetof(Frame, colormapName),
TK_OPTION_NULL_OK, 0, 0},
/*
* Having -container is useless in a labelframe since a container has
* no border. It should be deprecated.
*/
{TK_OPTION_BOOLEAN, "-container", "container", "Container",
- DEF_FRAME_CONTAINER, -1, Tk_Offset(Frame, isContainer), 0, 0, 0},
+ DEF_FRAME_CONTAINER, TCL_INDEX_NONE, offsetof(Frame, isContainer), 0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_FRAME_CURSOR, -1, Tk_Offset(Frame, cursor),
+ DEF_FRAME_CURSOR, TCL_INDEX_NONE, offsetof(Frame, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-height", "height", "Height",
- DEF_FRAME_HEIGHT, -1, Tk_Offset(Frame, height), 0, 0, 0},
+ DEF_FRAME_HEIGHT, TCL_INDEX_NONE, offsetof(Frame, height), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
- "HighlightBackground", DEF_FRAME_HIGHLIGHT_BG, -1,
- Tk_Offset(Frame, highlightBgColorPtr), 0, 0, 0},
+ "HighlightBackground", DEF_FRAME_HIGHLIGHT_BG, TCL_INDEX_NONE,
+ offsetof(Frame, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_FRAME_HIGHLIGHT, -1, Tk_Offset(Frame, highlightColorPtr),
+ DEF_FRAME_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Frame, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_FRAME_HIGHLIGHT_WIDTH, -1,
- Tk_Offset(Frame, highlightWidth), 0, 0, 0},
+ "HighlightThickness", DEF_FRAME_HIGHLIGHT_WIDTH, TCL_INDEX_NONE,
+ offsetof(Frame, highlightWidth), 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
- DEF_FRAME_PADX, Tk_Offset(Frame, padXPtr),
- Tk_Offset(Frame, padX), 0, 0, 0},
+ DEF_FRAME_PADX, offsetof(Frame, padXPtr),
+ offsetof(Frame, padX), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", "padY", "Pad",
- DEF_FRAME_PADY, Tk_Offset(Frame, padYPtr),
- Tk_Offset(Frame, padY), 0, 0, 0},
+ DEF_FRAME_PADY, offsetof(Frame, padYPtr),
+ offsetof(Frame, padY), 0, 0, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_FRAME_TAKE_FOCUS, -1, Tk_Offset(Frame, takeFocus),
+ DEF_FRAME_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Frame, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-visual", "visual", "Visual",
- DEF_FRAME_VISUAL, -1, Tk_Offset(Frame, visualName),
+ DEF_FRAME_VISUAL, TCL_INDEX_NONE, offsetof(Frame, visualName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-width", "width", "Width",
- DEF_FRAME_WIDTH, -1, Tk_Offset(Frame, width), 0, 0, 0},
+ DEF_FRAME_WIDTH, TCL_INDEX_NONE, offsetof(Frame, width), 0, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
static const Tk_OptionSpec frameOptSpec[] = {
+ {TK_OPTION_STRING, "-backgroundimage", "backgroundImage", "BackgroundImage",
+ DEF_FRAME_BG_IMAGE, offsetof(Frame, bgimgPtr), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL,
+ NULL, 0, TCL_INDEX_NONE, 0, "-backgroundimage", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0},
+ DEF_FRAME_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Frame, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-class", "class", "Class",
- DEF_FRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
+ DEF_FRAME_CLASS, TCL_INDEX_NONE, offsetof(Frame, className), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},
+ DEF_FRAME_RELIEF, TCL_INDEX_NONE, offsetof(Frame, relief), 0, 0, 0},
+ {TK_OPTION_BOOLEAN, "-tile", "tile", "Tile",
+ DEF_FRAME_BG_TILE, TCL_INDEX_NONE, offsetof(Frame, tile), 0, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL,
NULL, 0, 0, 0, commonOptSpec, 0}
};
static const Tk_OptionSpec toplevelOptSpec[] = {
+ {TK_OPTION_STRING, "-backgroundimage", "backgroundImage", "BackgroundImage",
+ DEF_FRAME_BG_IMAGE, offsetof(Frame, bgimgPtr), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL,
+ NULL, 0, TCL_INDEX_NONE, 0, "-backgroundimage", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0},
+ DEF_FRAME_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Frame, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-class", "class", "Class",
- DEF_TOPLEVEL_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
+ DEF_TOPLEVEL_CLASS, TCL_INDEX_NONE, offsetof(Frame, className), 0, 0, 0},
{TK_OPTION_STRING, "-menu", "menu", "Menu",
- DEF_TOPLEVEL_MENU, -1, Tk_Offset(Frame, menuName),
+ DEF_TOPLEVEL_MENU, TCL_INDEX_NONE, offsetof(Frame, menuName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},
+ DEF_FRAME_RELIEF, TCL_INDEX_NONE, offsetof(Frame, relief), 0, 0, 0},
{TK_OPTION_STRING, "-screen", "screen", "Screen",
- DEF_TOPLEVEL_SCREEN, -1, Tk_Offset(Frame, screenName),
+ DEF_TOPLEVEL_SCREEN, TCL_INDEX_NONE, offsetof(Frame, screenName),
TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_BOOLEAN, "-tile", "tile", "Tile",
+ DEF_FRAME_BG_TILE, TCL_INDEX_NONE, offsetof(Frame, tile), 0, 0, 0},
{TK_OPTION_STRING, "-use", "use", "Use",
- DEF_TOPLEVEL_USE, -1, Tk_Offset(Frame, useThis),
+ DEF_TOPLEVEL_USE, TCL_INDEX_NONE, offsetof(Frame, useThis),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL,
NULL, 0, 0, 0, commonOptSpec, 0}
@@ -255,27 +279,27 @@ static const Tk_OptionSpec toplevelOptSpec[] = {
static const Tk_OptionSpec labelframeOptSpec[] = {
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_LABELFRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth),
+ DEF_LABELFRAME_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Frame, borderWidth),
0, 0, 0},
{TK_OPTION_STRING, "-class", "class", "Class",
- DEF_LABELFRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
+ DEF_LABELFRAME_CLASS, TCL_INDEX_NONE, offsetof(Frame, className), 0, 0, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_LABELFRAME_FONT, -1, Tk_Offset(Labelframe, tkfont), 0, 0, 0},
+ DEF_LABELFRAME_FONT, TCL_INDEX_NONE, offsetof(Labelframe, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_LABELFRAME_FG, -1, Tk_Offset(Labelframe, textColorPtr), 0, 0, 0},
+ DEF_LABELFRAME_FG, TCL_INDEX_NONE, offsetof(Labelframe, textColorPtr), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-labelanchor", "labelAnchor", "LabelAnchor",
- DEF_LABELFRAME_LABELANCHOR, -1, Tk_Offset(Labelframe, labelAnchor),
+ DEF_LABELFRAME_LABELANCHOR, TCL_INDEX_NONE, offsetof(Labelframe, labelAnchor),
0, labelAnchorStrings, 0},
{TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget",
- NULL, -1, Tk_Offset(Labelframe, labelWin), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(Labelframe, labelWin), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_LABELFRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},
+ DEF_LABELFRAME_RELIEF, TCL_INDEX_NONE, offsetof(Frame, relief), 0, 0, 0},
{TK_OPTION_STRING, "-text", "text", "Text",
- DEF_LABELFRAME_TEXT, Tk_Offset(Labelframe, textPtr), -1,
+ DEF_LABELFRAME_TEXT, offsetof(Labelframe, textPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL,
NULL, 0, 0, 0, commonOptSpec, 0}
@@ -311,6 +335,12 @@ static int CreateFrame(ClientData clientData, Tcl_Interp *interp,
static void DestroyFrame(void *memPtr);
static void DestroyFramePartly(Frame *framePtr);
static void DisplayFrame(ClientData clientData);
+static void DrawFrameBackground(Tk_Window tkwin, Pixmap pixmap,
+ int highlightWidth, int borderWidth,
+ Tk_Image bgimg, int bgtile);
+static void FrameBgImageProc(ClientData clientData,
+ int x, int y, int width, int height,
+ int imgWidth, int imgHeight);
static void FrameCmdDeletedProc(ClientData clientData);
static void FrameEventProc(ClientData clientData,
XEvent *eventPtr);
@@ -346,7 +376,7 @@ static const Tk_ClassProcs frameClass = {
static const Tk_GeomMgr frameGeomType = {
"labelframe", /* name */
FrameRequestProc, /* requestProc */
- FrameLostContentProc /* lostSlaveProc */
+ FrameLostContentProc /* lostContentProc */
};
/*
@@ -431,7 +461,7 @@ TkCreateFrame(
* application. */
{
int result, i;
- Tcl_Obj **objv = ckalloc((argc+1) * sizeof(Tcl_Obj **));
+ Tcl_Obj **objv = (Tcl_Obj **)ckalloc((argc+1) * sizeof(Tcl_Obj **));
for (i=0; i<argc; i++) {
objv[i] = Tcl_NewStringObj(argv[i], -1);
@@ -472,7 +502,7 @@ TkListCreateFrame(
static int
CreateFrame(
- ClientData clientData, /* NULL. */
+ ClientData dummy, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument objects. */
@@ -488,10 +518,12 @@ CreateFrame(
Tk_Window newWin;
const char *className, *screenName, *visualName, *colormapName;
const char *arg, *useOption;
- int i, length, depth;
+ int i, depth;
+ TkSizeT length;
unsigned int mask;
Colormap colormap;
Visual *visual;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -520,19 +552,19 @@ CreateFrame(
continue;
}
if ((arg[1] == 'c') && (length >= 3)
- && (strncmp(arg, "-class", (unsigned) length) == 0)) {
+ && (strncmp(arg, "-class", length) == 0)) {
className = Tcl_GetString(objv[i+1]);
} else if ((arg[1] == 'c') && (length >= 3)
- && (strncmp(arg, "-colormap", (unsigned) length) == 0)) {
+ && (strncmp(arg, "-colormap", length) == 0)) {
colormapName = Tcl_GetString(objv[i+1]);
} else if ((arg[1] == 's') && (type == TYPE_TOPLEVEL)
- && (strncmp(arg, "-screen", (unsigned) length) == 0)) {
+ && (strncmp(arg, "-screen", length) == 0)) {
screenName = Tcl_GetString(objv[i+1]);
} else if ((arg[1] == 'u') && (type == TYPE_TOPLEVEL)
- && (strncmp(arg, "-use", (unsigned) length) == 0)) {
+ && (strncmp(arg, "-use", length) == 0)) {
useOption = Tcl_GetString(objv[i+1]);
} else if ((arg[1] == 'v')
- && (strncmp(arg, "-visual", (unsigned) length) == 0)) {
+ && (strncmp(arg, "-visual", length) == 0)) {
visualName = Tcl_GetString(objv[i+1]);
}
}
@@ -647,10 +679,10 @@ CreateFrame(
*/
if (type == TYPE_LABELFRAME) {
- framePtr = ckalloc(sizeof(Labelframe));
+ framePtr = (Frame *)ckalloc(sizeof(Labelframe));
memset(framePtr, 0, sizeof(Labelframe));
} else {
- framePtr = ckalloc(sizeof(Frame));
+ framePtr = (Frame *)ckalloc(sizeof(Frame));
memset(framePtr, 0, sizeof(Frame));
}
framePtr->tkwin = newWin;
@@ -682,7 +714,7 @@ CreateFrame(
mask |= ActivateMask;
}
Tk_CreateEventHandler(newWin, mask, FrameEventProc, framePtr);
- if ((Tk_InitOptions(interp, (char *) framePtr, optionTable, newWin)
+ if ((Tk_InitOptions(interp, framePtr, optionTable, newWin)
!= TCL_OK) ||
(ConfigureFrame(interp, framePtr, objc-2, objv+2) != TCL_OK)) {
goto error;
@@ -700,7 +732,7 @@ CreateFrame(
if (type == TYPE_TOPLEVEL) {
Tcl_DoWhenIdle(MapFrame, framePtr);
}
- Tcl_SetObjResult(interp, TkNewWindowObj(newWin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(newWin));
return TCL_OK;
error:
@@ -741,9 +773,10 @@ FrameWidgetObjCmd(
enum options {
FRAME_CGET, FRAME_CONFIGURE
};
- Frame *framePtr = clientData;
+ Frame *framePtr = (Frame *)clientData;
int result = TCL_OK, index;
- int c, i, length;
+ int c, i;
+ TkSizeT length;
Tcl_Obj *objPtr;
if (objc < 2) {
@@ -762,7 +795,7 @@ FrameWidgetObjCmd(
result = TCL_ERROR;
goto done;
}
- objPtr = Tk_GetOptionValue(interp, (char *) framePtr,
+ objPtr = Tk_GetOptionValue(interp, framePtr,
framePtr->optionTable, objv[2], framePtr->tkwin);
if (objPtr == NULL) {
result = TCL_ERROR;
@@ -772,7 +805,7 @@ FrameWidgetObjCmd(
break;
case FRAME_CONFIGURE:
if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) framePtr,
+ objPtr = Tk_GetOptionInfo(interp, framePtr,
framePtr->optionTable, (objc == 3) ? objv[2] : NULL,
framePtr->tkwin);
if (objPtr == NULL) {
@@ -794,17 +827,17 @@ FrameWidgetObjCmd(
}
c = arg[1];
if (((c == 'c') && (length >= 2)
- && (strncmp(arg, "-class", (unsigned)length) == 0))
+ && (strncmp(arg, "-class", length) == 0))
|| ((c == 'c') && (length >= 3)
- && (strncmp(arg, "-colormap", (unsigned)length) == 0))
+ && (strncmp(arg, "-colormap", length) == 0))
|| ((c == 'c') && (length >= 3)
- && (strncmp(arg, "-container", (unsigned)length) == 0))
+ && (strncmp(arg, "-container", length) == 0))
|| ((c == 's') && (framePtr->type == TYPE_TOPLEVEL)
- && (strncmp(arg, "-screen", (unsigned)length) == 0))
+ && (strncmp(arg, "-screen", length) == 0))
|| ((c == 'u') && (framePtr->type == TYPE_TOPLEVEL)
- && (strncmp(arg, "-use", (unsigned)length) == 0))
+ && (strncmp(arg, "-use", length) == 0))
|| ((c == 'v')
- && (strncmp(arg, "-visual", (unsigned)length) == 0))) {
+ && (strncmp(arg, "-visual", length) == 0))) {
#ifdef _WIN32
if (c == 'u') {
@@ -859,8 +892,8 @@ static void
DestroyFrame(
void *memPtr) /* Info about frame widget. */
{
- Frame *framePtr = memPtr;
- Labelframe *labelframePtr = memPtr;
+ Frame *framePtr = (Frame *)memPtr;
+ Labelframe *labelframePtr = (Labelframe *)memPtr;
if (framePtr->type == TYPE_LABELFRAME) {
Tk_FreeTextLayout(labelframePtr->textLayout);
@@ -868,9 +901,17 @@ DestroyFrame(
Tk_FreeGC(framePtr->display, labelframePtr->textGC);
}
}
+#ifndef TK_NO_DOUBLE_BUFFERING
+ if (framePtr->copyGC != NULL) {
+ Tk_FreeGC(framePtr->display, framePtr->copyGC);
+ }
+#endif /* TK_NO_DOUBLE_BUFFERING */
if (framePtr->colormap != None) {
Tk_FreeColormap(framePtr->display, framePtr->colormap);
}
+ if (framePtr->bgimg) {
+ Tk_FreeImage(framePtr->bgimg);
+ }
ckfree(framePtr);
}
@@ -945,6 +986,7 @@ ConfigureFrame(
char *oldMenuName;
Tk_Window oldWindow = NULL;
Labelframe *labelframePtr = (Labelframe *) framePtr;
+ Tk_Image image = NULL;
/*
* Need the old menubar name for the menu code to delete it.
@@ -953,14 +995,14 @@ ConfigureFrame(
if (framePtr->menuName == NULL) {
oldMenuName = NULL;
} else {
- oldMenuName = ckalloc(strlen(framePtr->menuName) + 1);
+ oldMenuName = (char *)ckalloc(strlen(framePtr->menuName) + 1);
strcpy(oldMenuName, framePtr->menuName);
}
if (framePtr->type == TYPE_LABELFRAME) {
oldWindow = labelframePtr->labelWin;
}
- if (Tk_SetOptions(interp, (char *) framePtr,
+ if (Tk_SetOptions(interp, framePtr,
framePtr->optionTable, objc, objv,
framePtr->tkwin, &savedOptions, NULL) != TCL_OK) {
if (oldMenuName != NULL) {
@@ -968,6 +1010,20 @@ ConfigureFrame(
}
return TCL_ERROR;
}
+
+ if (framePtr->bgimgPtr) {
+ image = Tk_GetImage(interp, framePtr->tkwin,
+ Tcl_GetString(framePtr->bgimgPtr), FrameBgImageProc, framePtr);
+ if (image == NULL) {
+ Tk_RestoreSavedOptions(&savedOptions);
+ return TCL_ERROR;
+ }
+ }
+ if (framePtr->bgimg) {
+ Tk_FreeImage(framePtr->bgimg);
+ }
+ framePtr->bgimg = image;
+
Tk_FreeSavedOptions(&savedOptions);
/*
@@ -1094,8 +1150,8 @@ static void
FrameWorldChanged(
ClientData instanceData) /* Information about widget. */
{
- Frame *framePtr = instanceData;
- Labelframe *labelframePtr = instanceData;
+ Frame *framePtr = (Frame *)instanceData;
+ Labelframe *labelframePtr = (Labelframe *)instanceData;
Tk_Window tkwin = framePtr->tkwin;
XGCValues gcValues;
GC gc;
@@ -1109,6 +1165,15 @@ FrameWorldChanged(
anyWindowLabel = (framePtr->type == TYPE_LABELFRAME) &&
(labelframePtr->labelWin != NULL);
+#ifndef TK_NO_DOUBLE_BUFFERING
+ gcValues.graphics_exposures = False;
+ gc = Tk_GetGC(tkwin, GCGraphicsExposures, &gcValues);
+ if (framePtr->copyGC != NULL) {
+ Tk_FreeGC(framePtr->display, framePtr->copyGC);
+ }
+ framePtr->copyGC = gc;
+#endif /* TK_NO_DOUBLE_BUFFERING */
+
if (framePtr->type == TYPE_LABELFRAME) {
/*
* The textGC is needed even in the labelWin case, so it's always
@@ -1412,7 +1477,7 @@ static void
DisplayFrame(
ClientData clientData) /* Information about widget. */
{
- Frame *framePtr = clientData;
+ Frame *framePtr = (Frame *)clientData;
Tk_Window tkwin = framePtr->tkwin;
int bdX1, bdY1, bdX2, bdY2, hlWidth;
Pixmap pixmap;
@@ -1453,6 +1518,20 @@ DisplayFrame(
return;
}
+#ifndef TK_NO_DOUBLE_BUFFERING
+ /*
+ * In order to avoid screen flashes, this function redraws the frame into
+ * off-screen memory, then copies it back on-screen in a single operation.
+ * This means there's no point in time where the on-screen image has been
+ * cleared.
+ */
+
+ pixmap = Tk_GetPixmap(framePtr->display, Tk_WindowId(tkwin),
+ Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
+#else
+ pixmap = Tk_WindowId(tkwin);
+#endif /* TK_NO_DOUBLE_BUFFERING */
+
if (framePtr->type != TYPE_LABELFRAME) {
/*
* Pass to platform specific draw function. In general, it just draws
@@ -1460,8 +1539,12 @@ DisplayFrame(
*/
noLabel:
- TkpDrawFrame(tkwin, framePtr->border, hlWidth,
+ TkpDrawFrameEx(tkwin, pixmap, framePtr->border, hlWidth,
framePtr->borderWidth, framePtr->relief);
+ if (framePtr->bgimg) {
+ DrawFrameBackground(tkwin, pixmap, hlWidth, framePtr->borderWidth,
+ framePtr->bgimg, framePtr->tile);
+ }
} else {
Labelframe *labelframePtr = (Labelframe *) framePtr;
@@ -1470,20 +1553,6 @@ DisplayFrame(
goto noLabel;
}
-#ifndef TK_NO_DOUBLE_BUFFERING
- /*
- * In order to avoid screen flashes, this function redraws the frame
- * into off-screen memory, then copies it back on-screen in a single
- * operation. This means there's no point in time where the on-screen
- * image has been cleared.
- */
-
- pixmap = Tk_GetPixmap(framePtr->display, Tk_WindowId(tkwin),
- Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
-#else
- pixmap = Tk_WindowId(tkwin);
-#endif /* TK_NO_DOUBLE_BUFFERING */
-
/*
* Clear the pixmap.
*/
@@ -1595,22 +1664,54 @@ DisplayFrame(
labelframePtr->labelBox.height);
}
}
+ }
#ifndef TK_NO_DOUBLE_BUFFERING
- /*
- * Everything's been redisplayed; now copy the pixmap onto the screen
- * and free up the pixmap.
- */
+ /*
+ * Everything's been redisplayed; now copy the pixmap onto the screen and
+ * free up the pixmap.
+ */
- XCopyArea(framePtr->display, pixmap, Tk_WindowId(tkwin),
- labelframePtr->textGC, hlWidth, hlWidth,
- (unsigned) (Tk_Width(tkwin) - 2 * hlWidth),
- (unsigned) (Tk_Height(tkwin) - 2 * hlWidth),
- hlWidth, hlWidth);
- Tk_FreePixmap(framePtr->display, pixmap);
+ XCopyArea(framePtr->display, pixmap, Tk_WindowId(tkwin),
+ framePtr->copyGC, hlWidth, hlWidth,
+ (unsigned) (Tk_Width(tkwin) - 2 * hlWidth),
+ (unsigned) (Tk_Height(tkwin) - 2 * hlWidth),
+ hlWidth, hlWidth);
+ Tk_FreePixmap(framePtr->display, pixmap);
#endif /* TK_NO_DOUBLE_BUFFERING */
- }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawFrame --
+ *
+ * This procedure draws the rectangular frame area.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws inside the tkwin area.
+ *
+ *----------------------------------------------------------------------
+ */
+void
+TkpDrawFrame(
+ Tk_Window tkwin,
+ Tk_3DBorder border,
+ int highlightWidth,
+ int borderWidth,
+ int relief)
+{
+ /*
+ * Legacy shim to allow for external callers. Internal ones use
+ * non-exposed TkpDrawFrameEx directly so they can use double-buffering.
+ */
+
+ TkpDrawFrameEx(tkwin, Tk_WindowId(tkwin), border,
+ highlightWidth, borderWidth, relief);
}
/*
@@ -1637,7 +1738,7 @@ FrameEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- Frame *framePtr = clientData;
+ Frame *framePtr = (Frame *)clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
goto redraw;
@@ -1729,7 +1830,7 @@ static void
FrameCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- Frame *framePtr = clientData;
+ Frame *framePtr = (Frame *)clientData;
Tk_Window tkwin = framePtr->tkwin;
if (framePtr->menuName != NULL) {
@@ -1780,7 +1881,7 @@ static void
MapFrame(
ClientData clientData) /* Pointer to frame structure. */
{
- Frame *framePtr = clientData;
+ Frame *framePtr = (Frame *)clientData;
/*
* Wait for all other background events to be processed before mapping
@@ -1835,7 +1936,7 @@ TkInstallFrameMenu(
TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->mainPtr != NULL) {
- Frame *framePtr = winPtr->instanceData;
+ Frame *framePtr = (Frame *)winPtr->instanceData;
if (framePtr == NULL) {
Tcl_Panic("TkInstallFrameMenu couldn't get frame pointer");
@@ -1868,7 +1969,7 @@ FrameStructureProc(
ClientData clientData, /* Pointer to record describing frame. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Labelframe *labelframePtr = clientData;
+ Labelframe *labelframePtr = (Labelframe *)clientData;
if (eventPtr->type == DestroyNotify) {
/*
@@ -1906,7 +2007,8 @@ FrameRequestProc(
ClientData clientData, /* Pointer to record for frame. */
Tk_Window tkwin) /* Window that changed its desired size. */
{
- Frame *framePtr = clientData;
+ Frame *framePtr = (Frame *)clientData;
+ (void)tkwin;
FrameWorldChanged(framePtr);
}
@@ -1930,12 +2032,13 @@ FrameRequestProc(
static void
FrameLostContentProc(
- ClientData clientData, /* Frame structure for content window that was
+ ClientData clientData, /* Frame structure for content window window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the content window. */
+ Tk_Window tkwin) /* Tk's handle for the content window window. */
{
- Frame *framePtr = clientData;
- Labelframe *labelframePtr = clientData;
+ Frame *framePtr = (Frame *)clientData;
+ Labelframe *labelframePtr = (Labelframe *)clientData;
+ (void)tkwin;
/*
* This should only happen in a labelframe but it doesn't hurt to be
@@ -1958,7 +2061,7 @@ void
TkMapTopFrame(
Tk_Window tkwin)
{
- Frame *framePtr = ((TkWindow *) tkwin)->instanceData;
+ Frame *framePtr = (Frame *)((TkWindow *) tkwin)->instanceData;
Tk_OptionTable optionTable;
if (Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_FRAME) {
@@ -2022,7 +2125,7 @@ TkToplevelWindowForCommand(
if (cmdInfo.objProc != FrameWidgetObjCmd) {
return NULL;
}
- framePtr = cmdInfo.objClientData;
+ framePtr = (Frame *)cmdInfo.objClientData;
if (framePtr->type != TYPE_TOPLEVEL) {
return NULL;
}
@@ -2030,6 +2133,135 @@ TkToplevelWindowForCommand(
}
/*
+ *----------------------------------------------------------------------
+ *
+ * FrameBgImageProc --
+ *
+ * This function is invoked by the image code whenever the manager for an
+ * image does something that affects the size or contents of an image
+ * displayed on a frame's background.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Arranges for the button to get redisplayed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+FrameBgImageProc(
+ ClientData clientData, /* Pointer to widget record. */
+ int x, int y, /* Upper left pixel (within image) that must
+ * be redisplayed. */
+ int width, int height, /* Dimensions of area to redisplay (might be
+ * <= 0). */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
+{
+ Frame *framePtr = (Frame *)clientData;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imgWidth;
+ (void)imgHeight;
+
+
+ /*
+ * Changing the background image never alters the dimensions of the frame.
+ */
+
+ if (framePtr->tkwin && Tk_IsMapped(framePtr->tkwin) &&
+ !(framePtr->flags & REDRAW_PENDING)) {
+ Tcl_DoWhenIdle(DisplayFrame, framePtr);
+ framePtr->flags |= REDRAW_PENDING;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawFrameBackground --
+ *
+ * This function draws the background image of a rectangular frame area.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws inside the tkwin area.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+DrawFrameBackground(
+ Tk_Window tkwin,
+ Pixmap pixmap,
+ int highlightWidth,
+ int borderWidth,
+ Tk_Image bgimg,
+ int bgtile)
+{
+ int width, height; /* Area to paint on. */
+ int imageWidth, imageHeight; /* Dimensions of image. */
+ const int bw = highlightWidth + borderWidth;
+
+ Tk_SizeOfImage(bgimg, &imageWidth, &imageHeight);
+ width = Tk_Width(tkwin) - 2*bw;
+ height = Tk_Height(tkwin) - 2*bw;
+
+ if (bgtile) {
+ /*
+ * Draw the image tiled in the widget (inside the border).
+ */
+
+ int x, y;
+
+ for (x = bw; x - bw < width; x += imageWidth) {
+ int w = imageWidth;
+ if (x - bw + imageWidth > width) {
+ w = (width + bw) - x;
+ }
+ for (y = bw; y < height + bw; y += imageHeight) {
+ int h = imageHeight;
+ if (y - bw + imageHeight > height) {
+ h = (height + bw) - y;
+ }
+ Tk_RedrawImage(bgimg, 0, 0, w, h, pixmap, x, y);
+ }
+ }
+ } else {
+ /*
+ * Draw the image centred in the widget (inside the border).
+ */
+
+ int x, y, xOff, yOff, w, h;
+
+ if (width > imageWidth) {
+ x = 0;
+ xOff = (Tk_Width(tkwin) - imageWidth) / 2;
+ w = imageWidth;
+ } else {
+ x = (imageWidth - width) / 2;
+ xOff = bw;
+ w = width;
+ }
+ if (height > imageHeight) {
+ y = 0;
+ yOff = (Tk_Height(tkwin) - imageHeight) / 2;
+ h = imageHeight;
+ } else {
+ y = (imageHeight - height) / 2;
+ yOff = bw;
+ h = height;
+ }
+ Tk_RedrawImage(bgimg, x, y, w, h, pixmap, xOff, yOff);
+ }
+}
+
+/*
* Local Variables:
* mode: c
* c-basic-offset: 4
diff --git a/generic/tkGC.c b/generic/tkGC.c
index 8744ec4..591e887 100644
--- a/generic/tkGC.c
+++ b/generic/tkGC.c
@@ -4,8 +4,8 @@
* This file maintains a database of read-only graphics contexts for the
* Tk toolkit, in order to allow GC's to be shared.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -23,7 +23,7 @@
typedef struct {
GC gc; /* Graphics context. */
Display *display; /* Display to which gc belongs. */
- int refCount; /* Number of active uses of gc. */
+ size_t refCount; /* Number of active uses of gc. */
Tcl_HashEntry *valueHashPtr;/* Entry in valueTable (needed when deleting
* this structure). */
} TkGC;
@@ -307,7 +307,7 @@ Tk_FreeGC(
return;
}
- idHashPtr = Tcl_FindHashEntry(&dispPtr->gcIdTable, (char *) gc);
+ idHashPtr = Tcl_FindHashEntry(&dispPtr->gcIdTable, gc);
if (idHashPtr == NULL) {
Tcl_Panic("Tk_FreeGC received unknown gc argument");
}
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 013347b..35bf58e 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.c
@@ -4,8 +4,8 @@
* This file contains generic Tk code for geometry management (stuff
* that's used by all geometry managers).
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1995 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -75,7 +75,7 @@ static void MaintainContentProc(ClientData clientData,
* previous geometry manager. The geometry manager will be notified (by
* calling procedures in *mgrPtr) when interesting things happen in the
* future. If there was an existing geometry manager for tkwin different
- * from the new one, it is notified by calling its lostSlaveProc.
+ * from the new one, it is notified by calling its lostContentProc.
*
*--------------------------------------------------------------
*/
@@ -95,8 +95,8 @@ Tk_ManageGeometry(
if ((winPtr->geomMgrPtr != NULL) && (mgrPtr != NULL)
&& ((winPtr->geomMgrPtr != mgrPtr)
|| (winPtr->geomData != clientData))
- && (winPtr->geomMgrPtr->lostSlaveProc != NULL)) {
- winPtr->geomMgrPtr->lostSlaveProc(winPtr->geomData, tkwin);
+ && (winPtr->geomMgrPtr->lostContentProc != NULL)) {
+ winPtr->geomMgrPtr->lostContentProc(winPtr->geomData, tkwin);
}
winPtr->geomMgrPtr = mgrPtr;
@@ -333,8 +333,8 @@ TkSetGeometryContainer(
if (winPtr->geomMgrName != NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "cannot use geometry manager %s inside %s which already"
- " has slaves managed by %s",
+ "cannot use geometry manager %s inside %s because"
+ " %s is already managing it's content windows",
name, Tk_PathName(tkwin), winPtr->geomMgrName));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "FIGHT", NULL);
}
diff --git a/generic/tkGet.c b/generic/tkGet.c
index 989584e..ec3641f 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.c
@@ -6,8 +6,8 @@
* functions, like Tk_GetDirection and Tk_GetUid. The more complex
* functions like Tk_GetColor are in separate files.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index a1ff46c..c1955a0 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -3,8 +3,8 @@
*
* This file provides functions that implement grabs for Tk.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -178,7 +178,7 @@ Tk_GrabObjCmd(
TkDisplay *dispPtr;
const char *arg;
int index;
- int len;
+ TkSizeT len;
static const char *const optionStrings[] = {
"current", "release", "set", "status", NULL
};
@@ -270,7 +270,7 @@ Tk_GrabObjCmd(
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (dispPtr->eventualGrabWinPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window)
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window)
dispPtr->eventualGrabWinPtr));
}
} else {
@@ -279,7 +279,7 @@ Tk_GrabObjCmd(
for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
if (dispPtr->eventualGrabWinPtr != NULL) {
- Tcl_ListObjAppendElement(NULL, resultObj, TkNewWindowObj(
+ Tcl_ListObjAppendElement(NULL, resultObj, Tk_NewWindowObj(
(Tk_Window) dispPtr->eventualGrabWinPtr));
}
}
@@ -666,6 +666,9 @@ ReleaseButtonGrab(
* This function is called for each pointer-related event, before the
* event has been processed. It does various things to make grabs work
* correctly.
+ * Also, this function takes care of warping the mouse pointer with
+ * respect to a given window, both when there is a grab in effect and
+ * when there is none.
*
* Results:
* If the return value is 1 it means the event should be processed (event
@@ -677,6 +680,7 @@ ReleaseButtonGrab(
* Grab state information may be updated. New events may also be pushed
* back onto the event queue to replace or augment the one passed in
* here.
+ * The mouse pointer may be moved.
*
*----------------------------------------------------------------------
*/
@@ -773,10 +777,24 @@ TkPointerEvent(
return 1;
}
+ if ((eventPtr->type == MotionNotify) && !appGrabbed) {
+
+ /*
+ * Warp the mouse pointer with respect to window dispPtr->warpWindow
+ * if such a window was set in HandleEventGenerate.
+ */
+
+ TkDoWarpWrtWin(dispPtr);
+ }
+
if (!appGrabbed) {
return 1;
}
+ /*
+ * From this point on, there is a grab in effect.
+ */
+
if (eventPtr->type == MotionNotify) {
/*
* When grabs are active, X reports motion events relative to the
@@ -799,6 +817,13 @@ TkPointerEvent(
Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_HEAD);
return 0;
}
+
+ /*
+ * Warp the mouse pointer with respect to window dispPtr->warpWindow
+ * if such a window was set in HandleEventGenerate.
+ */
+
+ TkDoWarpWrtWin(dispPtr);
return 1;
}
@@ -871,7 +896,7 @@ TkPointerEvent(
} else {
if (eventPtr->xbutton.button != AnyButton &&
((eventPtr->xbutton.state & ALL_BUTTONS)
- == TkGetButtonMask(eventPtr->xbutton.button))) {
+ == Tk_GetButtonMask(eventPtr->xbutton.button))) {
ReleaseButtonGrab(dispPtr); /* Note 4. */
}
}
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 785bc7f..1ca3fa7 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -3,7 +3,7 @@
*
* Grid based geometry manager.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -292,8 +292,8 @@ static void GridLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void GridReqProc(ClientData clientData, Tk_Window tkwin);
static void InitContainerData(Gridder *containerPtr);
-static Tcl_Obj * NewPairObj(int, int);
-static Tcl_Obj * NewQuadObj(int, int, int, int);
+static Tcl_Obj * NewPairObj(Tcl_WideInt, Tcl_WideInt);
+static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt);
static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn,
int maxOffset);
static void SetGridSize(Gridder *gridPtr);
@@ -308,7 +308,7 @@ static void Unlink(Gridder *gridPtr);
static const Tk_GeomMgr gridMgrType = {
"grid", /* name */
GridReqProc, /* requestProc */
- GridLostContentProc, /* lostSlaveProc */
+ GridLostContentProc, /* lostContentProc */
};
/*
@@ -341,6 +341,11 @@ Tk_GridObjCmd(
"content", "forget", "info", "location", "propagate",
"remove", "rowconfigure", "size", "slaves", NULL
};
+ static const char *const optionStringsNoDep[] = {
+ "anchor", "bbox", "columnconfigure", "configure",
+ "content", "forget", "info", "location", "propagate",
+ "remove", "rowconfigure", "size", NULL
+ };
enum options {
GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE,
GRID_CONTENT, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE,
@@ -361,8 +366,16 @@ Tk_GridObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
+ if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
+ /*
+ * Call it again without the deprecated ones to get a proper error
+ * message. This works well since there can't be any ambiguity between
+ * deprecated and new options.
+ */
+
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
+ sizeof(char *), "option", 0, &index);
return TCL_ERROR;
}
@@ -511,7 +524,7 @@ GridBboxCommand(
int width, height; /* size of the bounding box */
if (objc!=3 && objc != 5 && objc != 7) {
- Tcl_WrongNumArgs(interp, 2, objv, "master ?column row ?column row??");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?column row ?column row??");
return TCL_ERROR;
}
@@ -740,15 +753,15 @@ GridInfoCommand(
infoObj = Tcl_NewObj();
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1),
- TkNewWindowObj(contentPtr->containerPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1),
- Tcl_NewIntObj(contentPtr->column));
+ Tcl_NewWideIntObj(contentPtr->column));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1),
- Tcl_NewIntObj(contentPtr->row));
+ Tcl_NewWideIntObj(contentPtr->row));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1),
- Tcl_NewIntObj(contentPtr->numCols));
+ Tcl_NewWideIntObj(contentPtr->numCols));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1),
- Tcl_NewIntObj(contentPtr->numRows));
+ Tcl_NewWideIntObj(contentPtr->numRows));
TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX);
TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY);
TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft, contentPtr->padX);
@@ -792,7 +805,7 @@ GridLocationCommand(
int endX, endY; /* End of grid. */
if (objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "master x y");
+ Tcl_WrongNumArgs(interp, 2, objv, "window x y");
return TCL_ERROR;
}
@@ -985,7 +998,7 @@ GridRowColumnConfigureCommand(
Tcl_Obj *listCopy;
if (((objc % 2 != 0) && (objc > 6)) || (objc < 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "master index ?-option value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window index ?-option value ...?");
return TCL_ERROR;
}
@@ -1056,17 +1069,17 @@ GridRowColumnConfigureCommand(
Tcl_ListObjAppendElement(interp, res,
Tcl_NewStringObj("-minsize", -1));
- Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(minsize));
+ Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(minsize));
Tcl_ListObjAppendElement(interp, res,
Tcl_NewStringObj("-pad", -1));
- Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(pad));
+ Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(pad));
Tcl_ListObjAppendElement(interp, res,
Tcl_NewStringObj("-uniform", -1));
Tcl_ListObjAppendElement(interp, res,
Tcl_NewStringObj(uniform == NULL ? "" : uniform, -1));
Tcl_ListObjAppendElement(interp, res,
Tcl_NewStringObj("-weight", -1));
- Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(weight));
+ Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(weight));
Tcl_SetObjResult(interp, res);
Tcl_DecrRefCount(listCopy);
return TCL_OK;
@@ -1083,10 +1096,10 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
if (index == ROWCOL_MINSIZE) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
(ok == TCL_OK) ? slotPtr[slot].minSize : 0));
} else if (index == ROWCOL_WEIGHT) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
(ok == TCL_OK) ? slotPtr[slot].weight : 0));
} else if (index == ROWCOL_UNIFORM) {
Tk_Uid value = (ok == TCL_OK) ? slotPtr[slot].uniform : "";
@@ -1094,7 +1107,7 @@ GridRowColumnConfigureCommand(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
(value == NULL) ? "" : value, -1));
} else if (index == ROWCOL_PAD) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
(ok == TCL_OK) ? slotPtr[slot].pad : 0));
}
Tcl_DecrRefCount(listCopy);
@@ -1131,7 +1144,7 @@ GridRowColumnConfigureCommand(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"the window \"%s\" is not managed by \"%s\"",
Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2])));
- Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MASTER", NULL);
+ Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MANAGED", NULL);
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
@@ -1401,7 +1414,7 @@ GridContentCommand(
contentPtr->row+contentPtr->numRows-1 < row)) {
continue;
}
- Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(contentPtr->tkwin));
+ Tcl_ListObjAppendElement(interp,res, Tk_NewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, res);
return TCL_OK;
@@ -2777,11 +2790,15 @@ Unlink(
/*
* If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
+ *
+ * Send the event "NoManagedChild" to the container to inform it about there
+ * being no managed children inside it.
*/
if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) {
TkFreeGeometryContainer(containerPtr->tkwin, "grid");
containerPtr->flags &= ~ALLOCED_CONTAINER;
+ Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL);
}
}
@@ -2882,7 +2899,7 @@ GridStructureProc(
contentPtr->nextPtr = NULL;
}
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable,
- (char *)gridPtr->tkwin));
+ gridPtr->tkwin));
if (gridPtr->flags & REQUESTED_RELAYOUT) {
Tcl_CancelIdleCall(ArrangeGrid, gridPtr);
}
@@ -2966,7 +2983,7 @@ ConfigureContent(
firstChar = 0;
for (numWindows=0, i=0; i < objc; i++) {
- int length;
+ TkSizeT length;
char prevChar = firstChar;
string = Tcl_GetStringFromObj(objv[i], &length);
@@ -3344,7 +3361,7 @@ ConfigureContent(
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s", Tcl_GetString(objv[j]),
+ "can't put \"%s\" inside \"%s\"", Tcl_GetString(objv[j]),
Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
Unlink(contentPtr);
@@ -3360,7 +3377,7 @@ ConfigureContent(
container = (TkWindow *)TkGetContainer(container)) {
if (container == (TkWindow *)content) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s, would cause management loop",
+ "can't put \"%s\" inside \"%s\": would cause management loop",
Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
Unlink(contentPtr);
@@ -3445,7 +3462,7 @@ ConfigureContent(
if (containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't use '^', cant find master", -1));
+ "can't use '^', can't find container window", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
@@ -3499,7 +3516,7 @@ ConfigureContent(
}
if (!match) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't find slave to extend with \"^\"", -1));
+ "can't find content to extend with \"^\"", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
@@ -3507,7 +3524,7 @@ ConfigureContent(
if (containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't determine master window", -1));
+ "can't determine container window", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
@@ -3516,11 +3533,15 @@ ConfigureContent(
/*
* If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
+ *
+ * Send the event "NoManagedChild" to the container to inform it about there
+ * being no managed children inside it.
*/
if (containerPtr->contentPtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) {
TkFreeGeometryContainer(containerPtr->tkwin, "grid");
containerPtr->flags &= ~ALLOCED_CONTAINER;
+ Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL);
}
return TCL_OK;
@@ -3631,12 +3652,12 @@ StringToSticky(
static Tcl_Obj *
NewPairObj(
- int val1, int val2)
+ Tcl_WideInt val1, Tcl_WideInt val2)
{
Tcl_Obj *ary[2];
- ary[0] = Tcl_NewIntObj(val1);
- ary[1] = Tcl_NewIntObj(val2);
+ ary[0] = Tcl_NewWideIntObj(val1);
+ ary[1] = Tcl_NewWideIntObj(val2);
return Tcl_NewListObj(2, ary);
}
@@ -3658,14 +3679,14 @@ NewPairObj(
static Tcl_Obj *
NewQuadObj(
- int val1, int val2, int val3, int val4)
+ Tcl_WideInt val1, Tcl_WideInt val2, Tcl_WideInt val3, Tcl_WideInt val4)
{
Tcl_Obj *ary[4];
- ary[0] = Tcl_NewIntObj(val1);
- ary[1] = Tcl_NewIntObj(val2);
- ary[2] = Tcl_NewIntObj(val3);
- ary[3] = Tcl_NewIntObj(val4);
+ ary[0] = Tcl_NewWideIntObj(val1);
+ ary[1] = Tcl_NewWideIntObj(val2);
+ ary[2] = Tcl_NewWideIntObj(val3);
+ ary[3] = Tcl_NewWideIntObj(val4);
return Tcl_NewListObj(4, ary);
}
diff --git a/generic/tkImage.c b/generic/tkImage.c
index d42ed7d..ca9dac6 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -4,8 +4,8 @@
* This module implements the image protocol, which allows lots of
* different kinds of images to be used in lots of different widgets.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -472,7 +472,7 @@ Tk_ImageObjCmd(
switch ((enum options) index) {
case IMAGE_HEIGHT:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(modelPtr->height));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(modelPtr->height));
break;
case IMAGE_INUSE:
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
@@ -485,7 +485,7 @@ Tk_ImageObjCmd(
}
break;
case IMAGE_WIDTH:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(modelPtr->width));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(modelPtr->width));
break;
default:
Tcl_Panic("can't happen");
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index 04027b0..023c14b 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -3,9 +3,9 @@
*
* This procedure implements images of type "bitmap" for Tk.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1999 by Scriptics Corporation.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -18,7 +18,7 @@
* image:
*/
-typedef struct BitmapModel {
+typedef struct {
Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the
* image is being deleted. */
Tcl_Interp *interp; /* Interpreter for application that is using
@@ -49,7 +49,7 @@ typedef struct BitmapModel {
*/
typedef struct BitmapInstance {
- int refCount; /* Number of instances that share this data
+ size_t refCount; /* Number of instances that share this data
* structure. */
BitmapModel *modelPtr; /* Pointer to model for image. */
Tk_Window tkwin; /* Window in which the instances will be
@@ -108,17 +108,17 @@ Tk_ImageType tkBitmapImageType = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_UID, "-background", NULL, NULL,
- "", Tk_Offset(BitmapModel, bgUid), 0, NULL},
+ "", offsetof(BitmapModel, bgUid), 0, NULL},
{TK_CONFIG_STRING, "-data", NULL, NULL,
- NULL, Tk_Offset(BitmapModel, dataString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, dataString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_STRING, "-file", NULL, NULL,
- NULL, Tk_Offset(BitmapModel, fileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, fileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_UID, "-foreground", NULL, NULL,
- "#000000", Tk_Offset(BitmapModel, fgUid), 0, NULL},
+ "#000000", offsetof(BitmapModel, fgUid), 0, NULL},
{TK_CONFIG_STRING, "-maskdata", NULL, NULL,
- NULL, Tk_Offset(BitmapModel, maskDataString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, maskDataString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_STRING, "-maskfile", NULL, NULL,
- NULL, Tk_Offset(BitmapModel, maskFileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, maskFileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -169,7 +169,6 @@ static int NextBitmapWord(ParseInfo *parseInfoPtr);
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ImgBmapCreate(
Tcl_Interp *interp, /* Interpreter for application containing
@@ -179,12 +178,13 @@ ImgBmapCreate(
Tcl_Obj *const argv[], /* Argument objects for options (doesn't
* include image name or type). */
const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */
- Tk_ImageModel model, /* Token for image, to be used by us in later
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- BitmapModel *modelPtr = ckalloc(sizeof(BitmapModel));
+ BitmapModel *modelPtr = (BitmapModel *)ckalloc(sizeof(BitmapModel));
+ (void)typePtr;
modelPtr->tkModel = model;
modelPtr->interp = interp;
@@ -239,7 +239,7 @@ ImgBmapConfigureModel(
{
BitmapInstance *instancePtr;
int maskWidth, maskHeight, dummy1, dummy2;
- const char **argv = ckalloc((objc+1) * sizeof(char *));
+ const char **argv = (const char **)ckalloc((objc+1) * sizeof(char *));
for (dummy1 = 0; dummy1 < objc; dummy1++) {
argv[dummy1] = Tcl_GetString(objv[dummy1]);
@@ -620,7 +620,7 @@ TkGetBitmapData(
goto error;
}
numBytes = ((width+7)/8) * height;
- data = ckalloc(numBytes);
+ data = (char *)ckalloc(numBytes);
for (p = data; numBytes > 0; p++, numBytes--) {
if (NextBitmapWord(&pi) != TCL_OK) {
goto error;
@@ -757,7 +757,7 @@ ImgBmapCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *const bmapOptions[] = {"cget", "configure", NULL};
- BitmapModel *modelPtr = clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
int index;
if (objc < 2) {
@@ -819,7 +819,7 @@ ImgBmapGet(
ClientData modelData) /* Pointer to our model structure for the
* image. */
{
- BitmapModel *modelPtr = modelData;
+ BitmapModel *modelPtr = (BitmapModel *)modelData;
BitmapInstance *instancePtr;
/*
@@ -840,7 +840,7 @@ ImgBmapGet(
* the image.
*/
- instancePtr = ckalloc(sizeof(BitmapInstance));
+ instancePtr = (BitmapInstance *)ckalloc(sizeof(BitmapInstance));
instancePtr->refCount = 1;
instancePtr->modelPtr = modelPtr;
instancePtr->tkwin = tkwin;
@@ -894,7 +894,7 @@ ImgBmapDisplay(
/* Coordinates within drawable that correspond
* to imageX and imageY. */
{
- BitmapInstance *instancePtr = clientData;
+ BitmapInstance *instancePtr = (BitmapInstance *)clientData;
int masking;
/*
@@ -948,11 +948,10 @@ ImgBmapFree(
* instance to be displayed. */
Display *display) /* Display containing window that used image. */
{
- BitmapInstance *instancePtr = clientData;
+ BitmapInstance *instancePtr = (BitmapInstance *)clientData;
BitmapInstance *prevPtr;
- instancePtr->refCount--;
- if (instancePtr->refCount > 0) {
+ if (instancePtr->refCount-- > 1) {
return;
}
@@ -1010,7 +1009,7 @@ ImgBmapDelete(
ClientData modelData) /* Pointer to BitmapModel structure for
* image. Must not have any more instances. */
{
- BitmapModel *modelPtr = modelData;
+ BitmapModel *modelPtr = (BitmapModel *)modelData;
if (modelPtr->instancePtr != NULL) {
Tcl_Panic("tried to delete bitmap image when instances still exist");
@@ -1051,7 +1050,7 @@ ImgBmapCmdDeletedProc(
ClientData clientData) /* Pointer to BitmapModel structure for
* image. */
{
- BitmapModel *modelPtr = clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
modelPtr->imageCmd = NULL;
if (modelPtr->tkModel != NULL) {
@@ -1080,7 +1079,7 @@ GetByte(
Tcl_Channel chan) /* The channel we read from. */
{
char buffer;
- int size;
+ size_t size;
size = Tcl_Read(chan, &buffer, 1);
if (size != 1) {
@@ -1198,7 +1197,7 @@ ImgBmapPostscript(
int x, int y, int width, int height,
int prepass)
{
- BitmapModel *modelPtr = clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
Tcl_InterpState interpState;
Tcl_Obj *psObj;
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index ab4bc37..594ec1e 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -8,10 +8,10 @@
* encoded ascii. Derived from the giftoppm code found in the pbmplus
* package and tkImgFmtPPM.c in the tk4.0b2 distribution.
*
- * Copyright (c) Reed Wade (wade@cs.utk.edu), University of Tennessee
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1997 Australian National University
- * Copyright (c) 2005-2010 Donal K. Fellows
+ * Copyright © Reed Wade (wade@cs.utk.edu), University of Tennessee
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1997 Australian National University
+ * Copyright © 2005-2010 Donal K. Fellows
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -55,7 +55,7 @@ typedef struct mFile {
unsigned char *data; /* mmencoded source string */
int c; /* bits left over from previous character */
int state; /* decoder state (0-4 or GIF_DONE) */
- int length; /* Total amount of bytes in data */
+ size_t length; /* Total amount of bytes in data */
} MFile;
/*
@@ -111,35 +111,44 @@ typedef struct {
* serializing in the GIF format.
*/
-typedef int (WriteBytesFunc) (ClientData clientData, const char *bytes,
- int byteCount);
+typedef size_t (WriteBytesFunc) (ClientData clientData, const char *bytes,
+ size_t byteCount);
/*
* The format record for the GIF file format:
*/
-static int FileMatchGIF(Tcl_Channel chan, const char *fileName,
- Tcl_Obj *format, int *widthPtr, int *heightPtr,
- Tcl_Interp *interp);
+static int FileMatchGIF(Tcl_Interp *interp, Tcl_Channel chan,
+ const char *fileName, Tcl_Obj *format,
+ Tcl_Obj *metadataInObj, int *widthPtr,
+ int *heightPtr, Tcl_Obj *metadataOutObj);
static int FileReadGIF(Tcl_Interp *interp, Tcl_Channel chan,
const char *fileName, Tcl_Obj *format,
- Tk_PhotoHandle imageHandle, int destX, int destY,
- int width, int height, int srcX, int srcY);
-static int StringMatchGIF(Tcl_Obj *dataObj, Tcl_Obj *format,
- int *widthPtr, int *heightPtr, Tcl_Interp *interp);
+ Tcl_Obj *metadataInObj, Tk_PhotoHandle imageHandle,
+ int destX, int destY, int width, int height,
+ int srcX, int srcY, Tcl_Obj *metadataOutObj);
+static int StringMatchGIF(Tcl_Interp *interp, Tcl_Obj *dataObj,
+ Tcl_Obj *format, Tcl_Obj *metadataInObj,
+ int *widthPtr, int *heightPtr,
+ Tcl_Obj *metadataOutObj);
static int StringReadGIF(Tcl_Interp *interp, Tcl_Obj *dataObj,
- Tcl_Obj *format, Tk_PhotoHandle imageHandle,
+ Tcl_Obj *format, Tcl_Obj *metadataInObj,
+ Tk_PhotoHandle imageHandle,
int destX, int destY, int width, int height,
- int srcX, int srcY);
+ int srcX, int srcY, Tcl_Obj *metadataOutObj);
static int FileWriteGIF(Tcl_Interp *interp, const char *filename,
- Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr);
+ Tcl_Obj *format, Tcl_Obj *metadataInObj,
+ Tk_PhotoImageBlock *blockPtr);
static int StringWriteGIF(Tcl_Interp *interp, Tcl_Obj *format,
+ Tcl_Obj *metadataInObj,
Tk_PhotoImageBlock *blockPtr);
-static int CommonWriteGIF(Tcl_Interp *interp, ClientData clientData,
+static int CommonWriteGIF(Tcl_Interp *interp,
+ ClientData clientData,
WriteBytesFunc *writeProc, Tcl_Obj *format,
+ Tcl_Obj *metadataInObj,
Tk_PhotoImageBlock *blockPtr);
-Tk_PhotoImageFormat tkImgFmtGIF = {
+Tk_PhotoImageFormatVersion3 tkImgFmtGIF = {
"gif", /* name */
FileMatchGIF, /* fileMatchProc */
StringMatchGIF, /* stringMatchProc */
@@ -165,9 +174,11 @@ Tk_PhotoImageFormat tkImgFmtGIF = {
* Prototypes for local functions defined in this file:
*/
+static int ReadOneByte(Tcl_Interp *interp,
+ GIFImageConfig *gifConfPtr, Tcl_Channel chan);
static int DoExtension(GIFImageConfig *gifConfPtr,
Tcl_Channel chan, int label, unsigned char *buffer,
- int *transparent);
+ int *transparent, Tcl_Obj *metadataOutObj);
static int GetCode(Tcl_Channel chan, int code_size, int flag,
GIFImageConfig *gifConfPtr);
static int GetDataBlock(GIFImageConfig *gifConfPtr,
@@ -187,14 +198,14 @@ static int ReadImage(GIFImageConfig *gifConfPtr,
* these are for the BASE64 image reader code only
*/
-static int Fread(GIFImageConfig *gifConfPtr, unsigned char *dst,
+static size_t Fread(GIFImageConfig *gifConfPtr, unsigned char *dst,
size_t size, size_t count, Tcl_Channel chan);
-static int Mread(unsigned char *dst, size_t size, size_t count,
+static size_t Mread(unsigned char *dst, size_t size, size_t count,
MFile *handle);
static int Mgetc(MFile *handle);
static int char64(int c);
static void mInit(unsigned char *string, MFile *handle,
- int length);
+ size_t length);
/*
* Types, defines and variables needed to write and compress a GIF.
@@ -345,13 +356,15 @@ static void FlushChar(GIFState_t *statePtr);
static int
FileMatchGIF(
+ TCL_UNUSED(Tcl_Interp *), /* not used */
Tcl_Channel chan, /* The image file, open for reading. */
- const char *fileName, /* The name of the image file. */
- Tcl_Obj *format, /* User-specified format object, or NULL. */
+ TCL_UNUSED(const char *), /* The name of the image file. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format object, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
* here if the file is a valid raw GIF file. */
- Tcl_Interp *interp) /* not used */
+ TCL_UNUSED(Tcl_Obj *)) /* metadata return dict, may be NULL */
{
GIFImageConfig gifConf;
@@ -384,13 +397,15 @@ FileReadGIF(
Tcl_Channel chan, /* The image file, open for reading. */
const char *fileName, /* The name of the image file. */
Tcl_Obj *format, /* User-specified format object, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
int width, int height, /* Dimensions of block of photo image to be
* written to. */
- int srcX, int srcY) /* Coordinates of top-left pixel to be used in
+ int srcX, int srcY, /* Coordinates of top-left pixel to be used in
* image being read. */
+ Tcl_Obj *metadataOutObj) /* metadata return dict, may be NULL */
{
int fileWidth, fileHeight, imageWidth, imageHeight;
unsigned int nBytes;
@@ -399,6 +414,7 @@ FileReadGIF(
unsigned char buf[100];
unsigned char *trashBuffer = NULL;
int bitPixel;
+ int gifLabel;
unsigned char colorMap[MAXCOLORMAPSIZE][4];
int transparent = -1;
static const char *const optionStrings[] = {
@@ -501,23 +517,21 @@ FileReadGIF(
}
/*
+ * -------------------------------------------------------------------------
+ * From here on, go to error to not leave memory leaks
+ * -------------------------------------------------------------------------
+ */
+
+ /*
* Search for the frame from the GIF to display.
*/
while (1) {
- if (Fread(gifConfPtr, buf, 1, 1, chan) != 1) {
- /*
- * Premature end of image.
- */
-
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "premature end of image data for this index", -1));
- Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "PREMATURE_END",
- NULL);
+ if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) {
goto error;
}
- switch (buf[0]) {
+ switch (gifLabel) {
case GIF_TERMINATOR:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"no image data for this index", -1));
@@ -529,16 +543,12 @@ FileReadGIF(
* This is a GIF extension.
*/
- if (Fread(gifConfPtr, buf, 1, 1, chan) != 1) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "error reading extension function code in GIF image",
- -1));
- Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BAD_EXT",
- NULL);
+ if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) {
goto error;
}
- if (DoExtension(gifConfPtr, chan, buf[0],
- gifConfPtr->workingBuffer, &transparent) < 0) {
+ if (DoExtension(gifConfPtr, chan, gifLabel,
+ gifConfPtr->workingBuffer, &transparent, metadataOutObj)
+ < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"error reading extension in GIF image", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BAD_EXT",
@@ -597,7 +607,7 @@ FileReadGIF(
goto error;
}
nBytes = fileWidth * fileHeight * 3;
- trashBuffer = ckalloc(nBytes);
+ trashBuffer = (unsigned char *)ckalloc(nBytes);
if (trashBuffer) {
memset(trashBuffer, 0, nBytes);
}
@@ -692,7 +702,7 @@ FileReadGIF(
goto error;
}
nBytes = block.pitch * imageHeight;
- block.pixelPtr = ckalloc(nBytes);
+ block.pixelPtr = (unsigned char *)ckalloc(nBytes);
if (block.pixelPtr) {
memset(block.pixelPtr, 0, nBytes);
}
@@ -716,10 +726,52 @@ FileReadGIF(
* which suits as well). We're done.
*/
+ while (1) {
+ if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) {
+ goto error;
+ }
+ switch (gifLabel) {
+ case GIF_TERMINATOR:
+ break;
+
+ case GIF_EXTENSION:
+ /*
+ * This is a GIF extension.
+ */
+
+ if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) {
+ goto error;
+ }
+ if (DoExtension(gifConfPtr, chan, gifLabel,
+ gifConfPtr->workingBuffer, &transparent, metadataOutObj)
+ < 0) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "error reading extension in GIF image", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BAD_EXT",
+ NULL);
+ goto error;
+ }
+ continue;
+ case GIF_START:
+ /*
+ * There should not be a second image block - bail out without error
+ */
+ break;
+ default:
+ /*
+ * Not a valid start character; ignore it.
+ */
+
+ continue;
+ }
+ break;
+ }
+
Tcl_SetObjResult(interp, Tcl_NewStringObj(tkImgFmtGIF.name, -1));
result = TCL_OK;
- error:
+error:
+
/*
* If a trash buffer has been allocated, free it now.
*/
@@ -730,6 +782,45 @@ FileReadGIF(
return result;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Read one Byte --
+ *
+ * Read one byte (label byte) from the image stream.
+ *
+ * Results:
+ * The return value is 1 if the first characters in the data are like GIF
+ * data, and 0 otherwise.
+ *
+ * Side effects:
+ * The access position in the source is incremented.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+ReadOneByte(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ GIFImageConfig *gifConfPtr,
+ Tcl_Channel chan /* The image file, open for reading. */
+ )
+{
+ unsigned char buf[2];
+ if (Fread(gifConfPtr, buf, 1, 1, chan) != 1) {
+ /*
+ * Premature end of image.
+ */
+
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "premature end of image data", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "PREMATURE_END", NULL);
+ return -1;
+ }
+ return buf[0];
+}
+
/*
*----------------------------------------------------------------------
*
@@ -748,16 +839,19 @@ FileReadGIF(
*----------------------------------------------------------------------
*/
+
static int
StringMatchGIF(
+ TCL_UNUSED(Tcl_Interp *), /* not used */
Tcl_Obj *dataObj, /* the object containing the image data */
- Tcl_Obj *format, /* the image format object, or NULL */
+ TCL_UNUSED(Tcl_Obj *), /* the image format object, or NULL */
+ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */
int *widthPtr, /* where to put the string width */
int *heightPtr, /* where to put the string height */
- Tcl_Interp *interp) /* not used */
+ TCL_UNUSED(Tcl_Obj *)) /* metadata return dict, may be NULL */
{
unsigned char *data, header[10];
- int got, length;
+ TkSizeT got, length;
MFile handle;
data = Tcl_GetByteArrayFromObj(dataObj, &length);
@@ -820,13 +914,15 @@ StringReadGIF(
Tcl_Interp *interp, /* interpreter for reporting errors in */
Tcl_Obj *dataObj, /* object containing the image */
Tcl_Obj *format, /* format object, or NULL */
+ Tcl_Obj *metadataInObj, /* metadata input, may be NULL */
Tk_PhotoHandle imageHandle, /* the image to write this data into */
int destX, int destY, /* The rectangular region of the */
int width, int height, /* image to copy */
- int srcX, int srcY)
+ int srcX, int srcY,
+ Tcl_Obj *metadataOutObj) /* metadata return dict, may be NULL */
{
MFile handle, *hdlPtr = &handle;
- int length;
+ TkSizeT length;
const char *xferFormat;
unsigned char *data = Tcl_GetByteArrayFromObj(dataObj, &length);
@@ -852,7 +948,8 @@ StringReadGIF(
*/
return FileReadGIF(interp, (Tcl_Channel) hdlPtr, xferFormat, format,
- imageHandle, destX, destY, width, height, srcX, srcY);
+ metadataInObj, imageHandle, destX, destY, width, height, srcX, srcY,
+ metadataOutObj);
}
/*
@@ -917,7 +1014,7 @@ ReadColorMap(
unsigned char rgb[3];
for (i = 0; i < number; ++i) {
- if (Fread(gifConfPtr, rgb, sizeof(rgb), 1, chan) <= 0) {
+ if (((size_t)Fread(gifConfPtr, rgb, sizeof(rgb), 1, chan) + 1) < 2) {
return 0;
}
@@ -931,48 +1028,103 @@ ReadColorMap(
return 1;
}
+/*
+*----------------------------------------------------------------------
+*
+* DoExtension --
+*
+* Process a GIF extension block
+*
+* Results:
+* -1 to trigger an extension read error
+* >= 0 ok
+*
+* Side effects:
+* The transparent color is set if present in current extensions
+* The data of the following extensions are saved to the metadata dict:
+* - Application extension
+* - Comment extension in key "comment"
+* Plain text extensions are currently ignored.
+*
+*----------------------------------------------------------------------
+*/
+
static int
DoExtension(
GIFImageConfig *gifConfPtr,
Tcl_Channel chan,
int label,
- unsigned char *buf,
- int *transparent)
+ unsigned char *buf, /* defined as 280 byte working buffer */
+ int *transparent,
+ Tcl_Obj *metadataOutObj)
{
int count;
+ /* Prepare extension name
+ * Maximum string size: "comment" + Code(3) + trailing zero
+ */
+ char extensionStreamName[8];
+ extensionStreamName[0] = '\0';
switch (label) {
case 0x01: /* Plain Text Extension */
+ /* this extension is ignored, skip below */
break;
-
- case 0xff: /* Application Extension */
- break;
-
- case 0xfe: /* Comment Extension */
- do {
- count = GetDataBlock(gifConfPtr, chan, buf);
- } while (count > 0);
- return count;
-
case 0xf9: /* Graphic Control Extension */
count = GetDataBlock(gifConfPtr, chan, buf);
if (count < 0) {
- return 1;
+ return -1;
}
if ((buf[0] & 0x1) != 0) {
*transparent = buf[3];
}
-
- do {
+ break;
+ case 0xfe: /* Comment Extension */
+ strcpy(extensionStreamName,"comment");
+ /* copy the extension data below */
+ break;
+ }
+ /* Add extension to dict */
+ if (NULL != metadataOutObj
+ && extensionStreamName[0] != '\0' ) {
+ Tcl_Obj *ValueObj = NULL;
+ int length = 0;
+ for (;;) {
count = GetDataBlock(gifConfPtr, chan, buf);
- } while (count > 0);
- return count;
+ switch (count) {
+ case -1: /* error */
+ return -1;
+ case 0: /* end of data */
+ if (length > 0) {
+ if ( TCL_OK != Tcl_DictObjPut(NULL, metadataOutObj,
+ Tcl_NewByteArrayObj(
+ (unsigned char *)extensionStreamName,
+ strlen(extensionStreamName)), ValueObj)) {
+ return -1;
+ }
+ }
+ /* return success */
+ return 0;
+ default: /* block received */
+ if (length == 0) {
+ /* first block */
+ ValueObj = Tcl_NewByteArrayObj(buf, count);
+ length = count;
+ } else {
+ /* consecutive block */
+ unsigned char *bytePtr;
+ bytePtr = Tcl_SetByteArrayLength(ValueObj, length+count);
+ memcpy(bytePtr+length,buf,count);
+ length += count;
+ }
+ break;
+ }
+ } /* for */
}
-
+ /* skip eventual remaining data block bytes */
do {
count = GetDataBlock(gifConfPtr, chan, buf);
} while (count > 0);
- return count;
+ return count; /* this may be -1 for error or 0 */
}
static int
@@ -983,11 +1135,11 @@ GetDataBlock(
{
unsigned char count;
- if (Fread(gifConfPtr, &count, 1, 1, chan) <= 0) {
+ if (((size_t)Fread(gifConfPtr, &count, 1, 1, chan) + 1) < 2) {
return -1;
}
- if ((count != 0) && (Fread(gifConfPtr, buf, count, 1, chan) <= 0)) {
+ if ((count != 0) && (((size_t)Fread(gifConfPtr, buf, count, 1, chan) + 1) < 2)) {
return -1;
}
@@ -1029,7 +1181,8 @@ ReadImage(
Tcl_Channel chan,
int len, int rows,
unsigned char cmap[MAXCOLORMAPSIZE][4],
- int srcX, int srcY,
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
int interlace,
int transparent)
{
@@ -1049,7 +1202,7 @@ ReadImage(
* Initialize the decoder
*/
- if (Fread(gifConfPtr, &initialCodeSize, 1, 1, chan) <= 0) {
+ if (((size_t)Fread(gifConfPtr, &initialCodeSize, 1, 1, chan) + 1) < 2) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"error reading GIF image: %s", Tcl_PosixError(interp)));
return TCL_ERROR;
@@ -1392,7 +1545,7 @@ static void
mInit(
unsigned char *string, /* string containing initial mmencoded data */
MFile *handle, /* mmdecode "file" handle */
- int length) /* Number of bytes in string */
+ size_t length) /* Number of bytes in string */
{
handle->data = string;
handle->state = 0;
@@ -1418,15 +1571,15 @@ mInit(
*----------------------------------------------------------------------
*/
-static int
+static size_t
Mread(
unsigned char *dst, /* where to put the result */
size_t chunkSize, /* size of each transfer */
size_t numChunks, /* number of chunks */
MFile *handle) /* mmdecode "file" handle */
{
- int i, c;
- int count = chunkSize * numChunks;
+ int c;
+ size_t i, count = chunkSize * numChunks;
for (i=0; i<count && (c=Mgetc(handle)) != GIF_DONE; i++) {
*dst++ = c;
@@ -1567,7 +1720,7 @@ char64(
*----------------------------------------------------------------------
*/
-static int
+static size_t
Fread(
GIFImageConfig *gifConfPtr,
unsigned char *dst, /* where to put the result */
@@ -1581,20 +1734,20 @@ Fread(
if (gifConfPtr->fromData == INLINE_DATA_BINARY) {
MFile *handle = (MFile *) chan;
- if (handle->length <= 0 || (size_t) handle->length < hunk*count) {
- return -1;
+ if ((handle->length + 1 < 2) || (handle->length < hunk*count)) {
+ return (size_t)-1;
}
- memcpy(dst, handle->data, (size_t) (hunk * count));
+ memcpy(dst, handle->data, hunk * count);
handle->data += hunk * count;
handle->length -= hunk * count;
- return (int)(hunk * count);
+ return hunk * count;
}
/*
* Otherwise we've got a real file to read.
*/
- return Tcl_Read(chan, (char *) dst, (int) (hunk * count));
+ return Tcl_Read(chan, (char *) dst, hunk * count);
}
/*
@@ -1630,6 +1783,7 @@ FileWriteGIF(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
const char *filename,
Tcl_Obj *format,
+ Tcl_Obj *metadataInObj,
Tk_PhotoImageBlock *blockPtr)
{
Tcl_Channel chan = NULL;
@@ -1645,7 +1799,8 @@ FileWriteGIF(
return TCL_ERROR;
}
- result = CommonWriteGIF(interp, chan, WriteToChannel, format, blockPtr);
+ result = CommonWriteGIF(interp, chan, WriteToChannel, format, metadataInObj,
+ blockPtr);
if (Tcl_Close(interp, chan) == TCL_ERROR) {
return TCL_ERROR;
@@ -1658,6 +1813,7 @@ StringWriteGIF(
Tcl_Interp *interp, /* Interpreter to use for reporting errors and
* returning the GIF data. */
Tcl_Obj *format,
+ Tcl_Obj *metadataInObj,
Tk_PhotoImageBlock *blockPtr)
{
int result;
@@ -1665,7 +1821,7 @@ StringWriteGIF(
Tcl_IncrRefCount(objPtr);
result = CommonWriteGIF(interp, objPtr, WriteToByteArray, format,
- blockPtr);
+ metadataInObj, blockPtr);
if (result == TCL_OK) {
Tcl_SetObjResult(interp, objPtr);
}
@@ -1673,24 +1829,24 @@ StringWriteGIF(
return result;
}
-static int
+static size_t
WriteToChannel(
ClientData clientData,
const char *bytes,
- int byteCount)
+ size_t byteCount)
{
- Tcl_Channel handle = clientData;
+ Tcl_Channel handle = (Tcl_Channel)clientData;
return Tcl_Write(handle, bytes, byteCount);
}
-static int
+static size_t
WriteToByteArray(
ClientData clientData,
const char *bytes,
- int byteCount)
+ size_t byteCount)
{
- Tcl_Obj *objPtr = clientData;
+ Tcl_Obj *objPtr = (Tcl_Obj *)clientData;
Tcl_Obj *tmpObj = Tcl_NewByteArrayObj((unsigned char *) bytes, byteCount);
Tcl_IncrRefCount(tmpObj);
@@ -1704,7 +1860,8 @@ CommonWriteGIF(
Tcl_Interp *interp,
ClientData handle,
WriteBytesFunc *writeProc,
- Tcl_Obj *format,
+ TCL_UNUSED(Tcl_Obj *),
+ Tcl_Obj *metadataInObj,
Tk_PhotoImageBlock *blockPtr)
{
GifWriterState state;
@@ -1834,6 +1991,50 @@ CommonWriteGIF(
c = 0;
writeProc(handle, (char *) &c, 1);
+ /*
+ * Check for metadata keys to add to file
+ */
+ if (NULL != metadataInObj) {
+ Tcl_Obj *itemData;
+
+ /*
+ * Check and code comment block
+ */
+
+ if (TCL_ERROR == Tcl_DictObjGet(interp, metadataInObj,
+ Tcl_NewStringObj("comment",-1),
+ &itemData)) {
+ return TCL_ERROR;
+ }
+ if (itemData != NULL) {
+ int length;
+ unsigned char *comment;
+ comment = Tcl_GetByteArrayFromObj(itemData, &length);
+ if (length > 0) {
+ /* write comment header */
+ writeProc(handle, (char *) "\x21\xfe", 2);
+ /* write comment blocks */
+ for (;length > 0;) {
+ int blockLength;
+ unsigned char blockLengthChar;
+ if (length > 255) {
+ length -=255;
+ blockLength = 255;
+ } else {
+ blockLength = length;
+ length = 0;
+ }
+ blockLengthChar = (unsigned char) blockLength;
+ writeProc(handle, (char *) &blockLengthChar, 1);
+ writeProc(handle, (char *) comment, blockLength);
+ comment += blockLength;
+ }
+ /* Block terminator */
+ c = 0;
+ writeProc(handle, (char *) &c, 1);
+ }
+ }
+ }
c = GIF_TERMINATOR;
writeProc(handle, (char *) &c, 1);
diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c
new file mode 100644
index 0000000..824d303
--- /dev/null
+++ b/generic/tkImgListFormat.c
@@ -0,0 +1,1146 @@
+/*
+ * tkImgListFormat.c --
+ *
+ * Implements the default image data format. I.e. the format used for
+ * [imageName data] and [imageName put] if no other format is specified.
+ *
+ * The default format consits of a list of scan lines (rows) with each
+ * list element being itself a list of pixels (or columns). For details,
+ * see the manpage photo.n
+ *
+ * This image format cannot read/write files, it is meant for string
+ * data only.
+ *
+ *
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2002-2003 Donal K. Fellows
+ * Copyright © 2003 ActiveState Corporation.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * Authors:
+ * Paul Mackerras (paulus@cs.anu.edu.au),
+ * Department of Computer Science,
+ * Australian National University.
+ *
+ * Simon Bachmann (simonbachmann@bluewin.ch)
+ */
+
+
+#include "tkImgPhoto.h"
+
+/*
+ * Message to generate when an attempt to allocate memory for an image fails.
+ */
+
+#define TK_PHOTO_ALLOC_FAILURE_MESSAGE \
+ "not enough free memory for image buffer"
+
+
+/*
+ * Color name length limit: do not attempt to parse as color strings that are
+ * longer than this limit
+ */
+
+#define TK_PHOTO_MAX_COLOR_LENGTH 99
+
+/*
+ * Symbols for the different formats of a color string.
+ */
+
+enum ColorFormatType {
+ COLORFORMAT_TKCOLOR,
+ COLORFORMAT_EMPTYSTRING,
+ COLORFORMAT_LIST,
+ COLORFORMAT_RGB1,
+ COLORFORMAT_RGB2,
+ COLORFORMAT_RGBA1,
+ COLORFORMAT_RGBA2
+};
+
+/*
+ * Names for the color format types above.
+ * Order must match the one in enum ColorFormatType
+ */
+
+static const char *const colorFormatNames[] = {
+ "tkcolor",
+ "emptystring",
+ "list",
+ "rgb-short",
+ "rgb",
+ "rgba-short",
+ "rgba",
+ NULL
+};
+
+/*
+ * The following data structure is used to return information from
+ * ParseFormatOptions:
+ */
+
+struct FormatOptions {
+ int options; /* Individual bits indicate which options were
+ * specified - see below. */
+ Tcl_Obj *formatName; /* Name specified without an option. */
+ enum ColorFormatType colorFormat;
+ /* The color format type given with the
+ * -colorformat option */
+};
+
+/*
+ * Bit definitions for use with ParseFormatOptions: each bit is set in the
+ * allowedOptions parameter on a call to ParseFormatOptions if that option
+ * is allowed for the current photo image subcommand. On return, the bit is
+ * set in the options field of the FormatOptions structure if that option
+ * was specified.
+ *
+ * OPT_COLORFORMAT: Set if -alpha option allowed/specified.
+ */
+
+#define OPT_COLORFORMAT 1
+
+/*
+ * List of format option names. The order here must match the order of
+ * declarations of the FMT_OPT_* constants above.
+ */
+
+static const char *const formatOptionNames[] = {
+ "-colorformat",
+ NULL
+};
+
+/*
+ * Forward declarations
+ */
+
+static int ParseFormatOptions(Tcl_Interp *interp, int allowedOptions,
+ int objc, Tcl_Obj *const objv[], int *indexPtr,
+ struct FormatOptions *optPtr);
+static Tcl_Obj *GetBadOptMsg(const char *badValue, int allowedOpts);
+static int StringMatchDef(Tcl_Obj *data, Tcl_Obj *formatString,
+ int *widthPtr, int *heightPtr, Tcl_Interp *interp);
+static int StringReadDef(Tcl_Interp *interp, Tcl_Obj *data,
+ Tcl_Obj *formatString, Tk_PhotoHandle imageHandle,
+ int destX, int destY, int width, int height,
+ int srcX, int srcY);
+static int StringWriteDef(Tcl_Interp *interp,
+ Tcl_Obj *formatString,
+ Tk_PhotoImageBlock *blockPtr);
+static int ParseColor(Tcl_Interp *interp, Tcl_Obj *specObj,
+ Display *display, Colormap colormap, unsigned char *redPtr,
+ unsigned char *greenPtr, unsigned char *bluePtr,
+ unsigned char *alphaPtr);
+static int ParseColorAsList(Tcl_Interp *interp, const char *colorString,
+ int colorStrLen, unsigned char *redPtr,
+ unsigned char *greenPtr, unsigned char *bluePtr,
+ unsigned char *alphaPtr);
+static int ParseColorAsHex(Tcl_Interp *interp, const char *colorString,
+ int colorStrLen, Display *display, Colormap colormap,
+ unsigned char *redPtr, unsigned char *greenPtr,
+ unsigned char *bluePtr, unsigned char *alphaPtr);
+static int ParseColorAsStandard(Tcl_Interp *interp,
+ const char *colorString, int colorStrLen,
+ Display *display, Colormap colormap,
+ unsigned char *redPtr, unsigned char *greenPtr,
+ unsigned char *bluePtr, unsigned char *alphaPtr);
+
+/*
+ * The format record for the default image handler
+ */
+
+Tk_PhotoImageFormat tkImgFmtDefault = {
+ "default", /* name */
+ NULL, /* fileMatchProc: format doesn't support file ops */
+ StringMatchDef, /* stringMatchProc */
+ NULL, /* fileReadProc: format doesn't support file read */
+ StringReadDef, /* stringReadProc */
+ NULL, /* fileWriteProc: format doesn't support file write */
+ StringWriteDef, /* stringWriteProc */
+ NULL /* nextPtr */
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ParseFormatOptions --
+ *
+ * Parse the options passed to the image format handler.
+ *
+ * Results:
+ * On success, the structure pointed to by optPtr is filled with the
+ * values passed or with the defaults and TCL_OK returned.
+ * If an error occurs, leaves an error message in interp and returns
+ * TCL_ERROR.
+ *
+ * Side effects:
+ * The value in *indexPtr is updated to the index of the fist
+ * element in argv[] that does not look like an option/value, or to
+ * argc if parsing reached the end of argv[].
+ *
+ *----------------------------------------------------------------------
+ */
+static int
+ParseFormatOptions(
+ Tcl_Interp *interp, /* For error messages */
+ int allowedOptions, /* Bitfield specifying which options are
+ * to be considered allowed */
+ int objc, /* Number of elements in argv[] */
+ Tcl_Obj *const objv[], /* The arguments to parse */
+ int *indexPtr, /* Index giving the first element to
+ * parse. The value is updated to the
+ * index where parsing ended */
+ struct FormatOptions *optPtr) /* Parsed option values are written to
+ * this struct */
+
+{
+ int index, optIndex, first;
+ enum ColorFormatType typeIndex;
+ const char *option;
+
+ first = 1;
+
+ /*
+ * Fill in default values
+ */
+ optPtr->options = 0;
+ optPtr->formatName = NULL;
+ optPtr->colorFormat = COLORFORMAT_RGB2;
+ for (index = *indexPtr; index < objc; *indexPtr = ++index) {
+ int optionExists;
+
+ /*
+ * The first value can be the format handler's name. It goes to
+ * optPtr->name.
+ */
+ option = Tcl_GetString(objv[index]);
+ if (option[0] != '-') {
+ if (first) {
+ optPtr->formatName = objv[index];
+ first = 0;
+ continue;
+ } else {
+ break;
+ }
+ }
+ first = 0;
+
+ /*
+ * Check if option is known and allowed
+ */
+
+ optionExists = 1;
+ if (Tcl_GetIndexFromObj(NULL, objv[index], formatOptionNames,
+ "format option", 0, &optIndex) != TCL_OK) {
+ optionExists = 0;
+ }
+ if (!optionExists || !((1 << optIndex) & allowedOptions)) {
+ Tcl_SetObjResult(interp, GetBadOptMsg(Tcl_GetString(objv[index]),
+ allowedOptions));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Option-specific checks
+ */
+
+ switch (1 << optIndex) {
+ case OPT_COLORFORMAT:
+ *indexPtr = ++index;
+ if (index >= objc) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("the \"%s\" option "
+ "requires a value", Tcl_GetString(objv[index - 1])));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "MISSING_VALUE", NULL);
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "",
+ TCL_EXACT, (int *)&typeIndex) != TCL_OK
+ || (typeIndex != COLORFORMAT_LIST
+ && typeIndex != COLORFORMAT_RGB2
+ && typeIndex != COLORFORMAT_RGBA2) ) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad color format "
+ "\"%s\": must be rgb, rgba, or list",
+ Tcl_GetString(objv[index])));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "BAD_COLOR_FORMAT", NULL);
+ return TCL_ERROR;
+ }
+ optPtr->colorFormat = typeIndex;
+ break;
+ default:
+ Tcl_Panic("ParseFormatOptions: unexpected switch fallthrough");
+ }
+
+ /*
+ * Add option to bitfield in optPtr
+ */
+ optPtr->options |= (1 << optIndex);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetBadOptMsg --
+ *
+ * Build a Tcl_Obj containing an error message in the form "bad option
+ * "xx": must be y, or z", based on the bits set in allowedOpts.
+ *
+ * Results:
+ * A Tcl Object containig the error message.
+ *
+ * Side effects:
+ * None
+ *----------------------------------------------------------------------
+ */
+static Tcl_Obj *
+GetBadOptMsg(
+ const char *badValue, /* the erroneous option */
+ int allowedOpts) /* bitfield specifying the allowed options */
+{
+ int i, bit;
+ Tcl_Obj *resObj = Tcl_ObjPrintf("bad format option \"%s\": ", badValue);
+
+ if (allowedOpts == 0) {
+ Tcl_AppendToObj(resObj, "no options allowed", -1);
+ } else {
+ Tcl_AppendToObj(resObj, "must be ", -1);
+ bit = 1;
+ for (i = 0; formatOptionNames[i] != NULL; i++) {
+ if (allowedOpts & bit) {
+ if (allowedOpts & (bit -1)) {
+ /*
+ * not the first option
+ */
+ if (allowedOpts & ~((bit << 1) - 1)) {
+ /*
+ * not the last option
+ */
+ Tcl_AppendToObj(resObj, ", ", -1);
+ } else {
+ Tcl_AppendToObj(resObj, ", or ", -1);
+ }
+ }
+ Tcl_AppendToObj(resObj, formatOptionNames[i], -1);
+ }
+ bit <<=1;
+ }
+ }
+ return resObj;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * StringMatchDef --
+ *
+ * Default string match function. Test if image data in string form
+ * appears to be in the default list-of-list-of-pixel-data format
+ * accepted by the "<img> put" command.
+ *
+ * Results:
+ * If thte data is in the default format, writes the size of the image
+ * to widthPtr and heightPtr and returns 1. Otherwise, leaves an error
+ * message in interp (if not NULL) and returns 0.
+ * Note that this function does not parse all data points. A return
+ * value of 1 does not guarantee that the data can be read without
+ * errors.
+ *
+ * Side effects:
+ * None
+ *----------------------------------------------------------------------
+ */
+static int
+StringMatchDef(
+ Tcl_Obj *data, /* The data to check */
+ Tcl_Obj *formatString, /* Value of the -format option, not used here */
+ int *widthPtr, /* Width of image is written to this location */
+ int *heightPtr, /* Height of image is written to this location */
+ Tcl_Interp *interp) /* Error messages are left in this interpreter */
+{
+ int y, rowCount, colCount, curColCount;
+ unsigned char dummy;
+ Tcl_Obj **rowListPtr, *pixelData;
+ (void)formatString;
+
+ /*
+ * See if data can be parsed as a list, if every element is itself a valid
+ * list and all sublists have the same length.
+ */
+
+ if (Tcl_ListObjGetElements(interp, data, &rowCount, &rowListPtr)
+ != TCL_OK) {
+ return 0;
+ }
+ if (rowCount == 0) {
+ /*
+ * empty list is valid data
+ */
+
+ *widthPtr = 0;
+ *heightPtr = 0;
+ return 1;
+ }
+ colCount = -1;
+ for (y = 0; y < rowCount; y++) {
+ if (Tcl_ListObjLength(interp, rowListPtr[y], &curColCount) != TCL_OK) {
+ return 0;
+ }
+ if (colCount < 0) {
+ colCount = curColCount;
+ } else if (curColCount != colCount) {
+ if (interp != NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid row # %d: "
+ "all rows must have the same number of elements", y));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "INVALID_DATA", NULL);
+ }
+ return 0;
+ }
+ }
+
+ /*
+ * Data in base64 encoding (or even binary data), might actually pass
+ * these tests. To avoid parsing it as list of lists format, check one
+ * pixel for validity.
+ */
+ if (Tcl_ListObjIndex(interp, rowListPtr[0], 0, &pixelData) != TCL_OK) {
+ return 0;
+ }
+ (void)Tcl_GetString(pixelData);
+ if (pixelData->length > TK_PHOTO_MAX_COLOR_LENGTH) {
+ return 0;
+ }
+ if (ParseColor(interp, pixelData, Tk_Display(Tk_MainWindow(interp)),
+ Tk_Colormap(Tk_MainWindow(interp)), &dummy, &dummy, &dummy, &dummy)
+ != TCL_OK) {
+ return 0;
+ }
+
+ /*
+ * Looks like we have valid data for this format.
+ * We do not check any pixel values - that's the job of ImgStringRead()
+ */
+
+ *widthPtr = colCount;
+ *heightPtr = rowCount;
+
+ return 1;
+
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * StringReadDef --
+ *
+ * String read function for default format. (see manpage for details on
+ * the format).
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * If the data has valid format, write it to the image identified by
+ * imageHandle.
+ * If the image data cannot be parsed, an error message is left in
+ * interp.
+ *
+ *----------------------------------------------------------------------
+*/
+
+static int
+StringReadDef(
+ Tcl_Interp *interp, /* leave error messages here */
+ Tcl_Obj *data, /* the data to parse */
+ Tcl_Obj *formatString, /* value of the -format option */
+ Tk_PhotoHandle imageHandle, /* write data to this image */
+ int destX, int destY, /* start writing data at this point
+ * in destination image*/
+ int width, int height, /* dimensions of area to write to */
+ int srcX, int srcY) /* start reading source data at these
+ * coordinates */
+{
+ Tcl_Obj **rowListPtr, **colListPtr;
+ Tcl_Obj **objv;
+ int objc;
+ unsigned char *curPixelPtr;
+ int x, y, rowCount, colCount, curColCount;
+ Tk_PhotoImageBlock srcBlock;
+ Display *display;
+ Colormap colormap;
+ struct FormatOptions opts;
+ int optIndex;
+
+ /*
+ * Parse format suboptions
+ * We don't use any format suboptions, but we still need to provide useful
+ * error messages if suboptions were specified.
+ */
+
+ memset(&opts, 0, sizeof(opts));
+ if (formatString != NULL) {
+ if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ optIndex = 0;
+ if (ParseFormatOptions(interp, 0, objc, objv, &optIndex, &opts)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (optIndex < objc) {
+ Tcl_SetObjResult(interp,
+ GetBadOptMsg(Tcl_GetString(objv[optIndex]), 0));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL);
+ return TCL_ERROR;
+ }
+ }
+
+ /*
+ * Check input data
+ */
+
+ if (Tcl_ListObjGetElements(interp, data, &rowCount, &rowListPtr)
+ != TCL_OK ) {
+ return TCL_ERROR;
+ }
+ if ( rowCount > 0 && Tcl_ListObjLength(interp, rowListPtr[0], &colCount)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (width <= 0 || height <= 0 || rowCount == 0 || colCount == 0) {
+ /*
+ * No changes with zero sized input or zero sized output region
+ */
+
+ return TCL_OK;
+ }
+ if (srcX < 0 || srcY < 0 || srcX >= rowCount || srcY >= colCount) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("source coordinates out of range"));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Memory allocation overflow protection.
+ * May not be able to trigger/ demo / test this.
+ */
+
+ if (colCount > (int)(UINT_MAX / 4 / rowCount)) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "photo image dimensions exceed Tcl memory limits"));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "OVERFLOW", NULL);
+ return TCL_OK;
+ }
+
+ /*
+ * Read data and put it to imageHandle
+ */
+
+ srcBlock.width = colCount - srcX;
+ srcBlock.height = rowCount - srcY;
+ srcBlock.pixelSize = 4;
+ srcBlock.pitch = srcBlock.width * 4;
+ srcBlock.offset[0] = 0;
+ srcBlock.offset[1] = 1;
+ srcBlock.offset[2] = 2;
+ srcBlock.offset[3] = 3;
+ srcBlock.pixelPtr = (unsigned char *)attemptckalloc(srcBlock.pitch * srcBlock.height);
+ if (srcBlock.pixelPtr == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(TK_PHOTO_ALLOC_FAILURE_MESSAGE));
+ Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
+ return TCL_ERROR;
+ }
+ curPixelPtr = srcBlock.pixelPtr;
+ display = Tk_Display(Tk_MainWindow(interp));
+ colormap = Tk_Colormap(Tk_MainWindow(interp));
+ for (y = srcY; y < rowCount; y++) {
+ /*
+ * We don't test the length of row, as that's been done in
+ * ImgStringMatch()
+ */
+
+ if (Tcl_ListObjGetElements(interp, rowListPtr[y], &curColCount,
+ &colListPtr) != TCL_OK) {
+ goto errorExit;
+ }
+ for (x = srcX; x < colCount; x++) {
+ if (ParseColor(interp, colListPtr[x], display, colormap,
+ curPixelPtr, curPixelPtr + 1, curPixelPtr + 2,
+ curPixelPtr + 3) != TCL_OK) {
+ goto errorExit;
+ }
+ curPixelPtr += 4;
+ }
+ }
+
+ /*
+ * Write image data to destHandle
+ */
+ if (Tk_PhotoPutBlock(interp, imageHandle, &srcBlock, destX, destY,
+ width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
+ goto errorExit;
+ }
+
+ ckfree(srcBlock.pixelPtr);
+
+ return TCL_OK;
+
+ errorExit:
+ ckfree(srcBlock.pixelPtr);
+
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * StringWriteDef --
+ *
+ * String write function for default image data format. See the user
+ * documentation for details.
+ *
+ * Results:
+ * The converted data is set as the result of interp. Returns a standard
+ * Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+StringWriteDef(
+ Tcl_Interp *interp, /* For the result and errors */
+ Tcl_Obj *formatString, /* The value of the -format option */
+ Tk_PhotoImageBlock *blockPtr) /* The image data to convert */
+{
+ int greenOffset, blueOffset, alphaOffset, hasAlpha;
+ Tcl_Obj *result, **objv = NULL;
+ int objc, allowedOpts, optIndex;
+ struct FormatOptions opts;
+
+ /*
+ * Parse format suboptions
+ */
+ if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ allowedOpts = OPT_COLORFORMAT;
+ optIndex = 0;
+ if (ParseFormatOptions(interp, allowedOpts, objc, objv, &optIndex, &opts)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (optIndex < objc) {
+ Tcl_SetObjResult(interp,
+ GetBadOptMsg(Tcl_GetString(objv[optIndex]), allowedOpts));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL);
+ return TCL_ERROR;
+ }
+
+ greenOffset = blockPtr->offset[1] - blockPtr->offset[0];
+ blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
+
+ /*
+ * A negative alpha offset signals that the image is fully opaque.
+ * That's not really documented anywhere, but it's the way it is!
+ */
+
+ if (blockPtr->offset[3] < 0) {
+ hasAlpha = 0;
+ alphaOffset = 0;
+ } else {
+ hasAlpha = 1;
+ alphaOffset = blockPtr->offset[3] - blockPtr->offset[0];
+ }
+
+ if ((blockPtr->width > 0) && (blockPtr->height > 0)) {
+ int row, col;
+ Tcl_DString data, line;
+ char colorBuf[11];
+ unsigned char *pixelPtr;
+ unsigned char alphaVal = 255;
+
+ Tcl_DStringInit(&data);
+ for (row=0; row<blockPtr->height; row++) {
+ pixelPtr = blockPtr->pixelPtr + blockPtr->offset[0]
+ + row * blockPtr->pitch;
+ Tcl_DStringInit(&line);
+ for (col=0; col<blockPtr->width; col++) {
+ if (hasAlpha) {
+ alphaVal = pixelPtr[alphaOffset];
+ }
+
+ /*
+ * We don't build lines as a list for #RGBA and #RGB. Since
+ * these color formats look like comments, the first element
+ * of the list would get quoted with an additional {} .
+ * While this is not a problem if the data is used as
+ * a list, it would cause problems if someone decides to parse
+ * it as a string (and it looks kinda strange)
+ */
+
+ switch (opts.colorFormat) {
+ case COLORFORMAT_RGB2:
+ sprintf(colorBuf, "#%02x%02x%02x ", pixelPtr[0],
+ pixelPtr[greenOffset], pixelPtr[blueOffset]);
+ Tcl_DStringAppend(&line, colorBuf, -1);
+ break;
+ case COLORFORMAT_RGBA2:
+ sprintf(colorBuf, "#%02x%02x%02x%02x ",
+ pixelPtr[0], pixelPtr[greenOffset],
+ pixelPtr[blueOffset], alphaVal);
+ Tcl_DStringAppend(&line, colorBuf, -1);
+ break;
+ case COLORFORMAT_LIST:
+ Tcl_DStringStartSublist(&line);
+ sprintf(colorBuf, "%d", pixelPtr[0]);
+ Tcl_DStringAppendElement(&line, colorBuf);
+ sprintf(colorBuf, "%d", pixelPtr[greenOffset]);
+ Tcl_DStringAppendElement(&line, colorBuf);
+ sprintf(colorBuf, "%d", pixelPtr[blueOffset]);
+ Tcl_DStringAppendElement(&line, colorBuf);
+ sprintf(colorBuf, "%d", alphaVal);
+ Tcl_DStringAppendElement(&line, colorBuf);
+ Tcl_DStringEndSublist(&line);
+ break;
+ default:
+ Tcl_Panic("unexpected switch fallthrough");
+ }
+ pixelPtr += blockPtr->pixelSize;
+ }
+ if (opts.colorFormat != COLORFORMAT_LIST) {
+ /*
+ * For the #XXX formats, we need to remove the last
+ * whitespace.
+ */
+
+ *(Tcl_DStringValue(&line) + Tcl_DStringLength(&line) - 1)
+ = '\0';
+ }
+ Tcl_DStringAppendElement(&data, Tcl_DStringValue(&line));
+ Tcl_DStringFree(&line);
+ }
+ result = Tcl_NewStringObj(Tcl_DStringValue(&data), -1);
+ Tcl_DStringFree(&data);
+ } else {
+ result = Tcl_NewObj();
+ }
+
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ParseColor --
+ *
+ * This function extracts color and alpha values from a string. It
+ * understands standard Tk color formats, alpha suffixes and the color
+ * formats specific to photo images, which include alpha data.
+ *
+ * Results:
+ * On success, writes red, green, blue and alpha values to the
+ * corresponding pointers. If the color spec contains no alpha
+ * information, 255 is taken as transparency value.
+ * If the input cannot be parsed, leaves an error message in
+ * interp. Returns a standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+static int
+ParseColor(
+ Tcl_Interp *interp, /* error messages go there */
+ Tcl_Obj *specObj, /* the color data to parse */
+ Display *display, /* display of main window, needed to parse
+ * standard Tk colors */
+ Colormap colormap, /* colormap of current display */
+ unsigned char *redPtr, /* the result is written to these pointers */
+ unsigned char *greenPtr,
+ unsigned char *bluePtr,
+ unsigned char *alphaPtr)
+{
+ const char *specString;
+ TkSizeT length;
+
+ /*
+ * Find out which color format we have
+ */
+
+ specString = Tcl_GetStringFromObj(specObj, &length);
+
+ if (length == 0) {
+ /* Empty string */
+ *redPtr = *greenPtr = *bluePtr = *alphaPtr = 0;
+ return TCL_OK;
+ }
+ if (length > TK_PHOTO_MAX_COLOR_LENGTH) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid color"));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "INVALID_COLOR", NULL);
+ return TCL_ERROR;
+ }
+ if (specString[0] == '#') {
+ return ParseColorAsHex(interp, specString, length, display,
+ colormap, redPtr, greenPtr, bluePtr, alphaPtr);
+ }
+ if (ParseColorAsList(interp, specString, length,
+ redPtr, greenPtr, bluePtr, alphaPtr) == TCL_OK) {
+ return TCL_OK;
+ }
+
+ /*
+ * Parsing the color as standard Tk color always is the last option tried
+ * because TkParseColor() is very slow with values it cannot parse.
+ */
+
+ Tcl_ResetResult(interp);
+ return ParseColorAsStandard(interp, specString, length, display,
+ colormap, redPtr, greenPtr, bluePtr, alphaPtr);
+
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ParseColorAsList --
+ *
+ * This function extracts color and alpha values from a list of 3 or 4
+ * integers (the list color format).
+ *
+ * Results:
+ * On success, writes red, green, blue and alpha values to the
+ * corresponding pointers. If the color spec contains no alpha
+ * information, 255 is taken as transparency value.
+ * Returns a standard Tcl result.
+ *
+ * Side effects:
+ * Does *not* leave error messages in interp. The reason is that
+ * it is not always possible to tell if the list format was even
+ * intended and thus it is hard to return meaningful messages.
+ * A general error message from the caller is probably the best
+ * alternative.
+ *
+ *----------------------------------------------------------------------
+ */
+static int
+ParseColorAsList(
+ Tcl_Interp *dummy, /* not used */
+ const char *colorString, /* the color data to parse */
+ int colorStrLen, /* length of the color string */
+ unsigned char *redPtr, /* the result is written to these pointers */
+ unsigned char *greenPtr,
+ unsigned char *bluePtr,
+ unsigned char *alphaPtr)
+{
+ /*
+ * This is kinda ugly. The code would be certainly nicer if it
+ * used Tcl_ListObjGetElements() and Tcl_GetIntFromObj(). But with
+ * strtol() it's *much* faster.
+ */
+
+ const char *curPos;
+ int values[4];
+ int i;
+ (void)dummy;
+ (void)colorStrLen;
+
+ curPos = colorString;
+ i = 0;
+
+ /*
+ * strtol can give false positives with a sequence of space chars.
+ * To avoid that, avance the pointer to the next non-blank char.
+ */
+
+ while(isspace(UCHAR(*curPos))) {
+ ++curPos;
+ }
+ while (i < 4 && *curPos != '\0') {
+ values[i] = strtol(curPos, (char **)&curPos, 0);
+ if (values[i] < 0 || values[i] > 255) {
+ return TCL_ERROR;
+ }
+ while(isspace(UCHAR(*curPos))) {
+ ++curPos;
+ }
+ ++i;
+ }
+
+ if (i < 3 || *curPos != '\0') {
+ return TCL_ERROR;
+ }
+ if (i < 4) {
+ values[3] = 255;
+ }
+
+ *redPtr = (unsigned char) values[0];
+ *greenPtr = (unsigned char) values[1];
+ *bluePtr = (unsigned char) values[2];
+ *alphaPtr = (unsigned char) values[3];
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ParseColorAsHex --
+ *
+ * This function extracts color and alpha values from a string
+ * starting with '#', followed by hex digits. It undestands both
+ * the #RGBA form and the #RBG (with optional suffix)
+ *
+ * Results:
+ * On success, writes red, green, blue and alpha values to the
+ * corresponding pointers. If the color spec contains no alpha
+ * information, 255 is taken as transparency value.
+ * Returns a standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+static int
+ParseColorAsHex(
+ Tcl_Interp *interp, /* error messages are left here */
+ const char *colorString, /* the color data to parse */
+ int colorStrLen, /* length of the color string */
+ Display *display, /* display of main window */
+ Colormap colormap, /* colormap of current display */
+ unsigned char *redPtr, /* the result is written to these pointers */
+ unsigned char *greenPtr,
+ unsigned char *bluePtr,
+ unsigned char *alphaPtr)
+{
+ int i;
+ unsigned long int colorValue = 0;
+
+ if (colorStrLen - 1 != 4 && colorStrLen - 1 != 8) {
+ return ParseColorAsStandard(interp, colorString, colorStrLen,
+ display, colormap, redPtr, greenPtr, bluePtr, alphaPtr);
+ }
+ for (i = 1; i < colorStrLen; i++) {
+ if (!isxdigit(UCHAR(colorString[i]))) {
+ /*
+ * There still is a chance that this is a Tk color with
+ * an alpha suffix
+ */
+
+ return ParseColorAsStandard(interp, colorString, colorStrLen,
+ display, colormap, redPtr, greenPtr, bluePtr, alphaPtr);
+ }
+ }
+
+ colorValue = strtoul(colorString + 1, NULL, 16);
+ switch (colorStrLen - 1) {
+ case 4:
+ /* #RGBA format */
+ *redPtr = (unsigned char) ((colorValue >> 12) * 0x11);
+ *greenPtr = (unsigned char) (((colorValue >> 8) & 0xf) * 0x11);
+ *bluePtr = (unsigned char) (((colorValue >> 4) & 0xf) * 0x11);
+ *alphaPtr = (unsigned char) ((colorValue & 0xf) * 0x11);
+ return TCL_OK;
+ case 8:
+ /* #RRGGBBAA format */
+ *redPtr = (unsigned char) (colorValue >> 24);
+ *greenPtr = (unsigned char) ((colorValue >> 16) & 0xff);
+ *bluePtr = (unsigned char) ((colorValue >> 8) & 0xff);
+ *alphaPtr = (unsigned char) (colorValue & 0xff);
+ return TCL_OK;
+ default:
+ Tcl_Panic("unexpected switch fallthrough");
+ }
+
+ /* Shouldn't get here */
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ParseColorAsStandard --
+ *
+ * This function tries to split a color stirng in a color and a
+ * suffix part and to extract color and alpha values from them. The
+ * color part is treated as regular Tk color.
+ *
+ * Results:
+ * On success, writes red, green, blue and alpha values to the
+ * corresponding pointers. If the color spec contains no alpha
+ * information, 255 is taken as transparency value.
+ * Returns a standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+static int
+ParseColorAsStandard(
+ Tcl_Interp *interp, /* error messages are left here */
+ const char *specString, /* the color data to parse */
+ int specStrLen, /* length of the color string */
+ Display *display, /* display of main window */
+ Colormap colormap, /* colormap of current display */
+ unsigned char *redPtr, /* the result is written to these pointers */
+ unsigned char *greenPtr,
+ unsigned char *bluePtr,
+ unsigned char *alphaPtr)
+{
+ XColor parsedColor;
+ const char *suffixString, *colorString;
+ char colorBuffer[TK_PHOTO_MAX_COLOR_LENGTH + 1];
+ char *tmpString;
+ double fracAlpha;
+ unsigned int suffixAlpha;
+ int i;
+
+ /*
+ * Split color data string in color and suffix parts
+ */
+
+ if ((suffixString = strrchr(specString, '@')) == NULL
+ && ((suffixString = strrchr(specString, '#')) == NULL
+ || suffixString == specString)) {
+ suffixString = specString + specStrLen;
+ colorString = specString;
+ } else {
+ strncpy(colorBuffer, specString, suffixString - specString);
+ colorBuffer[suffixString - specString] = '\0';
+ colorString = (const char*)colorBuffer;
+ }
+
+ /*
+ * Try to parse as standard Tk color.
+ *
+ * We don't use Tk_GetColor() et al. here, as those functions
+ * migth return a color that does not exaxtly match the given name
+ * if the colormap is full. Also, we don't really want the color to be
+ * added to the colormap.
+ */
+
+ if ( ! TkParseColor(display, colormap, colorString, &parsedColor)) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "invalid color name \"%s\"", specString));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "INVALID_COLOR", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * parse the Suffix
+ */
+
+ switch (suffixString[0]) {
+ case '\0':
+ suffixAlpha = 255;
+ break;
+ case '@':
+ fracAlpha = strtod(suffixString + 1, &tmpString);
+ if (*tmpString != '\0') {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha "
+ "suffix \"%s\": expected floating-point value",
+ suffixString));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "INVALID COLOR", NULL);
+ return TCL_ERROR;
+ }
+ if (fracAlpha < 0 || fracAlpha > 1) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha suffix"
+ " \"%s\": value must be in the range from 0 to 1",
+ suffixString));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "INVALID_COLOR", NULL);
+ return TCL_ERROR;
+ }
+ suffixAlpha = (unsigned int) floor(fracAlpha * 255 + 0.5);
+ break;
+ case '#':
+ if (strlen(suffixString + 1) < 1 || strlen(suffixString + 1)> 2) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "invalid alpha suffix \"%s\"", suffixString));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "INVALID_COLOR", NULL);
+ return TCL_ERROR;
+ }
+ for (i = 1; i <= (int)strlen(suffixString + 1); i++) {
+ if ( ! isxdigit(UCHAR(suffixString[i]))) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "invalid alpha suffix \"%s\": expected hex digit",
+ suffixString));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "INVALID_COLOR", NULL);
+ return TCL_ERROR;
+ }
+ }
+ if (strlen(suffixString + 1) == 1) {
+ sscanf(suffixString, "#%1x", &suffixAlpha);
+ suffixAlpha *= 0x11;
+ } else {
+ sscanf(suffixString, "#%2x", &suffixAlpha);
+ }
+ break;
+ default:
+ Tcl_Panic("unexpected switch fallthrough");
+ }
+
+ *redPtr = (unsigned char) (parsedColor.red >> 8);
+ *greenPtr = (unsigned char) (parsedColor.green >> 8);
+ *bluePtr = (unsigned char) (parsedColor.blue >> 8);
+ *alphaPtr = (unsigned char) suffixAlpha;
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkDebugStringMatchDef --
+ *
+ * Debugging function for StringMatchDef. Basically just an alias for
+ * that function, intended to expose it directly to tests, as
+ * StirngMatchDef cannot be sufficiently tested otherwise.
+ *
+ * Results:
+ * See StringMatchDef.
+ *
+ * Side effects:
+ * None
+ *----------------------------------------------------------------------
+ */
+int
+TkDebugPhotoStringMatchDef(
+ Tcl_Interp *interp, /* Error messages are left in this interpreter */
+ Tcl_Obj *data, /* The data to check */
+ Tcl_Obj *formatString, /* Value of the -format option, not used here */
+ int *widthPtr, /* Width of image is written to this location */
+ int *heightPtr) /* Height of image is written to this location */
+{
+ return StringMatchDef(data, formatString, widthPtr, heightPtr, interp);
+}
+
+
+/* Local Variables: */
+/* mode: c */
+/* fill-column: 78 */
+/* c-basic-offset: 4 */
+/* tab-width: 8 */
+/* indent-tabs-mode: nil */
+/* End: */
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index 03bb4f8..69c2739 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -3,8 +3,8 @@
*
* A Tk photo image file handler for PNG files.
*
- * Copyright (c) 2006-2008 Muonics, Inc.
- * Copyright (c) 2008 Donal K. Fellows
+ * Copyright © 2006-2008 Muonics, Inc.
+ * Copyright © 2008 Donal K. Fellows
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -126,7 +126,7 @@ typedef struct {
Tcl_Channel channel; /* Channel for from-file reads. */
Tcl_Obj *objDataPtr;
unsigned char *strDataBuf; /* Raw source data for from-string reads. */
- int strDataLen; /* Length of source data. */
+ TkSizeT strDataLen; /* Length of source data. */
unsigned char *base64Data; /* base64 encoded string data. */
unsigned char base64Bits; /* Remaining bits from last base64 read. */
unsigned char base64State; /* Current state of base64 decoder. */
@@ -175,6 +175,15 @@ typedef struct {
Tcl_Obj *thisLineObj; /* Current line of pixels to process. */
int lineSize; /* Number of bytes in a PNG line. */
int phaseSize; /* Number of bytes/line in current phase. */
+
+
+ /*
+ * Physical size: pHYS chunks.
+ */
+
+ double DPI;
+ double aspect;
+
} PNGImage;
/*
@@ -198,32 +207,36 @@ static int DecodePNG(Tcl_Interp *interp, PNGImage *pngPtr,
Tcl_Obj *fmtObj, Tk_PhotoHandle imageHandle,
int destX, int destY);
static int EncodePNG(Tcl_Interp *interp,
- Tk_PhotoImageBlock *blockPtr, PNGImage *pngPtr);
-static int FileMatchPNG(Tcl_Channel chan, const char *fileName,
- Tcl_Obj *fmtObj, int *widthPtr, int *heightPtr,
- Tcl_Interp *interp);
+ Tk_PhotoImageBlock *blockPtr, PNGImage *pngPtr,
+ Tcl_Obj *metadataInObj);
+static int FileMatchPNG(Tcl_Interp *interp, Tcl_Channel chan,
+ const char *fileName, Tcl_Obj *fmtObj,
+ Tcl_Obj *metadataInObj, int *widthPtr,
+ int *heightPtr, Tcl_Obj *metadataOut);
static int FileReadPNG(Tcl_Interp *interp, Tcl_Channel chan,
const char *fileName, Tcl_Obj *fmtObj,
- Tk_PhotoHandle imageHandle, int destX, int destY,
- int width, int height, int srcX, int srcY);
+ Tcl_Obj *metadataInObj, Tk_PhotoHandle imageHandle,
+ int destX, int destY, int width, int height,
+ int srcX, int srcY, Tcl_Obj *metadataOutPtr);
static int FileWritePNG(Tcl_Interp *interp, const char *filename,
- Tcl_Obj *fmtObj, Tk_PhotoImageBlock *blockPtr);
+ Tcl_Obj *fmtObj, Tcl_Obj *metadataInObj,
+ Tk_PhotoImageBlock *blockPtr);
static int InitPNGImage(Tcl_Interp *interp, PNGImage *pngPtr,
Tcl_Channel chan, Tcl_Obj *objPtr, int dir);
static inline unsigned char Paeth(int a, int b, int c);
static int ParseFormat(Tcl_Interp *interp, Tcl_Obj *fmtObj,
PNGImage *pngPtr);
static int ReadBase64(Tcl_Interp *interp, PNGImage *pngPtr,
- unsigned char *destPtr, int destSz,
+ unsigned char *destPtr, size_t destSz,
unsigned long *crcPtr);
static int ReadByteArray(Tcl_Interp *interp, PNGImage *pngPtr,
- unsigned char *destPtr, int destSz,
+ unsigned char *destPtr, size_t destSz,
unsigned long *crcPtr);
static int ReadData(Tcl_Interp *interp, PNGImage *pngPtr,
- unsigned char *destPtr, int destSz,
+ unsigned char *destPtr, size_t destSz,
unsigned long *crcPtr);
static int ReadChunkHeader(Tcl_Interp *interp, PNGImage *pngPtr,
- int *sizePtr, unsigned long *typePtr,
+ size_t *sizePtr, unsigned long *typePtr,
unsigned long *crcPtr);
static int ReadIDAT(Tcl_Interp *interp, PNGImage *pngPtr,
int chunkSz, unsigned long crc);
@@ -236,26 +249,30 @@ static int ReadTRNS(Tcl_Interp *interp, PNGImage *pngPtr,
int chunkSz, unsigned long crc);
static int SkipChunk(Tcl_Interp *interp, PNGImage *pngPtr,
int chunkSz, unsigned long crc);
-static int StringMatchPNG(Tcl_Obj *dataObj, Tcl_Obj *fmtObj,
+static int StringMatchPNG(Tcl_Interp *interp, Tcl_Obj *pObjData,
+ Tcl_Obj *fmtObj, Tcl_Obj *metadataInObj,
int *widthPtr, int *heightPtr,
- Tcl_Interp *interp);
-static int StringReadPNG(Tcl_Interp *interp, Tcl_Obj *dataObj,
- Tcl_Obj *fmtObj, Tk_PhotoHandle imageHandle,
+ Tcl_Obj *metadataOutObj);
+static int StringReadPNG(Tcl_Interp *interp, Tcl_Obj *pObjData,
+ Tcl_Obj *fmtObj, Tcl_Obj *metadataInObj,
+ Tk_PhotoHandle imageHandle,
int destX, int destY, int width, int height,
- int srcX, int srcY);
+ int srcX, int srcY, Tcl_Obj *metadataOutObj);
+
static int StringWritePNG(Tcl_Interp *interp, Tcl_Obj *fmtObj,
+ Tcl_Obj *metadataInObj,
Tk_PhotoImageBlock *blockPtr);
static int UnfilterLine(Tcl_Interp *interp, PNGImage *pngPtr);
static inline int WriteByte(Tcl_Interp *interp, PNGImage *pngPtr,
unsigned char c, unsigned long *crcPtr);
static inline int WriteChunk(Tcl_Interp *interp, PNGImage *pngPtr,
unsigned long chunkType,
- const unsigned char *dataPtr, int dataSize);
+ const unsigned char *dataPtr, size_t dataSize);
static int WriteData(Tcl_Interp *interp, PNGImage *pngPtr,
- const unsigned char *srcPtr, int srcSz,
+ const unsigned char *srcPtr, size_t srcSz,
unsigned long *crcPtr);
static int WriteExtraChunks(Tcl_Interp *interp,
- PNGImage *pngPtr);
+ PNGImage *pngPtr, Tcl_Obj *metadataInObj);
static int WriteIHDR(Tcl_Interp *interp, PNGImage *pngPtr,
Tk_PhotoImageBlock *blockPtr);
static int WriteIDAT(Tcl_Interp *interp, PNGImage *pngPtr,
@@ -267,7 +284,7 @@ static inline int WriteInt32(Tcl_Interp *interp, PNGImage *pngPtr,
* The format record for the PNG file format:
*/
-Tk_PhotoImageFormat tkImgFmtPNG = {
+Tk_PhotoImageFormatVersion3 tkImgFmtPNG = {
"png", /* name */
FileMatchPNG, /* fileMatchProc */
StringMatchPNG, /* stringMatchProc */
@@ -345,6 +362,13 @@ InitPNGImage(
return TCL_ERROR;
}
+ /*
+ * Initialize physical size pHYS values
+ */
+
+ pngPtr->DPI = -1;
+ pngPtr->aspect = -1;
+
return TCL_OK;
}
@@ -430,7 +454,7 @@ ReadBase64(
Tcl_Interp *interp,
PNGImage *pngPtr,
unsigned char *destPtr,
- int destSz,
+ size_t destSz,
unsigned long *crcPtr)
{
static const unsigned char from64[] = {
@@ -555,14 +579,14 @@ ReadByteArray(
Tcl_Interp *interp,
PNGImage *pngPtr,
unsigned char *destPtr,
- int destSz,
+ size_t destSz,
unsigned long *crcPtr)
{
/*
* Check to make sure the number of requested bytes are available.
*/
- if (pngPtr->strDataLen < destSz) {
+ if ((size_t)pngPtr->strDataLen < destSz) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unexpected end of image data", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EARLY_END", NULL);
@@ -570,7 +594,7 @@ ReadByteArray(
}
while (destSz) {
- int blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
+ size_t blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
memcpy(destPtr, pngPtr->strDataBuf, blockSz);
@@ -613,7 +637,7 @@ ReadData(
Tcl_Interp *interp,
PNGImage *pngPtr,
unsigned char *destPtr,
- int destSz,
+ size_t destSz,
unsigned long *crcPtr)
{
if (pngPtr->base64Data) {
@@ -623,10 +647,10 @@ ReadData(
}
while (destSz) {
- int blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
+ TkSizeT blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
blockSz = Tcl_Read(pngPtr->channel, (char *)destPtr, blockSz);
- if (blockSz == -1) {
+ if (blockSz == TCL_IO_FAILURE) {
/* TODO: failure info... */
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"channel read failed: %s", Tcl_PosixError(interp)));
@@ -858,7 +882,7 @@ static int
ReadChunkHeader(
Tcl_Interp *interp,
PNGImage *pngPtr,
- int *sizePtr,
+ size_t *sizePtr,
unsigned long *typePtr,
unsigned long *crcPtr)
{
@@ -933,6 +957,7 @@ ReadChunkHeader(
case CHUNK_IDAT:
case CHUNK_IEND:
case CHUNK_IHDR:
+ case CHUNK_pHYs:
case CHUNK_PLTE:
case CHUNK_tRNS:
break;
@@ -951,7 +976,6 @@ ReadChunkHeader(
case CHUNK_iTXt:
case CHUNK_oFFs:
case CHUNK_pCAL:
- case CHUNK_pHYs:
case CHUNK_sBIT:
case CHUNK_sCAL:
case CHUNK_sPLT:
@@ -1239,7 +1263,7 @@ ReadIHDR(
{
unsigned char sigBuf[PNG_SIG_SZ];
unsigned long chunkType;
- int chunkSz;
+ size_t chunkSz;
unsigned long crc;
unsigned long width, height;
int mismatch;
@@ -1643,6 +1667,84 @@ ReadTRNS(
/*
*----------------------------------------------------------------------
*
+ * ReadPHYS --
+ *
+ * This function reads the PHYS (physical size) chunk data from
+ * the PNG file and populates the fields in the PNGImage
+ * structure.
+ *
+ * Results:
+ * TCL_OK, or TCL_ERROR if an I/O error occurs or the PHYS chunk is
+ * invalid.
+ *
+ * Side effects:
+ * The access position in f advances.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+ReadPHYS(
+ Tcl_Interp *interp,
+ PNGImage *pngPtr,
+ int chunkSz,
+ unsigned long crc)
+{
+ unsigned long PPUx, PPUy;
+ char unitSpecifier;
+
+ /*
+ * Check chunk size equal 9 bytes
+ */
+
+ if (chunkSz != 9) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "invalid physical chunk size", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_PHYS", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Read the chunk data
+ * 4 bytes: Pixels per unit, x axis
+ * 4 bytes: Pixels per unit, y axis
+ * 1 byte: unit specifier
+ */
+
+ if (ReadInt32(interp, pngPtr, &PPUx, &crc) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (ReadInt32(interp, pngPtr, &PPUy, &crc) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (ReadData(interp, pngPtr, (unsigned char *)&unitSpecifier, 1, &crc) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+ if (CheckCRC(interp, pngPtr, crc) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+ if ( PPUx > 2147483647 || PPUy > 2147483647
+ || unitSpecifier > 1 ) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "invalid physical size value", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_PHYS", NULL);
+ return TCL_ERROR;
+ }
+
+ if (PPUx > 0) {
+ pngPtr->aspect = ((double) PPUy) / ((double) PPUx);
+ }
+ if (1 == unitSpecifier) {
+ pngPtr->DPI = ((double) PPUx) * 0.0254;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* Paeth --
*
* Utility function for applying the Paeth filter to a pixel. The Paeth
@@ -2097,7 +2199,7 @@ ReadIDAT(
*/
while (chunkSz && !Tcl_ZlibStreamEof(pngPtr->stream)) {
- int len1, len2;
+ TkSizeT len1, len2;
/*
* Read another block of input into the zlib stream if data remains.
@@ -2153,7 +2255,7 @@ ReadIDAT(
}
Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, &len2);
- if (len2 == pngPtr->phaseSize) {
+ if (len2 == (TkSizeT)pngPtr->phaseSize) {
if (pngPtr->phase > 7) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"extra data after final scan line of final phase",
@@ -2295,7 +2397,7 @@ ParseFormat(
static const char *const fmtOptions[] = {
"-alpha", NULL
};
- enum fmtOptions {
+ enum fmtOptionsEnum {
OPT_ALPHA
};
@@ -2332,7 +2434,7 @@ ParseFormat(
objc--;
objv++;
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum) optIndex) {
case OPT_ALPHA:
if (Tcl_GetDoubleFromObj(interp, objv[0],
&pngPtr->alpha) == TCL_ERROR) {
@@ -2382,7 +2484,7 @@ DecodePNG(
int destY)
{
unsigned long chunkType;
- int chunkSz;
+ size_t chunkSz;
unsigned long crc;
/*
@@ -2415,6 +2517,29 @@ DecodePNG(
return TCL_ERROR;
}
+ /*
+ * Physical header may be present here so try to parse it
+ */
+
+ if (CHUNK_pHYs == chunkType) {
+ /*
+ * Finish parsing the PHYS chunk.
+ */
+
+ if (ReadPHYS(interp, pngPtr, chunkSz, crc) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Begin the next chunk.
+ */
+
+ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType,
+ &crc) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ }
+
if (CHUNK_PLTE == chunkType) {
/*
* Finish parsing the PLTE chunk.
@@ -2466,6 +2591,29 @@ DecodePNG(
}
/*
+ * Physical header may be present here so try to parse it
+ */
+
+ if (CHUNK_pHYs == chunkType) {
+ /*
+ * Finish parsing the PHYS chunk.
+ */
+
+ if (ReadPHYS(interp, pngPtr, chunkSz, crc) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Begin the next chunk.
+ */
+
+ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType,
+ &crc) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ }
+
+ /*
* Other ancillary chunk types could appear here, but for now we're only
* interested in IDAT. The others should have been skipped.
*/
@@ -2520,7 +2668,7 @@ DecodePNG(
pngPtr->thisLineObj = Tcl_NewObj();
Tcl_IncrRefCount(pngPtr->thisLineObj);
- pngPtr->block.pixelPtr = attemptckalloc(pngPtr->blockLen);
+ pngPtr->block.pixelPtr = (unsigned char *)attemptckalloc(pngPtr->blockLen);
if (!pngPtr->block.pixelPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"memory allocation failed", -1));
@@ -2667,12 +2815,15 @@ DecodePNG(
static int
FileMatchPNG(
- Tcl_Channel chan,
- const char *fileName,
- Tcl_Obj *fmtObj,
- int *widthPtr,
- int *heightPtr,
- Tcl_Interp *interp)
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tcl_Channel chan, /* The image file, open for reading. */
+ TCL_UNUSED(const char *), /* The name of the image file. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format object, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */
+ int *widthPtr, int *heightPtr,
+ /* The dimensions of the image are returned
+ * here if the file is a valid raw GIF file. */
+ TCL_UNUSED(Tcl_Obj *)) /* metadata return dict, may be NULL */
{
PNGImage png;
int match = 0;
@@ -2711,17 +2862,21 @@ FileMatchPNG(
static int
FileReadPNG(
- Tcl_Interp *interp,
- Tcl_Channel chan,
- const char *fileName,
- Tcl_Obj *fmtObj,
- Tk_PhotoHandle imageHandle,
- int destX,
- int destY,
- int width,
- int height,
- int srcX,
- int srcY)
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tcl_Channel chan, /* The image file, open for reading. */
+ TCL_UNUSED(const char *), /* The name of the image file. */
+ Tcl_Obj *fmtObj, /* User-specified format object, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */
+ Tk_PhotoHandle imageHandle, /* The photo image to write into. */
+ int destX, int destY, /* Coordinates of top-left pixel in photo
+ * image to be written to. */
+ TCL_UNUSED(int), /* Dimensions of block of photo image to be
+ * written to. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Coordinates of top-left pixel to be used in
+ * image being read. */
+ TCL_UNUSED(int),
+ Tcl_Obj *metadataOutObj) /* metadata return dict, may be NULL */
{
PNGImage png;
int result = TCL_ERROR;
@@ -2732,6 +2887,18 @@ FileReadPNG(
result = DecodePNG(interp, &png, fmtObj, imageHandle, destX, destY);
}
+ if (TCL_OK == result && metadataOutObj != NULL && png.DPI != -1) {
+ result = Tcl_DictObjPut(NULL, metadataOutObj,
+ Tcl_NewStringObj("DPI",-1),
+ Tcl_NewDoubleObj(png.DPI));
+ }
+
+ if (TCL_OK == result && metadataOutObj != NULL && png.aspect != -1) {
+ result = Tcl_DictObjPut(NULL, metadataOutObj,
+ Tcl_NewStringObj("aspect",-1),
+ Tcl_NewDoubleObj(png.aspect));
+ }
+
CleanupPNGImage(&png);
return result;
}
@@ -2756,11 +2923,13 @@ FileReadPNG(
static int
StringMatchPNG(
- Tcl_Obj *pObjData,
- Tcl_Obj *fmtObj,
- int *widthPtr,
- int *heightPtr,
- Tcl_Interp *interp)
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tcl_Obj *pObjData, /* the object containing the image data */
+ TCL_UNUSED(Tcl_Obj *), /* the image format object, or NULL */
+ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */
+ int *widthPtr, /* where to put the string width */
+ int *heightPtr, /* where to put the string height */
+ TCL_UNUSED(Tcl_Obj *)) /* metadata return dict, may be NULL */
{
PNGImage png;
int match = 0;
@@ -2799,16 +2968,17 @@ StringMatchPNG(
static int
StringReadPNG(
- Tcl_Interp *interp,
- Tcl_Obj *pObjData,
- Tcl_Obj *fmtObj,
- Tk_PhotoHandle imageHandle,
- int destX,
- int destY,
- int width,
- int height,
- int srcX,
- int srcY)
+ Tcl_Interp *interp, /* interpreter for reporting errors in */
+ Tcl_Obj *pObjData, /* object containing the image */
+ Tcl_Obj *fmtObj, /* format object, or NULL */
+ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */
+ Tk_PhotoHandle imageHandle, /* the image to write this data into */
+ int destX, int destY, /* The rectangular region of the */
+ TCL_UNUSED(int), /* image to copy */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ Tcl_Obj *metadataOutObj) /* metadata return dict, may be NULL */
{
PNGImage png;
int result = TCL_ERROR;
@@ -2820,6 +2990,18 @@ StringReadPNG(
result = DecodePNG(interp, &png, fmtObj, imageHandle, destX, destY);
}
+ if (TCL_OK == result && metadataOutObj != NULL && png.DPI != -1) {
+ result = Tcl_DictObjPut(NULL, metadataOutObj,
+ Tcl_NewStringObj("DPI",-1),
+ Tcl_NewDoubleObj(png.DPI));
+ }
+
+ if (TCL_OK == result && metadataOutObj != NULL && png.aspect != -1) {
+ result = Tcl_DictObjPut(NULL, metadataOutObj,
+ Tcl_NewStringObj("aspect",-1),
+ Tcl_NewDoubleObj(png.aspect));
+ }
+
CleanupPNGImage(&png);
return result;
}
@@ -2845,7 +3027,7 @@ WriteData(
Tcl_Interp *interp,
PNGImage *pngPtr,
const unsigned char *srcPtr,
- int srcSz,
+ size_t srcSz,
unsigned long *crcPtr)
{
if (!srcPtr || !srcSz) {
@@ -2862,12 +3044,12 @@ WriteData(
*/
if (pngPtr->objDataPtr) {
- int objSz;
+ TkSizeT objSz;
unsigned char *destPtr;
Tcl_GetByteArrayFromObj(pngPtr->objDataPtr, &objSz);
- if (objSz > INT_MAX - srcSz) {
+ if (objSz + srcSz > INT_MAX) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"image too large to store completely in byte array", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "TOO_LARGE", NULL);
@@ -2884,7 +3066,7 @@ WriteData(
}
memcpy(destPtr+objSz, srcPtr, srcSz);
- } else if (Tcl_Write(pngPtr->channel, (const char *) srcPtr, srcSz) == -1) {
+ } else if (Tcl_Write(pngPtr->channel, (const char *) srcPtr, srcSz) == TCL_IO_FAILURE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write to channel failed: %s", Tcl_PosixError(interp)));
return TCL_ERROR;
@@ -2906,6 +3088,34 @@ WriteByte(
/*
*----------------------------------------------------------------------
*
+ * LongToInt32 --
+ *
+ * This function transforms to a 32-bit integer value as
+ * four bytes in network byte order.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * Buffer will be modified.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static inline void
+LongToInt32(
+ unsigned long l,
+ unsigned char *pc)
+{
+ pc[0] = (unsigned char) ((l & 0xff000000) >> 24);
+ pc[1] = (unsigned char) ((l & 0x00ff0000) >> 16);
+ pc[2] = (unsigned char) ((l & 0x0000ff00) >> 8);
+ pc[3] = (unsigned char) ((l & 0x000000ff) >> 0);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* WriteInt32 --
*
* This function writes a 32-bit integer value out to the PNG image as
@@ -2928,12 +3138,7 @@ WriteInt32(
unsigned long *crcPtr)
{
unsigned char pc[4];
-
- pc[0] = (unsigned char) ((l & 0xff000000) >> 24);
- pc[1] = (unsigned char) ((l & 0x00ff0000) >> 16);
- pc[2] = (unsigned char) ((l & 0x0000ff00) >> 8);
- pc[3] = (unsigned char) ((l & 0x000000ff) >> 0);
-
+ LongToInt32(l,pc);
return WriteData(interp, pngPtr, pc, 4, crcPtr);
}
@@ -2960,7 +3165,7 @@ WriteChunk(
PNGImage *pngPtr,
unsigned long chunkType,
const unsigned char *dataPtr,
- int dataSize)
+ size_t dataSize)
{
unsigned long crc = Tcl_ZlibCRC32(0, NULL, 0);
int result = TCL_OK;
@@ -3131,9 +3336,10 @@ WriteIDAT(
PNGImage *pngPtr,
Tk_PhotoImageBlock *blockPtr)
{
- int rowNum, flush = TCL_ZLIB_NO_FLUSH, outputSize, result;
+ int rowNum, flush = TCL_ZLIB_NO_FLUSH, result;
Tcl_Obj *outputObj;
unsigned char *outputBytes;
+ TkSizeT outputSize;
/*
* Filter and compress each row one at a time.
@@ -3251,7 +3457,8 @@ WriteIDAT(
static int
WriteExtraChunks(
Tcl_Interp *interp,
- PNGImage *pngPtr)
+ PNGImage *pngPtr,
+ Tcl_Obj *metadataInObj)
{
static const unsigned char sBIT_contents[] = {
8, 8, 8, 8
@@ -3303,6 +3510,79 @@ WriteExtraChunks(
}
Tcl_DStringFree(&buf);
+ /*
+ * Add a pHYs chunk if there is metadata for DPI and/or aspect
+ * aspect = PPUy / PPUx
+ * DPI = PPUx * 0.0254
+ * The physical chunk consists of:
+ * - Points per meter in x direction (32 bit)
+ * - Points per meter in x direction (32 bit)
+ * - Unit specifier: 0: no unit (only aspect), 1: Points per meter
+ */
+
+ if (metadataInObj != NULL) {
+
+ Tcl_Obj *aspectObj, *DPIObj;
+ double aspectValue=-1, DPIValue=-1;
+ unsigned long PPUx = 65536, PPUy = 65536;
+ char unitSpecifier;
+
+ if (TCL_ERROR == Tcl_DictObjGet(interp, metadataInObj,
+ Tcl_NewStringObj("aspect",-1),
+ &aspectObj) ||
+ TCL_ERROR == Tcl_DictObjGet(interp, metadataInObj,
+ Tcl_NewStringObj("DPI",-1),
+ &DPIObj) ) {
+ return TCL_ERROR;
+ }
+ if (DPIObj != NULL) {
+ if (TCL_ERROR == Tcl_GetDoubleFromObj(interp, DPIObj, &DPIValue))
+ {
+ return TCL_ERROR;
+ }
+ PPUx = (unsigned long)floor(DPIValue / 0.0254+0.5);
+ if (aspectObj == NULL) {
+ PPUy = PPUx;
+ }
+ unitSpecifier = 1;
+ }
+ if (aspectObj != NULL) {
+ if (TCL_ERROR == Tcl_GetDoubleFromObj(interp, aspectObj,
+ &aspectValue)) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * aspect = PPUy / PPUx
+ */
+
+ if (DPIObj == NULL) {
+ unitSpecifier = 0;
+ PPUx = 65536;
+ PPUy = (unsigned long)floor(65536.0 * aspectValue+0.5);
+ } else {
+ PPUy = (unsigned long)floor(DPIValue * aspectValue / 0.0254+0.5);
+ }
+ }
+ if (DPIObj != NULL || aspectObj != NULL) {
+ unsigned char buffer[9];
+
+ if ( PPUx > 2147483647 || PPUy > 2147483647 ) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "DPI or aspect out of range", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "PHYS", NULL);
+ return TCL_ERROR;
+ }
+
+ LongToInt32(PPUx, buffer);
+ LongToInt32(PPUy, buffer+4);
+ buffer[8] = unitSpecifier;
+ if (WriteChunk(interp, pngPtr, CHUNK_pHYs, buffer, 9)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+ }
return TCL_OK;
}
@@ -3328,7 +3608,8 @@ static int
EncodePNG(
Tcl_Interp *interp,
Tk_PhotoImageBlock *blockPtr,
- PNGImage *pngPtr)
+ PNGImage *pngPtr,
+ Tcl_Obj *metadataInObj)
{
int greenOffset, blueOffset, alphaOffset;
@@ -3411,7 +3692,7 @@ EncodePNG(
* other programs more than us.
*/
- if (WriteExtraChunks(interp, pngPtr) == TCL_ERROR) {
+ if (WriteExtraChunks(interp, pngPtr, metadataInObj) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -3452,7 +3733,8 @@ static int
FileWritePNG(
Tcl_Interp *interp,
const char *filename,
- Tcl_Obj *fmtObj,
+ TCL_UNUSED(Tcl_Obj *),
+ Tcl_Obj *metadataInObj,
Tk_PhotoImageBlock *blockPtr)
{
Tcl_Channel chan;
@@ -3493,7 +3775,7 @@ FileWritePNG(
* Write the raw PNG data out to the file.
*/
- result = EncodePNG(interp, blockPtr, &png);
+ result = EncodePNG(interp, blockPtr, &png, metadataInObj);
cleanup:
Tcl_Close(interp, chan);
@@ -3522,7 +3804,8 @@ FileWritePNG(
static int
StringWritePNG(
Tcl_Interp *interp,
- Tcl_Obj *fmtObj,
+ TCL_UNUSED(Tcl_Obj *),
+ Tcl_Obj *metadataInObj,
Tk_PhotoImageBlock *blockPtr)
{
Tcl_Obj *resultObj = Tcl_NewObj();
@@ -3543,7 +3826,7 @@ StringWritePNG(
* back to the interpreter if successful.
*/
- result = EncodePNG(interp, blockPtr, &png);
+ result = EncodePNG(interp, blockPtr, &png, metadataInObj);
if (TCL_OK == result) {
Tcl_SetObjResult(interp, png.objDataPtr);
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index fed1ca7..6a4426b 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -3,8 +3,8 @@
*
* A photo image file handler for PPM (Portable PixMap) files.
*
- * Copyright (c) 1994 The Australian National University.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -141,7 +141,8 @@ FileReadPPM(
* image being read. */
{
int fileWidth, fileHeight, maxIntensity;
- int nLines, nBytes, h, type, count, bytesPerChannel = 1;
+ int nLines, h, type, bytesPerChannel = 1;
+ size_t nBytes, count;
unsigned char *pixelPtr;
Tk_PhotoImageBlock block;
@@ -200,7 +201,7 @@ FileReadPPM(
}
if (srcY > 0) {
- Tcl_Seek(chan, (Tcl_WideInt)(srcY * block.pitch), SEEK_CUR);
+ Tcl_Seek(chan, (long long)srcY * block.pitch, SEEK_CUR);
}
nLines = (MAX_MEMORY + block.pitch - 1) / block.pitch;
@@ -285,7 +286,8 @@ FileWritePPM(
Tk_PhotoImageBlock *blockPtr)
{
Tcl_Channel chan;
- int w, h, greenOffset, blueOffset, nBytes;
+ int w, h, greenOffset, blueOffset;
+ size_t nBytes;
unsigned char *pixelPtr, *pixLinePtr;
char header[16 + TCL_INTEGER_SPACE * 2];
@@ -315,16 +317,16 @@ FileWritePPM(
if ((greenOffset == 1) && (blueOffset == 2) && (blockPtr->pixelSize == 3)
&& (blockPtr->pitch == (blockPtr->width * 3))) {
nBytes = blockPtr->height * blockPtr->pitch;
- if (Tcl_Write(chan, (char *) pixLinePtr, nBytes) != nBytes) {
+ if ((size_t)Tcl_Write(chan, (char *) pixLinePtr, nBytes) != nBytes) {
goto writeerror;
}
} else {
for (h = blockPtr->height; h > 0; h--) {
pixelPtr = pixLinePtr;
for (w = blockPtr->width; w > 0; w--) {
- if ( Tcl_Write(chan,(char *)&pixelPtr[0], 1) == -1 ||
- Tcl_Write(chan,(char *)&pixelPtr[greenOffset],1) == -1 ||
- Tcl_Write(chan,(char *)&pixelPtr[blueOffset],1) == -1) {
+ if (Tcl_Write(chan,(char *)&pixelPtr[0], 1) == TCL_IO_FAILURE ||
+ Tcl_Write(chan,(char *)&pixelPtr[greenOffset],1) == TCL_IO_FAILURE ||
+ Tcl_Write(chan,(char *)&pixelPtr[blueOffset],1) == TCL_IO_FAILURE) {
goto writeerror;
}
pixelPtr += blockPtr->pixelSize;
@@ -761,7 +763,8 @@ ReadPPMStringHeader(
{
#define BUFFER_SIZE 1000
char buffer[BUFFER_SIZE], c;
- int i, numFields, dataSize, type = 0;
+ int i, numFields, type = 0;
+ TkSizeT dataSize;
unsigned char *dataBuffer;
dataBuffer = Tcl_GetByteArrayFromObj(dataPtr, &dataSize);
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index 37ee3d9..2f6b288 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -5,10 +5,10 @@
* images are stored in full color (32 bits per pixel including alpha
* channel) and displayed using dithering if necessary.
*
- * Copyright (c) 1994 The Australian National University.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2002-2008 Donal K. Fellows
- * Copyright (c) 2003 ActiveState Corporation.
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2002-2008 Donal K. Fellows
+ * Copyright © 2003 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -24,8 +24,15 @@
/*
* Declaration for internal Xlib function used here:
*/
-
+#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TK)
+#ifdef __cplusplus
+extern "C" {
+#endif
extern int _XInitImageFuncPtrs(XImage *image);
+#ifdef __cplusplus
+}
+#endif
+#endif
/*
* Forward declarations
@@ -37,7 +44,7 @@ static void BlendComplexAlpha(XImage *bgImg, PhotoInstance *iPtr,
#endif
static int IsValidPalette(PhotoInstance *instancePtr,
const char *palette);
-static int CountBits(pixel mask);
+static int CountBits(unsigned mask);
static void GetColorTable(PhotoInstance *instancePtr);
static void FreeColorTable(ColorTable *colorPtr, int force);
static void AllocateColors(ColorTable *colorPtr);
@@ -77,7 +84,7 @@ void
TkImgPhotoConfigureInstance(
PhotoInstance *instancePtr) /* Instance to reconfigure. */
{
- PhotoModel *modelPtr = instancePtr->masterPtr;
+ PhotoModel *modelPtr = instancePtr->modelPtr;
XImage *imagePtr;
int bitsPerPixel;
ColorTable *colorTablePtr;
@@ -113,7 +120,7 @@ TkImgPhotoConfigureInstance(
*/
if (colorTablePtr != NULL) {
- colorTablePtr->liveRefCount -= 1;
+ colorTablePtr->liveRefCount--;
FreeColorTable(colorTablePtr, 0);
}
GetColorTable(instancePtr);
@@ -210,7 +217,7 @@ TkImgPhotoGet(
ClientData modelData) /* Pointer to our model structure for the
* image. */
{
- PhotoModel *modelPtr = modelData;
+ PhotoModel *modelPtr = (PhotoModel *)modelData;
PhotoInstance *instancePtr;
Colormap colormap;
int mono, nRed, nGreen, nBlue, numVisuals;
@@ -276,8 +283,8 @@ TkImgPhotoGet(
* a new instance of the image.
*/
- instancePtr = ckalloc(sizeof(PhotoInstance));
- instancePtr->masterPtr = modelPtr;
+ instancePtr = (PhotoInstance *)ckalloc(sizeof(PhotoInstance));
+ instancePtr->modelPtr = modelPtr;
instancePtr->display = Tk_Display(tkwin);
instancePtr->colormap = Tk_Colormap(tkwin);
Tk_PreserveColormap(instancePtr->display, instancePtr->colormap);
@@ -373,7 +380,7 @@ TkImgPhotoGet(
*/
if (instancePtr->nextPtr == NULL) {
- Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0,
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0,
modelPtr->width, modelPtr->height);
}
@@ -435,7 +442,7 @@ BlendComplexAlpha(
int x, y, line;
unsigned long pixel;
unsigned char r, g, b, alpha, unalpha, *modelPtr;
- unsigned char *alphaAr = iPtr->masterPtr->pix32;
+ unsigned char *alphaAr = iPtr->modelPtr->pix32;
/*
* This blending is an integer version of the Source-Over compositing rule
@@ -492,7 +499,7 @@ BlendComplexAlpha(
green_mlen = 8 - CountBits(green_mask >> green_shift);
blue_mlen = 8 - CountBits(blue_mask >> blue_shift);
for (y = 0; y < height; y++) {
- line = (y + yOffset) * iPtr->masterPtr->width;
+ line = (y + yOffset) * iPtr->modelPtr->width;
for (x = 0; x < width; x++) {
modelPtr = alphaAr + ((line + x + xOffset) * 4);
alpha = modelPtr[3];
@@ -535,7 +542,7 @@ BlendComplexAlpha(
#endif /* !_WIN32 */
for (y = 0; y < height; y++) {
- line = (y + yOffset) * iPtr->masterPtr->width;
+ line = (y + yOffset) * iPtr->modelPtr->width;
for (x = 0; x < width; x++) {
modelPtr = alphaAr + ((line + x + xOffset) * 4);
alpha = modelPtr[3];
@@ -606,7 +613,7 @@ TkImgPhotoDisplay(
int drawableX,int drawableY)/* Coordinates within drawable that correspond
* to imageX and imageY. */
{
- PhotoInstance *instancePtr = clientData;
+ PhotoInstance *instancePtr = (PhotoInstance *)clientData;
#ifndef TK_CAN_RENDER_RGBA
XVisualInfo visInfo = instancePtr->visualInfo;
#endif
@@ -627,7 +634,7 @@ TkImgPhotoDisplay(
* no need to call XGetImage or to do the Porter-Duff compositing by hand.
*/
- unsigned char *rgbaPixels = instancePtr->masterPtr->pix32;
+ unsigned char *rgbaPixels = instancePtr->modelPtr->pix32;
XImage *photo = XCreateImage(display, NULL, 32, ZPixmap, 0, (char*)rgbaPixels,
(unsigned int)instancePtr->width,
(unsigned int)instancePtr->height,
@@ -640,7 +647,7 @@ TkImgPhotoDisplay(
#else
- if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA)
+ if ((instancePtr->modelPtr->flags & COMPLEX_ALPHA)
&& visInfo.depth >= 15
&& (visInfo.c_class == DirectColor || visInfo.c_class == TrueColor)) {
Tk_ErrorHandler handler;
@@ -688,7 +695,7 @@ TkImgPhotoDisplay(
fallBack:
TkSetRegion(display, instancePtr->gc,
- instancePtr->masterPtr->validRegion);
+ instancePtr->modelPtr->validRegion);
XSetClipOrigin(display, instancePtr->gc, drawableX - imageX,
drawableY - imageY);
XCopyArea(display, instancePtr->pixels, drawable, instancePtr->gc,
@@ -726,8 +733,9 @@ TkImgPhotoFree(
Display *display) /* Display containing window that used
* image. */
{
- PhotoInstance *instancePtr = clientData;
+ PhotoInstance *instancePtr = (PhotoInstance *)clientData;
ColorTable *colorPtr;
+ (void)display;
if (instancePtr->refCount-- > 1) {
return;
@@ -742,7 +750,7 @@ TkImgPhotoFree(
colorPtr = instancePtr->colorTablePtr;
if (colorPtr != NULL) {
- colorPtr->liveRefCount -= 1;
+ colorPtr->liveRefCount--;
}
Tcl_DoWhenIdle(TkImgDisposeInstance, instancePtr);
@@ -776,7 +784,7 @@ TkImgPhotoInstanceSetSize(
XRectangle validBox;
Pixmap newPixmap;
- modelPtr = instancePtr->masterPtr;
+ modelPtr = instancePtr->modelPtr;
TkClipBox(modelPtr->validRegion, &validBox);
if ((instancePtr->width != modelPtr->width)
@@ -826,7 +834,7 @@ TkImgPhotoInstanceSetSize(
* such possibility.
*/
- newError = ckalloc(modelPtr->height * modelPtr->width
+ newError = (schar *)ckalloc(modelPtr->height * modelPtr->width
* 3 * sizeof(schar));
/*
@@ -864,8 +872,8 @@ TkImgPhotoInstanceSetSize(
if (modelPtr->width == instancePtr->width) {
offset = validBox.y * modelPtr->width * 3;
memcpy(newError + offset, instancePtr->error + offset,
- (size_t) (validBox.height
- * modelPtr->width * 3 * sizeof(schar)));
+ (size_t) validBox.height
+ * modelPtr->width * 3 * sizeof(schar));
} else if (validBox.width > 0 && validBox.height > 0) {
errDestPtr = newError +
@@ -993,7 +1001,7 @@ IsValidPalette(
static int
CountBits(
- pixel mask) /* Value to count the 1 bits in. */
+ unsigned mask) /* Value to count the 1 bits in. */
{
int n;
@@ -1055,13 +1063,13 @@ GetColorTable(
* Re-use the existing entry.
*/
- colorPtr = Tcl_GetHashValue(entry);
+ colorPtr = (ColorTable *)Tcl_GetHashValue(entry);
} else {
/*
* No color table currently available; need to make one.
*/
- colorPtr = ckalloc(sizeof(ColorTable));
+ colorPtr = (ColorTable *)ckalloc(sizeof(ColorTable));
/*
* The following line of code should not normally be needed due to the
@@ -1125,8 +1133,7 @@ FreeColorTable(
* longer required by an instance. */
int force) /* Force free to happen immediately. */
{
- colorPtr->refCount--;
- if (colorPtr->refCount > 0) {
+ if (colorPtr->refCount-- > 1) {
return;
}
@@ -1223,7 +1230,7 @@ AllocateColors(
} else {
numColors = MAX(MAX(nRed, nGreen), nBlue);
}
- colors = ckalloc(numColors * sizeof(XColor));
+ colors = (XColor *)ckalloc(numColors * sizeof(XColor));
for (i = 0; i < numColors; ++i) {
if (igam == 1.0) {
@@ -1243,7 +1250,7 @@ AllocateColors(
*/
numColors = (mono) ? nRed: (nRed * nGreen * nBlue);
- colors = ckalloc(numColors * sizeof(XColor));
+ colors = (XColor *)ckalloc(numColors * sizeof(XColor));
if (!mono) {
/*
@@ -1287,7 +1294,7 @@ AllocateColors(
* Now try to allocate the colors we've calculated.
*/
- pixels = ckalloc(numColors * sizeof(unsigned long));
+ pixels = (unsigned long *)ckalloc(numColors * sizeof(unsigned long));
for (i = 0; i < numColors; ++i) {
if (!XAllocColor(colorPtr->id.display, colorPtr->id.colormap,
&colors[i])) {
@@ -1447,7 +1454,7 @@ DisposeColorTable(
ClientData clientData) /* Pointer to the ColorTable whose
* colors are to be released. */
{
- ColorTable *colorPtr = clientData;
+ ColorTable *colorPtr = (ColorTable *)clientData;
Tcl_HashEntry *entry;
if (colorPtr->pixelMap != NULL) {
@@ -1459,7 +1466,7 @@ DisposeColorTable(
ckfree(colorPtr->pixelMap);
}
- entry = Tcl_FindHashEntry(&imgPhotoColorHash, (char *) &colorPtr->id);
+ entry = Tcl_FindHashEntry(&imgPhotoColorHash, &colorPtr->id);
if (entry == NULL) {
Tcl_Panic("DisposeColorTable couldn't find hash entry");
}
@@ -1507,7 +1514,7 @@ ReclaimColors(
entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch);
while (entry != NULL) {
- colorPtr = Tcl_GetHashValue(entry);
+ colorPtr = (ColorTable *)Tcl_GetHashValue(entry);
if ((colorPtr->id.display == id->display)
&& (colorPtr->id.colormap == id->colormap)
&& (colorPtr->liveRefCount == 0 )&& (colorPtr->numColors != 0)
@@ -1536,7 +1543,7 @@ ReclaimColors(
entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch);
while ((entry != NULL) && (numColors > 0)) {
- colorPtr = Tcl_GetHashValue(entry);
+ colorPtr = (ColorTable *)Tcl_GetHashValue(entry);
if ((colorPtr->id.display == id->display)
&& (colorPtr->id.colormap == id->colormap)
&& (colorPtr->liveRefCount == 0) && (colorPtr->numColors != 0)
@@ -1581,7 +1588,7 @@ TkImgDisposeInstance(
ClientData clientData) /* Pointer to the instance whose resources are
* to be released. */
{
- PhotoInstance *instancePtr = clientData;
+ PhotoInstance *instancePtr = (PhotoInstance *)clientData;
PhotoInstance *prevPtr;
if (instancePtr->pixels != None) {
@@ -1600,10 +1607,10 @@ TkImgDisposeInstance(
FreeColorTable(instancePtr->colorTablePtr, 1);
}
- if (instancePtr->masterPtr->instancePtr == instancePtr) {
- instancePtr->masterPtr->instancePtr = instancePtr->nextPtr;
+ if (instancePtr->modelPtr->instancePtr == instancePtr) {
+ instancePtr->modelPtr->instancePtr = instancePtr->nextPtr;
} else {
- for (prevPtr = instancePtr->masterPtr->instancePtr;
+ for (prevPtr = instancePtr->modelPtr->instancePtr;
prevPtr->nextPtr != instancePtr; prevPtr = prevPtr->nextPtr) {
/* Empty loop body. */
}
@@ -1637,14 +1644,14 @@ TkImgDitherInstance(
* block to be dithered. */
int width, int height) /* Dimensions of the block to be dithered. */
{
- PhotoModel *modelPtr = instancePtr->masterPtr;
+ PhotoModel *modelPtr = instancePtr->modelPtr;
ColorTable *colorPtr = instancePtr->colorTablePtr;
XImage *imagePtr;
int nLines, bigEndian, i, c, x, y, xEnd, doDithering = 1;
int bitsPerPixel, bytesPerLine, lineLength;
unsigned char *srcLinePtr;
schar *errLinePtr;
- pixel firstBit, word, mask;
+ unsigned firstBit, word, mask;
/*
* Turn dithering off in certain cases where it is not needed (TrueColor,
@@ -1691,7 +1698,7 @@ TkImgDitherInstance(
* recovering from the failure.
*/
- imagePtr->data = ckalloc(imagePtr->bytes_per_line * nLines);
+ imagePtr->data = (char *)ckalloc(imagePtr->bytes_per_line * nLines);
bigEndian = imagePtr->bitmap_bit_order == MSBFirst;
firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1;
@@ -1717,7 +1724,7 @@ TkImgDitherInstance(
unsigned char *srcPtr = srcLinePtr;
schar *errPtr = errLinePtr;
unsigned char *destBytePtr = dstLinePtr;
- pixel *destLongPtr = (pixel *) dstLinePtr;
+ unsigned *destLongPtr = (unsigned *) dstLinePtr;
if (colorPtr->flags & COLOR_WINDOW) {
/*
@@ -1808,7 +1815,7 @@ TkImgDitherInstance(
* sizes.
*/
- case NBBY * sizeof(pixel):
+ case NBBY * sizeof(unsigned):
*destLongPtr++ = i;
break;
#endif
@@ -1870,7 +1877,7 @@ TkImgDitherInstance(
* sizes.
*/
- case NBBY * sizeof(pixel):
+ case NBBY * sizeof(unsigned):
*destLongPtr++ = i;
break;
#endif
@@ -1980,8 +1987,8 @@ TkImgResetDither(
{
if (instancePtr->error) {
memset(instancePtr->error, 0,
- /*(size_t)*/ (instancePtr->masterPtr->width
- * instancePtr->masterPtr->height * 3 * sizeof(schar)));
+ (size_t) instancePtr->modelPtr->width
+ * instancePtr->modelPtr->height * 3 * sizeof(schar));
}
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index b91cacb..cc4f412 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -5,10 +5,10 @@
* full color (32 bits per pixel including alpha channel) and displayed
* using dithering if necessary.
*
- * Copyright (c) 1994 The Australian National University.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2002-2003 Donal K. Fellows
- * Copyright (c) 2003 ActiveState Corporation.
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2002-2003 Donal K. Fellows
+ * Copyright © 2003 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -39,6 +39,7 @@ struct SubcommandOptions {
XColor *background; /* Value specified for -background option. */
int compositingRule; /* Value specified for -compositingrule
* option. */
+ Tcl_Obj *metadata; /* Value specified for -metadata option. */
};
/*
@@ -48,26 +49,32 @@ struct SubcommandOptions {
* set in the options field of the SubcommandOptions structure if that option
* was specified.
*
+ * OPT_ALPHA: Set if -alpha option allowed/specified.
* OPT_BACKGROUND: Set if -format option allowed/specified.
* OPT_COMPOSITE: Set if -compositingrule option allowed/spec'd.
* OPT_FORMAT: Set if -format option allowed/specified.
* OPT_FROM: Set if -from option allowed/specified.
* OPT_GRAYSCALE: Set if -grayscale option allowed/specified.
+ * OPT_METADATA: Set if -metadata option allowed/specified.
* OPT_SHRINK: Set if -shrink option allowed/specified.
* OPT_SUBSAMPLE: Set if -subsample option allowed/spec'd.
* OPT_TO: Set if -to option allowed/specified.
+ * OPT_WITHALPHA: Set if -withalpha option allowed/specified.
* OPT_ZOOM: Set if -zoom option allowed/specified.
*/
-#define OPT_BACKGROUND 1
-#define OPT_COMPOSITE 2
-#define OPT_FORMAT 4
-#define OPT_FROM 8
-#define OPT_GRAYSCALE 0x10
-#define OPT_SHRINK 0x20
-#define OPT_SUBSAMPLE 0x40
-#define OPT_TO 0x80
-#define OPT_ZOOM 0x100
+#define OPT_ALPHA 1
+#define OPT_BACKGROUND 2
+#define OPT_COMPOSITE 4
+#define OPT_FORMAT 8
+#define OPT_FROM 0x10
+#define OPT_GRAYSCALE 0x20
+#define OPT_METADATA 0x40
+#define OPT_SHRINK 0x80
+#define OPT_SUBSAMPLE 0x100
+#define OPT_TO 0x200
+#define OPT_WITHALPHA 0x400
+#define OPT_ZOOM 0x800
/*
* List of option names. The order here must match the order of declarations
@@ -75,14 +82,17 @@ struct SubcommandOptions {
*/
static const char *const optionNames[] = {
+ "-alpha",
"-background",
"-compositingrule",
"-format",
"-from",
"-grayscale",
+ "-metadata",
"-shrink",
"-subsample",
"-to",
+ "-withalpha",
"-zoom",
NULL
};
@@ -129,9 +139,14 @@ typedef struct {
Tk_PhotoImageFormat *formatList;
/* Pointer to the first in the list of known
* photo image formats.*/
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
Tk_PhotoImageFormat *oldFormatList;
/* Pointer to the first in the list of known
* photo image formats.*/
+#endif
+ Tk_PhotoImageFormatVersion3 *formatListVersion3;
+ /* Pointer to the first in the list of known
+ * photo image formats in Version3 format.*/
int initialized; /* Set to 1 if we've initialized the
* structure. */
} ThreadSpecificData;
@@ -152,15 +167,15 @@ static Tcl_ThreadDataKey dataKey;
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_STRING, "-file", NULL, NULL,
- NULL, Tk_Offset(PhotoModel, fileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PhotoModel, fileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_DOUBLE, "-gamma", NULL, NULL,
- DEF_PHOTO_GAMMA, Tk_Offset(PhotoModel, gamma), 0, NULL},
+ DEF_PHOTO_GAMMA, offsetof(PhotoModel, gamma), 0, NULL},
{TK_CONFIG_INT, "-height", NULL, NULL,
- DEF_PHOTO_HEIGHT, Tk_Offset(PhotoModel, userHeight), 0, NULL},
+ DEF_PHOTO_HEIGHT, offsetof(PhotoModel, userHeight), 0, NULL},
{TK_CONFIG_UID, "-palette", NULL, NULL,
- DEF_PHOTO_PALETTE, Tk_Offset(PhotoModel, palette), 0, NULL},
+ DEF_PHOTO_PALETTE, offsetof(PhotoModel, palette), 0, NULL},
{TK_CONFIG_INT, "-width", NULL, NULL,
- DEF_PHOTO_WIDTH, Tk_Offset(PhotoModel, userWidth), 0, NULL},
+ DEF_PHOTO_WIDTH, offsetof(PhotoModel, userWidth), 0, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -182,19 +197,22 @@ static int ImgPhotoConfigureModel(Tcl_Interp *interp,
static int ToggleComplexAlphaIfNeeded(PhotoModel *mPtr);
static int ImgPhotoSetSize(PhotoModel *modelPtr, int width,
int height);
-static int ImgStringWrite(Tcl_Interp *interp,
- Tcl_Obj *formatString,
- Tk_PhotoImageBlock *blockPtr);
static char * ImgGetPhoto(PhotoModel *modelPtr,
Tk_PhotoImageBlock *blockPtr,
struct SubcommandOptions *optPtr);
static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan,
const char *fileName, Tcl_Obj *formatString,
+ Tcl_Obj *metadataInObj,
+ Tcl_Obj *metadataOutObj,
Tk_PhotoImageFormat **imageFormatPtr,
+ Tk_PhotoImageFormatVersion3 **imageFormatVersion3Ptr,
int *widthPtr, int *heightPtr, int *oldformat);
static int MatchStringFormat(Tcl_Interp *interp, Tcl_Obj *data,
Tcl_Obj *formatString,
+ Tcl_Obj *metadataInObj,
+ Tcl_Obj *metadataOutObj,
Tk_PhotoImageFormat **imageFormatPtr,
+ Tk_PhotoImageFormatVersion3 **imageFormatVersion3Ptr,
int *widthPtr, int *heightPtr, int *oldformat);
static const char * GetExtension(const char *path);
@@ -219,26 +237,36 @@ PhotoFormatThreadExitProc(
TCL_UNUSED(void *)) /* not used */
{
Tk_PhotoImageFormat *freePtr;
+ Tk_PhotoImageFormatVersion3 *freePtrVersion3;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
while (tsdPtr->oldFormatList != NULL) {
freePtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr;
ckfree(freePtr);
}
+#endif
while (tsdPtr->formatList != NULL) {
freePtr = tsdPtr->formatList;
tsdPtr->formatList = tsdPtr->formatList->nextPtr;
ckfree((char *)freePtr->name);
ckfree(freePtr);
}
+ while (tsdPtr->formatListVersion3 != NULL) {
+ freePtrVersion3 = tsdPtr->formatListVersion3;
+ tsdPtr->formatListVersion3 = tsdPtr->formatListVersion3->nextPtr;
+ ckfree((char *)freePtrVersion3->name);
+ ckfree(freePtrVersion3);
+ }
}
/*
*----------------------------------------------------------------------
*
- * Tk_CreateOldPhotoImageFormat, Tk_CreatePhotoImageFormat --
+ * Tk_CreateOldPhotoImageFormat, Tk_CreatePhotoImageFormat,
+ * Tk_CreatePhotoImageFormatVersion3 --
*
* This function is invoked by an image file handler to register a new
* photo image format and the functions that handle the new format. The
@@ -254,6 +282,7 @@ PhotoFormatThreadExitProc(
*----------------------------------------------------------------------
*/
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
void
Tk_CreateOldPhotoImageFormat(
const Tk_PhotoImageFormat *formatPtr)
@@ -274,6 +303,7 @@ Tk_CreateOldPhotoImageFormat(
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
}
+#endif
void
Tk_CreatePhotoImageFormat(
@@ -292,10 +322,13 @@ Tk_CreatePhotoImageFormat(
}
copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
if (isupper((unsigned char) *formatPtr->name)) {
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
- } else {
+ } else
+#endif
+ {
/* for compatibility with aMSN: make a copy of formatPtr->name */
char *name = (char *)ckalloc(strlen(formatPtr->name) + 1);
strcpy(name, formatPtr->name);
@@ -304,6 +337,32 @@ Tk_CreatePhotoImageFormat(
tsdPtr->formatList = copyPtr;
}
}
+void
+Tk_CreatePhotoImageFormatVersion3(
+ const Tk_PhotoImageFormatVersion3 *formatPtr)
+ /* Structure describing the format. All of the
+ * fields except "nextPtr" must be filled in
+ * by caller. */
+{
+ Tk_PhotoImageFormatVersion3 *copyPtr;
+ char *name;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ if (!tsdPtr->initialized) {
+ tsdPtr->initialized = 1;
+ Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL);
+ }
+ copyPtr = (Tk_PhotoImageFormatVersion3 *)
+ ckalloc(sizeof(Tk_PhotoImageFormatVersion3));
+ *copyPtr = *formatPtr;
+ /* for compatibility with aMSN: make a copy of formatPtr->name */
+ name = (char *)ckalloc(strlen(formatPtr->name) + 1);
+ strcpy(name, formatPtr->name);
+ copyPtr->name = name;
+ copyPtr->nextPtr = tsdPtr->formatListVersion3;
+ tsdPtr->formatListVersion3 = copyPtr;
+}
/*
*----------------------------------------------------------------------
@@ -331,7 +390,7 @@ ImgPhotoCreate(
Tcl_Obj *const objv[], /* Argument objects for options (doesn't
* include image name or type). */
TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */
- Tk_ImageModel model, /* Token for image, to be used by us in later
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
@@ -344,7 +403,7 @@ ImgPhotoCreate(
modelPtr = (PhotoModel *)ckalloc(sizeof(PhotoModel));
memset(modelPtr, 0, sizeof(PhotoModel));
- modelPtr->tkMaster = model;
+ modelPtr->tkModel = model;
modelPtr->interp = interp;
modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
modelPtr, ImgPhotoCmdDeletedProc);
@@ -401,15 +460,14 @@ ImgPhotoCmd(
PHOTO_WRITE
};
- PhotoModel *modelPtr = clientData;
- int result, index, x, y, width, height, dataWidth, dataHeight, listObjc;
+ PhotoModel *modelPtr = (PhotoModel *)clientData;
+ int result, index, x, y, width, height;
struct SubcommandOptions options;
- Tcl_Obj **listObjv, **srcObjv;
unsigned char *pixelPtr;
Tk_PhotoImageBlock block;
- Tk_Window tkwin;
Tk_PhotoImageFormat *imageFormat;
- size_t length;
+ Tk_PhotoImageFormatVersion3 *imageFormatVersion3;
+ TkSizeT length;
int imageWidth, imageHeight, matched, oldformat = 0;
Tcl_Channel chan;
Tk_PhotoHandle srcHandle;
@@ -447,8 +505,7 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "option");
return TCL_ERROR;
}
- arg = Tcl_GetString(objv[2]);
- length = objv[2]->length;
+ arg = Tcl_GetStringFromObj(objv[2], &length);
if (strncmp(arg,"-data", length) == 0) {
if (modelPtr->dataString) {
Tcl_SetObjResult(interp, modelPtr->dataString);
@@ -457,6 +514,10 @@ ImgPhotoCmd(
if (modelPtr->format) {
Tcl_SetObjResult(interp, modelPtr->format);
}
+ } else if (strncmp(arg, "-metadata", length) == 0) {
+ if (modelPtr->metadata) {
+ Tcl_SetObjResult(interp, modelPtr->metadata);
+ }
} else {
Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
(char *) modelPtr, Tcl_GetString(objv[2]), 0);
@@ -492,14 +553,20 @@ ImgPhotoCmd(
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
Tcl_ListObjAppendElement(interp, obj, subobj);
+ subobj = Tcl_NewStringObj("-metadata {} {} {}", 16);
+ if (modelPtr->metadata) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->metadata);
+ } else {
+ Tcl_AppendStringsToObj(subobj, " {}", NULL);
+ }
+ Tcl_ListObjAppendElement(interp, obj, subobj);
Tcl_ListObjAppendList(interp, obj, Tcl_GetObjResult(interp));
Tcl_SetObjResult(interp, obj);
return TCL_OK;
} else if (objc == 3) {
- const char *arg = Tcl_GetString(objv[2]);
+ const char *arg = Tcl_GetStringFromObj(objv[2], &length);
- length = objv[2]->length;
if (length > 1 && !strncmp(arg, "-data", length)) {
Tcl_AppendResult(interp, "-data {} {} {}", NULL);
if (modelPtr->dataString) {
@@ -527,6 +594,20 @@ ImgPhotoCmd(
Tcl_AppendResult(interp, " {}", NULL);
}
return TCL_OK;
+ } else if (length > 1 &&
+ !strncmp(arg, "-metadata", length)) {
+ Tcl_AppendResult(interp, "-metadata {} {} {}", NULL);
+ if (modelPtr->metadata) {
+ /*
+ * TODO: Modifying result is bad!
+ */
+
+ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
+ modelPtr->metadata);
+ } else {
+ Tcl_AppendResult(interp, " {}", NULL);
+ }
+ return TCL_OK;
} else {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
configSpecs, (char *) modelPtr, arg, 0);
@@ -660,7 +741,7 @@ ImgPhotoCmd(
return TCL_ERROR;
}
}
- Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0,
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0,
modelPtr->width, modelPtr->height);
if (options.background) {
Tk_FreeColor(options.background);
@@ -668,26 +749,31 @@ ImgPhotoCmd(
return result;
case PHOTO_DATA: {
- char *data;
+ char *data = NULL;
+ Tcl_Obj *freeObj = NULL;
+ Tcl_Obj *metadataIn;
/*
* photo data command - first parse and check any options given.
*/
Tk_ImageStringWriteProc *stringWriteProc = NULL;
+ Tk_ImageStringWriteProcVersion3 *stringWriteProcVersion3 = NULL;
- index = 2;
+ index = 1;
memset(&options, 0, sizeof(options));
options.name = NULL;
options.format = NULL;
+ options.metadata = NULL;
options.fromX = 0;
options.fromY = 0;
if (ParseSubcommandOptions(&options, interp,
- OPT_FORMAT | OPT_FROM | OPT_GRAYSCALE | OPT_BACKGROUND,
+ OPT_FORMAT | OPT_FROM | OPT_GRAYSCALE | OPT_BACKGROUND
+ | OPT_METADATA,
&index, objc, objv) != TCL_OK) {
return TCL_ERROR;
}
- if ((options.name != NULL) || (index < objc)) {
+ if ((options.name == NULL) || (index < objc)) {
Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?");
return TCL_ERROR;
}
@@ -709,50 +795,79 @@ ImgPhotoCmd(
options.fromX2 = modelPtr->width;
options.fromY2 = modelPtr->height;
}
+ if (!(options.options & OPT_FORMAT)) {
+ options.format = Tcl_NewStringObj("default", -1);
+ freeObj = options.format;
+ }
+
+ /*
+ * Use argument metadata if specified, otherwise the master metadata
+ */
+
+ if (NULL != options.metadata) {
+ metadataIn = options.metadata;
+ } else {
+ metadataIn = modelPtr->metadata;
+ }
/*
* Search for an appropriate image string format handler.
*/
- if (options.options & OPT_FORMAT) {
- matched = 0;
- for (imageFormat = tsdPtr->formatList; imageFormat != NULL;
- imageFormat = imageFormat->nextPtr) {
+ matched = 0;
+ for (imageFormat = tsdPtr->formatList; imageFormat != NULL;
+ imageFormat = imageFormat->nextPtr) {
+ if ((strncasecmp(Tcl_GetString(options.format),
+ imageFormat->name, strlen(imageFormat->name)) == 0)) {
+ matched = 1;
+ if (imageFormat->stringWriteProc != NULL) {
+ stringWriteProc = imageFormat->stringWriteProc;
+ break;
+ }
+ }
+ }
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
+ if (stringWriteProc == NULL) {
+ oldformat = 1;
+ for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
+ imageFormat = imageFormat->nextPtr) {
+ if ((strncasecmp(Tcl_GetString(options.format),
+ imageFormat->name,
+ strlen(imageFormat->name)) == 0)) {
+ matched = 1;
+ if (imageFormat->stringWriteProc != NULL) {
+ stringWriteProc = imageFormat->stringWriteProc;
+ break;
+ }
+ }
+ }
+ }
+#endif
+ if (stringWriteProc == NULL) {
+ oldformat = 0;
+ for (imageFormatVersion3 = tsdPtr->formatListVersion3;
+ imageFormatVersion3 != NULL;
+ imageFormatVersion3 = imageFormatVersion3->nextPtr) {
if ((strncasecmp(Tcl_GetString(options.format),
- imageFormat->name, strlen(imageFormat->name)) == 0)) {
+ imageFormatVersion3->name,
+ strlen(imageFormatVersion3->name)) == 0)) {
matched = 1;
- if (imageFormat->stringWriteProc != NULL) {
- stringWriteProc = imageFormat->stringWriteProc;
+ if (imageFormatVersion3->stringWriteProc != NULL) {
+ stringWriteProcVersion3 =
+ imageFormatVersion3->stringWriteProc;
break;
}
}
}
- if (stringWriteProc == NULL) {
- oldformat = 1;
- for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
- imageFormat = imageFormat->nextPtr) {
- if ((strncasecmp(Tcl_GetString(options.format),
- imageFormat->name,
- strlen(imageFormat->name)) == 0)) {
- matched = 1;
- if (imageFormat->stringWriteProc != NULL) {
- stringWriteProc = imageFormat->stringWriteProc;
- break;
- }
- }
- }
- }
- if (stringWriteProc == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "image string format \"%s\" is %s",
- Tcl_GetString(options.format),
- (matched ? "not supported" : "unknown")));
- Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT",
- Tcl_GetString(options.format), NULL);
- return TCL_ERROR;
- }
- } else {
- stringWriteProc = ImgStringWrite;
+ }
+ if (stringWriteProc == NULL && stringWriteProcVersion3 == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "image string format \"%s\" is %s",
+ Tcl_GetString(options.format),
+ (matched ? "not supported" : "unknown")));
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT",
+ Tcl_GetString(options.format), NULL);
+ goto dataErrorExit;
}
/*
@@ -761,7 +876,10 @@ ImgPhotoCmd(
data = ImgGetPhoto(modelPtr, &block, &options);
- if (oldformat) {
+ if (stringWriteProc == NULL) {
+ result = (stringWriteProcVersion3)(interp,
+ options.format, metadataIn, &block);
+ } else if (oldformat) {
Tcl_DString buffer;
typedef int (*OldStringWriteProc)(Tcl_Interp *interp,
Tcl_DString *dataPtr, const char *formatString,
@@ -789,7 +907,22 @@ ImgPhotoCmd(
if (data) {
ckfree(data);
}
+ if (freeObj != NULL) {
+ Tcl_DecrRefCount(freeObj);
+ }
return result;
+
+ dataErrorExit:
+ if (options.background) {
+ Tk_FreeColor(options.background);
+ }
+ if (data) {
+ ckfree(data);
+ }
+ if (freeObj != NULL) {
+ Tcl_DecrRefCount(freeObj);
+ }
+ return TCL_ERROR;
}
case PHOTO_GET: {
@@ -797,12 +930,24 @@ ImgPhotoCmd(
* photo get command - first parse and check parameters.
*/
- Tcl_Obj *channels[3];
-
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "x y");
+ Tcl_Obj *channels[4];
+ int channelCount = 3;
+
+ index = 3;
+ memset(&options, 0, sizeof(options));
+ options.name = NULL;
+ if (ParseSubcommandOptions(&options, interp, OPT_WITHALPHA,
+ &index, objc, objv) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (options.name == NULL || index < objc) {
+ Tcl_WrongNumArgs(interp, 2, objv, "x y ?-withalpha?");
return TCL_ERROR;
}
+ if (options.options & OPT_WITHALPHA) {
+ channelCount = 4;
+ }
+
if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
return TCL_ERROR;
@@ -822,22 +967,28 @@ ImgPhotoCmd(
*/
pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
- channels[0] = Tcl_NewIntObj(pixelPtr[0]);
- channels[1] = Tcl_NewIntObj(pixelPtr[1]);
- channels[2] = Tcl_NewIntObj(pixelPtr[2]);
- Tcl_SetObjResult(interp, Tcl_NewListObj(3, channels));
+ channels[0] = Tcl_NewWideIntObj(pixelPtr[0]);
+ channels[1] = Tcl_NewWideIntObj(pixelPtr[1]);
+ channels[2] = Tcl_NewWideIntObj(pixelPtr[2]);
+ channels[3] = Tcl_NewWideIntObj(pixelPtr[3]);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(channelCount, channels));
return TCL_OK;
}
- case PHOTO_PUT:
+ case PHOTO_PUT: {
+ Tcl_Obj *format, *data;
+
/*
- * photo put command - first parse the options and colors specified.
+ * photo put command - first parse the options.
*/
index = 2;
memset(&options, 0, sizeof(options));
options.name = NULL;
- if (ParseSubcommandOptions(&options, interp, OPT_TO|OPT_FORMAT,
+ options.format = NULL;
+ options.metadata = NULL;
+ if (ParseSubcommandOptions(&options, interp,
+ OPT_TO|OPT_FORMAT|OPT_METADATA,
&index, objc, objv) != TCL_OK) {
return TCL_ERROR;
}
@@ -846,174 +997,65 @@ ImgPhotoCmd(
return TCL_ERROR;
}
- if (MatchStringFormat(interp, options.name ? objv[2]:NULL,
- options.format, &imageFormat, &imageWidth,
- &imageHeight, &oldformat) == TCL_OK) {
- Tcl_Obj *format, *data;
+ /*
+ * See if there's a format that can read the data
+ */
- if (!(options.options & OPT_TO) || (options.toX2 < 0)) {
- options.toX2 = options.toX + imageWidth;
- options.toY2 = options.toY + imageHeight;
- }
- if (imageWidth > options.toX2 - options.toX) {
- imageWidth = options.toX2 - options.toX;
- }
- if (imageHeight > options.toY2 - options.toY) {
- imageHeight = options.toY2 - options.toY;
- }
- format = options.format;
- data = objv[2];
- if (oldformat) {
- if (format) {
- format = (Tcl_Obj *) Tcl_GetString(format);
- }
- data = (Tcl_Obj *) Tcl_GetString(data);
- }
- if (imageFormat->stringReadProc(interp, data, format,
- (Tk_PhotoHandle) modelPtr, options.toX, options.toY,
- imageWidth, imageHeight, 0, 0) != TCL_OK) {
- return TCL_ERROR;
- }
- modelPtr->flags |= IMAGE_CHANGED;
- return TCL_OK;
- }
- if (options.options & OPT_FORMAT) {
- return TCL_ERROR;
- }
- Tcl_ResetResult(interp);
- if (Tcl_ListObjGetElements(interp, options.name,
- &dataHeight, &srcObjv) != TCL_OK) {
+ if (MatchStringFormat(interp, objv[2], options.format,
+ options.metadata, NULL, &imageFormat,
+ &imageFormatVersion3, &imageWidth, &imageHeight, &oldformat)
+ != TCL_OK) {
return TCL_ERROR;
}
- tkwin = Tk_MainWindow(interp);
- block.pixelPtr = NULL;
- dataWidth = 0;
- pixelPtr = NULL;
- for (y = 0; y < dataHeight; ++y) {
- if (Tcl_ListObjGetElements(interp, srcObjv[y],
- &listObjc, &listObjv) != TCL_OK) {
- break;
- }
-
- if (y == 0) {
- if (listObjc == 0) {
- /*
- * Lines must be non-empty...
- */
-
- break;
- }
- dataWidth = listObjc;
- /*
- * Memory allocation overflow protection.
- * May not be able to trigger/ demo / test this.
- */
-
- if (dataWidth > (int)((UINT_MAX/3) / dataHeight)) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "photo image dimensions exceed Tcl memory limits", -1));
- Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
- "OVERFLOW", NULL);
- break;
- }
-
- pixelPtr = ckalloc(dataWidth * dataHeight * 3);
- block.pixelPtr = pixelPtr;
- } else if (listObjc != dataWidth) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "all elements of color list must have the same"
- " number of elements", -1));
- Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
- "NON_RECTANGULAR", NULL);
- break;
- }
-
- for (x = 0; x < dataWidth; ++x) {
- const char *colorString = Tcl_GetString(listObjv[x]);
- XColor color;
- int tmpr, tmpg, tmpb;
-
- /*
- * We do not use Tk_GetColorFromObj() because we absolutely do
- * not want to invoke the fallback code.
- */
-
- if (colorString[0] == '#') {
- if (isxdigit(UCHAR(colorString[1])) &&
- isxdigit(UCHAR(colorString[2])) &&
- isxdigit(UCHAR(colorString[3]))) {
- if (colorString[4] == '\0') {
- /* Got #rgb */
- sscanf(colorString+1, "%1x%1x%1x",
- &tmpr, &tmpg, &tmpb);
- *pixelPtr++ = tmpr * 0x11;
- *pixelPtr++ = tmpg * 0x11;
- *pixelPtr++ = tmpb * 0x11;
- continue;
- } else if (isxdigit(UCHAR(colorString[4])) &&
- isxdigit(UCHAR(colorString[5])) &&
- isxdigit(UCHAR(colorString[6])) &&
- colorString[7] == '\0') {
- /* Got #rrggbb */
- sscanf(colorString+1, "%2x%2x%2x",
- &tmpr, &tmpg, &tmpb);
- *pixelPtr++ = tmpr;
- *pixelPtr++ = tmpg;
- *pixelPtr++ = tmpb;
- continue;
- }
- }
- }
- if (!TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin),
- colorString, &color)) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't parse color \"%s\"", colorString));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "COLOR", NULL);
- break;
- }
- *pixelPtr++ = color.red >> 8;
- *pixelPtr++ = color.green >> 8;
- *pixelPtr++ = color.blue >> 8;
- }
- if (x < dataWidth) {
- break;
+ if (!(options.options & OPT_TO) || (options.toX2 < 0)) {
+ options.toX2 = options.toX + imageWidth;
+ options.toY2 = options.toY + imageHeight;
+ }
+ if (imageWidth > options.toX2 - options.toX) {
+ imageWidth = options.toX2 - options.toX;
+ }
+ if (imageHeight > options.toY2 - options.toY) {
+ imageHeight = options.toY2 - options.toY;
+ }
+ format = options.format;
+ data = objv[2];
+ if (oldformat) {
+ if (format) {
+ format = (Tcl_Obj *) Tcl_GetString(format);
}
+ data = (Tcl_Obj *) Tcl_GetString(data);
}
- if (y < dataHeight || dataHeight == 0 || dataWidth == 0) {
- if (block.pixelPtr != NULL) {
- ckfree(block.pixelPtr);
+
+ if (imageFormat != NULL) {
+ if (imageFormat->stringReadProc(interp, data, format,
+ (Tk_PhotoHandle) modelPtr, options.toX, options.toY,
+ options.toX2 - options.toX,
+ options.toY2 - options.toY, 0, 0) != TCL_OK) {
+ return TCL_ERROR;
}
- if (y < dataHeight) {
+ } else {
+ if (imageFormatVersion3->stringReadProc(interp, data, format,
+ options.metadata,
+ (Tk_PhotoHandle) modelPtr, options.toX, options.toY,
+ options.toX2 - options.toX,
+ options.toY2 - options.toY, 0, 0,
+ NULL)
+ != TCL_OK) {
return TCL_ERROR;
}
- return TCL_OK;
}
/*
- * Fill in default values for the -to option, then copy the block in
- * using Tk_PhotoPutBlock.
+ * SB: is the next line really needed? The stringReadProc
+ * writes image data with Tk_PhotoPutBlock(), which in turn
+ * takes care to notify the changed image and to set/unset the
+ * IMAGE_CHANGED bit.
*/
+ modelPtr->flags |= IMAGE_CHANGED;
- if (!(options.options & OPT_TO) || (options.toX2 < 0)) {
- options.toX2 = options.toX + dataWidth;
- options.toY2 = options.toY + dataHeight;
- }
- block.width = dataWidth;
- block.height = dataHeight;
- block.pitch = dataWidth * 3;
- block.pixelSize = 3;
- block.offset[0] = 0;
- block.offset[1] = 1;
- block.offset[2] = 2;
- block.offset[3] = 0;
- result = Tk_PhotoPutBlock(interp, modelPtr, &block,
- options.toX, options.toY, options.toX2 - options.toX,
- options.toY2 - options.toY,
- TK_PHOTO_COMPOSITE_SET);
- ckfree(block.pixelPtr);
- return result;
-
+ return TCL_OK;
+ }
case PHOTO_READ: {
Tcl_Obj *format;
@@ -1025,8 +1067,9 @@ ImgPhotoCmd(
memset(&options, 0, sizeof(options));
options.name = NULL;
options.format = NULL;
+ options.metadata = NULL;
if (ParseSubcommandOptions(&options, interp,
- OPT_FORMAT | OPT_FROM | OPT_TO | OPT_SHRINK,
+ OPT_FORMAT | OPT_FROM | OPT_TO | OPT_SHRINK | OPT_METADATA,
&index, objc, objv) != TCL_OK) {
return TCL_ERROR;
}
@@ -1067,10 +1110,12 @@ ImgPhotoCmd(
}
if (MatchFileFormat(interp, chan,
- Tcl_GetString(options.name), options.format, &imageFormat,
- &imageWidth, &imageHeight, &oldformat) != TCL_OK) {
- Tcl_Close(NULL, chan);
- return TCL_ERROR;
+ Tcl_GetString(options.name), options.format,
+ options.metadata, NULL, &imageFormat,
+ &imageFormatVersion3, &imageWidth, &imageHeight, &oldformat)
+ != TCL_OK) {
+ result = TCL_ERROR;
+ goto readCleanup;
}
/*
@@ -1084,8 +1129,8 @@ ImgPhotoCmd(
"coordinates for -from option extend outside source image",
-1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);
- Tcl_Close(NULL, chan);
- return TCL_ERROR;
+ result = TCL_ERROR;
+ goto readCleanup;
}
if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) {
width = imageWidth - options.fromX;
@@ -1106,8 +1151,8 @@ ImgPhotoCmd(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
- Tcl_Close(NULL, chan);
- return TCL_ERROR;
+ result = TCL_ERROR;
+ goto readCleanup;
}
}
@@ -1120,10 +1165,19 @@ ImgPhotoCmd(
if (oldformat && format) {
format = (Tcl_Obj *) Tcl_GetString(format);
}
- result = imageFormat->fileReadProc(interp, chan,
- Tcl_GetString(options.name),
- format, (Tk_PhotoHandle) modelPtr, options.toX,
- options.toY, width, height, options.fromX, options.fromY);
+ if (imageFormat != NULL) {
+ result = imageFormat->fileReadProc(interp, chan,
+ Tcl_GetString(options.name),
+ format, (Tk_PhotoHandle) modelPtr, options.toX,
+ options.toY, width, height, options.fromX, options.fromY);
+ } else {
+ result = imageFormatVersion3->fileReadProc(interp, chan,
+ Tcl_GetString(options.name),
+ format, options.metadata, (Tk_PhotoHandle) modelPtr,
+ options.toX, options.toY, width, height, options.fromX,
+ options.fromY, NULL);
+ }
+readCleanup:
if (chan != NULL) {
Tcl_Close(NULL, chan);
}
@@ -1159,7 +1213,7 @@ ImgPhotoCmd(
* Tell the core image code that part of the image has changed.
*/
- Tk_ImageChanged(modelPtr->tkMaster, x, y,
+ Tk_ImageChanged(modelPtr->tkModel, x, y,
(modelPtr->width - x), (modelPtr->height - y),
modelPtr->width, modelPtr->height);
}
@@ -1184,17 +1238,40 @@ ImgPhotoCmd(
switch ((enum transOptions) index) {
case PHOTO_TRANS_GET: {
- XRectangle testBox;
- TkRegion testRegion;
+ int boolMode;
- if (objc != 5) {
- Tcl_WrongNumArgs(interp, 3, objv, "x y");
+ /*
+ * parse fixed args and option
+ */
+
+ if (objc > 6 || objc < 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "x y ?-option?");
return TCL_ERROR;
}
if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)) {
return TCL_ERROR;
}
+
+ index = 4;
+ memset(&options, 0, sizeof(options));
+ if (ParseSubcommandOptions(&options, interp,
+ OPT_ALPHA, &index, objc, objv) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (index < objc) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "unknown option \"%s\": must be -alpha",
+ Tcl_GetString(objv[index])));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION",
+ NULL);
+ return TCL_ERROR;
+ }
+ boolMode = 1;
+ if (options.options & OPT_ALPHA) {
+ boolMode = 0;
+ }
+
if ((x < 0) || (x >= modelPtr->width)
|| (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1205,36 +1282,55 @@ ImgPhotoCmd(
return TCL_ERROR;
}
- testBox.x = x;
- testBox.y = y;
- testBox.width = 1;
- testBox.height = 1;
- /* What a way to do a test! */
- testRegion = TkCreateRegion();
- TkUnionRectWithRegion(&testBox, testRegion, testRegion);
- TkIntersectRegion(testRegion, modelPtr->validRegion, testRegion);
- TkClipBox(testRegion, &testBox);
- TkDestroyRegion(testRegion);
-
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- testBox.width==0 && testBox.height==0));
+ /*
+ * Extract and return the desired value
+ */
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
+ if (boolMode) {
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj( ! pixelPtr[3]));
+ } else {
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pixelPtr[3]));
+ }
return TCL_OK;
}
case PHOTO_TRANS_SET: {
- int transFlag;
+ int newVal, boolMode;
XRectangle setBox;
+ TkRegion modRegion;
+
+ /*
+ * Parse args and option, check for valid values
+ */
- if (objc != 6) {
- Tcl_WrongNumArgs(interp, 3, objv, "x y boolean");
+ if (objc < 6 || objc > 7) {
+ Tcl_WrongNumArgs(interp, 3, objv, "x y newVal ?-option?");
return TCL_ERROR;
}
if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)
- || (Tcl_GetBooleanFromObj(interp, objv[5],
- &transFlag) != TCL_OK)) {
+ || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+
+ index = 5;
+ memset(&options, 0, sizeof(options));
+ if (ParseSubcommandOptions(&options, interp,
+ OPT_ALPHA, &index, objc, objv) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (index < objc) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "unknown option \"%s\": must be -alpha",
+ Tcl_GetString(objv[index])));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION",
+ NULL);
return TCL_ERROR;
}
+ boolMode = 1;
+ if (options.options & OPT_ALPHA) {
+ boolMode = 0;
+ }
+
if ((x < 0) || (x >= modelPtr->width)
|| (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1245,45 +1341,60 @@ ImgPhotoCmd(
return TCL_ERROR;
}
+ if (boolMode) {
+ if (Tcl_GetBooleanFromObj(interp, objv[5], &newVal) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ } else {
+ if (Tcl_GetIntFromObj(interp, objv[5], &newVal) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (newVal < 0 || newVal > 255) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "invalid alpha value \"%d\": "
+ "must be integer between 0 and 255", newVal));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "BAD_VALUE", NULL);
+ return TCL_ERROR;
+ }
+ }
+
+ /*
+ * Set new alpha value for the pixel
+ */
+
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
+ if (boolMode) {
+ pixelPtr[3] = newVal ? 0 : 255;
+ } else {
+ pixelPtr[3] = newVal;
+ }
+
+ /*
+ * Update the validRegion of the image
+ */
+
setBox.x = x;
setBox.y = y;
setBox.width = 1;
setBox.height = 1;
- pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
-
- if (transFlag) {
- /*
- * Make pixel transparent.
- */
-
- TkRegion clearRegion = TkCreateRegion();
-
- TkUnionRectWithRegion(&setBox, clearRegion, clearRegion);
- TkSubtractRegion(modelPtr->validRegion, clearRegion,
+ modRegion = TkCreateRegion();
+ TkUnionRectWithRegion(&setBox, modRegion, modRegion);
+ if (pixelPtr[3]) {
+ TkUnionRectWithRegion(&setBox, modelPtr->validRegion,
modelPtr->validRegion);
- TkDestroyRegion(clearRegion);
-
- /*
- * Set the alpha value correctly.
- */
-
- pixelPtr[3] = 0;
} else {
- /*
- * Make pixel opaque.
- */
-
- TkUnionRectWithRegion(&setBox, modelPtr->validRegion,
+ TkSubtractRegion(modelPtr->validRegion, modRegion,
modelPtr->validRegion);
- pixelPtr[3] = 255;
}
+ TkDestroyRegion(modRegion);
/*
* Inform the generic image code that the image
* has (potentially) changed.
*/
- Tk_ImageChanged(modelPtr->tkMaster, x, y, 1, 1,
+ Tk_ImageChanged(modelPtr->tkModel, x, y, 1, 1,
modelPtr->width, modelPtr->height);
modelPtr->flags &= ~IMAGE_CHANGED;
return TCL_OK;
@@ -1296,7 +1407,7 @@ ImgPhotoCmd(
case PHOTO_WRITE: {
char *data;
const char *fmtString;
- Tcl_Obj *format;
+ Tcl_Obj *format, *metadataIn;
int usedExt;
/*
@@ -1318,8 +1429,10 @@ ImgPhotoCmd(
memset(&options, 0, sizeof(options));
options.name = NULL;
options.format = NULL;
+ options.metadata = NULL;
if (ParseSubcommandOptions(&options, interp,
- OPT_FORMAT | OPT_FROM | OPT_GRAYSCALE | OPT_BACKGROUND,
+ OPT_FORMAT | OPT_FROM | OPT_GRAYSCALE | OPT_BACKGROUND
+ | OPT_METADATA,
&index, objc, objv) != TCL_OK) {
return TCL_ERROR;
}
@@ -1355,6 +1468,17 @@ ImgPhotoCmd(
usedExt = 0;
}
+
+ /*
+ * Use argument metadata if specified, otherwise the master metadata
+ */
+
+ if (NULL != options.metadata) {
+ metadataIn = options.metadata;
+ } else {
+ metadataIn = modelPtr->metadata;
+ }
+
/*
* Search for an appropriate image file format handler, and give an
* error if none is found.
@@ -1362,6 +1486,7 @@ ImgPhotoCmd(
matched = 0;
redoFormatLookup:
+ imageFormatVersion3 = NULL;
for (imageFormat = tsdPtr->formatList; imageFormat != NULL;
imageFormat = imageFormat->nextPtr) {
if ((fmtString == NULL)
@@ -1373,6 +1498,7 @@ ImgPhotoCmd(
}
}
}
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
if (imageFormat == NULL) {
oldformat = 1;
for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
@@ -1387,6 +1513,22 @@ ImgPhotoCmd(
}
}
}
+#endif
+ if (imageFormat == NULL) {
+ oldformat = 0;
+ for (imageFormatVersion3 = tsdPtr->formatListVersion3;
+ imageFormatVersion3 != NULL;
+ imageFormatVersion3 = imageFormatVersion3->nextPtr) {
+ if ((fmtString == NULL)
+ || (strncasecmp(fmtString, imageFormatVersion3->name,
+ strlen(imageFormatVersion3->name)) == 0)) {
+ matched = 1;
+ if (imageFormatVersion3->fileWriteProc != NULL) {
+ break;
+ }
+ }
+ }
+ }
if (usedExt && !matched) {
/*
* If we didn't find one and we're using file extensions as the
@@ -1398,7 +1540,7 @@ ImgPhotoCmd(
fmtString = NULL;
goto redoFormatLookup;
}
- if (imageFormat == NULL) {
+ if (imageFormat == NULL && imageFormatVersion3 == NULL) {
if (fmtString == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"no available image file format has file writing"
@@ -1425,8 +1567,14 @@ ImgPhotoCmd(
if (oldformat && format) {
format = (Tcl_Obj *) Tcl_GetString(options.format);
}
- result = imageFormat->fileWriteProc(interp,
- Tcl_GetString(options.name), format, &block);
+ if (imageFormat != NULL) {
+ result = imageFormat->fileWriteProc(interp,
+ Tcl_GetString(options.name), format, &block);
+ } else {
+ result = imageFormatVersion3->fileWriteProc(interp,
+ Tcl_GetString(options.name), format, metadataIn,
+ &block);
+ }
if (options.background) {
Tk_FreeColor(options.background);
}
@@ -1478,13 +1626,18 @@ GetExtension(
*
* This function is invoked to process one of the options which may be
* specified for the photo image subcommands, namely, -from, -to, -zoom,
- * -subsample, -format, -shrink, and -compositingrule.
+ * -subsample, -format, -shrink, -compositingrule, -alpha, -boolean,
+ * -withalpha and -metadata.
+ * Parsing starts at the index in *optIndexPtr and stops at the end of
+ * objv[] or at the first value that does not belong to an option.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * Fields in *optPtr get filled in.
+ * Fields in *optPtr get filled in. The value of optIndexPtr is updated
+ * to contain the index of the first element in argv[] that was not
+ * parsed, or argc if the end of objv[] was reached.
*
*----------------------------------------------------------------------
*/
@@ -1508,7 +1661,7 @@ ParseSubcommandOptions(
* TK_PHOTO_COMPOSITE_* constants. */
NULL
};
- size_t length;
+ TkSizeT length;
int index, c, bit, currentBit;
int values[4], numValues, maxValues, argIndex;
const char *option, *expandedOption, *needed;
@@ -1521,8 +1674,7 @@ ParseSubcommandOptions(
* optPtr->name.
*/
- expandedOption = option = Tcl_GetString(objv[index]);
- length = objv[index]->length;
+ expandedOption = option = Tcl_GetStringFromObj(objv[index], &length);
if (option[0] != '-') {
if (optPtr->name == NULL) {
optPtr->name = objv[index];
@@ -1593,6 +1745,17 @@ ParseSubcommandOptions(
}
*optIndexPtr = ++index;
optPtr->format = objv[index];
+ } else if (bit == OPT_METADATA) {
+ /*
+ * The -metadata option takes a single dict value. Note that
+ * parsing this is outside the scope of this function.
+ */
+
+ if (index + 1 >= objc) {
+ goto oneValueRequired;
+ }
+ *optIndexPtr = ++index;
+ optPtr->metadata = objv[index];
} else if (bit == OPT_COMPOSITE) {
/*
* The -compositingrule option takes a single value from a
@@ -1609,7 +1772,8 @@ ParseSubcommandOptions(
return TCL_ERROR;
}
*optIndexPtr = index;
- } else if ((bit != OPT_SHRINK) && (bit != OPT_GRAYSCALE)) {
+ } else if (bit == OPT_TO || bit == OPT_FROM
+ || bit == OPT_SUBSAMPLE || bit == OPT_ZOOM) {
const char *val;
maxValues = ((bit == OPT_FROM) || (bit == OPT_TO)) ? 4 : 2;
@@ -1788,19 +1952,20 @@ ImgPhotoConfigureModel(
{
PhotoInstance *instancePtr;
const char *oldFileString, *oldPaletteString;
- Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL;
+ Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL,
+ *metadataInObj = NULL, *metadataOutObj = NULL;
Tcl_Obj *tempdata, *tempformat;
- size_t length;
+ TkSizeT length;
int i, j, result, imageWidth, imageHeight, oldformat;
double oldGamma;
Tcl_Channel chan;
Tk_PhotoImageFormat *imageFormat;
+ Tk_PhotoImageFormatVersion3 *imageFormatVersion3;
const char **args;
args = (const char **)ckalloc((objc + 1) * sizeof(char *));
for (i = 0, j = 0; i < objc; i++,j++) {
- args[j] = Tcl_GetString(objv[i]);
- length = objv[i]->length;
+ args[j] = Tcl_GetStringFromObj(objv[i], &length);
if ((length > 1) && (args[j][0] == '-')) {
if ((args[j][1] == 'd') &&
!strncmp(args[j], "-data", length)) {
@@ -1828,6 +1993,19 @@ ImgPhotoConfigureModel(
"MISSING_VALUE", NULL);
return TCL_ERROR;
}
+ } else if ((args[j][1] == 'm') &&
+ !strncmp(args[j], "-metadata", length)) {
+ if (++i < objc) {
+ metadataInObj = objv[i];
+ j--;
+ } else {
+ ckfree(args);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "value for \"-metadata\" missing", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "MISSING_VALUE", NULL);
+ return TCL_ERROR;
+ }
}
}
}
@@ -1867,7 +2045,7 @@ ImgPhotoConfigureModel(
ckfree(args);
/*
- * Regard the empty string for -file, -data or -format as the null value.
+ * Regard the empty string for -file, -data, -format or -metadata as the null value.
*/
if ((modelPtr->fileString != NULL) && (modelPtr->fileString[0] == 0)) {
@@ -1879,7 +2057,7 @@ ImgPhotoConfigureModel(
* Force into ByteArray format, which most (all) image handlers will
* use anyway. Empty length means ignore the -data option.
*/
- int bytesize;
+ TkSizeT bytesize;
(void) Tcl_GetByteArrayFromObj(data, &bytesize);
if (bytesize) {
@@ -1909,6 +2087,32 @@ ImgPhotoConfigureModel(
}
modelPtr->format = format;
}
+ if (metadataInObj) {
+ /*
+ * Make -metadata a dict.
+ * Take also empty metadatas as this may be a sign to replace
+ * existing metadata.
+ */
+ int dictSize;
+
+ if (TCL_OK != Tcl_DictObjSize(interp,metadataInObj, &dictSize)) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "value for \"-metadata\" not a dict", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "UNRECOGNIZED_DATA", NULL);
+ return TCL_ERROR;
+ }
+
+ if (dictSize > 0) {
+ Tcl_IncrRefCount(metadataInObj);
+ } else {
+ metadataInObj = NULL;
+ }
+ if (modelPtr->metadata) {
+ Tcl_DecrRefCount(modelPtr->metadata);
+ }
+ modelPtr->metadata = metadataInObj;
+ }
/*
* Set the image to the user-requested size, if any, and make sure storage
* is correctly allocated for this image.
@@ -1930,6 +2134,7 @@ ImgPhotoConfigureModel(
if ((modelPtr->fileString != NULL)
&& ((modelPtr->fileString != oldFileString)
|| (modelPtr->format != oldFormat))) {
+
/*
* Prevent file system access in a safe interpreter.
*/
@@ -1949,14 +2154,22 @@ ImgPhotoConfigureModel(
}
/*
+ * Flag that we want the metadata result dict
+ */
+
+ metadataOutObj = Tcl_NewDictObj();
+ Tcl_IncrRefCount(metadataOutObj);
+
+ /*
* -translation binary also sets -encoding binary
*/
if ((Tcl_SetChannelOption(interp, chan,
"-translation", "binary") != TCL_OK) ||
(MatchFileFormat(interp, chan, modelPtr->fileString,
- modelPtr->format, &imageFormat, &imageWidth,
- &imageHeight, &oldformat) != TCL_OK)) {
+ modelPtr->format, modelPtr->metadata, metadataOutObj,
+ &imageFormat, &imageFormatVersion3,
+ &imageWidth, &imageHeight, &oldformat) != TCL_OK)) {
Tcl_Close(NULL, chan);
goto errorExit;
}
@@ -1972,9 +2185,19 @@ ImgPhotoConfigureModel(
if (oldformat && tempformat) {
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
}
- result = imageFormat->fileReadProc(interp, chan,
- modelPtr->fileString, tempformat, (Tk_PhotoHandle) modelPtr,
- 0, 0, imageWidth, imageHeight, 0, 0);
+ if (imageFormat != NULL) {
+ result = imageFormat->fileReadProc(interp, chan,
+ modelPtr->fileString, tempformat,
+ (Tk_PhotoHandle) modelPtr,
+ 0, 0, imageWidth, imageHeight, 0, 0);
+ } else {
+ result = imageFormatVersion3->fileReadProc(interp, chan,
+ modelPtr->fileString, tempformat, modelPtr->metadata,
+ (Tk_PhotoHandle) modelPtr,
+ 0, 0, imageWidth, imageHeight, 0, 0,
+ metadataOutObj);
+ }
+
Tcl_Close(NULL, chan);
if (result != TCL_OK) {
goto errorExit;
@@ -1988,8 +2211,16 @@ ImgPhotoConfigureModel(
&& ((modelPtr->dataString != oldData)
|| (modelPtr->format != oldFormat))) {
+ /*
+ * Flag that we want the metadata result dict
+ */
+
+ metadataOutObj = Tcl_NewDictObj();
+ Tcl_IncrRefCount(metadataOutObj);
+
if (MatchStringFormat(interp, modelPtr->dataString,
- modelPtr->format, &imageFormat, &imageWidth,
+ modelPtr->format, modelPtr->metadata, metadataOutObj,
+ &imageFormat, &imageFormatVersion3, &imageWidth,
&imageHeight, &oldformat) != TCL_OK) {
goto errorExit;
}
@@ -2007,10 +2238,18 @@ ImgPhotoConfigureModel(
}
tempdata = (Tcl_Obj *) Tcl_GetString(tempdata);
}
- if (imageFormat->stringReadProc(interp, tempdata, tempformat,
- (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight,
- 0, 0) != TCL_OK) {
- goto errorExit;
+ if (imageFormat != NULL) {
+ if (imageFormat->stringReadProc(interp, tempdata, tempformat,
+ (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight,
+ 0, 0) != TCL_OK) {
+ goto errorExit;
+ }
+ } else {
+ if (imageFormatVersion3->stringReadProc(interp, tempdata, tempformat,
+ modelPtr->metadata, (Tk_PhotoHandle) modelPtr, 0, 0,
+ imageWidth, imageHeight, 0, 0, metadataOutObj) != TCL_OK) {
+ goto errorExit;
+ }
}
Tcl_ResetResult(interp);
@@ -2018,6 +2257,49 @@ ImgPhotoConfigureModel(
}
/*
+ * Merge driver returned metadata and master metadata
+ */
+ if (metadataOutObj != NULL) {
+ int dictSize;
+ if (TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize)) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "driver metadata not a dict", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "UNRECOGNIZED_DATA", NULL);
+ goto errorExit;
+ }
+ if (dictSize > 0) {
+
+ /*
+ * We have driver return metadata
+ */
+
+ if (modelPtr->metadata == NULL) {
+ modelPtr->metadata = metadataOutObj;
+ metadataOutObj = NULL;
+ } else {
+ Tcl_DictSearch search;
+ Tcl_Obj *key, *value;
+ int done;
+
+ if (Tcl_IsShared(modelPtr->metadata)) {
+ Tcl_DecrRefCount(modelPtr->metadata);
+ modelPtr->metadata = Tcl_DuplicateObj(modelPtr->metadata);
+ Tcl_IncrRefCount(modelPtr->metadata);
+ }
+
+ if (Tcl_DictObjFirst(interp, metadataOutObj, &search, &key,
+ &value, &done) != TCL_OK) {
+ goto errorExit;
+ }
+ for (; !done ; Tcl_DictObjNext(&search, &key, &value, &done)) {
+ Tcl_DictObjPut(interp, modelPtr->metadata, key, value);
+ }
+ }
+ }
+ }
+
+ /*
* Enforce a reasonable value for gamma.
*/
@@ -2045,7 +2327,7 @@ ImgPhotoConfigureModel(
* Inform the generic image code that the image has (potentially) changed.
*/
- Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width,
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width,
modelPtr->height, modelPtr->width, modelPtr->height);
modelPtr->flags &= ~IMAGE_CHANGED;
@@ -2055,6 +2337,9 @@ ImgPhotoConfigureModel(
if (oldFormat != NULL) {
Tcl_DecrRefCount(oldFormat);
}
+ if (metadataOutObj != NULL) {
+ Tcl_DecrRefCount(metadataOutObj);
+ }
ToggleComplexAlphaIfNeeded(modelPtr);
@@ -2067,6 +2352,9 @@ ImgPhotoConfigureModel(
if (oldFormat != NULL) {
Tcl_DecrRefCount(oldFormat);
}
+ if (metadataOutObj != NULL) {
+ Tcl_DecrRefCount(metadataOutObj);
+ }
return TCL_ERROR;
}
@@ -2148,7 +2436,7 @@ ImgPhotoDelete(
Tcl_CancelIdleCall(TkImgDisposeInstance, instancePtr);
TkImgDisposeInstance(instancePtr);
}
- modelPtr->tkMaster = NULL;
+ modelPtr->tkModel = NULL;
if (modelPtr->imageCmd != NULL) {
Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd);
}
@@ -2164,6 +2452,9 @@ ImgPhotoDelete(
if (modelPtr->format != NULL) {
Tcl_DecrRefCount(modelPtr->format);
}
+ if (modelPtr->metadata != NULL) {
+ Tcl_DecrRefCount(modelPtr->metadata);
+ }
Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0);
ckfree(modelPtr);
}
@@ -2193,8 +2484,8 @@ ImgPhotoCmdDeletedProc(
PhotoModel *modelPtr = (PhotoModel *)clientData;
modelPtr->imageCmd = NULL;
- if (modelPtr->tkMaster != NULL) {
- Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkMaster));
+ if (modelPtr->tkModel != NULL) {
+ Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel));
}
}
@@ -2400,9 +2691,9 @@ ImgPhotoSetSize(
*
* Results:
* A standard TCL return value. If the return value is TCL_OK, a pointer
- * to the image format record is returned in *imageFormatPtr, and the
- * width and height of the image are returned in *widthPtr and
- * *heightPtr.
+ * to the image format record is returned in *imageFormatPtr or
+ * *imageFormatVersion3Ptr, and the width and height of the image are
+ * returned in *widthPtr and *heightPtr.
*
* Side effects:
* None.
@@ -2416,16 +2707,25 @@ MatchFileFormat(
Tcl_Channel chan, /* The image file, open for reading. */
const char *fileName, /* The name of the image file. */
Tcl_Obj *formatObj, /* User-specified format string, or NULL. */
+ Tcl_Obj *metadataInObj, /* User-specified metadata, may be NULL */
+ Tcl_Obj *metadataOutObj, /* metadata to return, may be NULL */
Tk_PhotoImageFormat **imageFormatPtr,
/* A pointer to the photo image format record
- * is returned here. */
+ * is returned here. For formatVersion3, this is
+ * set to NULL */
+ Tk_PhotoImageFormatVersion3 **imageFormatVersion3Ptr,
+ /* A pointer to the photo image formatVersion3
+ * record is returned here. For non
+ * formatVersion3, this is set to NULL*/
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
* here. */
int *oldformat) /* Returns 1 if the old image API is used. */
{
- int matched = 0, useoldformat = 0;
+ int matched = 0;
+ int useoldformat = 0;
Tk_PhotoImageFormat *formatPtr;
+ Tk_PhotoImageFormatVersion3 *formatVersion3Ptr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
const char *formatString = NULL;
@@ -2471,7 +2771,8 @@ MatchFileFormat(
}
}
}
- if (formatPtr == NULL) {
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
+if (formatPtr == NULL) {
useoldformat = 1;
for (formatPtr = tsdPtr->oldFormatList; formatPtr != NULL;
formatPtr = formatPtr->nextPtr) {
@@ -2505,28 +2806,99 @@ MatchFileFormat(
}
}
}
+#endif
- if (formatPtr == NULL) {
- if ((formatObj != NULL) && !matched) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "image file format \"%s\" is not supported",
- formatString));
- Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT",
- formatString, NULL);
- } else {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "couldn't recognize data in image file \"%s\"",
- fileName));
- Tcl_SetErrorCode(interp, "TK", "PHOTO", "IMAGE",
- "UNRECOGNIZED_DATA", NULL);
+ /*
+ * For old and not version 3 format, exit now with success
+ */
+
+ if (formatPtr != NULL) {
+ *imageFormatPtr = formatPtr;
+ *imageFormatVersion3Ptr = NULL;
+ *oldformat = useoldformat;
+ (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET);
+ return TCL_OK;
+ }
+
+ /*
+ * Scan through the table of file format version 3 handlers to find one
+ * which can handle the image.
+ */
+
+ for (formatVersion3Ptr = tsdPtr->formatListVersion3;
+ formatVersion3Ptr != NULL;
+ formatVersion3Ptr = formatVersion3Ptr->nextPtr) {
+ if (formatObj != NULL) {
+ if (strncasecmp(formatString,
+ formatVersion3Ptr->name, strlen(formatVersion3Ptr->name))
+ != 0) {
+ continue;
+ }
+ matched = 1;
+ if (formatVersion3Ptr->fileMatchProc == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "-file option isn't supported for %s images",
+ formatString));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "NOT_FILE_FORMAT", NULL);
+ return TCL_ERROR;
+ }
+ }
+ if (formatVersion3Ptr->fileMatchProc != NULL) {
+ (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET);
+
+ if (formatVersion3Ptr->fileMatchProc(interp, chan, fileName,
+ formatObj, metadataInObj, widthPtr, heightPtr,
+ metadataOutObj)) {
+ if (*widthPtr < 1) {
+ *widthPtr = 1;
+ }
+ if (*heightPtr < 1) {
+ *heightPtr = 1;
+ }
+ *imageFormatVersion3Ptr = formatVersion3Ptr;
+ *imageFormatPtr = NULL;
+ *oldformat = 0;
+ (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET);
+ return TCL_OK;
+ }
+
+ /*
+ * Check if driver has shared or changed the metadata Tcl object.
+ * In this case, release and recreate it.
+ */
+
+ if (metadataOutObj != NULL) {
+ int dictSize;
+ if (Tcl_IsShared(metadataOutObj)
+ || TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize)
+ || dictSize > 0) {
+ Tcl_DecrRefCount(metadataOutObj);
+ metadataOutObj = Tcl_NewDictObj();
+ Tcl_IncrRefCount(metadataOutObj);
+ }
+ }
}
- return TCL_ERROR;
}
- *imageFormatPtr = formatPtr;
- *oldformat = useoldformat;
- (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET);
- return TCL_OK;
+ /*
+ * No matching format found
+ */
+
+ if ((formatObj != NULL) && !matched) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "image file format \"%s\" is not supported",
+ formatString));
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT",
+ formatString, NULL);
+ } else {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "couldn't recognize data in image file \"%s\"",
+ fileName));
+ Tcl_SetErrorCode(interp, "TK", "PHOTO", "IMAGE",
+ "UNRECOGNIZED_DATA", NULL);
+ }
+ return TCL_ERROR;
}
/*
@@ -2541,9 +2913,9 @@ MatchFileFormat(
*
* Results:
* A standard TCL return value. If the return value is TCL_OK, a pointer
- * to the image format record is returned in *imageFormatPtr, and the
- * width and height of the image are returned in *widthPtr and
- * *heightPtr.
+ * to the image format record is returned in *imageFormatPtr or
+ * *imageFormatVersion3Ptr, and the width and height of the image are
+ * returned in *widthPtr and *heightPtr.
*
* Side effects:
* None.
@@ -2556,16 +2928,24 @@ MatchStringFormat(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
Tcl_Obj *data, /* Object containing the image data. */
Tcl_Obj *formatObj, /* User-specified format string, or NULL. */
+ Tcl_Obj *metadataInObj, /* User-specified metadata, may be NULL */
+ Tcl_Obj *metadataOutObj, /* metadata output dict, may be NULL */
Tk_PhotoImageFormat **imageFormatPtr,
/* A pointer to the photo image format record
- * is returned here. */
+ * is returned here. For formatVersion3, this is
+ * set to NULL*/
+ Tk_PhotoImageFormatVersion3 **imageFormatVersion3Ptr,
+ /* A pointer to the photo image formatVersion3
+ * record is returned here. For non
+ * formatVersion3, this is set to NULL*/
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
* here. */
int *oldformat) /* Returns 1 if the old image API is used. */
{
int matched = 0, useoldformat = 0;
- Tk_PhotoImageFormat *formatPtr;
+ Tk_PhotoImageFormat *formatPtr, *defaultFormatPtr = NULL;
+ Tk_PhotoImageFormatVersion3 *formatVersion3Ptr = NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
const char *formatString = NULL;
@@ -2581,6 +2961,16 @@ MatchStringFormat(
for (formatPtr = tsdPtr->formatList; formatPtr != NULL;
formatPtr = formatPtr->nextPtr) {
+ /*
+ * To keep the behaviour of older versions (Tk <= 8.6), the default
+ * list-of-lists string format is checked last. Remember its position.
+ */
+
+ if (strncasecmp("default", formatPtr->name, strlen(formatPtr->name))
+ == 0) {
+ defaultFormatPtr = formatPtr;
+ }
+
if (formatObj != NULL) {
if (strncasecmp(formatString,
formatPtr->name, strlen(formatPtr->name)) != 0) {
@@ -2596,6 +2986,16 @@ MatchStringFormat(
return TCL_ERROR;
}
}
+
+ /*
+ * If this is the default format, and it was not passed as -format
+ * option, skip the stringMatchProc test. It'll be done later
+ */
+
+ if (formatObj == NULL && formatPtr == defaultFormatPtr) {
+ continue;
+ }
+
if ((formatPtr->stringMatchProc != NULL)
&& (formatPtr->stringReadProc != NULL)
&& formatPtr->stringMatchProc(data, formatObj,
@@ -2604,6 +3004,7 @@ MatchStringFormat(
}
}
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
if (formatPtr == NULL) {
useoldformat = 1;
for (formatPtr = tsdPtr->oldFormatList; formatPtr != NULL;
@@ -2633,23 +3034,104 @@ MatchStringFormat(
}
}
}
+#endif
+
if (formatPtr == NULL) {
- if ((formatObj != NULL) && !matched) {
+ useoldformat = 0;
+ for (formatVersion3Ptr = tsdPtr->formatListVersion3;
+ formatVersion3Ptr != NULL;
+ formatVersion3Ptr = formatVersion3Ptr->nextPtr) {
+ if (formatObj != NULL) {
+ if (strncasecmp(formatString,
+ formatVersion3Ptr->name, strlen(formatVersion3Ptr->name)
+ ) != 0) {
+ continue;
+ }
+ matched = 1;
+ if (formatVersion3Ptr->stringMatchProc == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "-data option isn't supported for %s images",
+ formatString));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "NOT_DATA_FORMAT", NULL);
+ return TCL_ERROR;
+ }
+ }
+ if ((formatVersion3Ptr->stringMatchProc != NULL)
+ && (formatVersion3Ptr->stringReadProc != NULL)
+ && formatVersion3Ptr->stringMatchProc(interp, data,
+ formatObj, metadataInObj, widthPtr, heightPtr,
+ metadataOutObj)) {
+ break;
+ }
+
+ /*
+ * Check if driver has shared or changed the metadata tcl object.
+ * In this case, release and recreate it.
+ */
+
+ if (metadataOutObj != NULL) {
+ int dictSize;
+ if (Tcl_IsShared(metadataOutObj)
+ || TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize)
+ || dictSize > 0) {
+ Tcl_DecrRefCount(metadataOutObj);
+ metadataOutObj = Tcl_NewDictObj();
+ Tcl_IncrRefCount(metadataOutObj);
+ }
+ }
+ }
+ }
+
+ if (formatPtr == NULL && formatVersion3Ptr == NULL) {
+ /*
+ * Try the default format as last resort (only if no -format option
+ * was passed).
+ */
+
+ if ( formatObj == NULL && defaultFormatPtr == NULL) {
+ Tcl_Panic("default image format handler not registered");
+ }
+ if ( formatObj == NULL
+ && defaultFormatPtr->stringMatchProc != NULL
+ && defaultFormatPtr->stringReadProc != NULL
+ && defaultFormatPtr->stringMatchProc(data, formatObj,
+ widthPtr, heightPtr, interp) != 0) {
+ useoldformat = 0;
+ formatPtr = defaultFormatPtr;
+ } else if ((formatObj != NULL) && !matched) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"image format \"%s\" is not supported", formatString));
Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT",
formatString, NULL);
+ return TCL_ERROR;
} else {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "couldn't recognize image data", -1));
- Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
- "UNRECOGNIZED_DATA", NULL);
+
+ /*
+ * Some lower level routine (stringMatchProc) may have already set
+ * a specific error message, so just return this. Otherwise return
+ * a generic image data error.
+ */
+
+ if (Tcl_GetString(Tcl_GetObjResult(interp))[0] == '\0') {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "couldn't recognize image data", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
+ "UNRECOGNIZED_DATA", NULL);
+ }
+ return TCL_ERROR;
}
- return TCL_ERROR;
}
*imageFormatPtr = formatPtr;
+ *imageFormatVersion3Ptr = formatVersion3Ptr;
*oldformat = useoldformat;
+
+ /*
+ * Some stringMatchProc might have left error messages and error codes in
+ * interp. Clear them before return.
+ */
+ Tcl_ResetResult(interp);
return TCL_OK;
}
@@ -2681,7 +3163,7 @@ Tk_FindPhoto(
{
const Tk_ImageType *typePtr;
ClientData clientData =
- Tk_GetImageMasterData(interp, imageName, &typePtr);
+ Tk_GetImageModelData(interp, imageName, &typePtr);
if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) {
return NULL;
@@ -3111,7 +3593,7 @@ Tk_PhotoPutBlock(
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height,
+ Tk_ImageChanged(modelPtr->tkModel, x, y, width, height,
modelPtr->width, modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3467,7 +3949,7 @@ Tk_PhotoPutZoomedBlock(
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height, modelPtr->width,
+ Tk_ImageChanged(modelPtr->tkModel, x, y, width, height, modelPtr->width,
modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3611,7 +4093,7 @@ Tk_PhotoBlank(
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width,
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width,
modelPtr->height, modelPtr->width, modelPtr->height);
}
@@ -3660,7 +4142,7 @@ Tk_PhotoExpand(
}
return TCL_ERROR;
}
- Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, modelPtr->width,
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width,
modelPtr->height);
}
return TCL_OK;
@@ -3735,7 +4217,7 @@ Tk_PhotoSetSize(
}
return TCL_ERROR;
}
- Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0,
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0,
modelPtr->width, modelPtr->height);
return TCL_OK;
}
@@ -3965,57 +4447,6 @@ ImgGetPhoto(
/*
*----------------------------------------------------------------------
*
- * ImgStringWrite --
- *
- * Default string write function. The data is formatted in the default
- * format as accepted by the "<img> put" command.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-ImgStringWrite(
- Tcl_Interp *interp,
- Tcl_Obj *formatString,
- Tk_PhotoImageBlock *blockPtr)
-{
- int greenOffset, blueOffset;
- Tcl_Obj *data;
-
- greenOffset = blockPtr->offset[1] - blockPtr->offset[0];
- blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
-
- data = Tcl_NewObj();
- if ((blockPtr->width > 0) && (blockPtr->height > 0)) {
- int row, col;
-
- for (row=0; row<blockPtr->height; row++) {
- Tcl_Obj *line = Tcl_NewObj();
- unsigned char *pixelPtr = blockPtr->pixelPtr + blockPtr->offset[0]
- + row * blockPtr->pitch;
-
- for (col=0; col<blockPtr->width; col++) {
- Tcl_AppendPrintfToObj(line, "%s#%02x%02x%02x",
- col ? " " : "", *pixelPtr,
- pixelPtr[greenOffset], pixelPtr[blueOffset]);
- pixelPtr += blockPtr->pixelSize;
- }
- Tcl_ListObjAppendElement(NULL, data, line);
- }
- }
- Tcl_SetObjResult(interp, data);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* Tk_PhotoGetImage --
*
* This function is called to obtain image data from a photo image. This
@@ -4103,7 +4534,7 @@ ImgPhotoPostscript(
*
*----------------------------------------------------------------------
*/
-
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
void
Tk_PhotoPutBlock_NoComposite(
Tk_PhotoHandle handle,
@@ -4189,6 +4620,7 @@ Tk_PhotoSetSize_Panic(
Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
}
}
+#endif /* TK_NO_DEPRECATED */
/*
* Local Variables:
diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h
index 994fa40..7ac738f 100644
--- a/generic/tkImgPhoto.h
+++ b/generic/tkImgPhoto.h
@@ -3,10 +3,10 @@
*
* Declarations for images of type "photo" for Tk.
*
- * Copyright (c) 1994 The Australian National University.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2002-2008 Donal K. Fellows
- * Copyright (c) 2003 ActiveState Corporation.
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2002-2008 Donal K. Fellows
+ * Copyright © 2003 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -27,11 +27,11 @@
* Forward declarations of the structures we define.
*/
-#define PhotoModel PhotoMaster
+#define PhotoMaster PhotoModel
typedef struct ColorTableId ColorTableId;
typedef struct ColorTable ColorTable;
typedef struct PhotoInstance PhotoInstance;
-typedef struct PhotoMaster PhotoMaster;
+typedef struct PhotoModel PhotoModel;
/*
* A signed 8-bit integral type. If chars are unsigned and the compiler isn't
@@ -50,13 +50,6 @@ typedef struct PhotoMaster PhotoMaster;
#endif
/*
- * An unsigned 32-bit integral type, used for pixel values. We use int rather
- * than long here to accommodate those systems where longs are 64 bits.
- */
-
-typedef unsigned int pixel;
-
-/*
* The maximum number of pixels to transmit to the server in a single
* XPutImage call.
*/
@@ -94,19 +87,26 @@ struct ColorTableId {
struct ColorTable {
ColorTableId id; /* Information used in selecting this color
* table. */
+#if TCL_MAJOR_VERSION > 8
+ size_t refCount; /* Number of instances using this map. */
+ size_t liveRefCount; /* Number of instances which are actually in
+ * use, using this map. */
int flags; /* See below. */
- int refCount; /* Number of instances using this map. */
- int liveRefCount; /* Number of instances which are actually in
+#else
+ int flags; /* See below. */
+ unsigned int refCount; /* Number of instances using this map. */
+ unsigned int liveRefCount; /* Number of instances which are actually in
* use, using this map. */
+#endif
int numColors; /* Number of colors allocated for this map. */
XVisualInfo visualInfo; /* Information about the visual for windows
* using this color table. */
- pixel redValues[256]; /* Maps 8-bit values of red intensity to a
+ unsigned redValues[256]; /* Maps 8-bit values of red intensity to a
* pixel value or index in pixelMap. */
- pixel greenValues[256]; /* Ditto for green intensity. */
- pixel blueValues[256]; /* Ditto for blue intensity. */
+ unsigned greenValues[256]; /* Ditto for green intensity. */
+ unsigned blueValues[256]; /* Ditto for blue intensity. */
unsigned long *pixelMap; /* Actual pixel values allocated. */
unsigned char colorQuant[3][256];
@@ -141,8 +141,8 @@ struct ColorTable {
* Definition of the data associated with each photo image model.
*/
-struct PhotoMaster {
- Tk_ImageMaster tkMaster; /* Tk's token for image model. NULL means the
+struct PhotoModel {
+ Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the
* image is being deleted. */
Tcl_Interp *interp; /* Interpreter associated with the application
* using this image. */
@@ -159,6 +159,8 @@ struct PhotoMaster {
Tcl_Obj *dataString; /* Object to use as contents of image. */
Tcl_Obj *format; /* User-specified format of data in image file
* or string value. */
+ Tcl_Obj *metadata; /* User-specified metadata dict or read from
+ * image file */
unsigned char *pix32; /* Local storage for 32-bit image. */
int ditherX, ditherY; /* Location of first incorrectly dithered
* pixel in image. */
@@ -169,7 +171,7 @@ struct PhotoMaster {
};
/*
- * Bit definitions for the flags field of a PhotoMaster.
+ * Bit definitions for the flags field of a PhotoModel.
* COLOR_IMAGE: 1 means that the image has different color
* components.
* IMAGE_CHANGED: 1 means that the instances of this image need
@@ -196,13 +198,17 @@ struct PhotoMaster {
*/
struct PhotoInstance {
- PhotoMaster *masterPtr; /* Pointer to model for image. */
+ PhotoModel *modelPtr; /* Pointer to model for image. */
Display *display; /* Display for windows using this instance. */
Colormap colormap; /* The image may only be used in windows with
* this particular colormap. */
PhotoInstance *nextPtr; /* Pointer to the next instance in the list of
* instances associated with this model. */
- int refCount; /* Number of instances using this structure. */
+#if TCL_MAJOR_VERSION > 8
+ size_t refCount; /* Number of instances using this structure. */
+#else
+ unsigned int refCount; /* Number of instances using this structure. */
+#endif
Tk_Uid palette; /* Palette for these particular instances. */
double gamma; /* Gamma value for these instances. */
Tk_Uid defaultPalette; /* Default palette to use if a palette is not
diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c
new file mode 100644
index 0000000..427b2c0
--- /dev/null
+++ b/generic/tkImgSVGnano.c
@@ -0,0 +1,880 @@
+/*
+ * tkImgSVGnano.c
+ *
+ * A photo file handler for SVG files.
+ *
+ * Copyright © 2013-14 Mikko Mononen memon@inside.org
+ * Copyright © 2018 Christian Gollwitzer auriocus@gmx.de
+ * Copyright © 2018 Christian Werner https://www.androwish.org/
+ * Copyright © 2018 Rene Zaumseil r.zaumseil@freenet.de
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * This handler is build using the original nanosvg library files from
+ * https://github.com/memononen/nanosvg
+ *
+ */
+
+#include "tkInt.h"
+#define NANOSVG_malloc ckalloc
+#define NANOSVG_realloc ckrealloc
+#define NANOSVG_free ckfree
+#define NANOSVG_SCOPE MODULE_SCOPE
+#define NANOSVG_ALL_COLOR_KEYWORDS
+#define NANOSVG_IMPLEMENTATION
+#include "nanosvg.h"
+#define NANOSVGRAST_IMPLEMENTATION
+#include "nanosvgrast.h"
+
+/* Additional parameters to nsvgRasterize() */
+
+typedef struct {
+ double scale;
+ int scaleToHeight;
+ int scaleToWidth;
+} RastOpts;
+
+/*
+ * Per interp cache of last NSVGimage which was matched to
+ * be immediately rasterized after the match. This helps to
+ * eliminate double parsing of the SVG file/string.
+ */
+
+typedef struct {
+ /* A poiner to remember if it is the same svn image (data)
+ * It is a Tcl_Channel if image created by -file option
+ * or a Tcl_Obj, if image is created with the -data option
+ */
+ ClientData dataOrChan;
+ Tcl_DString formatString;
+ NSVGimage *nsvgImage;
+ RastOpts ropts;
+} NSVGcache;
+
+static const void * MemMem(const void *haystack, size_t haysize,
+ const void *needle, size_t needlen);
+static int FileMatchSVG(Tcl_Channel chan, const char *fileName,
+ Tcl_Obj *format, int *widthPtr, int *heightPtr,
+ Tcl_Interp *interp);
+static int FileReadSVG(Tcl_Interp *interp, Tcl_Channel chan,
+ const char *fileName, Tcl_Obj *format,
+ Tk_PhotoHandle imageHandle, int destX, int destY,
+ int width, int height, int srcX, int srcY);
+static int StringMatchSVG(Tcl_Obj *dataObj, Tcl_Obj *format,
+ int *widthPtr, int *heightPtr, Tcl_Interp *interp);
+static int StringReadSVG(Tcl_Interp *interp, Tcl_Obj *dataObj,
+ Tcl_Obj *format, Tk_PhotoHandle imageHandle,
+ int destX, int destY, int width, int height,
+ int srcX, int srcY);
+static NSVGimage * ParseSVGWithOptions(Tcl_Interp *interp,
+ const char *input, TkSizeT length, Tcl_Obj *format,
+ RastOpts *ropts);
+static int RasterizeSVG(Tcl_Interp *interp,
+ Tk_PhotoHandle imageHandle, NSVGimage *nsvgImage,
+ int destX, int destY, int width, int height,
+ int srcX, int srcY, RastOpts *ropts);
+static double GetScaleFromParameters(NSVGimage *nsvgImage,
+ RastOpts *ropts, int *widthPtr, int *heightPtr);
+static NSVGcache * GetCachePtr(Tcl_Interp *interp);
+static int CacheSVG(Tcl_Interp *interp, ClientData dataOrChan,
+ Tcl_Obj *formatObj, NSVGimage *nsvgImage,
+ RastOpts *ropts);
+static NSVGimage * GetCachedSVG(Tcl_Interp *interp, ClientData dataOrChan,
+ Tcl_Obj *formatObj, RastOpts *ropts);
+static void CleanCache(Tcl_Interp *interp);
+static void FreeCache(ClientData clientData, Tcl_Interp *interp);
+
+/*
+ * The format record for the SVG nano file format:
+ */
+
+Tk_PhotoImageFormat tkImgFmtSVGnano = {
+ "svg", /* name */
+ FileMatchSVG, /* fileMatchProc */
+ StringMatchSVG, /* stringMatchProc */
+ FileReadSVG, /* fileReadProc */
+ StringReadSVG, /* stringReadProc */
+ NULL, /* fileWriteProc */
+ NULL, /* stringWriteProc */
+ NULL
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MemMem --
+ *
+ * Like strstr() but operating on memory buffers with sizes.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static const void *
+MemMem(const void *haystack, size_t haylen,
+ const void *needle, size_t needlen)
+{
+ const void *hayend, *second, *p;
+ unsigned char first;
+
+ if ((needlen <= 0) || (haylen < needlen)) {
+ return NULL;
+ }
+ hayend = (const void *) ((char *) haystack + haylen - needlen);
+ first = ((char *) needle)[0];
+ second = (const void *) ((char *) needle + 1);
+ needlen -= 1;
+ while (haystack < hayend) {
+ p = memchr(haystack, first, (char *) hayend - (char *) haystack);
+ if (p == NULL) {
+ break;
+ }
+ if (needlen == 0) {
+ return p;
+ }
+ haystack = (const void *) ((char *) p + 1);
+ if (memcmp(second, haystack, needlen) == 0) {
+ return p;
+ }
+ }
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FileMatchSVG --
+ *
+ * This function is invoked by the photo image type to see if a file
+ * contains image data in SVG format.
+ *
+ * Results:
+ * The return value is >0 if the file can be successfully parsed,
+ * and 0 otherwise.
+ *
+ * Side effects:
+ * The file is saved in the internal cache for further use.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+FileMatchSVG(
+ Tcl_Channel chan,
+ const char *fileName,
+ Tcl_Obj *formatObj,
+ int *widthPtr, int *heightPtr,
+ Tcl_Interp *interp)
+{
+ TkSizeT length;
+ Tcl_Obj *dataObj = Tcl_NewObj();
+ const char *data;
+ RastOpts ropts;
+ NSVGimage *nsvgImage;
+ (void)fileName;
+
+ CleanCache(interp);
+ if (Tcl_ReadChars(chan, dataObj, 4096, 0) == TCL_IO_FAILURE) {
+ /* in case of an error reading the file */
+ Tcl_DecrRefCount(dataObj);
+ return 0;
+ }
+ data = Tcl_GetStringFromObj(dataObj, &length);
+ /* should have a '<svg' and a '>' in the first 4k */
+ if ((memchr(data, '>', length) == NULL) ||
+ (MemMem(data, length, "<svg", 4) == NULL)) {
+ Tcl_DecrRefCount(dataObj);
+ return 0;
+ }
+ if (!Tcl_Eof(chan) && (Tcl_ReadChars(chan, dataObj, -1, 1) == TCL_IO_FAILURE)) {
+ /* in case of an error reading the file */
+ Tcl_DecrRefCount(dataObj);
+ return 0;
+ }
+ data = Tcl_GetStringFromObj(dataObj, &length);
+ nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts);
+ Tcl_DecrRefCount(dataObj);
+ if (nsvgImage != NULL) {
+ GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr);
+ if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) {
+ nsvgDelete(nsvgImage);
+ return 0;
+ }
+ if (!CacheSVG(interp, chan, formatObj, nsvgImage, &ropts)) {
+ nsvgDelete(nsvgImage);
+ }
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FileReadSVG --
+ *
+ * This function is called by the photo image type to read SVG format
+ * data from a file and write it into a given photo image.
+ *
+ * Results:
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in the interp's result.
+ *
+ * Side effects:
+ * The access position in file f is changed, and new data is added to the
+ * image given by imageHandle.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+FileReadSVG(
+ Tcl_Interp *interp,
+ Tcl_Channel chan,
+ const char *fileName,
+ Tcl_Obj *formatObj,
+ Tk_PhotoHandle imageHandle,
+ int destX, int destY,
+ int width, int height,
+ int srcX, int srcY)
+{
+ TkSizeT length;
+ const char *data;
+ RastOpts ropts;
+ NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts);
+ (void)fileName;
+
+ if (nsvgImage == NULL) {
+ Tcl_Obj *dataObj = Tcl_NewObj();
+
+ if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) {
+ /* in case of an error reading the file */
+ Tcl_DecrRefCount(dataObj);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("read error", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "READ_ERROR", NULL);
+ return TCL_ERROR;
+ }
+ data = Tcl_GetStringFromObj(dataObj, &length);
+ nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj,
+ &ropts);
+ Tcl_DecrRefCount(dataObj);
+ if (nsvgImage == NULL) {
+ return TCL_ERROR;
+ }
+ }
+ return RasterizeSVG(interp, imageHandle, nsvgImage, destX, destY,
+ width, height, srcX, srcY, &ropts);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * StringMatchSVG --
+ *
+ * This function is invoked by the photo image type to see if a string
+ * contains image data in SVG format.
+ *
+ * Results:
+ * The return value is >0 if the file can be successfully parsed,
+ * and 0 otherwise.
+ *
+ * Side effects:
+ * The file is saved in the internal cache for further use.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+StringMatchSVG(
+ Tcl_Obj *dataObj,
+ Tcl_Obj *formatObj,
+ int *widthPtr, int *heightPtr,
+ Tcl_Interp *interp)
+{
+ TkSizeT length, testLength;
+ const char *data;
+ RastOpts ropts;
+ NSVGimage *nsvgImage;
+
+ CleanCache(interp);
+ data = Tcl_GetStringFromObj(dataObj, &length);
+ /* should have a '<svg' and a '>' in the first 4k */
+ testLength = (length > 4096) ? 4096 : length;
+ if ((memchr(data, '>', testLength) == NULL) ||
+ (MemMem(data, testLength, "<svg", 4) == NULL)) {
+ return 0;
+ }
+ nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts);
+ if (nsvgImage != NULL) {
+ GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr);
+ if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) {
+ nsvgDelete(nsvgImage);
+ return 0;
+ }
+ if (!CacheSVG(interp, dataObj, formatObj, nsvgImage, &ropts)) {
+ nsvgDelete(nsvgImage);
+ }
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * StringReadSVG --
+ *
+ * This function is called by the photo image type to read SVG format
+ * data from a string and write it into a given photo image.
+ *
+ * Results:
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in the interp's result.
+ *
+ * Side effects:
+ * New data is added to the image given by imageHandle.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+StringReadSVG(
+ Tcl_Interp *interp,
+ Tcl_Obj *dataObj,
+ Tcl_Obj *formatObj,
+ Tk_PhotoHandle imageHandle,
+ int destX, int destY,
+ int width, int height,
+ int srcX, int srcY)
+{
+ TkSizeT length;
+ const char *data;
+ RastOpts ropts;
+ NSVGimage *nsvgImage = GetCachedSVG(interp, dataObj, formatObj, &ropts);
+
+ if (nsvgImage == NULL) {
+ data = Tcl_GetStringFromObj(dataObj, &length);
+ nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj,
+ &ropts);
+ }
+ if (nsvgImage == NULL) {
+ return TCL_ERROR;
+ }
+ return RasterizeSVG(interp, imageHandle, nsvgImage, destX, destY,
+ width, height, srcX, srcY, &ropts);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ParseSVGWithOptions --
+ *
+ * This function is called to parse the given input string as SVG.
+ *
+ * Results:
+ * Return a newly create NSVGimage on success, and NULL otherwise.
+ *
+ * Side effects:
+ *
+ *----------------------------------------------------------------------
+ */
+
+static NSVGimage *
+ParseSVGWithOptions(
+ Tcl_Interp *interp,
+ const char *input,
+ TkSizeT length,
+ Tcl_Obj *formatObj,
+ RastOpts *ropts)
+{
+ Tcl_Obj **objv = NULL;
+ int objc = 0;
+ double dpi = 96.0;
+ char *inputCopy = NULL;
+ NSVGimage *nsvgImage;
+ int parameterScaleSeen = 0;
+ static const char *const fmtOptions[] = {
+ "-dpi", "-scale", "-scaletoheight", "-scaletowidth", NULL
+ };
+ enum fmtOptionsEnum {
+ OPT_DPI, OPT_SCALE, OPT_SCALE_TO_HEIGHT, OPT_SCALE_TO_WIDTH
+ };
+
+ /*
+ * The parser destroys the original input string,
+ * therefore first duplicate.
+ */
+
+ inputCopy = (char *)attemptckalloc(length+1);
+ if (inputCopy == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc data buffer", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL);
+ goto error;
+ }
+ memcpy(inputCopy, input, length);
+ inputCopy[length] = '\0';
+
+ /*
+ * Process elements of format specification as a list.
+ */
+
+ ropts->scale = 1.0;
+ ropts->scaleToHeight = 0;
+ ropts->scaleToWidth = 0;
+ if ((formatObj != NULL) &&
+ Tcl_ListObjGetElements(interp, formatObj, &objc, &objv) != TCL_OK) {
+ goto error;
+ }
+ for (; objc > 0 ; objc--, objv++) {
+ int optIndex;
+
+ /*
+ * Ignore the "svg" part of the format specification.
+ */
+
+ if (!strcasecmp(Tcl_GetString(objv[0]), "svg")) {
+ continue;
+ }
+
+ if (Tcl_GetIndexFromObjStruct(interp, objv[0], fmtOptions,
+ sizeof(char *), "option", 0, &optIndex) == TCL_ERROR) {
+ goto error;
+ }
+
+ if (objc < 2) {
+ ckfree(inputCopy);
+ inputCopy = NULL;
+ Tcl_WrongNumArgs(interp, 1, objv, "value");
+ goto error;
+ }
+
+ objc--;
+ objv++;
+
+ /*
+ * check that only one scale option is given
+ */
+ switch ((enum fmtOptionsEnum)optIndex) {
+ case OPT_SCALE:
+ case OPT_SCALE_TO_HEIGHT:
+ case OPT_SCALE_TO_WIDTH:
+ if ( parameterScaleSeen ) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "only one of -scale, -scaletoheight, -scaletowidth may be given", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE",
+ NULL);
+ goto error;
+ }
+ parameterScaleSeen = 1;
+ break;
+ default:
+ break;
+ }
+
+ /*
+ * Decode parameters
+ */
+ switch ((enum fmtOptionsEnum) optIndex) {
+ case OPT_DPI:
+ if (Tcl_GetDoubleFromObj(interp, objv[0], &dpi) == TCL_ERROR) {
+ goto error;
+ }
+ if (dpi < 0.0) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "-dpi value must be positive", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_DPI",
+ NULL);
+ goto error;
+ }
+ break;
+ case OPT_SCALE:
+ if (Tcl_GetDoubleFromObj(interp, objv[0], &ropts->scale) ==
+ TCL_ERROR) {
+ goto error;
+ }
+ if (ropts->scale <= 0.0) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "-scale value must be positive", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE",
+ NULL);
+ goto error;
+ }
+ break;
+ case OPT_SCALE_TO_HEIGHT:
+ if (Tcl_GetIntFromObj(interp, objv[0], &ropts->scaleToHeight) ==
+ TCL_ERROR) {
+ goto error;
+ }
+ if (ropts->scaleToHeight <= 0) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "-scaletoheight value must be positive", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE",
+ NULL);
+ goto error;
+ }
+ break;
+ case OPT_SCALE_TO_WIDTH:
+ if (Tcl_GetIntFromObj(interp, objv[0], &ropts->scaleToWidth) ==
+ TCL_ERROR) {
+ goto error;
+ }
+ if (ropts->scaleToWidth <= 0) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "-scaletowidth value must be positive", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE",
+ NULL);
+ goto error;
+ }
+ break;
+ }
+ }
+
+ nsvgImage = nsvgParse(inputCopy, "px", (float) dpi);
+ if (nsvgImage == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot parse SVG image", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "PARSE_ERROR", NULL);
+ goto error;
+ }
+ ckfree(inputCopy);
+ return nsvgImage;
+
+error:
+ if (inputCopy != NULL) {
+ ckfree(inputCopy);
+ }
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RasterizeSVG --
+ *
+ * This function is called to rasterize the given nsvgImage and
+ * fill the imageHandle with data.
+ *
+ * Results:
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in the interp's result.
+ *
+ *
+ * Side effects:
+ * On error the given nsvgImage will be deleted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+RasterizeSVG(
+ Tcl_Interp *interp,
+ Tk_PhotoHandle imageHandle,
+ NSVGimage *nsvgImage,
+ int destX, int destY,
+ int width, int height,
+ int srcX, int srcY,
+ RastOpts *ropts)
+{
+ int w, h, c;
+ NSVGrasterizer *rast;
+ unsigned char *imgData;
+ Tk_PhotoImageBlock svgblock;
+ double scale;
+ Tcl_WideUInt wh;
+ (void)srcX;
+ (void)srcY;
+
+ scale = GetScaleFromParameters(nsvgImage, ropts, &w, &h);
+
+ rast = nsvgCreateRasterizer();
+ if (rast == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot initialize rasterizer", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "RASTERIZER_ERROR",
+ NULL);
+ goto cleanAST;
+ }
+
+ /* Tk Ticket [822330269b] Check potential int overflow in following ckalloc */
+ wh = (Tcl_WideUInt)w * (Tcl_WideUInt)h;
+ if ( w < 0 || h < 0 || wh > INT_MAX / 4) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("image size overflow", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "IMAGE_SIZE_OVERFLOW", NULL);
+ goto cleanRAST;
+ }
+
+ imgData = (unsigned char *)attemptckalloc(wh * 4);
+ if (imgData == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc image buffer", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL);
+ goto cleanRAST;
+ }
+ nsvgRasterize(rast, nsvgImage, 0, 0,
+ (float) scale, imgData, w, h, w * 4);
+ /* transfer the data to a photo block */
+ svgblock.pixelPtr = imgData;
+ svgblock.width = w;
+ svgblock.height = h;
+ svgblock.pitch = w * 4;
+ svgblock.pixelSize = 4;
+ for (c = 0; c <= 3; c++) {
+ svgblock.offset[c] = c;
+ }
+ if (Tk_PhotoExpand(interp, imageHandle,
+ destX + width, destY + height) != TCL_OK) {
+ goto cleanRAST;
+ }
+ if (Tk_PhotoPutBlock(interp, imageHandle, &svgblock, destX, destY,
+ width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
+ goto cleanimg;
+ }
+ ckfree(imgData);
+ nsvgDeleteRasterizer(rast);
+ nsvgDelete(nsvgImage);
+ return TCL_OK;
+
+cleanimg:
+ ckfree(imgData);
+
+cleanRAST:
+ nsvgDeleteRasterizer(rast);
+
+cleanAST:
+ nsvgDelete(nsvgImage);
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetScaleFromParameters --
+ *
+ * Get the scale value from the already parsed parameters -scale,
+ * -scaletoheight and -scaletowidth.
+ *
+ * The image width and height is also returned.
+ *
+ * Results:
+ * The evaluated or configured scale value, or 0.0 on failure
+ *
+ * Side effects:
+ * heightPtr and widthPtr are set to height and width of the image.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static double
+GetScaleFromParameters(
+ NSVGimage *nsvgImage,
+ RastOpts *ropts,
+ int *widthPtr,
+ int *heightPtr)
+{
+ double scale;
+ int width, height;
+
+ if ((nsvgImage->width == 0.0) || (nsvgImage->height == 0.0)) {
+ width = height = 0;
+ scale = 1.0;
+ } else if (ropts->scaleToHeight > 0) {
+ /*
+ * Fixed height
+ */
+ height = ropts->scaleToHeight;
+ scale = height / nsvgImage->height;
+ width = (int) ceil(nsvgImage->width * scale);
+ } else if (ropts->scaleToWidth > 0) {
+ /*
+ * Fixed width
+ */
+ width = ropts->scaleToWidth;
+ scale = width / nsvgImage->width;
+ height = (int) ceil(nsvgImage->height * scale);
+ } else {
+ /*
+ * Scale factor
+ */
+ scale = ropts->scale;
+ width = (int) ceil(nsvgImage->width * scale);
+ height = (int) ceil(nsvgImage->height * scale);
+ }
+
+ *heightPtr = height;
+ *widthPtr = width;
+ return scale;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetCachePtr --
+ *
+ * This function is called to get the per interpreter used
+ * svg image cache.
+ *
+ * Results:
+ * Return a pointer to the used cache.
+ *
+ * Side effects:
+ * Initialize the cache on the first call.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static NSVGcache *
+GetCachePtr(
+ Tcl_Interp *interp
+) {
+ NSVGcache *cachePtr = (NSVGcache *)Tcl_GetAssocData(interp, "tksvgnano", NULL);
+ if (cachePtr == NULL) {
+ cachePtr = (NSVGcache *)ckalloc(sizeof(NSVGcache));
+ cachePtr->dataOrChan = NULL;
+ Tcl_DStringInit(&cachePtr->formatString);
+ cachePtr->nsvgImage = NULL;
+ Tcl_SetAssocData(interp, "tksvgnano", FreeCache, cachePtr);
+ }
+ return cachePtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CacheSVG --
+ *
+ * Add the given svg image informations to the cache for further usage.
+ *
+ * Results:
+ * Return 1 on success, and 0 otherwise.
+ *
+ * Side effects:
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+CacheSVG(
+ Tcl_Interp *interp,
+ ClientData dataOrChan,
+ Tcl_Obj *formatObj,
+ NSVGimage *nsvgImage,
+ RastOpts *ropts)
+{
+ TkSizeT length;
+ const char *data;
+ NSVGcache *cachePtr = GetCachePtr(interp);
+
+ if (cachePtr != NULL) {
+ cachePtr->dataOrChan = dataOrChan;
+ if (formatObj != NULL) {
+ data = Tcl_GetStringFromObj(formatObj, &length);
+ Tcl_DStringAppend(&cachePtr->formatString, data, length);
+ }
+ cachePtr->nsvgImage = nsvgImage;
+ cachePtr->ropts = *ropts;
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetCachedSVG --
+ *
+ * Try to get the NSVGimage from the internal cache.
+ *
+ * Results:
+ * Return the found NSVGimage on success, and NULL otherwise.
+ *
+ * Side effects:
+ * Calls the CleanCache() function.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static NSVGimage *
+GetCachedSVG(
+ Tcl_Interp *interp,
+ ClientData dataOrChan,
+ Tcl_Obj *formatObj,
+ RastOpts *ropts)
+{
+ TkSizeT length;
+ const char *data;
+ NSVGcache *cachePtr = GetCachePtr(interp);
+ NSVGimage *nsvgImage = NULL;
+
+ if ((cachePtr != NULL) && (cachePtr->nsvgImage != NULL) &&
+ (cachePtr->dataOrChan == dataOrChan)) {
+ if (formatObj != NULL) {
+ data = Tcl_GetStringFromObj(formatObj, &length);
+ if (strcmp(data, Tcl_DStringValue(&cachePtr->formatString)) == 0) {
+ nsvgImage = cachePtr->nsvgImage;
+ *ropts = cachePtr->ropts;
+ cachePtr->nsvgImage = NULL;
+ }
+ } else if (Tcl_DStringLength(&cachePtr->formatString) == 0) {
+ nsvgImage = cachePtr->nsvgImage;
+ *ropts = cachePtr->ropts;
+ cachePtr->nsvgImage = NULL;
+ }
+ }
+ CleanCache(interp);
+ return nsvgImage;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CleanCache --
+ *
+ * Reset the cache and delete the saved image in it.
+ *
+ * Results:
+ *
+ * Side effects:
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CleanCache(Tcl_Interp *interp)
+{
+ NSVGcache *cachePtr = GetCachePtr(interp);
+
+ if (cachePtr != NULL) {
+ cachePtr->dataOrChan = NULL;
+ Tcl_DStringSetLength(&cachePtr->formatString, 0);
+ if (cachePtr->nsvgImage != NULL) {
+ nsvgDelete(cachePtr->nsvgImage);
+ cachePtr->nsvgImage = NULL;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FreeCache --
+ *
+ * This function is called to clean up the internal cache data.
+ *
+ * Results:
+ *
+ * Side effects:
+ * Existing image data in the cache and the cache will be deleted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+FreeCache(ClientData clientData, Tcl_Interp *interp)
+{
+ NSVGcache *cachePtr = (NSVGcache *)clientData;
+ (void)interp;
+
+ Tcl_DStringFree(&cachePtr->formatString);
+ if (cachePtr->nsvgImage != NULL) {
+ nsvgDelete(cachePtr->nsvgImage);
+ }
+ ckfree(cachePtr);
+}
+
diff --git a/generic/tkImgUtil.c b/generic/tkImgUtil.c
index 5487165..e1b9c38 100644
--- a/generic/tkImgUtil.c
+++ b/generic/tkImgUtil.c
@@ -3,7 +3,7 @@
*
* This file contains image related utility functions.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -55,7 +55,7 @@ TkAlignImageData(
dataWidth += (alignment - (dataWidth % alignment));
}
- data = ckalloc(dataWidth * image->height);
+ data = (char *)ckalloc(dataWidth * image->height);
destPtr = data;
for (i = 0; i < image->height; i++) {
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 2faf410..3f91d5e 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -4,8 +4,8 @@
# are exported by the Tk library. This file is used to generate the
# tkIntDecls.h, tkIntPlatDecls.h, tkIntStub.c, and tkPlatStub.c files.
#
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 2007 Daniel A. Steffen <das@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -99,7 +99,7 @@ declare 21 {
const TkStateMap *mapPtr, const char *strKey)
}
declare 22 {
- CONST86 char *TkFindStateString(const TkStateMap *mapPtr, int numKey)
+ const char *TkFindStateString(const TkStateMap *mapPtr, int numKey)
}
declare 23 {
void TkFocusDeadWindow(TkWindow *winPtr)
@@ -182,7 +182,7 @@ declare 45 {
void TkInstallFrameMenu(Tk_Window tkwin)
}
declare 46 {
- CONST86 char *TkKeysymToString(KeySym keysym)
+ const char *TkKeysymToString(KeySym keysym)
}
declare 47 {
int TkLineToArea(double end1Ptr[], double end2Ptr[], double rectPtr[])
@@ -288,7 +288,7 @@ declare 78 {
}
declare 79 {
int TkScrollWindow(Tk_Window tkwin, GC gc, int x, int y,
- int width, int height, int dx, int dy, TkRegion damageRgn)
+ int width, int height, int dx, int dy, Region damageRgn)
}
declare 80 {
void TkSelDeadWindow(TkWindow *winPtr)
@@ -389,7 +389,7 @@ declare 108 {
Tcl_Obj *objPtr, Tk_Window *windowPtr)
}
declare 109 {
- CONST86 char *TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr)
+ const char *TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr)
}
declare 110 {
void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont)
@@ -402,27 +402,27 @@ declare 112 {
void TkpMenuThreadInit(void)
}
declare 113 {
- int TkClipBox(TkRegion rgn, XRectangle *rect_return)
+ int XClipBox(Region rgn, XRectangle *rect_return)
}
declare 114 {
- TkRegion TkCreateRegion(void)
+ Region XCreateRegion(void)
}
declare 115 {
- int TkDestroyRegion(TkRegion rgn)
+ int XDestroyRegion(Region rgn)
}
declare 116 {
- int TkIntersectRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return)
+ int XIntersectRegion(Region sra, Region srcb, Region dr_return)
}
declare 117 {
- int TkRectInRegion(TkRegion rgn, int x, int y, unsigned int width,
+ int XRectInRegion(Region rgn, int x, int y, unsigned int width,
unsigned int height)
}
declare 118 {
- int TkSetRegion(Display *display, GC gc, TkRegion rgn)
+ int XSetRegion(Display *display, GC gc, Region rgn)
}
declare 119 {
- int TkUnionRectWithRegion(XRectangle *rect,
- TkRegion src, TkRegion dr_return)
+ int XUnionRectWithRegion(XRectangle *rect,
+ Region src, Region dr_return)
}
declare 121 aqua {
Pixmap TkpCreateNativeBitmap(Display *display, const void *source)
@@ -452,7 +452,7 @@ declare 139 {
void TkpInitKeymapInfo(TkDisplay *dispPtr)
}
declare 140 {
- TkRegion TkPhotoGetValidRegion(Tk_PhotoHandle handle)
+ Region TkPhotoGetValidRegion(Tk_PhotoHandle handle)
}
declare 141 {
TkWindow **TkWmStackorderToplevel(TkWindow *parentPtr)
@@ -467,7 +467,7 @@ declare 144 {
void TkGCCleanup(TkDisplay *dispPtr)
}
declare 145 {
- int TkSubtractRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return)
+ int XSubtractRegion(Region sra, Region srcb, Region dr_return)
}
declare 146 {
void TkStylePkgInit(TkMainInfo *mainPtr)
@@ -538,7 +538,7 @@ declare 162 {
int byteIndex, struct TkTextIndex *indexPtr)
}
declare 163 {
- int TkTextPrintIndex(const struct TkText *textPtr,
+ TkSizeT TkTextPrintIndex(const struct TkText *textPtr,
const struct TkTextIndex *indexPtr, char *string)
}
declare 164 {
@@ -567,51 +567,51 @@ declare 168 {
# Next group of functions exposed due to [Bug 2768945].
declare 169 {
int TkStateParseProc(ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, const char *value, char *widgRec, int offset)
+ Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset)
}
declare 170 {
- CONST86 char *TkStatePrintProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+ const char *TkStatePrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr)
}
declare 171 {
int TkCanvasDashParseProc(ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, const char *value, char *widgRec, int offset)
+ Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset)
}
declare 172 {
- CONST86 char *TkCanvasDashPrintProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+ const char *TkCanvasDashPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr)
}
declare 173 {
int TkOffsetParseProc(ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, const char *value, char *widgRec, int offset)
+ Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset)
}
declare 174 {
- CONST86 char *TkOffsetPrintProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+ const char *TkOffsetPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr)
}
declare 175 {
int TkPixelParseProc(ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, const char *value, char *widgRec, int offset)
+ Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset)
}
declare 176 {
- CONST86 char *TkPixelPrintProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+ const char *TkPixelPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr)
}
declare 177 {
int TkOrientParseProc(ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, const char *value, char *widgRec, int offset)
+ Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset)
}
declare 178 {
- CONST86 char *TkOrientPrintProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+ const char *TkOrientPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr)
}
declare 179 {
int TkSmoothParseProc(ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, const char *value, char *widgRec, int offset)
+ Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset)
}
declare 180 {
- CONST86 char *TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+ const char *TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr)
}
# Angled text API, exposed for Emiliano Gavilán's RBC work.
@@ -643,6 +643,12 @@ declare 186 macosx {
int TkpWillDrawWidget(Tk_Window tkwin)
}
+# Debugging / testing functions for photo images
+declare 187 {
+ int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data,
+ Tcl_Obj *formatString, int *widthPtr, int *heightPtr)
+}
+
##############################################################################
@@ -912,9 +918,10 @@ declare 9 aqua {
declare 10 aqua {
int TkMacOSXDispatchMenuEvent(int menuID, int index)
}
-declare 11 aqua {
- void TkMacOSXInstallCursor(int resizeOverride)
-}
+# Now a static function
+# declare 11 aqua {
+# void TkMacOSXInstallCursor(int resizeOverride)
+# }
declare 12 aqua {
void TkMacOSXHandleTearoffMenu(void)
}
@@ -986,7 +993,7 @@ declare 34 aqua {
int TkMacOSXUseMenuID(short macID)
}
declare 35 aqua {
- TkRegion TkMacOSXVisableClipRgn(TkWindow *winPtr)
+ Region TkMacOSXVisableClipRgn(TkWindow *winPtr)
}
declare 36 aqua {
void TkMacOSXWinBounds(TkWindow *winPtr, void *geometry)
@@ -1020,10 +1027,10 @@ declare 46 aqua {
int TkpIsWindowFloating(void *window)
}
declare 47 aqua {
- Tk_Window TkMacOSXGetCapture(void)
+ Tk_Window TkpGetCapture(void)
}
declare 49 aqua {
- Tk_Window TkGetTransientMaster(TkWindow *winPtr)
+ Tk_Window TkMacOSXGetContainer(TkWindow *winPtr)
}
declare 50 aqua {
int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state)
@@ -1499,386 +1506,566 @@ declare 137 win {
int sx, int sy, int dx, int dy,
unsigned int w, unsigned int h)
}
+declare 138 win {
+ Region XPolygonRegion(XPoint *pts, int n, int rule)
+}
+declare 139 win {
+ int XPointInRegion(Region rgn, int x, int y)
+}
+# For XIM
+declare 140 win {
+ XVaNestedList XVaCreateNestedList(int dummy, ...)
+}
+declare 141 win {
+ char *XSetICValues(XIC xic, ...)
+}
+declare 142 win {
+ char *XGetICValues(XIC xic, ...)
+}
+declare 143 win {
+ void XSetICFocus(XIC xic)
+}
+declare 147 win {
+ void XFreeFontSet(Display *display, XFontSet fontset)
+}
+declare 148 win {
+ int XCloseIM(XIM im)
+}
+declare 149 win {
+ Bool XRegisterIMInstantiateCallback(Display *dpy, struct _XrmHashBucketRec *rbd,
+ char *res_name, char *res_class, XIDProc callback, XPointer client_data)
+}
+declare 150 win {
+ Bool XUnregisterIMInstantiateCallback(Display *dpy, struct _XrmHashBucketRec *rbd,
+ char *res_name, char *res_class, XIDProc callback, XPointer client_data)
+}
+declare 151 win {
+ char *XSetLocaleModifiers(const char *modifier_list)
+}
+declare 152 win {
+ XIM XOpenIM(Display *dpy, struct _XrmHashBucketRec *rdb, char *res_name,
+ char *res_class)
+}
+declare 153 win {
+ char *XGetIMValues(XIM im, ...)
+}
+declare 154 win {
+ char *XSetIMValues(XIM im, ...)
+}
+declare 155 win {
+ XFontSet XCreateFontSet(Display *display, _Xconst char *base_font_name_list,
+ char ***missing_charset_list, int *missing_charset_count, char **def_string)
+}
+declare 156 win {
+ void XFreeStringList(char **list)
+}
+declare 157 win {
+ KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i)
+}
declare 158 win {
- void TkUnusedStubEntry(void)
+ Display *XkbOpenDisplay(const char *name, int *ev_rtrn, int *err_rtrn,
+ int *major_rtrn, int *minor_rtrn, int *reason)
}
################################
-# X functions for Aqua
+# X functions for MacOSX
-declare 0 aqua {
+declare 0 macosx {
int XSetDashes(Display *display, GC gc, int dash_offset,
_Xconst char *dash_list, int n)
}
-declare 1 aqua {
+declare 1 macosx {
XModifierKeymap *XGetModifierMapping(Display *d)
}
-declare 2 aqua {
+declare 2 macosx {
XImage *XCreateImage(Display *d, Visual *v, unsigned int ui1, int i1,
int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3,
int i4)
}
-declare 3 aqua {
+declare 3 macosx {
XImage *XGetImage(Display *d, Drawable dr, int i1, int i2,
unsigned int ui1, unsigned int ui2, unsigned long ul, int i3)
}
-declare 4 aqua {
+declare 4 macosx {
char *XGetAtomName(Display *d, Atom a)
}
-declare 5 aqua {
+declare 5 macosx {
char *XKeysymToString(KeySym k)
}
-declare 6 aqua {
+declare 6 macosx {
Colormap XCreateColormap(Display *d, Window w, Visual *v, int i)
}
-declare 7 aqua {
+declare 7 macosx {
GContext XGContextFromGC(GC g)
}
-declare 8 aqua {
- KeySym XKeycodeToKeysym(Display *d, KeyCode k, int i)
+# second parameter was of type KeyCode
+declare 8 macosx {
+ KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i)
}
-declare 9 aqua {
+declare 9 macosx {
KeySym XStringToKeysym(_Xconst char *c)
}
-declare 10 aqua {
+declare 10 macosx {
Window XRootWindow(Display *d, int i)
}
-declare 11 aqua {
+declare 11 macosx {
XErrorHandler XSetErrorHandler(XErrorHandler x)
}
-declare 12 aqua {
+declare 12 macosx {
Status XAllocColor(Display *d, Colormap c, XColor *xp)
}
-declare 13 aqua {
+declare 13 macosx {
int XBell(Display *d, int i)
}
-declare 14 aqua {
+declare 14 macosx {
int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1,
int i2, _Xconst unsigned char *c, int i3)
}
-declare 15 aqua {
+declare 15 macosx {
int XChangeWindowAttributes(Display *d, Window w, unsigned long ul,
XSetWindowAttributes *x)
}
-declare 16 aqua {
+declare 16 macosx {
int XConfigureWindow(Display *d, Window w, unsigned int i,
XWindowChanges *x)
}
-declare 17 aqua {
+declare 17 macosx {
int XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1,
int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)
}
-declare 18 aqua {
+declare 18 macosx {
int XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1,
int i2, unsigned int ui1,
unsigned int ui2, int i3, int i4, unsigned long ul)
}
-declare 19 aqua {
+declare 19 macosx {
Pixmap XCreateBitmapFromData(Display *display, Drawable d,
_Xconst char *data, unsigned int width, unsigned int height)
}
-declare 20 aqua {
+declare 20 macosx {
int XDefineCursor(Display *d, Window w, Cursor c)
}
-declare 21 aqua {
+declare 21 macosx {
int XDestroyWindow(Display *d, Window w)
}
-declare 22 aqua {
+declare 22 macosx {
int XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2,
unsigned int ui1, unsigned int ui2, int i3, int i4)
}
-declare 23 aqua {
+declare 23 macosx {
int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)
}
-declare 24 aqua {
+declare 24 macosx {
int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2,
unsigned int ui1, unsigned int ui2)
}
-declare 25 aqua {
+declare 25 macosx {
int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2,
unsigned int ui1, unsigned int ui2, int i3, int i4)
}
-declare 26 aqua {
+declare 26 macosx {
int XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x,
int i1, int i2, int i3)
}
-declare 27 aqua {
+declare 27 macosx {
int XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i)
}
-declare 28 aqua {
+declare 28 macosx {
int XFreeColormap(Display *d, Colormap c)
}
-declare 29 aqua {
+declare 29 macosx {
int XFreeColors(Display *d, Colormap c,
unsigned long *ulp, int i, unsigned long ul)
}
-declare 30 aqua {
+declare 30 macosx {
int XFreeModifiermap(XModifierKeymap *x)
}
-declare 31 aqua {
+declare 31 macosx {
Status XGetGeometry(Display *d, Drawable dr, Window *w, int *i1,
int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3,
unsigned int *ui4)
}
-declare 32 aqua {
+declare 32 macosx {
int XGetWindowProperty(Display *d, Window w, Atom a1, long l1, long l2,
Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1,
unsigned long *ulp2, unsigned char **cpp)
}
-declare 33 aqua {
+declare 33 macosx {
int XGrabKeyboard(Display *d, Window w, Bool b, int i1, int i2, Time t)
}
-declare 34 aqua {
+declare 34 macosx {
int XGrabPointer(Display *d, Window w1, Bool b, unsigned int ui,
int i1, int i2, Window w2, Cursor c, Time t)
}
-declare 35 aqua {
+declare 35 macosx {
KeyCode XKeysymToKeycode(Display *d, KeySym k)
}
-declare 36 aqua {
+declare 36 macosx {
int XMapWindow(Display *d, Window w)
}
-declare 37 aqua {
+declare 37 macosx {
int XMoveResizeWindow(Display *d, Window w, int i1, int i2,
unsigned int ui1, unsigned int ui2)
}
-declare 38 aqua {
+declare 38 macosx {
int XMoveWindow(Display *d, Window w, int i1, int i2)
}
-declare 39 aqua {
+declare 39 macosx {
Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3,
int *i1, int *i2, int *i3, int *i4, unsigned int *ui)
}
-declare 40 aqua {
+declare 40 macosx {
int XRaiseWindow(Display *d, Window w)
}
-declare 41 aqua {
+declare 41 macosx {
int XRefreshKeyboardMapping(XMappingEvent *x)
}
-declare 42 aqua {
+declare 42 macosx {
int XResizeWindow(Display *d, Window w, unsigned int ui1,
unsigned int ui2)
}
-declare 43 aqua {
+declare 43 macosx {
int XSelectInput(Display *d, Window w, long l)
}
-declare 44 aqua {
+declare 44 macosx {
Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x)
}
-declare 45 aqua {
+declare 45 macosx {
int XSetIconName(Display *d, Window w, _Xconst char *c)
}
-declare 46 aqua {
+declare 46 macosx {
int XSetInputFocus(Display *d, Window w, int i, Time t)
}
-declare 47 aqua {
+declare 47 macosx {
int XSetSelectionOwner(Display *d, Atom a, Window w, Time t)
}
-declare 48 aqua {
+declare 48 macosx {
int XSetWindowBackground(Display *d, Window w, unsigned long ul)
}
-declare 49 aqua {
+declare 49 macosx {
int XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p)
}
-declare 50 aqua {
+declare 50 macosx {
int XSetWindowBorder(Display *d, Window w, unsigned long ul)
}
-declare 51 aqua {
+declare 51 macosx {
int XSetWindowBorderPixmap(Display *d, Window w, Pixmap p)
}
-declare 52 aqua {
+declare 52 macosx {
int XSetWindowBorderWidth(Display *d, Window w, unsigned int ui)
}
-declare 53 aqua {
+declare 53 macosx {
int XSetWindowColormap(Display *d, Window w, Colormap c)
}
-declare 54 aqua {
+declare 54 macosx {
int XUngrabKeyboard(Display *d, Time t)
}
-declare 55 aqua {
+declare 55 macosx {
int XUngrabPointer(Display *d, Time t)
}
-declare 56 aqua {
+declare 56 macosx {
int XUnmapWindow(Display *d, Window w)
}
-declare 57 aqua {
+declare 57 macosx {
int TkPutImage(unsigned long *colors, int ncolors, Display *display,
Drawable d, GC gc, XImage *image, int src_x, int src_y,
int dest_x, int dest_y, unsigned int width, unsigned int height)
}
-declare 58 aqua {
+declare 58 macosx {
Status XParseColor(Display *display, Colormap map,
_Xconst char *spec, XColor *colorPtr)
}
-declare 59 aqua {
+declare 59 macosx {
GC XCreateGC(Display *display, Drawable d,
unsigned long valuemask, XGCValues *values)
}
-declare 60 aqua {
+declare 60 macosx {
int XFreeGC(Display *display, GC gc)
}
-declare 61 aqua {
+declare 61 macosx {
Atom XInternAtom(Display *display, _Xconst char *atom_name,
Bool only_if_exists)
}
-declare 62 aqua {
+declare 62 macosx {
int XSetBackground(Display *display, GC gc, unsigned long foreground)
}
-declare 63 aqua {
+declare 63 macosx {
int XSetForeground(Display *display, GC gc, unsigned long foreground)
}
-declare 64 aqua {
+declare 64 macosx {
int XSetClipMask(Display *display, GC gc, Pixmap pixmap)
}
-declare 65 aqua {
+declare 65 macosx {
int XSetClipOrigin(Display *display, GC gc,
int clip_x_origin, int clip_y_origin)
}
-declare 66 aqua {
+declare 66 macosx {
int XSetTSOrigin(Display *display, GC gc,
int ts_x_origin, int ts_y_origin)
}
-declare 67 aqua {
+declare 67 macosx {
int XChangeGC(Display *d, GC gc, unsigned long mask, XGCValues *values)
}
-declare 68 aqua {
+declare 68 macosx {
int XSetFont(Display *display, GC gc, Font font)
}
-declare 69 aqua {
+declare 69 macosx {
int XSetArcMode(Display *display, GC gc, int arc_mode)
}
-declare 70 aqua {
+declare 70 macosx {
int XSetStipple(Display *display, GC gc, Pixmap stipple)
}
-declare 71 aqua {
+declare 71 macosx {
int XSetFillRule(Display *display, GC gc, int fill_rule)
}
-declare 72 aqua {
+declare 72 macosx {
int XSetFillStyle(Display *display, GC gc, int fill_style)
}
-declare 73 aqua {
+declare 73 macosx {
int XSetFunction(Display *display, GC gc, int function)
}
-declare 74 aqua {
+declare 74 macosx {
int XSetLineAttributes(Display *display, GC gc, unsigned int line_width,
int line_style, int cap_style, int join_style)
}
-declare 75 aqua {
+declare 75 macosx {
int _XInitImageFuncPtrs(XImage *image)
}
-declare 76 aqua {
+declare 76 macosx {
XIC XCreateIC(XIM xim, ...)
}
-declare 77 aqua {
+declare 77 macosx {
XVisualInfo *XGetVisualInfo(Display *display, long vinfo_mask,
XVisualInfo *vinfo_template, int *nitems_return)
}
-declare 78 aqua {
+declare 78 macosx {
void XSetWMClientMachine(Display *display, Window w,
XTextProperty *text_prop)
}
-declare 79 aqua {
+declare 79 macosx {
Status XStringListToTextProperty(char **list, int count,
XTextProperty *text_prop_return)
}
-declare 80 aqua {
+declare 80 macosx {
int XDrawSegments(Display *display, Drawable d, GC gc,
XSegment *segments, int nsegments)
}
-declare 81 aqua {
+declare 81 macosx {
int XForceScreenSaver(Display *display, int mode)
}
-declare 82 aqua {
+declare 82 macosx {
int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1,
int x2, int y2)
}
-declare 83 aqua {
+declare 83 macosx {
int XFillRectangle(Display *display, Drawable d, GC gc,
int x, int y, unsigned int width, unsigned int height)
}
-declare 84 aqua {
+declare 84 macosx {
int XClearWindow(Display *d, Window w)
}
-declare 85 aqua {
+declare 85 macosx {
int XDrawPoint(Display *display, Drawable d, GC gc, int x, int y)
}
-declare 86 aqua {
+declare 86 macosx {
int XDrawPoints(Display *display, Drawable d, GC gc, XPoint *points,
int npoints, int mode)
}
-declare 87 aqua {
+declare 87 macosx {
int XWarpPointer(Display *display, Window src_w, Window dest_w,
int src_x, int src_y, unsigned int src_width,
unsigned int src_height, int dest_x, int dest_y)
}
-declare 88 aqua {
+declare 88 macosx {
int XQueryColor(Display *display, Colormap colormap, XColor *def_in_out)
}
-declare 89 aqua {
+declare 89 macosx {
int XQueryColors(Display *display, Colormap colormap,
XColor *defs_in_out, int ncolors)
}
-declare 90 aqua {
+declare 90 macosx {
Status XQueryTree(Display *d, Window w1, Window *w2, Window *w3,
Window **w4, unsigned int *ui)
}
-declare 91 aqua {
+declare 91 macosx {
int XSync(Display *display, Bool discard)
}
-declare 106 aqua {
+declare 92 macosx {
+ Bool XTranslateCoordinates(Display *d, Window w1, Window w2, int i1,
+ int i2, int *i3, int *i4, Window *w3)
+}
+declare 93 macosx {
+ int XDeleteProperty(Display *d, Window w, Atom a)
+}
+declare 94 macosx {
+ int XFreeCursor(Display *d, Cursor c)
+}
+declare 95 macosx {
+ int XGetInputFocus(Display *d, Window *w, int *i)
+}
+declare 96 macosx {
+ int XmbLookupString(XIC xi, XKeyPressedEvent *xk, char *c, int i,
+ KeySym *k, Status *s)
+}
+declare 97 macosx {
+ int XNextEvent(Display *d, XEvent *x)
+}
+declare 98 macosx {
+ int XPutBackEvent(Display *d, XEvent *x)
+}
+declare 99 macosx {
+ int XSetCommand(Display *d, Window w, char **c, int i)
+}
+declare 100 macosx {
+ int XWindowEvent(Display *d, Window w, long l, XEvent *x)
+}
+declare 101 macosx {
+ Status XGetWindowAttributes(Display *d, Window w, XWindowAttributes *x)
+}
+declare 102 macosx {
+ Status XGetWMColormapWindows(Display *d, Window w, Window **wpp, int *ip)
+}
+declare 103 macosx {
+ Status XIconifyWindow(Display *d, Window w, int i)
+}
+declare 104 macosx {
+ Status XWithdrawWindow(Display *d, Window w, int i)
+}
+declare 105 macosx {
+ XHostAddress *XListHosts(Display *d, int *i, Bool *b)
+}
+declare 106 macosx {
int XSetClipRectangles(Display *display, GC gc, int clip_x_origin,
int clip_y_origin, XRectangle rectangles[], int n, int ordering)
}
-
-declare 107 aqua {
+declare 107 macosx {
int XFlush(Display *display)
}
-declare 108 aqua {
+declare 108 macosx {
int XGrabServer(Display *display)
}
-declare 109 aqua {
+declare 109 macosx {
int XUngrabServer(Display *display)
}
-declare 110 aqua {
+declare 110 macosx {
int XFree(void *data)
}
-declare 111 aqua {
+declare 111 macosx {
int XNoOp(Display *display)
}
-declare 112 aqua {
+declare 112 macosx {
XAfterFunction XSynchronize(Display *display, Bool onoff)
}
-declare 114 aqua {
+declare 113 macosx {
+ Status XLookupColor(Display *d, Colormap c1, _Xconst char *c2,
+ XColor *x1, XColor *x2)
+}
+declare 114 macosx {
VisualID XVisualIDFromVisual(Visual *visual)
}
-declare 120 aqua {
- int XOffsetRegion(void *rgn, int dx, int dy)
+declare 120 macosx {
+ int XOffsetRegion(Region rgn, int dx, int dy)
}
-declare 129 aqua {
+declare 121 macosx {
+ int XUnionRegion(Region srca, Region srcb, Region dr_return)
+}
+declare 122 macosx {
+ Window XCreateWindow(Display *display, Window parent, int x, int y,
+ unsigned int width, unsigned int height,
+ unsigned int border_width, int depth, unsigned int clazz,
+ Visual *visual, unsigned long value_mask,
+ XSetWindowAttributes *attributes)
+}
+declare 129 macosx {
int XLowerWindow(Display *d, Window w)
}
-declare 137 aqua {
+declare 130 macosx {
+ int XFillArcs(Display *d, Drawable dr, GC gc, XArc *a, int n)
+}
+declare 131 macosx {
+ int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a, int n)
+}
+declare 132 macosx {
+ int XDrawRectangles(Display *d, Drawable dr, GC gc, XRectangle *r, int n)
+}
+declare 136 macosx {
+ int XReparentWindow(Display *d, Window w, Window p, int x, int y)
+}
+declare 137 macosx {
int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
int sx, int sy, int dx, int dy,
unsigned int w, unsigned int h)
}
-declare 144 aqua {
+declare 138 macosx {
+ Region XPolygonRegion(XPoint *pts, int n, int rule)
+}
+declare 139 macosx {
+ int XPointInRegion(Region rgn, int x, int y)
+}
+declare 140 macosx {
+ XVaNestedList XVaCreateNestedList(int dummy, ...)
+}
+declare 141 macosx {
+ char *XSetICValues(XIC xic, ...)
+}
+declare 142 macosx {
+ char *XGetICValues(XIC xic, ...)
+}
+declare 143 macosx {
+ void XSetICFocus(XIC xic)
+}
+declare 144 macosx {
void XDestroyIC(XIC xic)
}
-declare 145 aqua {
+declare 145 macosx {
Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2,
XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2)
}
-declare 146 aqua {
+declare 146 macosx {
Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2,
unsigned int ui1, unsigned int ui2, XColor _Xconst *x1,
XColor _Xconst *x2)
}
-declare 157 aqua {
+declare 147 macosx {
+ void XFreeFontSet(Display *display, XFontSet fontset)
+}
+declare 148 macosx {
+ int XCloseIM(XIM im)
+}
+declare 149 macosx {
+ Bool XRegisterIMInstantiateCallback(Display *dpy, struct _XrmHashBucketRec *rbd,
+ char *res_name, char *res_class, XIDProc callback, XPointer client_data)
+}
+declare 150 macosx {
+ Bool XUnregisterIMInstantiateCallback(Display *dpy, struct _XrmHashBucketRec *rbd,
+ char *res_name, char *res_class, XIDProc callback, XPointer client_data)
+}
+declare 151 macosx {
+ char *XSetLocaleModifiers(const char *modifier_list)
+}
+declare 152 macosx {
+ XIM XOpenIM(Display *dpy, struct _XrmHashBucketRec *rdb, char *res_name,
+ char *res_class)
+}
+declare 153 macosx {
+ char *XGetIMValues(XIM im, ...)
+}
+declare 154 macosx {
+ char *XSetIMValues(XIM im, ...)
+}
+declare 155 macosx {
+ XFontSet XCreateFontSet(Display *display, _Xconst char *base_font_name_list,
+ char ***missing_charset_list, int *missing_charset_count, char **def_string)
+}
+declare 156 macosx {
+ void XFreeStringList(char **list)
+}
+declare 157 macosx {
KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i)
}
-declare 158 aqua {
- void TkUnusedStubEntry(void)
+declare 158 macosx {
+ Display *XkbOpenDisplay(const char *name, int *ev_rtrn, int *err_rtrn,
+ int *major_rtrn, int *minor_rtrn, int *reason)
}
# Local Variables:
diff --git a/generic/tkInt.h b/generic/tkInt.h
index fe8f16e..75283f5 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998 by Scriptics Corporation.
+ * Copyright (c) 1998 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -25,7 +25,6 @@
* Darwin (where configure runs only once for multiple architectures).
*/
-#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
@@ -74,14 +73,19 @@
# endif
#endif
-#if defined(_WIN32) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7)
-# if TCL_UTF_MAX > 3
-# define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf((TCHAR *)(a),(b)*sizeof(WCHAR),c)
-# define Tcl_UtfToWCharDString(a,b,c) (WCHAR *)Tcl_WinUtfToTChar(a,b,c)
-# else
-# define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString)
-# define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString)
-# endif
+#ifndef TkSizeT
+# if TCL_MAJOR_VERSION > 8
+# define TkSizeT size_t
+# else
+# define TkSizeT int
+# endif
+#endif
+
+#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7)
+# define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString)
+# define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString)
+# define Tcl_Char16ToUtfDString Tcl_UniCharToUtfDString
+# define Tcl_UtfToChar16DString Tcl_UtfToUniCharDString
#endif
#if defined(__GNUC__) && (__GNUC__ > 2)
@@ -90,7 +94,7 @@
# define TKFLEXARRAY 1
#endif
-#ifndef Tcl_GetParent
+#if !defined(Tcl_GetParent) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7)
# define Tcl_GetParent Tcl_GetMaster
#endif
@@ -103,22 +107,33 @@
#if !defined(INT2PTR) && !defined(PTR2INT)
# if defined(HAVE_INTPTR_T) || defined(intptr_t)
# define INT2PTR(p) ((void*)(intptr_t)(p))
-# define PTR2INT(p) ((int)(intptr_t)(p))
+# define PTR2INT(p) ((intptr_t)(p))
# else
# define INT2PTR(p) ((void*)(p))
-# define PTR2INT(p) ((int)(p))
+# define PTR2INT(p) ((long)(p))
# endif
#endif
#if !defined(UINT2PTR) && !defined(PTR2UINT)
# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
# define UINT2PTR(p) ((void*)(uintptr_t)(p))
-# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
+# define PTR2UINT(p) ((uintptr_t)(p))
# else
# define UINT2PTR(p) ((void*)(p))
-# define PTR2UINT(p) ((unsigned int)(p))
+# define PTR2UINT(p) ((unsigned long)(p))
# endif
#endif
+/*
+ * Fallback in case Tk is linked against a Tcl version not having TIP #585
+ * (TCL_INDEX_TEMP_TABLE flag). This allows to use the internal
+ * INDEX_TEMP_TABLE flag of Tcl. However this is rather ugly and not robust
+ * since nothing prevents Tcl from changing the value of its internal flags!
+ */
+
+#if !defined(TCL_INDEX_TEMP_TABLE)
+# define TCL_INDEX_TEMP_TABLE 2
+#endif
+
#ifndef TCL_Z_MODIFIER
# if defined(_WIN64)
# define TCL_Z_MODIFIER "I"
@@ -128,6 +143,12 @@
# define TCL_Z_MODIFIER ""
# endif
#endif /* !TCL_Z_MODIFIER */
+#undef TCL_LL_MODIFIER
+#if defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO)
+# define TCL_LL_MODIFIER "I64"
+#else
+# define TCL_LL_MODIFIER "ll"
+#endif
/*
* Opaque type declarations:
@@ -137,7 +158,7 @@ typedef struct TkColormap TkColormap;
typedef struct TkFontAttributes TkFontAttributes;
typedef struct TkGrabEvent TkGrabEvent;
typedef struct TkpCursor_ *TkpCursor;
-typedef struct TkRegion_ *TkRegion;
+#define TkRegion Region
typedef struct TkStressedCmap TkStressedCmap;
typedef struct TkBindInfo_ *TkBindInfo;
typedef struct Busy *TkBusy;
@@ -152,7 +173,7 @@ typedef struct TkCursor {
Tk_Cursor cursor; /* System specific identifier for cursor. */
Display *display; /* Display containing cursor. Needed for
* disposal and retrieval of cursors. */
- int resourceRefCount; /* Number of active uses of this cursor (each
+ TkSizeT resourceRefCount; /* Number of active uses of this cursor (each
* active use corresponds to a call to
* Tk_AllocPreserveFromObj or Tk_Preserve). If
* this count is 0, then this structure is no
@@ -161,7 +182,7 @@ typedef struct TkCursor {
* there are objects referring to it. The
* structure is freed when resourceRefCount
* and objRefCount are both 0. */
- int objRefCount; /* Number of Tcl objects that reference this
+ TkSizeT objRefCount; /* Number of Tcl objects that reference this
* structure.. */
Tcl_HashTable *otherTable; /* Second table (other than idTable) used to
* index this entry. */
@@ -196,6 +217,8 @@ typedef struct TkCaret {
* specific data, since each thread will have its own TkDisplay structure.
*/
+typedef enum TkLockUsage {LU_IGNORE, LU_CAPS, LU_SHIFT} TkLockUsage;
+
typedef struct TkDisplay {
Display *display; /* Xlib's info about display. */
struct TkDisplay *nextPtr; /* Next in list of all displays. */
@@ -237,7 +260,7 @@ typedef struct TkDisplay {
unsigned int altModMask; /* Has one bit set to indicate the modifier
* corresponding to the "Meta" key. If no such
* modifier, then this is zero. */
- enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
+ TkLockUsage lockUsage;
/* Indicates how to interpret lock
* modifier. */
int numModKeyCodes; /* Number of entries in modKeyCodes array
@@ -311,7 +334,7 @@ typedef struct TkDisplay {
/* First in list of error handlers for this
* display. NULL means no handlers exist at
* present. */
- int deleteCount; /* Counts # of handlers deleted since last
+ TkSizeT deleteCount; /* Counts # of handlers deleted since last
* time inactive handlers were garbage-
* collected. When this number gets big,
* handlers get cleaned up. */
@@ -446,9 +469,9 @@ typedef struct TkDisplay {
*/
int placeInit; /* 0 means tables below need initializing. */
- Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
+ Tcl_HashTable containerTable; /* Maps from Tk_Window token to the Container
* structure for the window, if it exists. */
- Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave
+ Tcl_HashTable contentTable; /* Maps from Tk_Window token to the Content
* structure for the window, if it exists. */
/*
@@ -520,14 +543,14 @@ typedef struct TkDisplay {
* Miscellaneous information:
*/
-#ifdef TK_USE_INPUT_METHODS
+#if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8)
XIM inputMethod; /* Input method for this display. */
XIMStyle inputStyle; /* Input style selected for this display. */
XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */
#endif /* TK_USE_INPUT_METHODS */
Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
- int refCount; /* Reference count of how many Tk applications
+ TkSizeT refCount; /* Reference count of how many Tk applications
* are using this display. Used to clean up
* the display when we no longer have any Tk
* applications using it. */
@@ -536,10 +559,17 @@ typedef struct TkDisplay {
* The following field were all added for Tk8.3
*/
+#if TCL_MAJOR_VERSION < 9
+#if !defined(TK_NO_DEPRECATED)
int mouseButtonState; /* Current mouse button state for this
* display. NOT USED as of 8.6.10 */
Window mouseButtonWindow; /* Window the button state was set in, added
* in Tk 8.4. */
+#else
+ int notused1;
+ XID notused2;
+#endif /* !TK_NO_DEPRECATED */
+#endif
Tk_Window warpWindow;
Tk_Window warpMainwin; /* For finding the root window for warping
* purposes. */
@@ -557,8 +587,11 @@ typedef struct TkDisplay {
int iconDataSize; /* Size of default iconphoto image data. */
unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */
-#ifdef TK_USE_INPUT_METHODS
int ximGeneration; /* Used to invalidate XIC */
+#if !defined(TK_USE_INPUT_METHODS) && (TCL_MAJOR_VERSION < 9)
+ XIM inputMethod; /* Input method for this display. */
+ XIMStyle inputStyle; /* Input style selected for this display. */
+ XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */
#endif /* TK_USE_INPUT_METHODS */
} TkDisplay;
@@ -570,15 +603,11 @@ typedef struct TkDisplay {
* Whether to use input methods for this display
* TK_DISPLAY_WM_TRACING: (default off)
* Whether we should do wm tracing on this display.
- * TK_DISPLAY_IN_WARP: (default off)
- * Indicates that we are in a pointer warp
*/
#define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0)
#define TK_DISPLAY_USE_IM (1 << 1)
#define TK_DISPLAY_WM_TRACING (1 << 3)
-#define TK_DISPLAY_IN_WARP (1 << 4)
-#define TK_DISPLAY_USE_XKB (1 << 5)
/*
* One of the following structures exists for each error handler created by a
@@ -631,7 +660,7 @@ typedef struct TkEventHandler {
*/
typedef struct TkMainInfo {
- int refCount; /* Number of windows whose "mainPtr" fields
+ TkSizeT refCount; /* Number of windows whose "mainPtr" fields
* point here. When this becomes zero, can
* free up the structure (the reference count
* is zero because windows can get deleted in
@@ -642,7 +671,11 @@ typedef struct TkMainInfo {
Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow
* structs for all windows related to this
* main window. Managed by tkWindow.c. */
- long deletionEpoch; /* Incremented by window deletions. */
+#if TCL_MAJOR_VERSION > 8
+ size_t deletionEpoch; /* Incremented by window deletions. */
+#else
+ long deletionEpoch;
+#endif
Tk_BindingTable bindingTable;
/* Used in conjunction with "bind" command to
* bind events to Tcl commands. */
@@ -783,7 +816,7 @@ typedef struct TkWindow {
TkEventHandler *handlerList;/* First in list of event handlers declared
* for this window, or NULL if none. */
-#ifdef TK_USE_INPUT_METHODS
+#if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8)
XIC inputContext; /* XIM input context. */
#endif /* TK_USE_INPUT_METHODS */
@@ -864,7 +897,7 @@ typedef struct TkWindow {
int minReqWidth; /* Minimum requested width. */
int minReqHeight; /* Minimum requested height. */
-#ifdef TK_USE_INPUT_METHODS
+#if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8)
int ximGeneration; /* Used to invalidate XIC */
#endif /* TK_USE_INPUT_METHODS */
char *geomMgrName; /* Records the name of the geometry manager. */
@@ -872,6 +905,10 @@ typedef struct TkWindow {
/* The geometry container for this window. The
* value is NULL if the window has no container or
* if its container is its parent. */
+#if !defined(TK_USE_INPUT_METHODS) && (TCL_MAJOR_VERSION < 9)
+ XIC inputContext; /* XIM input context. */
+ int ximGeneration; /* Used to invalidate XIC */
+#endif /* TK_USE_INPUT_METHODS */
} TkWindow;
/*
@@ -891,7 +928,7 @@ typedef struct {
* adding), or NULL if that has not been
* computed yet. If non-NULL, this string was
* allocated with ckalloc(). */
- int charValueLen; /* Length of string in charValuePtr when that
+ TkSizeT charValueLen; /* Length of string in charValuePtr when that
* is non-NULL. */
KeySym keysym; /* Key symbol computed after input methods
* have been invoked */
@@ -906,6 +943,15 @@ typedef struct {
#define TK_MAKE_MENU_POPUP 1
#define TK_MAKE_MENU_DROPDOWN 2
+/* See TIP #494 */
+#ifndef TCL_IO_FAILURE
+# define TCL_IO_FAILURE (-1)
+#endif
+/* See TIP #537 */
+#ifndef TCL_INDEX_NONE
+# define TCL_INDEX_NONE (-1)
+#endif
+
/*
* The following structure is used with TkMakeEnsemble to create ensemble
* commands and optionally to create sub-ensembles.
@@ -937,7 +983,7 @@ typedef struct TkpClipMask {
int type; /* TKP_CLIP_PIXMAP or TKP_CLIP_REGION. */
union {
Pixmap pixmap;
- TkRegion region;
+ Region region;
} value;
} TkpClipMask;
@@ -987,15 +1033,39 @@ typedef struct TkpClipMask {
#define EXTENDED_MASK (AnyModifier<<3)
/*
+ * Buttons 8 and 9 are the Xbuttons (left and right side-buttons). On Windows/Mac, those
+ * are known as Buttons 4 and 5. At script level, they also get the numbers 4 and 5.
+ */
+
+#ifndef Button8
+# define Button8 8
+#endif
+#ifndef Button9
+# define Button9 9
+#endif
+
+#ifndef Button6Mask
+# define Button6Mask (1<<13)
+#endif
+#ifndef Button7Mask
+# define Button7Mask (1<<14)
+#endif
+#ifndef Button8Mask
+# define Button8Mask (AnyModifier<<4)
+#endif
+#ifndef Button9Mask
+# define Button9Mask (AnyModifier<<5)
+#endif
+
+/*
* Mask that selects any of the state bits corresponding to buttons, plus
* masks that select individual buttons' bits:
*/
#define ALL_BUTTONS \
- (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
-
+ (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask \
+ |Button6Mask|Button7Mask|Button8Mask|Button9Mask)
-MODULE_SCOPE unsigned TkGetButtonMask(unsigned);
/*
* Object types not declared in tkObj.c need to be mentioned here so they can
@@ -1017,10 +1087,12 @@ MODULE_SCOPE const Tcl_ObjType tkTextIndexType;
MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod;
MODULE_SCOPE Tk_ImageType tkBitmapImageType;
-MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF;
+MODULE_SCOPE Tk_PhotoImageFormatVersion3 tkImgFmtGIF;
MODULE_SCOPE void (*tkHandleEventProc) (XEvent* eventPtr);
-MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPNG;
+MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtDefault;
+MODULE_SCOPE Tk_PhotoImageFormatVersion3 tkImgFmtPNG;
MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM;
+MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtSVGnano;
MODULE_SCOPE TkMainInfo *tkMainWindowList;
MODULE_SCOPE Tk_ImageType tkPhotoImageType;
MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable;
@@ -1223,13 +1295,8 @@ MODULE_SCOPE int Tk_WinfoObjCmd(ClientData clientData,
MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *objPtr,
- double *doublePtr);
-#define TkSetGeometryContainer TkSetGeometryMaster
MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp,
Tk_Window tkwin, const char *name);
-#define TkFreeGeometryContainer TkFreeGeometryMaster
MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin,
const char *name);
@@ -1245,6 +1312,15 @@ MODULE_SCOPE int TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin,
MODULE_SCOPE int TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin,
Tk_PostscriptInfo psInfo, XImage *ximage,
int x, int y, int width, int height);
+#if TCL_MAJOR_VERSION > 8
+MODULE_SCOPE int TkCanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, const char *value, char *widgRec, size_t offset);
+MODULE_SCOPE const char *TkCanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, size_t offset, Tcl_FreeProc **freeProcPtr);
+#else
+#define TkCanvasTagsParseProc Tk_CanvasTagsParseProc
+#define TkCanvasTagsPrintProc Tk_CanvasTagsPrintProc
+#endif
MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin);
MODULE_SCOPE XEvent * TkpGetBindingXEvent(Tcl_Interp *interp);
MODULE_SCOPE void TkCreateExitHandler(Tcl_ExitProc *proc,
@@ -1253,7 +1329,7 @@ MODULE_SCOPE void TkDeleteExitHandler(Tcl_ExitProc *proc,
ClientData clientData);
MODULE_SCOPE Tcl_ExitProc TkFinalize;
MODULE_SCOPE Tcl_ExitProc TkFinalizeThread;
-MODULE_SCOPE void TkpBuildRegionFromAlphaData(TkRegion region,
+MODULE_SCOPE void TkpBuildRegionFromAlphaData(Region region,
unsigned x, unsigned y, unsigned width,
unsigned height, unsigned char *dataPtr,
unsigned pixelStride, unsigned lineStride);
@@ -1264,7 +1340,6 @@ MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp,
int *pad1Ptr, int *pad2Ptr);
MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr);
MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr);
-MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin);
MODULE_SCOPE void TkpDrawCharsInContext(Display * display,
Drawable drawable, GC gc, Tk_Font tkfont,
const char *source, int numBytes, int rangeStart,
@@ -1283,7 +1358,9 @@ MODULE_SCOPE void TkUnderlineCharsInContext(Display *display,
int firstByte, int lastByte);
MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
int c, struct TkFontAttributes *faPtr);
-MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin);
+MODULE_SCOPE void TkpDrawFrameEx(Tk_Window tkwin, Drawable drawable,
+ Tk_3DBorder border, int highlightWidth,
+ int borderWidth, int relief);
MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy);
MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy);
MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin,
@@ -1293,8 +1370,6 @@ MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef,
TkBusy busy);
MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv, int flags);
-MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin,
- const char *eventName, Tcl_Obj *detail);
MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp,
const char *nsname, const char *name,
ClientData clientData, const TkEnsemble *map);
@@ -1302,11 +1377,20 @@ MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp,
ClientData clientData);
MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp,
ClientData clientData);
+MODULE_SCOPE void TkInitEmbeddedConfigurationInformation(
+ Tcl_Interp *interp);
+MODULE_SCOPE void TkDoWarpWrtWin(TkDisplay *dispPtr);
MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr);
-MODULE_SCOPE void TkpCancelWarp(TkDisplay *dispPtr);
MODULE_SCOPE int TkListCreateFrame(ClientData clientData,
Tcl_Interp *interp, Tcl_Obj *listObj,
int toplevel, Tcl_Obj *nameObj);
+MODULE_SCOPE void TkRotatePoint(double originX, double originY,
+ double sine, double cosine, double *xPtr,
+ double *yPtr);
+MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, int lastOK, TkSizeT*);
+
+#define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1)
+#define TK_OPTION_UNDERLINE_DEF(type, field) "-1", TCL_INDEX_NONE, offsetof(type, field), 0, NULL
#ifdef _WIN32
#define TkParseColor XParseColor
@@ -1315,8 +1399,30 @@ MODULE_SCOPE Status TkParseColor (Display * display,
Colormap map, const char* spec,
XColor * colorPtr);
#endif
+#if !defined(_WIN32) && !defined(__CYGWIN__) /* UNIX and MacOSX */
+#undef TkPutImage
+#define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \
+ XPutImage(display, pixels, gc, image, srcx, srcy, destx, desty, width, height);
+#else
+#undef XPutImage
+#define XPutImage(display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \
+ TkPutImage(NULL, 0, display, pixels, gc, image, srcx, srcy, destx, desty, width, height);
+#endif
+
+/*
+ * These macros are just wrappers for the equivalent X Region calls.
+ */
+#define TkClipBox XClipBox
+#define TkCreateRegion XCreateRegion
+#define TkDestroyRegion XDestroyRegion
+#define TkIntersectRegion XIntersectRegion
+#define TkRectInRegion XRectInRegion
+#define TkSetRegion XSetRegion
+#define TkSubtractRegion XSubtractRegion
+#define TkUnionRectWithRegion XUnionRectWithRegion
+
#ifdef HAVE_XFT
-MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
+MODULE_SCOPE void TkUnixSetXftClipRegion(Region clipRegion);
#endif
#if !defined(__cplusplus) && !defined(c_plusplus)
@@ -1325,15 +1431,15 @@ MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
/* Tcl 8.6 has a different definition of Tcl_UniChar than other Tcl versions for TCL_UTF_MAX > 3 */
#if TCL_UTF_MAX > (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6))
-# define TkUtfToUniChar Tcl_UtfToUniChar
-# define TkUniCharToUtf Tcl_UniCharToUtf
-# define TkUtfPrev Tcl_UtfPrev
-# define TkUtfAtIndex Tcl_UtfAtIndex
+# define TkUtfToUniChar(src, ch) (size_t)(((int (*)(const char *, int *))Tcl_UtfToUniChar)(src, ch))
+# define TkUniCharToUtf(ch, src) (size_t)(((int (*)(int, char *))Tcl_UniCharToUtf)(ch, src))
#else
- MODULE_SCOPE int TkUtfToUniChar(const char *, int *);
- MODULE_SCOPE int TkUniCharToUtf(int, char *);
- MODULE_SCOPE const char *TkUtfPrev(const char *, const char *);
- MODULE_SCOPE const char *TkUtfAtIndex(const char *src, int index);
+ MODULE_SCOPE size_t TkUtfToUniChar(const char *, int *);
+ MODULE_SCOPE size_t TkUniCharToUtf(int, char *);
+#endif
+
+#if defined(_WIN32) && !defined(STATIC_BUILD) && TCL_MAJOR_VERSION < 9
+# define tcl_CreateFileHandler reserved9
#endif
/*
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index 7057411..2e96807 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -6,7 +6,7 @@
* interfaces are not guaranteed to remain the same between
* versions. Use at your own risk.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -15,6 +15,8 @@
#ifndef _TKINTDECLS
#define _TKINTDECLS
+#include "X11/Xutil.h"
+
#ifdef BUILD_tk
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
@@ -104,7 +106,7 @@ EXTERN int TkFindStateNum(Tcl_Interp *interp,
const char *option, const TkStateMap *mapPtr,
const char *strKey);
/* 22 */
-EXTERN CONST86 char * TkFindStateString(const TkStateMap *mapPtr,
+EXTERN const char * TkFindStateString(const TkStateMap *mapPtr,
int numKey);
/* 23 */
EXTERN void TkFocusDeadWindow(TkWindow *winPtr);
@@ -167,7 +169,7 @@ EXTERN void TkInOutEvents(XEvent *eventPtr, TkWindow *sourcePtr,
/* 45 */
EXTERN void TkInstallFrameMenu(Tk_Window tkwin);
/* 46 */
-EXTERN CONST86 char * TkKeysymToString(KeySym keysym);
+EXTERN const char * TkKeysymToString(KeySym keysym);
/* 47 */
EXTERN int TkLineToArea(double end1Ptr[], double end2Ptr[],
double rectPtr[]);
@@ -254,7 +256,7 @@ EXTERN int TkReadBitmapFile(Display *display, Drawable d,
/* 79 */
EXTERN int TkScrollWindow(Tk_Window tkwin, GC gc, int x, int y,
int width, int height, int dx, int dy,
- TkRegion damageRgn);
+ Region damageRgn);
/* 80 */
EXTERN void TkSelDeadWindow(TkWindow *winPtr);
/* 81 */
@@ -324,7 +326,7 @@ EXTERN int TkGetWindowFromObj(Tcl_Interp *interp,
Tk_Window tkwin, Tcl_Obj *objPtr,
Tk_Window *windowPtr);
/* 109 */
-EXTERN CONST86 char * TkpGetString(TkWindow *winPtr, XEvent *eventPtr,
+EXTERN const char * TkpGetString(TkWindow *winPtr, XEvent *eventPtr,
Tcl_DString *dsPtr);
/* 110 */
EXTERN void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont);
@@ -334,22 +336,22 @@ EXTERN Tcl_Obj * TkpGetSystemDefault(Tk_Window tkwin,
/* 112 */
EXTERN void TkpMenuThreadInit(void);
/* 113 */
-EXTERN int TkClipBox(TkRegion rgn, XRectangle *rect_return);
+EXTERN int XClipBox(Region rgn, XRectangle *rect_return);
/* 114 */
-EXTERN TkRegion TkCreateRegion(void);
+EXTERN Region XCreateRegion(void);
/* 115 */
-EXTERN int TkDestroyRegion(TkRegion rgn);
+EXTERN int XDestroyRegion(Region rgn);
/* 116 */
-EXTERN int TkIntersectRegion(TkRegion sra, TkRegion srcb,
- TkRegion dr_return);
+EXTERN int XIntersectRegion(Region sra, Region srcb,
+ Region dr_return);
/* 117 */
-EXTERN int TkRectInRegion(TkRegion rgn, int x, int y,
+EXTERN int XRectInRegion(Region rgn, int x, int y,
unsigned int width, unsigned int height);
/* 118 */
-EXTERN int TkSetRegion(Display *display, GC gc, TkRegion rgn);
+EXTERN int XSetRegion(Display *display, GC gc, Region rgn);
/* 119 */
-EXTERN int TkUnionRectWithRegion(XRectangle *rect, TkRegion src,
- TkRegion dr_return);
+EXTERN int XUnionRectWithRegion(XRectangle *rect, Region src,
+ Region dr_return);
/* Slot 120 is reserved */
#ifdef MAC_OSX_TK /* AQUA */
/* 121 */
@@ -390,7 +392,7 @@ EXTERN KeySym TkpGetKeySym(TkDisplay *dispPtr, XEvent *eventPtr);
/* 139 */
EXTERN void TkpInitKeymapInfo(TkDisplay *dispPtr);
/* 140 */
-EXTERN TkRegion TkPhotoGetValidRegion(Tk_PhotoHandle handle);
+EXTERN Region TkPhotoGetValidRegion(Tk_PhotoHandle handle);
/* 141 */
EXTERN TkWindow ** TkWmStackorderToplevel(TkWindow *parentPtr);
/* 142 */
@@ -400,8 +402,8 @@ EXTERN void TkClipCleanup(TkDisplay *dispPtr);
/* 144 */
EXTERN void TkGCCleanup(TkDisplay *dispPtr);
/* 145 */
-EXTERN int TkSubtractRegion(TkRegion sra, TkRegion srcb,
- TkRegion dr_return);
+EXTERN int XSubtractRegion(Region sra, Region srcb,
+ Region dr_return);
/* 146 */
EXTERN void TkStylePkgInit(TkMainInfo *mainPtr);
/* 147 */
@@ -459,7 +461,7 @@ EXTERN struct TkTextIndex * TkTextMakeByteIndex(TkTextBTree tree,
const struct TkText *textPtr, int lineIndex,
int byteIndex, struct TkTextIndex *indexPtr);
/* 163 */
-EXTERN int TkTextPrintIndex(const struct TkText *textPtr,
+EXTERN TkSizeT TkTextPrintIndex(const struct TkText *textPtr,
const struct TkTextIndex *indexPtr,
char *string);
/* 164 */
@@ -486,51 +488,57 @@ EXTERN void TkTextInsertDisplayProc(struct TkText *textPtr,
/* 169 */
EXTERN int TkStateParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- const char *value, char *widgRec, int offset);
+ const char *value, char *widgRec,
+ TkSizeT offset);
/* 170 */
-EXTERN CONST86 char * TkStatePrintProc(ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr);
+EXTERN const char * TkStatePrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec,
+ TkSizeT offset, Tcl_FreeProc **freeProcPtr);
/* 171 */
EXTERN int TkCanvasDashParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- const char *value, char *widgRec, int offset);
+ const char *value, char *widgRec,
+ TkSizeT offset);
/* 172 */
-EXTERN CONST86 char * TkCanvasDashPrintProc(ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr);
+EXTERN const char * TkCanvasDashPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec,
+ TkSizeT offset, Tcl_FreeProc **freeProcPtr);
/* 173 */
EXTERN int TkOffsetParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- const char *value, char *widgRec, int offset);
+ const char *value, char *widgRec,
+ TkSizeT offset);
/* 174 */
-EXTERN CONST86 char * TkOffsetPrintProc(ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr);
+EXTERN const char * TkOffsetPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec,
+ TkSizeT offset, Tcl_FreeProc **freeProcPtr);
/* 175 */
EXTERN int TkPixelParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- const char *value, char *widgRec, int offset);
+ const char *value, char *widgRec,
+ TkSizeT offset);
/* 176 */
-EXTERN CONST86 char * TkPixelPrintProc(ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr);
+EXTERN const char * TkPixelPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec,
+ TkSizeT offset, Tcl_FreeProc **freeProcPtr);
/* 177 */
EXTERN int TkOrientParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- const char *value, char *widgRec, int offset);
+ const char *value, char *widgRec,
+ TkSizeT offset);
/* 178 */
-EXTERN CONST86 char * TkOrientPrintProc(ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr);
+EXTERN const char * TkOrientPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec,
+ TkSizeT offset, Tcl_FreeProc **freeProcPtr);
/* 179 */
EXTERN int TkSmoothParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- const char *value, char *widgRec, int offset);
+ const char *value, char *widgRec,
+ TkSizeT offset);
/* 180 */
-EXTERN CONST86 char * TkSmoothPrintProc(ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr);
+EXTERN const char * TkSmoothPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec,
+ TkSizeT offset, Tcl_FreeProc **freeProcPtr);
/* 181 */
EXTERN void TkDrawAngledTextLayout(Display *display,
Drawable drawable, GC gc,
@@ -558,6 +566,10 @@ EXTERN void TkpRedrawWidget(Tk_Window tkwin);
/* 186 */
EXTERN int TkpWillDrawWidget(Tk_Window tkwin);
#endif /* MACOSX */
+/* 187 */
+EXTERN int TkDebugPhotoStringMatchDef(Tcl_Interp *inter,
+ Tcl_Obj *data, Tcl_Obj *formatString,
+ int *widthPtr, int *heightPtr);
typedef struct TkIntStubs {
int magic;
@@ -585,7 +597,7 @@ typedef struct TkIntStubs {
void (*tkEventDeadWindow) (TkWindow *winPtr); /* 19 */
void (*tkFillPolygon) (Tk_Canvas canvas, double *coordPtr, int numPoints, Display *display, Drawable drawable, GC gc, GC outlineGC); /* 20 */
int (*tkFindStateNum) (Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey); /* 21 */
- CONST86 char * (*tkFindStateString) (const TkStateMap *mapPtr, int numKey); /* 22 */
+ const char * (*tkFindStateString) (const TkStateMap *mapPtr, int numKey); /* 22 */
void (*tkFocusDeadWindow) (TkWindow *winPtr); /* 23 */
int (*tkFocusFilterEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 24 */
TkWindow * (*tkFocusKeyEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 25 */
@@ -609,7 +621,7 @@ typedef struct TkIntStubs {
void (*tkIncludePoint) (Tk_Item *itemPtr, double *pointPtr); /* 43 */
void (*tkInOutEvents) (XEvent *eventPtr, TkWindow *sourcePtr, TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position); /* 44 */
void (*tkInstallFrameMenu) (Tk_Window tkwin); /* 45 */
- CONST86 char * (*tkKeysymToString) (KeySym keysym); /* 46 */
+ const char * (*tkKeysymToString) (KeySym keysym); /* 46 */
int (*tkLineToArea) (double end1Ptr[], double end2Ptr[], double rectPtr[]); /* 47 */
double (*tkLineToPoint) (double end1Ptr[], double end2Ptr[], double pointPtr[]); /* 48 */
int (*tkMakeBezierCurve) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); /* 49 */
@@ -642,7 +654,7 @@ typedef struct TkIntStubs {
void (*reserved76)(void);
void (*tkQueueEventForAllChildren) (TkWindow *winPtr, XEvent *eventPtr); /* 77 */
int (*tkReadBitmapFile) (Display *display, Drawable d, const char *filename, unsigned int *width_return, unsigned int *height_return, Pixmap *bitmap_return, int *x_hot_return, int *y_hot_return); /* 78 */
- int (*tkScrollWindow) (Tk_Window tkwin, GC gc, int x, int y, int width, int height, int dx, int dy, TkRegion damageRgn); /* 79 */
+ int (*tkScrollWindow) (Tk_Window tkwin, GC gc, int x, int y, int width, int height, int dx, int dy, Region damageRgn); /* 79 */
void (*tkSelDeadWindow) (TkWindow *winPtr); /* 80 */
void (*tkSelEventProc) (Tk_Window tkwin, XEvent *eventPtr); /* 81 */
void (*tkSelInit) (Tk_Window tkwin); /* 82 */
@@ -672,17 +684,17 @@ typedef struct TkIntStubs {
TkDisplay * (*tkGetDisplayList) (void); /* 106 */
TkMainInfo * (*tkGetMainInfoList) (void); /* 107 */
int (*tkGetWindowFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 108 */
- CONST86 char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */
+ const char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */
void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */
Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 111 */
void (*tkpMenuThreadInit) (void); /* 112 */
- int (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */
- TkRegion (*tkCreateRegion) (void); /* 114 */
- int (*tkDestroyRegion) (TkRegion rgn); /* 115 */
- int (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */
- int (*tkRectInRegion) (TkRegion rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */
- int (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */
- int (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */
+ int (*xClipBox) (Region rgn, XRectangle *rect_return); /* 113 */
+ Region (*xCreateRegion) (void); /* 114 */
+ int (*xDestroyRegion) (Region rgn); /* 115 */
+ int (*xIntersectRegion) (Region sra, Region srcb, Region dr_return); /* 116 */
+ int (*xRectInRegion) (Region rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */
+ int (*xSetRegion) (Display *display, GC gc, Region rgn); /* 118 */
+ int (*xUnionRectWithRegion) (XRectangle *rect, Region src, Region dr_return); /* 119 */
void (*reserved120)(void);
#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
void (*reserved121)(void);
@@ -730,12 +742,12 @@ typedef struct TkIntStubs {
void (*tkpSetKeycodeAndState) (Tk_Window tkwin, KeySym keySym, XEvent *eventPtr); /* 137 */
KeySym (*tkpGetKeySym) (TkDisplay *dispPtr, XEvent *eventPtr); /* 138 */
void (*tkpInitKeymapInfo) (TkDisplay *dispPtr); /* 139 */
- TkRegion (*tkPhotoGetValidRegion) (Tk_PhotoHandle handle); /* 140 */
+ Region (*tkPhotoGetValidRegion) (Tk_PhotoHandle handle); /* 140 */
TkWindow ** (*tkWmStackorderToplevel) (TkWindow *parentPtr); /* 141 */
void (*tkFocusFree) (TkMainInfo *mainPtr); /* 142 */
void (*tkClipCleanup) (TkDisplay *dispPtr); /* 143 */
void (*tkGCCleanup) (TkDisplay *dispPtr); /* 144 */
- int (*tkSubtractRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 145 */
+ int (*xSubtractRegion) (Region sra, Region srcb, Region dr_return); /* 145 */
void (*tkStylePkgInit) (TkMainInfo *mainPtr); /* 146 */
void (*tkStylePkgFree) (TkMainInfo *mainPtr); /* 147 */
Tk_Window (*tkToplevelWindowForCommand) (Tcl_Interp *interp, const char *cmdName); /* 148 */
@@ -753,24 +765,24 @@ typedef struct TkIntStubs {
int (*tkTextIndexBackBytes) (const struct TkText *textPtr, const struct TkTextIndex *srcPtr, int count, struct TkTextIndex *dstPtr); /* 160 */
int (*tkTextIndexForwBytes) (const struct TkText *textPtr, const struct TkTextIndex *srcPtr, int count, struct TkTextIndex *dstPtr); /* 161 */
struct TkTextIndex * (*tkTextMakeByteIndex) (TkTextBTree tree, const struct TkText *textPtr, int lineIndex, int byteIndex, struct TkTextIndex *indexPtr); /* 162 */
- int (*tkTextPrintIndex) (const struct TkText *textPtr, const struct TkTextIndex *indexPtr, char *string); /* 163 */
+ TkSizeT (*tkTextPrintIndex) (const struct TkText *textPtr, const struct TkTextIndex *indexPtr, char *string); /* 163 */
struct TkTextSegment * (*tkTextSetMark) (struct TkText *textPtr, const char *name, struct TkTextIndex *indexPtr); /* 164 */
int (*tkTextXviewCmd) (struct TkText *textPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 165 */
void (*tkTextChanged) (struct TkSharedText *sharedTextPtr, struct TkText *textPtr, const struct TkTextIndex *index1Ptr, const struct TkTextIndex *index2Ptr); /* 166 */
int (*tkBTreeNumLines) (TkTextBTree tree, const struct TkText *textPtr); /* 167 */
void (*tkTextInsertDisplayProc) (struct TkText *textPtr, struct TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 168 */
- int (*tkStateParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 169 */
- CONST86 char * (*tkStatePrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 170 */
- int (*tkCanvasDashParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 171 */
- CONST86 char * (*tkCanvasDashPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 172 */
- int (*tkOffsetParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 173 */
- CONST86 char * (*tkOffsetPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 174 */
- int (*tkPixelParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 175 */
- CONST86 char * (*tkPixelPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 176 */
- int (*tkOrientParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 177 */
- CONST86 char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 178 */
- int (*tkSmoothParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 179 */
- CONST86 char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 180 */
+ int (*tkStateParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset); /* 169 */
+ const char * (*tkStatePrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 170 */
+ int (*tkCanvasDashParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset); /* 171 */
+ const char * (*tkCanvasDashPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 172 */
+ int (*tkOffsetParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset); /* 173 */
+ const char * (*tkOffsetPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 174 */
+ int (*tkPixelParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset); /* 175 */
+ const char * (*tkPixelPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 176 */
+ int (*tkOrientParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset); /* 177 */
+ const char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 178 */
+ int (*tkSmoothParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset); /* 179 */
+ const char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 180 */
void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, int lastChar); /* 181 */
void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */
int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */
@@ -793,6 +805,7 @@ typedef struct TkIntStubs {
#ifdef MAC_OSX_TCL /* MACOSX */
int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 186 */
#endif /* MACOSX */
+ int (*tkDebugPhotoStringMatchDef) (Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); /* 187 */
} TkIntStubs;
extern const TkIntStubs *tkIntStubsPtr;
@@ -1028,20 +1041,20 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkpGetSystemDefault) /* 111 */
#define TkpMenuThreadInit \
(tkIntStubsPtr->tkpMenuThreadInit) /* 112 */
-#define TkClipBox \
- (tkIntStubsPtr->tkClipBox) /* 113 */
-#define TkCreateRegion \
- (tkIntStubsPtr->tkCreateRegion) /* 114 */
-#define TkDestroyRegion \
- (tkIntStubsPtr->tkDestroyRegion) /* 115 */
-#define TkIntersectRegion \
- (tkIntStubsPtr->tkIntersectRegion) /* 116 */
-#define TkRectInRegion \
- (tkIntStubsPtr->tkRectInRegion) /* 117 */
-#define TkSetRegion \
- (tkIntStubsPtr->tkSetRegion) /* 118 */
-#define TkUnionRectWithRegion \
- (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */
+#define XClipBox \
+ (tkIntStubsPtr->xClipBox) /* 113 */
+#define XCreateRegion \
+ (tkIntStubsPtr->xCreateRegion) /* 114 */
+#define XDestroyRegion \
+ (tkIntStubsPtr->xDestroyRegion) /* 115 */
+#define XIntersectRegion \
+ (tkIntStubsPtr->xIntersectRegion) /* 116 */
+#define XRectInRegion \
+ (tkIntStubsPtr->xRectInRegion) /* 117 */
+#define XSetRegion \
+ (tkIntStubsPtr->xSetRegion) /* 118 */
+#define XUnionRectWithRegion \
+ (tkIntStubsPtr->xUnionRectWithRegion) /* 119 */
/* Slot 120 is reserved */
#ifdef MAC_OSX_TK /* AQUA */
#define TkpCreateNativeBitmap \
@@ -1086,8 +1099,8 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkClipCleanup) /* 143 */
#define TkGCCleanup \
(tkIntStubsPtr->tkGCCleanup) /* 144 */
-#define TkSubtractRegion \
- (tkIntStubsPtr->tkSubtractRegion) /* 145 */
+#define XSubtractRegion \
+ (tkIntStubsPtr->xSubtractRegion) /* 145 */
#define TkStylePkgInit \
(tkIntStubsPtr->tkStylePkgInit) /* 146 */
#define TkStylePkgFree \
@@ -1173,6 +1186,8 @@ extern const TkIntStubs *tkIntStubsPtr;
#define TkpWillDrawWidget \
(tkIntStubsPtr->tkpWillDrawWidget) /* 186 */
#endif /* MACOSX */
+#define TkDebugPhotoStringMatchDef \
+ (tkIntStubsPtr->tkDebugPhotoStringMatchDef) /* 187 */
#endif /* defined(USE_TK_STUBS) */
@@ -1181,19 +1196,6 @@ extern const TkIntStubs *tkIntStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
-/*
- * On X11, these macros are just wrappers for the equivalent X Region calls.
- */
-#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */
-
-#undef TkClipBox
-#undef TkCreateRegion
-#undef TkDestroyRegion
-#undef TkIntersectRegion
-#undef TkRectInRegion
-#undef TkSetRegion
-#undef TkSubtractRegion
-#undef TkUnionRectWithRegion
#undef TkpCmapStressed_
#undef TkpSync_
#undef TkUnixContainerId_
@@ -1203,20 +1205,6 @@ extern const TkIntStubs *tkIntStubsPtr;
#undef TkSendCleanup_
#undef TkpTestsendCmd_
-#define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
-#define TkCreateRegion() (TkRegion) XCreateRegion()
-#define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
-#define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
- (Region) b, (Region) r)
-#define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
-#define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
-#define TkSubtractRegion(a, b, r) XSubtractRegion((Region) a, \
- (Region) b, (Region) r)
-#define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
- (Region) src, (Region) ret)
-
-#endif /* UNIX */
-
#if !defined(MAC_OSX_TK)
# undef TkpWillDrawWidget
# undef TkpRedrawWidget
@@ -1225,4 +1213,3 @@ extern const TkIntStubs *tkIntStubsPtr;
#endif
#endif /* _TKINTDECLS */
-
diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h
index e9b3a65..0b770a1 100644
--- a/generic/tkIntPlatDecls.h
+++ b/generic/tkIntPlatDecls.h
@@ -6,7 +6,7 @@
* interfaces are not guaranteed to remain the same between
* versions. Use at your own risk.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
* All rights reserved.
*/
@@ -170,8 +170,7 @@ EXTERN unsigned int TkMacOSXButtonKeyState(void);
EXTERN void TkMacOSXClearMenubarActive(void);
/* 10 */
EXTERN int TkMacOSXDispatchMenuEvent(int menuID, int index);
-/* 11 */
-EXTERN void TkMacOSXInstallCursor(int resizeOverride);
+/* Slot 11 is reserved */
/* 12 */
EXTERN void TkMacOSXHandleTearoffMenu(void);
/* Slot 13 is reserved */
@@ -216,7 +215,7 @@ EXTERN void TkMacOSXUpdateClipRgn(TkWindow *winPtr);
/* 34 */
EXTERN int TkMacOSXUseMenuID(short macID);
/* 35 */
-EXTERN TkRegion TkMacOSXVisableClipRgn(TkWindow *winPtr);
+EXTERN Region TkMacOSXVisableClipRgn(TkWindow *winPtr);
/* 36 */
EXTERN void TkMacOSXWinBounds(TkWindow *winPtr, void *geometry);
/* 37 */
@@ -242,10 +241,10 @@ EXTERN void TkMacOSXPreprocessMenu(void);
/* 46 */
EXTERN int TkpIsWindowFloating(void *window);
/* 47 */
-EXTERN Tk_Window TkMacOSXGetCapture(void);
+EXTERN Tk_Window TkpGetCapture(void);
/* Slot 48 is reserved */
/* 49 */
-EXTERN Tk_Window TkGetTransientMaster(TkWindow *winPtr);
+EXTERN Tk_Window TkMacOSXGetContainer(TkWindow *winPtr);
/* 50 */
EXTERN int TkGenerateButtonEvent(int x, int y, Window window,
unsigned int state);
@@ -402,7 +401,7 @@ typedef struct TkIntPlatStubs {
unsigned int (*tkMacOSXButtonKeyState) (void); /* 8 */
void (*tkMacOSXClearMenubarActive) (void); /* 9 */
int (*tkMacOSXDispatchMenuEvent) (int menuID, int index); /* 10 */
- void (*tkMacOSXInstallCursor) (int resizeOverride); /* 11 */
+ void (*reserved11)(void);
void (*tkMacOSXHandleTearoffMenu) (void); /* 12 */
void (*reserved13)(void);
int (*tkMacOSXDoHLEvent) (void *theEvent); /* 14 */
@@ -426,7 +425,7 @@ typedef struct TkIntPlatStubs {
void (*tkMacOSXUpdateClipRgn) (TkWindow *winPtr); /* 32 */
void (*reserved33)(void);
int (*tkMacOSXUseMenuID) (short macID); /* 34 */
- TkRegion (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */
+ Region (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */
void (*tkMacOSXWinBounds) (TkWindow *winPtr, void *geometry); /* 36 */
void (*tkMacOSXWindowOffset) (void *wRef, int *xOffset, int *yOffset); /* 37 */
int (*tkSetMacColor) (unsigned long pixel, void *macColor); /* 38 */
@@ -438,9 +437,9 @@ typedef struct TkIntPlatStubs {
MacDrawable * (*tkMacOSXGetHostToplevel) (TkWindow *winPtr); /* 44 */
void (*tkMacOSXPreprocessMenu) (void); /* 45 */
int (*tkpIsWindowFloating) (void *window); /* 46 */
- Tk_Window (*tkMacOSXGetCapture) (void); /* 47 */
+ Tk_Window (*tkpGetCapture) (void); /* 47 */
void (*reserved48)(void);
- Tk_Window (*tkGetTransientMaster) (TkWindow *winPtr); /* 49 */
+ Tk_Window (*tkMacOSXGetContainer) (TkWindow *winPtr); /* 49 */
int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */
void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */
void (*tkMacOSXSetDrawingEnabled) (TkWindow *winPtr, int flag); /* 52 */
@@ -628,8 +627,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXClearMenubarActive) /* 9 */
#define TkMacOSXDispatchMenuEvent \
(tkIntPlatStubsPtr->tkMacOSXDispatchMenuEvent) /* 10 */
-#define TkMacOSXInstallCursor \
- (tkIntPlatStubsPtr->tkMacOSXInstallCursor) /* 11 */
+/* Slot 11 is reserved */
#define TkMacOSXHandleTearoffMenu \
(tkIntPlatStubsPtr->tkMacOSXHandleTearoffMenu) /* 12 */
/* Slot 13 is reserved */
@@ -693,11 +691,11 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXPreprocessMenu) /* 45 */
#define TkpIsWindowFloating \
(tkIntPlatStubsPtr->tkpIsWindowFloating) /* 46 */
-#define TkMacOSXGetCapture \
- (tkIntPlatStubsPtr->tkMacOSXGetCapture) /* 47 */
+#define TkpGetCapture \
+ (tkIntPlatStubsPtr->tkpGetCapture) /* 47 */
/* Slot 48 is reserved */
-#define TkGetTransientMaster \
- (tkIntPlatStubsPtr->tkGetTransientMaster) /* 49 */
+#define TkMacOSXGetContainer \
+ (tkIntPlatStubsPtr->tkMacOSXGetContainer) /* 49 */
#define TkGenerateButtonEvent \
(tkIntPlatStubsPtr->tkGenerateButtonEvent) /* 50 */
#define TkGenWMDestroyEvent \
@@ -793,10 +791,12 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#undef TkSendCleanup_
#undef TkpTestsendCmd_
#undef TkGenerateActivateEvents_
-
-#define TkMacOSXGetContainer TkGetTransientMaster
+#undef TkMacOSXSetUpClippingRgn
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+#undef TkWinGetPlatformId
+#define TkWinGetPlatformId() (2) /* VER_PLATFORM_WIN32_NT */
+
#endif /* _TKINTPLATDECLS */
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 9d4200a..7e86d52 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -6,7 +6,7 @@
* interfaces are not guaranteed to remain the same between
* versions. Use at your own risk.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
* All rights reserved.
*/
@@ -23,17 +23,23 @@
# include <tcl.h>
#endif
-/* Some (older) versions of X11/Xutil.h have a wrong signature of those
- two functions, so move them out of the way temporarly. */
-#define XOffsetRegion _XOffsetRegion
-#define XUnionRegion _XUnionRegion
+#ifndef EXTERN
+# define EXTERN extern TCL_STORAGE_CLASS
+#endif
+
#include "X11/Xutil.h"
-#undef XOffsetRegion
-#undef XUnionRegion
#ifdef BUILD_tk
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLEXPORT
+# undef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS DLLEXPORT
+#else
+# ifndef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS DLLIMPORT
+# endif
+#endif
+
+#if defined(MAC_OSX_TK) && !defined(MAC_OSX_TCL)
+# define MAC_OSX_TCL 1
#endif
typedef int (*XAfterFunction) ( /* WARNING, this type not in Xlib spec */
@@ -413,30 +419,61 @@ EXTERN int XReparentWindow(Display *d, Window w, Window p,
EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
int sx, int sy, int dx, int dy,
unsigned int w, unsigned int h);
-/* Slot 138 is reserved */
-/* Slot 139 is reserved */
-/* Slot 140 is reserved */
-/* Slot 141 is reserved */
-/* Slot 142 is reserved */
-/* Slot 143 is reserved */
+/* 138 */
+EXTERN Region XPolygonRegion(XPoint *pts, int n, int rule);
+/* 139 */
+EXTERN int XPointInRegion(Region rgn, int x, int y);
+/* 140 */
+EXTERN XVaNestedList XVaCreateNestedList(int dummy, ...);
+/* 141 */
+EXTERN char * XSetICValues(XIC xic, ...);
+/* 142 */
+EXTERN char * XGetICValues(XIC xic, ...);
+/* 143 */
+EXTERN void XSetICFocus(XIC xic);
/* Slot 144 is reserved */
/* Slot 145 is reserved */
/* Slot 146 is reserved */
-/* Slot 147 is reserved */
-/* Slot 148 is reserved */
-/* Slot 149 is reserved */
-/* Slot 150 is reserved */
-/* Slot 151 is reserved */
-/* Slot 152 is reserved */
-/* Slot 153 is reserved */
-/* Slot 154 is reserved */
-/* Slot 155 is reserved */
-/* Slot 156 is reserved */
-/* Slot 157 is reserved */
+/* 147 */
+EXTERN void XFreeFontSet(Display *display, XFontSet fontset);
+/* 148 */
+EXTERN int XCloseIM(XIM im);
+/* 149 */
+EXTERN Bool XRegisterIMInstantiateCallback(Display *dpy,
+ struct _XrmHashBucketRec *rbd,
+ char *res_name, char *res_class,
+ XIDProc callback, XPointer client_data);
+/* 150 */
+EXTERN Bool XUnregisterIMInstantiateCallback(Display *dpy,
+ struct _XrmHashBucketRec *rbd,
+ char *res_name, char *res_class,
+ XIDProc callback, XPointer client_data);
+/* 151 */
+EXTERN char * XSetLocaleModifiers(const char *modifier_list);
+/* 152 */
+EXTERN XIM XOpenIM(Display *dpy, struct _XrmHashBucketRec *rdb,
+ char *res_name, char *res_class);
+/* 153 */
+EXTERN char * XGetIMValues(XIM im, ...);
+/* 154 */
+EXTERN char * XSetIMValues(XIM im, ...);
+/* 155 */
+EXTERN XFontSet XCreateFontSet(Display *display,
+ _Xconst char *base_font_name_list,
+ char ***missing_charset_list,
+ int *missing_charset_count,
+ char **def_string);
+/* 156 */
+EXTERN void XFreeStringList(char **list);
+/* 157 */
+EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g,
+ int i);
/* 158 */
-EXTERN void TkUnusedStubEntry(void);
+EXTERN Display * XkbOpenDisplay(const char *name, int *ev_rtrn,
+ int *err_rtrn, int *major_rtrn,
+ int *minor_rtrn, int *reason);
#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
+#ifdef MAC_OSX_TCL /* MACOSX */
/* 0 */
EXTERN int XSetDashes(Display *display, GC gc, int dash_offset,
_Xconst char *dash_list, int n);
@@ -460,7 +497,7 @@ EXTERN Colormap XCreateColormap(Display *d, Window w, Visual *v,
/* 7 */
EXTERN GContext XGContextFromGC(GC g);
/* 8 */
-EXTERN KeySym XKeycodeToKeysym(Display *d, KeyCode k, int i);
+EXTERN KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i);
/* 9 */
EXTERN KeySym XStringToKeysym(_Xconst char *c);
/* 10 */
@@ -699,20 +736,39 @@ EXTERN Status XQueryTree(Display *d, Window w1, Window *w2,
Window *w3, Window **w4, unsigned int *ui);
/* 91 */
EXTERN int XSync(Display *display, Bool discard);
-/* Slot 92 is reserved */
-/* Slot 93 is reserved */
-/* Slot 94 is reserved */
-/* Slot 95 is reserved */
-/* Slot 96 is reserved */
-/* Slot 97 is reserved */
-/* Slot 98 is reserved */
-/* Slot 99 is reserved */
-/* Slot 100 is reserved */
-/* Slot 101 is reserved */
-/* Slot 102 is reserved */
-/* Slot 103 is reserved */
-/* Slot 104 is reserved */
-/* Slot 105 is reserved */
+/* 92 */
+EXTERN Bool XTranslateCoordinates(Display *d, Window w1,
+ Window w2, int i1, int i2, int *i3, int *i4,
+ Window *w3);
+/* 93 */
+EXTERN int XDeleteProperty(Display *d, Window w, Atom a);
+/* 94 */
+EXTERN int XFreeCursor(Display *d, Cursor c);
+/* 95 */
+EXTERN int XGetInputFocus(Display *d, Window *w, int *i);
+/* 96 */
+EXTERN int XmbLookupString(XIC xi, XKeyPressedEvent *xk,
+ char *c, int i, KeySym *k, Status *s);
+/* 97 */
+EXTERN int XNextEvent(Display *d, XEvent *x);
+/* 98 */
+EXTERN int XPutBackEvent(Display *d, XEvent *x);
+/* 99 */
+EXTERN int XSetCommand(Display *d, Window w, char **c, int i);
+/* 100 */
+EXTERN int XWindowEvent(Display *d, Window w, long l, XEvent *x);
+/* 101 */
+EXTERN Status XGetWindowAttributes(Display *d, Window w,
+ XWindowAttributes *x);
+/* 102 */
+EXTERN Status XGetWMColormapWindows(Display *d, Window w,
+ Window **wpp, int *ip);
+/* 103 */
+EXTERN Status XIconifyWindow(Display *d, Window w, int i);
+/* 104 */
+EXTERN Status XWithdrawWindow(Display *d, Window w, int i);
+/* 105 */
+EXTERN XHostAddress * XListHosts(Display *d, int *i, Bool *b);
/* 106 */
EXTERN int XSetClipRectangles(Display *display, GC gc,
int clip_x_origin, int clip_y_origin,
@@ -729,7 +785,9 @@ EXTERN int XFree(void *data);
EXTERN int XNoOp(Display *display);
/* 112 */
EXTERN XAfterFunction XSynchronize(Display *display, Bool onoff);
-/* Slot 113 is reserved */
+/* 113 */
+EXTERN Status XLookupColor(Display *d, Colormap c1,
+ _Xconst char *c2, XColor *x1, XColor *x2);
/* 114 */
EXTERN VisualID XVisualIDFromVisual(Visual *visual);
/* Slot 115 is reserved */
@@ -738,9 +796,18 @@ EXTERN VisualID XVisualIDFromVisual(Visual *visual);
/* Slot 118 is reserved */
/* Slot 119 is reserved */
/* 120 */
-EXTERN int XOffsetRegion(void *rgn, int dx, int dy);
-/* Slot 121 is reserved */
-/* Slot 122 is reserved */
+EXTERN int XOffsetRegion(Region rgn, int dx, int dy);
+/* 121 */
+EXTERN int XUnionRegion(Region srca, Region srcb,
+ Region dr_return);
+/* 122 */
+EXTERN Window XCreateWindow(Display *display, Window parent, int x,
+ int y, unsigned int width,
+ unsigned int height,
+ unsigned int border_width, int depth,
+ unsigned int clazz, Visual *visual,
+ unsigned long value_mask,
+ XSetWindowAttributes *attributes);
/* Slot 123 is reserved */
/* Slot 124 is reserved */
/* Slot 125 is reserved */
@@ -749,23 +816,37 @@ EXTERN int XOffsetRegion(void *rgn, int dx, int dy);
/* Slot 128 is reserved */
/* 129 */
EXTERN int XLowerWindow(Display *d, Window w);
-/* Slot 130 is reserved */
-/* Slot 131 is reserved */
-/* Slot 132 is reserved */
+/* 130 */
+EXTERN int XFillArcs(Display *d, Drawable dr, GC gc, XArc *a,
+ int n);
+/* 131 */
+EXTERN int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a,
+ int n);
+/* 132 */
+EXTERN int XDrawRectangles(Display *d, Drawable dr, GC gc,
+ XRectangle *r, int n);
/* Slot 133 is reserved */
/* Slot 134 is reserved */
/* Slot 135 is reserved */
-/* Slot 136 is reserved */
+/* 136 */
+EXTERN int XReparentWindow(Display *d, Window w, Window p,
+ int x, int y);
/* 137 */
EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
int sx, int sy, int dx, int dy,
unsigned int w, unsigned int h);
-/* Slot 138 is reserved */
-/* Slot 139 is reserved */
-/* Slot 140 is reserved */
-/* Slot 141 is reserved */
-/* Slot 142 is reserved */
-/* Slot 143 is reserved */
+/* 138 */
+EXTERN Region XPolygonRegion(XPoint *pts, int n, int rule);
+/* 139 */
+EXTERN int XPointInRegion(Region rgn, int x, int y);
+/* 140 */
+EXTERN XVaNestedList XVaCreateNestedList(int dummy, ...);
+/* 141 */
+EXTERN char * XSetICValues(XIC xic, ...);
+/* 142 */
+EXTERN char * XGetICValues(XIC xic, ...);
+/* 143 */
+EXTERN void XSetICFocus(XIC xic);
/* 144 */
EXTERN void XDestroyIC(XIC xic);
/* 145 */
@@ -776,22 +857,45 @@ EXTERN Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2,
EXTERN Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2,
unsigned int ui1, unsigned int ui2,
XColor _Xconst *x1, XColor _Xconst *x2);
-/* Slot 147 is reserved */
-/* Slot 148 is reserved */
-/* Slot 149 is reserved */
-/* Slot 150 is reserved */
-/* Slot 151 is reserved */
-/* Slot 152 is reserved */
-/* Slot 153 is reserved */
-/* Slot 154 is reserved */
-/* Slot 155 is reserved */
-/* Slot 156 is reserved */
+/* 147 */
+EXTERN void XFreeFontSet(Display *display, XFontSet fontset);
+/* 148 */
+EXTERN int XCloseIM(XIM im);
+/* 149 */
+EXTERN Bool XRegisterIMInstantiateCallback(Display *dpy,
+ struct _XrmHashBucketRec *rbd,
+ char *res_name, char *res_class,
+ XIDProc callback, XPointer client_data);
+/* 150 */
+EXTERN Bool XUnregisterIMInstantiateCallback(Display *dpy,
+ struct _XrmHashBucketRec *rbd,
+ char *res_name, char *res_class,
+ XIDProc callback, XPointer client_data);
+/* 151 */
+EXTERN char * XSetLocaleModifiers(const char *modifier_list);
+/* 152 */
+EXTERN XIM XOpenIM(Display *dpy, struct _XrmHashBucketRec *rdb,
+ char *res_name, char *res_class);
+/* 153 */
+EXTERN char * XGetIMValues(XIM im, ...);
+/* 154 */
+EXTERN char * XSetIMValues(XIM im, ...);
+/* 155 */
+EXTERN XFontSet XCreateFontSet(Display *display,
+ _Xconst char *base_font_name_list,
+ char ***missing_charset_list,
+ int *missing_charset_count,
+ char **def_string);
+/* 156 */
+EXTERN void XFreeStringList(char **list);
/* 157 */
EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g,
int i);
/* 158 */
-EXTERN void TkUnusedStubEntry(void);
-#endif /* AQUA */
+EXTERN Display * XkbOpenDisplay(const char *name, int *ev_rtrn,
+ int *err_rtrn, int *major_rtrn,
+ int *minor_rtrn, int *reason);
+#endif /* MACOSX */
typedef struct TkIntXlibStubs {
int magic;
@@ -936,29 +1040,29 @@ typedef struct TkIntXlibStubs {
int (*xDrawPoints) (Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 135 */
int (*xReparentWindow) (Display *d, Window w, Window p, int x, int y); /* 136 */
int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */
- void (*reserved138)(void);
- void (*reserved139)(void);
- void (*reserved140)(void);
- void (*reserved141)(void);
- void (*reserved142)(void);
- void (*reserved143)(void);
+ Region (*xPolygonRegion) (XPoint *pts, int n, int rule); /* 138 */
+ int (*xPointInRegion) (Region rgn, int x, int y); /* 139 */
+ XVaNestedList (*xVaCreateNestedList) (int dummy, ...); /* 140 */
+ char * (*xSetICValues) (XIC xic, ...); /* 141 */
+ char * (*xGetICValues) (XIC xic, ...); /* 142 */
+ void (*xSetICFocus) (XIC xic); /* 143 */
void (*reserved144)(void);
void (*reserved145)(void);
void (*reserved146)(void);
- void (*reserved147)(void);
- void (*reserved148)(void);
- void (*reserved149)(void);
- void (*reserved150)(void);
- void (*reserved151)(void);
- void (*reserved152)(void);
- void (*reserved153)(void);
- void (*reserved154)(void);
- void (*reserved155)(void);
- void (*reserved156)(void);
- void (*reserved157)(void);
- void (*tkUnusedStubEntry) (void); /* 158 */
+ void (*xFreeFontSet) (Display *display, XFontSet fontset); /* 147 */
+ int (*xCloseIM) (XIM im); /* 148 */
+ Bool (*xRegisterIMInstantiateCallback) (Display *dpy, struct _XrmHashBucketRec *rbd, char *res_name, char *res_class, XIDProc callback, XPointer client_data); /* 149 */
+ Bool (*xUnregisterIMInstantiateCallback) (Display *dpy, struct _XrmHashBucketRec *rbd, char *res_name, char *res_class, XIDProc callback, XPointer client_data); /* 150 */
+ char * (*xSetLocaleModifiers) (const char *modifier_list); /* 151 */
+ XIM (*xOpenIM) (Display *dpy, struct _XrmHashBucketRec *rdb, char *res_name, char *res_class); /* 152 */
+ char * (*xGetIMValues) (XIM im, ...); /* 153 */
+ char * (*xSetIMValues) (XIM im, ...); /* 154 */
+ XFontSet (*xCreateFontSet) (Display *display, _Xconst char *base_font_name_list, char ***missing_charset_list, int *missing_charset_count, char **def_string); /* 155 */
+ void (*xFreeStringList) (char **list); /* 156 */
+ KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */
+ Display * (*xkbOpenDisplay) (const char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason); /* 158 */
#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
+#ifdef MAC_OSX_TCL /* MACOSX */
int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */
XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */
@@ -967,7 +1071,7 @@ typedef struct TkIntXlibStubs {
char * (*xKeysymToString) (KeySym k); /* 5 */
Colormap (*xCreateColormap) (Display *d, Window w, Visual *v, int i); /* 6 */
GContext (*xGContextFromGC) (GC g); /* 7 */
- KeySym (*xKeycodeToKeysym) (Display *d, KeyCode k, int i); /* 8 */
+ KeySym (*xKeycodeToKeysym) (Display *d, unsigned int k, int i); /* 8 */
KeySym (*xStringToKeysym) (_Xconst char *c); /* 9 */
Window (*xRootWindow) (Display *d, int i); /* 10 */
XErrorHandler (*xSetErrorHandler) (XErrorHandler x); /* 11 */
@@ -1051,20 +1155,20 @@ typedef struct TkIntXlibStubs {
int (*xQueryColors) (Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 89 */
Status (*xQueryTree) (Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 90 */
int (*xSync) (Display *display, Bool discard); /* 91 */
- void (*reserved92)(void);
- void (*reserved93)(void);
- void (*reserved94)(void);
- void (*reserved95)(void);
- void (*reserved96)(void);
- void (*reserved97)(void);
- void (*reserved98)(void);
- void (*reserved99)(void);
- void (*reserved100)(void);
- void (*reserved101)(void);
- void (*reserved102)(void);
- void (*reserved103)(void);
- void (*reserved104)(void);
- void (*reserved105)(void);
+ Bool (*xTranslateCoordinates) (Display *d, Window w1, Window w2, int i1, int i2, int *i3, int *i4, Window *w3); /* 92 */
+ int (*xDeleteProperty) (Display *d, Window w, Atom a); /* 93 */
+ int (*xFreeCursor) (Display *d, Cursor c); /* 94 */
+ int (*xGetInputFocus) (Display *d, Window *w, int *i); /* 95 */
+ int (*xmbLookupString) (XIC xi, XKeyPressedEvent *xk, char *c, int i, KeySym *k, Status *s); /* 96 */
+ int (*xNextEvent) (Display *d, XEvent *x); /* 97 */
+ int (*xPutBackEvent) (Display *d, XEvent *x); /* 98 */
+ int (*xSetCommand) (Display *d, Window w, char **c, int i); /* 99 */
+ int (*xWindowEvent) (Display *d, Window w, long l, XEvent *x); /* 100 */
+ Status (*xGetWindowAttributes) (Display *d, Window w, XWindowAttributes *x); /* 101 */
+ Status (*xGetWMColormapWindows) (Display *d, Window w, Window **wpp, int *ip); /* 102 */
+ Status (*xIconifyWindow) (Display *d, Window w, int i); /* 103 */
+ Status (*xWithdrawWindow) (Display *d, Window w, int i); /* 104 */
+ XHostAddress * (*xListHosts) (Display *d, int *i, Bool *b); /* 105 */
int (*xSetClipRectangles) (Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 106 */
int (*xFlush) (Display *display); /* 107 */
int (*xGrabServer) (Display *display); /* 108 */
@@ -1072,16 +1176,16 @@ typedef struct TkIntXlibStubs {
int (*xFree) (void *data); /* 110 */
int (*xNoOp) (Display *display); /* 111 */
XAfterFunction (*xSynchronize) (Display *display, Bool onoff); /* 112 */
- void (*reserved113)(void);
+ Status (*xLookupColor) (Display *d, Colormap c1, _Xconst char *c2, XColor *x1, XColor *x2); /* 113 */
VisualID (*xVisualIDFromVisual) (Visual *visual); /* 114 */
void (*reserved115)(void);
void (*reserved116)(void);
void (*reserved117)(void);
void (*reserved118)(void);
void (*reserved119)(void);
- int (*xOffsetRegion) (void *rgn, int dx, int dy); /* 120 */
- void (*reserved121)(void);
- void (*reserved122)(void);
+ int (*xOffsetRegion) (Region rgn, int dx, int dy); /* 120 */
+ int (*xUnionRegion) (Region srca, Region srcb, Region dr_return); /* 121 */
+ Window (*xCreateWindow) (Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int clazz, Visual *visual, unsigned long value_mask, XSetWindowAttributes *attributes); /* 122 */
void (*reserved123)(void);
void (*reserved124)(void);
void (*reserved125)(void);
@@ -1089,36 +1193,36 @@ typedef struct TkIntXlibStubs {
void (*reserved127)(void);
void (*reserved128)(void);
int (*xLowerWindow) (Display *d, Window w); /* 129 */
- void (*reserved130)(void);
- void (*reserved131)(void);
- void (*reserved132)(void);
+ int (*xFillArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 130 */
+ int (*xDrawArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 131 */
+ int (*xDrawRectangles) (Display *d, Drawable dr, GC gc, XRectangle *r, int n); /* 132 */
void (*reserved133)(void);
void (*reserved134)(void);
void (*reserved135)(void);
- void (*reserved136)(void);
+ int (*xReparentWindow) (Display *d, Window w, Window p, int x, int y); /* 136 */
int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */
- void (*reserved138)(void);
- void (*reserved139)(void);
- void (*reserved140)(void);
- void (*reserved141)(void);
- void (*reserved142)(void);
- void (*reserved143)(void);
+ Region (*xPolygonRegion) (XPoint *pts, int n, int rule); /* 138 */
+ int (*xPointInRegion) (Region rgn, int x, int y); /* 139 */
+ XVaNestedList (*xVaCreateNestedList) (int dummy, ...); /* 140 */
+ char * (*xSetICValues) (XIC xic, ...); /* 141 */
+ char * (*xGetICValues) (XIC xic, ...); /* 142 */
+ void (*xSetICFocus) (XIC xic); /* 143 */
void (*xDestroyIC) (XIC xic); /* 144 */
Cursor (*xCreatePixmapCursor) (Display *d, Pixmap p1, Pixmap p2, XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2); /* 145 */
Cursor (*xCreateGlyphCursor) (Display *d, Font f1, Font f2, unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, XColor _Xconst *x2); /* 146 */
- void (*reserved147)(void);
- void (*reserved148)(void);
- void (*reserved149)(void);
- void (*reserved150)(void);
- void (*reserved151)(void);
- void (*reserved152)(void);
- void (*reserved153)(void);
- void (*reserved154)(void);
- void (*reserved155)(void);
- void (*reserved156)(void);
+ void (*xFreeFontSet) (Display *display, XFontSet fontset); /* 147 */
+ int (*xCloseIM) (XIM im); /* 148 */
+ Bool (*xRegisterIMInstantiateCallback) (Display *dpy, struct _XrmHashBucketRec *rbd, char *res_name, char *res_class, XIDProc callback, XPointer client_data); /* 149 */
+ Bool (*xUnregisterIMInstantiateCallback) (Display *dpy, struct _XrmHashBucketRec *rbd, char *res_name, char *res_class, XIDProc callback, XPointer client_data); /* 150 */
+ char * (*xSetLocaleModifiers) (const char *modifier_list); /* 151 */
+ XIM (*xOpenIM) (Display *dpy, struct _XrmHashBucketRec *rdb, char *res_name, char *res_class); /* 152 */
+ char * (*xGetIMValues) (XIM im, ...); /* 153 */
+ char * (*xSetIMValues) (XIM im, ...); /* 154 */
+ XFontSet (*xCreateFontSet) (Display *display, _Xconst char *base_font_name_list, char ***missing_charset_list, int *missing_charset_count, char **def_string); /* 155 */
+ void (*xFreeStringList) (char **list); /* 156 */
KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */
- void (*tkUnusedStubEntry) (void); /* 158 */
-#endif /* AQUA */
+ Display * (*xkbOpenDisplay) (const char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason); /* 158 */
+#endif /* MACOSX */
} TkIntXlibStubs;
extern const TkIntXlibStubs *tkIntXlibStubsPtr;
@@ -1398,30 +1502,47 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xReparentWindow) /* 136 */
#define XPutImage \
(tkIntXlibStubsPtr->xPutImage) /* 137 */
-/* Slot 138 is reserved */
-/* Slot 139 is reserved */
-/* Slot 140 is reserved */
-/* Slot 141 is reserved */
-/* Slot 142 is reserved */
-/* Slot 143 is reserved */
+#define XPolygonRegion \
+ (tkIntXlibStubsPtr->xPolygonRegion) /* 138 */
+#define XPointInRegion \
+ (tkIntXlibStubsPtr->xPointInRegion) /* 139 */
+#define XVaCreateNestedList \
+ (tkIntXlibStubsPtr->xVaCreateNestedList) /* 140 */
+#define XSetICValues \
+ (tkIntXlibStubsPtr->xSetICValues) /* 141 */
+#define XGetICValues \
+ (tkIntXlibStubsPtr->xGetICValues) /* 142 */
+#define XSetICFocus \
+ (tkIntXlibStubsPtr->xSetICFocus) /* 143 */
/* Slot 144 is reserved */
/* Slot 145 is reserved */
/* Slot 146 is reserved */
-/* Slot 147 is reserved */
-/* Slot 148 is reserved */
-/* Slot 149 is reserved */
-/* Slot 150 is reserved */
-/* Slot 151 is reserved */
-/* Slot 152 is reserved */
-/* Slot 153 is reserved */
-/* Slot 154 is reserved */
-/* Slot 155 is reserved */
-/* Slot 156 is reserved */
-/* Slot 157 is reserved */
-#define TkUnusedStubEntry \
- (tkIntXlibStubsPtr->tkUnusedStubEntry) /* 158 */
+#define XFreeFontSet \
+ (tkIntXlibStubsPtr->xFreeFontSet) /* 147 */
+#define XCloseIM \
+ (tkIntXlibStubsPtr->xCloseIM) /* 148 */
+#define XRegisterIMInstantiateCallback \
+ (tkIntXlibStubsPtr->xRegisterIMInstantiateCallback) /* 149 */
+#define XUnregisterIMInstantiateCallback \
+ (tkIntXlibStubsPtr->xUnregisterIMInstantiateCallback) /* 150 */
+#define XSetLocaleModifiers \
+ (tkIntXlibStubsPtr->xSetLocaleModifiers) /* 151 */
+#define XOpenIM \
+ (tkIntXlibStubsPtr->xOpenIM) /* 152 */
+#define XGetIMValues \
+ (tkIntXlibStubsPtr->xGetIMValues) /* 153 */
+#define XSetIMValues \
+ (tkIntXlibStubsPtr->xSetIMValues) /* 154 */
+#define XCreateFontSet \
+ (tkIntXlibStubsPtr->xCreateFontSet) /* 155 */
+#define XFreeStringList \
+ (tkIntXlibStubsPtr->xFreeStringList) /* 156 */
+#define XkbKeycodeToKeysym \
+ (tkIntXlibStubsPtr->xkbKeycodeToKeysym) /* 157 */
+#define XkbOpenDisplay \
+ (tkIntXlibStubsPtr->xkbOpenDisplay) /* 158 */
#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
+#ifdef MAC_OSX_TCL /* MACOSX */
#define XSetDashes \
(tkIntXlibStubsPtr->xSetDashes) /* 0 */
#define XGetModifierMapping \
@@ -1606,20 +1727,34 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xQueryTree) /* 90 */
#define XSync \
(tkIntXlibStubsPtr->xSync) /* 91 */
-/* Slot 92 is reserved */
-/* Slot 93 is reserved */
-/* Slot 94 is reserved */
-/* Slot 95 is reserved */
-/* Slot 96 is reserved */
-/* Slot 97 is reserved */
-/* Slot 98 is reserved */
-/* Slot 99 is reserved */
-/* Slot 100 is reserved */
-/* Slot 101 is reserved */
-/* Slot 102 is reserved */
-/* Slot 103 is reserved */
-/* Slot 104 is reserved */
-/* Slot 105 is reserved */
+#define XTranslateCoordinates \
+ (tkIntXlibStubsPtr->xTranslateCoordinates) /* 92 */
+#define XDeleteProperty \
+ (tkIntXlibStubsPtr->xDeleteProperty) /* 93 */
+#define XFreeCursor \
+ (tkIntXlibStubsPtr->xFreeCursor) /* 94 */
+#define XGetInputFocus \
+ (tkIntXlibStubsPtr->xGetInputFocus) /* 95 */
+#define XmbLookupString \
+ (tkIntXlibStubsPtr->xmbLookupString) /* 96 */
+#define XNextEvent \
+ (tkIntXlibStubsPtr->xNextEvent) /* 97 */
+#define XPutBackEvent \
+ (tkIntXlibStubsPtr->xPutBackEvent) /* 98 */
+#define XSetCommand \
+ (tkIntXlibStubsPtr->xSetCommand) /* 99 */
+#define XWindowEvent \
+ (tkIntXlibStubsPtr->xWindowEvent) /* 100 */
+#define XGetWindowAttributes \
+ (tkIntXlibStubsPtr->xGetWindowAttributes) /* 101 */
+#define XGetWMColormapWindows \
+ (tkIntXlibStubsPtr->xGetWMColormapWindows) /* 102 */
+#define XIconifyWindow \
+ (tkIntXlibStubsPtr->xIconifyWindow) /* 103 */
+#define XWithdrawWindow \
+ (tkIntXlibStubsPtr->xWithdrawWindow) /* 104 */
+#define XListHosts \
+ (tkIntXlibStubsPtr->xListHosts) /* 105 */
#define XSetClipRectangles \
(tkIntXlibStubsPtr->xSetClipRectangles) /* 106 */
#define XFlush \
@@ -1634,7 +1769,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xNoOp) /* 111 */
#define XSynchronize \
(tkIntXlibStubsPtr->xSynchronize) /* 112 */
-/* Slot 113 is reserved */
+#define XLookupColor \
+ (tkIntXlibStubsPtr->xLookupColor) /* 113 */
#define XVisualIDFromVisual \
(tkIntXlibStubsPtr->xVisualIDFromVisual) /* 114 */
/* Slot 115 is reserved */
@@ -1644,8 +1780,10 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
/* Slot 119 is reserved */
#define XOffsetRegion \
(tkIntXlibStubsPtr->xOffsetRegion) /* 120 */
-/* Slot 121 is reserved */
-/* Slot 122 is reserved */
+#define XUnionRegion \
+ (tkIntXlibStubsPtr->xUnionRegion) /* 121 */
+#define XCreateWindow \
+ (tkIntXlibStubsPtr->xCreateWindow) /* 122 */
/* Slot 123 is reserved */
/* Slot 124 is reserved */
/* Slot 125 is reserved */
@@ -1654,50 +1792,72 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
/* Slot 128 is reserved */
#define XLowerWindow \
(tkIntXlibStubsPtr->xLowerWindow) /* 129 */
-/* Slot 130 is reserved */
-/* Slot 131 is reserved */
-/* Slot 132 is reserved */
+#define XFillArcs \
+ (tkIntXlibStubsPtr->xFillArcs) /* 130 */
+#define XDrawArcs \
+ (tkIntXlibStubsPtr->xDrawArcs) /* 131 */
+#define XDrawRectangles \
+ (tkIntXlibStubsPtr->xDrawRectangles) /* 132 */
/* Slot 133 is reserved */
/* Slot 134 is reserved */
/* Slot 135 is reserved */
-/* Slot 136 is reserved */
+#define XReparentWindow \
+ (tkIntXlibStubsPtr->xReparentWindow) /* 136 */
#define XPutImage \
(tkIntXlibStubsPtr->xPutImage) /* 137 */
-/* Slot 138 is reserved */
-/* Slot 139 is reserved */
-/* Slot 140 is reserved */
-/* Slot 141 is reserved */
-/* Slot 142 is reserved */
-/* Slot 143 is reserved */
+#define XPolygonRegion \
+ (tkIntXlibStubsPtr->xPolygonRegion) /* 138 */
+#define XPointInRegion \
+ (tkIntXlibStubsPtr->xPointInRegion) /* 139 */
+#define XVaCreateNestedList \
+ (tkIntXlibStubsPtr->xVaCreateNestedList) /* 140 */
+#define XSetICValues \
+ (tkIntXlibStubsPtr->xSetICValues) /* 141 */
+#define XGetICValues \
+ (tkIntXlibStubsPtr->xGetICValues) /* 142 */
+#define XSetICFocus \
+ (tkIntXlibStubsPtr->xSetICFocus) /* 143 */
#define XDestroyIC \
(tkIntXlibStubsPtr->xDestroyIC) /* 144 */
#define XCreatePixmapCursor \
(tkIntXlibStubsPtr->xCreatePixmapCursor) /* 145 */
#define XCreateGlyphCursor \
(tkIntXlibStubsPtr->xCreateGlyphCursor) /* 146 */
-/* Slot 147 is reserved */
-/* Slot 148 is reserved */
-/* Slot 149 is reserved */
-/* Slot 150 is reserved */
-/* Slot 151 is reserved */
-/* Slot 152 is reserved */
-/* Slot 153 is reserved */
-/* Slot 154 is reserved */
-/* Slot 155 is reserved */
-/* Slot 156 is reserved */
+#define XFreeFontSet \
+ (tkIntXlibStubsPtr->xFreeFontSet) /* 147 */
+#define XCloseIM \
+ (tkIntXlibStubsPtr->xCloseIM) /* 148 */
+#define XRegisterIMInstantiateCallback \
+ (tkIntXlibStubsPtr->xRegisterIMInstantiateCallback) /* 149 */
+#define XUnregisterIMInstantiateCallback \
+ (tkIntXlibStubsPtr->xUnregisterIMInstantiateCallback) /* 150 */
+#define XSetLocaleModifiers \
+ (tkIntXlibStubsPtr->xSetLocaleModifiers) /* 151 */
+#define XOpenIM \
+ (tkIntXlibStubsPtr->xOpenIM) /* 152 */
+#define XGetIMValues \
+ (tkIntXlibStubsPtr->xGetIMValues) /* 153 */
+#define XSetIMValues \
+ (tkIntXlibStubsPtr->xSetIMValues) /* 154 */
+#define XCreateFontSet \
+ (tkIntXlibStubsPtr->xCreateFontSet) /* 155 */
+#define XFreeStringList \
+ (tkIntXlibStubsPtr->xFreeStringList) /* 156 */
#define XkbKeycodeToKeysym \
(tkIntXlibStubsPtr->xkbKeycodeToKeysym) /* 157 */
-#define TkUnusedStubEntry \
- (tkIntXlibStubsPtr->tkUnusedStubEntry) /* 158 */
-#endif /* AQUA */
+#define XkbOpenDisplay \
+ (tkIntXlibStubsPtr->xkbOpenDisplay) /* 158 */
+#endif /* MACOSX */
#endif /* defined(USE_TK_STUBS) */
/* !END!: Do not edit above this line. */
+#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* X11, Except MacOS/Cygwin */
+EXTERN Display *XkbOpenDisplay(const char *, int *, int *, int *, int *, int *);
+#endif
+
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
-#undef TkUnusedStubEntry
-
#endif /* _TKINTXLIBDECLS */
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index cba8954..8de96b6 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -5,15 +5,15 @@
* displays a collection of strings, one per line, and provides scrolling
* and selection.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
+#include "default.h"
#ifdef _WIN32
#include "tkWinInt.h"
@@ -239,80 +239,80 @@ static const char *const activeStyleStrings[] = {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-activestyle", "activeStyle", "ActiveStyle",
- DEF_LISTBOX_ACTIVE_STYLE, -1, Tk_Offset(Listbox, activeStyle),
+ DEF_LISTBOX_ACTIVE_STYLE, TCL_INDEX_NONE, offsetof(Listbox, activeStyle),
0, activeStyleStrings, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_LISTBOX_BG_COLOR, -1, Tk_Offset(Listbox, normalBorder),
+ DEF_LISTBOX_BG_COLOR, TCL_INDEX_NONE, offsetof(Listbox, normalBorder),
0, DEF_LISTBOX_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_LISTBOX_BORDER_WIDTH, -1, Tk_Offset(Listbox, borderWidth),
+ DEF_LISTBOX_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Listbox, borderWidth),
0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_LISTBOX_CURSOR, -1, Tk_Offset(Listbox, cursor),
+ DEF_LISTBOX_CURSOR, TCL_INDEX_NONE, offsetof(Listbox, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
- "DisabledForeground", DEF_LISTBOX_DISABLED_FG, -1,
- Tk_Offset(Listbox, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
+ "DisabledForeground", DEF_LISTBOX_DISABLED_FG, TCL_INDEX_NONE,
+ offsetof(Listbox, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
- "ExportSelection", DEF_LISTBOX_EXPORT_SELECTION, -1,
- Tk_Offset(Listbox, exportSelection), 0, 0, 0},
+ "ExportSelection", DEF_LISTBOX_EXPORT_SELECTION, TCL_INDEX_NONE,
+ offsetof(Listbox, exportSelection), 0, 0, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_LISTBOX_FONT, -1, Tk_Offset(Listbox, tkfont), 0, 0, 0},
+ DEF_LISTBOX_FONT, TCL_INDEX_NONE, offsetof(Listbox, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_LISTBOX_FG, -1, Tk_Offset(Listbox, fgColorPtr), 0, 0, 0},
+ DEF_LISTBOX_FG, TCL_INDEX_NONE, offsetof(Listbox, fgColorPtr), 0, 0, 0},
{TK_OPTION_INT, "-height", "height", "Height",
- DEF_LISTBOX_HEIGHT, -1, Tk_Offset(Listbox, height), 0, 0, 0},
+ DEF_LISTBOX_HEIGHT, TCL_INDEX_NONE, offsetof(Listbox, height), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
- "HighlightBackground", DEF_LISTBOX_HIGHLIGHT_BG, -1,
- Tk_Offset(Listbox, highlightBgColorPtr), 0, 0, 0},
+ "HighlightBackground", DEF_LISTBOX_HIGHLIGHT_BG, TCL_INDEX_NONE,
+ offsetof(Listbox, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_LISTBOX_HIGHLIGHT, -1, Tk_Offset(Listbox, highlightColorPtr),
+ DEF_LISTBOX_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Listbox, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_LISTBOX_HIGHLIGHT_WIDTH, -1,
- Tk_Offset(Listbox, highlightWidth), 0, 0, 0},
+ "HighlightThickness", DEF_LISTBOX_HIGHLIGHT_WIDTH, TCL_INDEX_NONE,
+ offsetof(Listbox, highlightWidth), 0, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_LISTBOX_JUSTIFY, -1, Tk_Offset(Listbox, justify), 0, 0, 0},
+ DEF_LISTBOX_JUSTIFY, TCL_INDEX_NONE, offsetof(Listbox, justify), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_LISTBOX_RELIEF, -1, Tk_Offset(Listbox, relief), 0, 0, 0},
+ DEF_LISTBOX_RELIEF, TCL_INDEX_NONE, offsetof(Listbox, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_LISTBOX_SELECT_COLOR, -1, Tk_Offset(Listbox, selBorder),
+ DEF_LISTBOX_SELECT_COLOR, TCL_INDEX_NONE, offsetof(Listbox, selBorder),
0, DEF_LISTBOX_SELECT_MONO, 0},
{TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth",
- "BorderWidth", DEF_LISTBOX_SELECT_BD, -1,
- Tk_Offset(Listbox, selBorderWidth), 0, 0, 0},
+ "BorderWidth", DEF_LISTBOX_SELECT_BD, TCL_INDEX_NONE,
+ offsetof(Listbox, selBorderWidth), 0, 0, 0},
{TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
- DEF_LISTBOX_SELECT_FG_COLOR, -1, Tk_Offset(Listbox, selFgColorPtr),
+ DEF_LISTBOX_SELECT_FG_COLOR, TCL_INDEX_NONE, offsetof(Listbox, selFgColorPtr),
TK_OPTION_NULL_OK, DEF_LISTBOX_SELECT_FG_MONO, 0},
{TK_OPTION_STRING, "-selectmode", "selectMode", "SelectMode",
- DEF_LISTBOX_SELECT_MODE, -1, Tk_Offset(Listbox, selectMode),
+ DEF_LISTBOX_SELECT_MODE, TCL_INDEX_NONE, offsetof(Listbox, selectMode),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid",
- DEF_LISTBOX_SET_GRID, -1, Tk_Offset(Listbox, setGrid), 0, 0, 0},
+ DEF_LISTBOX_SET_GRID, TCL_INDEX_NONE, offsetof(Listbox, setGrid), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_LISTBOX_STATE, -1, Tk_Offset(Listbox, state),
+ DEF_LISTBOX_STATE, TCL_INDEX_NONE, offsetof(Listbox, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_LISTBOX_TAKE_FOCUS, -1, Tk_Offset(Listbox, takeFocus),
+ DEF_LISTBOX_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Listbox, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-width", "width", "Width",
- DEF_LISTBOX_WIDTH, -1, Tk_Offset(Listbox, width), 0, 0, 0},
+ DEF_LISTBOX_WIDTH, TCL_INDEX_NONE, offsetof(Listbox, width), 0, 0, 0},
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
- DEF_LISTBOX_SCROLL_COMMAND, -1, Tk_Offset(Listbox, xScrollCmd),
+ DEF_LISTBOX_SCROLL_COMMAND, TCL_INDEX_NONE, offsetof(Listbox, xScrollCmd),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand",
- DEF_LISTBOX_SCROLL_COMMAND, -1, Tk_Offset(Listbox, yScrollCmd),
+ DEF_LISTBOX_SCROLL_COMMAND, TCL_INDEX_NONE, offsetof(Listbox, yScrollCmd),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-listvariable", "listVariable", "Variable",
- DEF_LISTBOX_LIST_VARIABLE, -1, Tk_Offset(Listbox, listVarName),
+ DEF_LISTBOX_LIST_VARIABLE, TCL_INDEX_NONE, offsetof(Listbox, listVarName),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
/*
@@ -322,25 +322,25 @@ static const Tk_OptionSpec optionSpecs[] = {
static const Tk_OptionSpec itemAttrOptionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
- NULL, -1, Tk_Offset(ItemAttr, border),
+ NULL, TCL_INDEX_NONE, offsetof(ItemAttr, border),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT,
DEF_LISTBOX_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- NULL, -1, Tk_Offset(ItemAttr, fgColor),
+ NULL, TCL_INDEX_NONE, offsetof(ItemAttr, fgColor),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
- NULL, -1, Tk_Offset(ItemAttr, selBorder),
+ NULL, TCL_INDEX_NONE, offsetof(ItemAttr, selBorder),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT,
DEF_LISTBOX_SELECT_MONO, 0},
{TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
- NULL, -1, Tk_Offset(ItemAttr, selFgColor),
+ NULL, TCL_INDEX_NONE, offsetof(ItemAttr, selFgColor),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT,
DEF_LISTBOX_SELECT_FG_MONO, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
/*
@@ -377,10 +377,10 @@ enum scancommand {
};
static const char *const indexNames[] = {
- "active", "anchor", "end", NULL
+ "active", "anchor", NULL
};
enum indices {
- INDEX_ACTIVE, INDEX_ANCHOR, INDEX_END
+ INDEX_ACTIVE, INDEX_ANCHOR
};
/*
@@ -409,8 +409,8 @@ static void ListboxComputeGeometry(Listbox *listPtr,
int fontChanged, int maxIsStale, int updateGrid);
static void ListboxEventProc(ClientData clientData,
XEvent *eventPtr);
-static int ListboxFetchSelection(ClientData clientData,
- int offset, char *buffer, int maxBytes);
+static TkSizeT ListboxFetchSelection(ClientData clientData,
+ TkSizeT offset, char *buffer, TkSizeT maxBytes);
static void ListboxLostSelection(ClientData clientData);
static void GenerateListboxSelectEvent(Listbox *listPtr);
static void EventuallyRedrawRange(Listbox *listPtr,
@@ -473,7 +473,7 @@ static const Tk_ClassProcs listboxClass = {
int
Tk_ListboxObjCmd(
- ClientData clientData, /* NULL. */
+ ClientData dummy, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -481,6 +481,7 @@ Tk_ListboxObjCmd(
Listbox *listPtr;
Tk_Window tkwin;
ListboxOptionTables *optionTables;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -493,7 +494,7 @@ Tk_ListboxObjCmd(
return TCL_ERROR;
}
- optionTables = Tcl_GetAssocData(interp, "ListboxOptionTables", NULL);
+ optionTables = (ListboxOptionTables *)Tcl_GetAssocData(interp, "ListboxOptionTables", NULL);
if (optionTables == NULL) {
/*
* We haven't created the option tables for this widget class yet. Do
@@ -501,7 +502,7 @@ Tk_ListboxObjCmd(
* command, so future invocations will have access to it.
*/
- optionTables = ckalloc(sizeof(ListboxOptionTables));
+ optionTables = (ListboxOptionTables *)ckalloc(sizeof(ListboxOptionTables));
/*
* Set up an exit handler to free the optionTables struct.
@@ -526,7 +527,7 @@ Tk_ListboxObjCmd(
* already (e.g. resource pointers).
*/
- listPtr = ckalloc(sizeof(Listbox));
+ listPtr = (Listbox *)ckalloc(sizeof(Listbox));
memset(listPtr, 0, sizeof(Listbox));
listPtr->tkwin = tkwin;
@@ -537,9 +538,9 @@ Tk_ListboxObjCmd(
ListboxCmdDeletedProc);
listPtr->optionTable = optionTables->listboxOptionTable;
listPtr->itemAttrOptionTable = optionTables->itemAttrOptionTable;
- listPtr->selection = ckalloc(sizeof(Tcl_HashTable));
+ listPtr->selection = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(listPtr->selection, TCL_ONE_WORD_KEYS);
- listPtr->itemAttrTable = ckalloc(sizeof(Tcl_HashTable));
+ listPtr->itemAttrTable = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(listPtr->itemAttrTable, TCL_ONE_WORD_KEYS);
listPtr->relief = TK_RELIEF_RAISED;
listPtr->textGC = NULL;
@@ -567,7 +568,7 @@ Tk_ListboxObjCmd(
ListboxEventProc, listPtr);
Tk_CreateSelHandler(listPtr->tkwin, XA_PRIMARY, XA_STRING,
ListboxFetchSelection, listPtr, XA_STRING);
- if (Tk_InitOptions(interp, (char *)listPtr,
+ if (Tk_InitOptions(interp, listPtr,
optionTables->listboxOptionTable, tkwin) != TCL_OK) {
Tk_DestroyWindow(listPtr->tkwin);
return TCL_ERROR;
@@ -578,7 +579,7 @@ Tk_ListboxObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(listPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(listPtr->tkwin));
return TCL_OK;
}
@@ -607,7 +608,7 @@ ListboxWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */
{
- Listbox *listPtr = clientData;
+ Listbox *listPtr = (Listbox *)clientData;
int cmdIndex, index;
int result = TCL_OK;
Tcl_Obj *objPtr;
@@ -682,7 +683,7 @@ ListboxWidgetObjCmd(
break;
}
- objPtr = Tk_GetOptionValue(interp, (char *) listPtr,
+ objPtr = Tk_GetOptionValue(interp, listPtr,
listPtr->optionTable, objv[2], listPtr->tkwin);
if (objPtr == NULL) {
result = TCL_ERROR;
@@ -694,7 +695,7 @@ ListboxWidgetObjCmd(
case COMMAND_CONFIGURE:
if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) listPtr,
+ objPtr = Tk_GetOptionInfo(interp, listPtr,
listPtr->optionTable,
(objc == 3) ? objv[2] : NULL, listPtr->tkwin);
if (objPtr == NULL) {
@@ -728,7 +729,7 @@ ListboxWidgetObjCmd(
objPtr = Tcl_NewObj();
for (i = 0; i < listPtr->nElements; i++) {
if (Tcl_FindHashEntry(listPtr->selection, KEY(i))) {
- Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewIntObj(i));
+ Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(i));
}
}
Tcl_SetObjResult(interp, objPtr);
@@ -841,7 +842,7 @@ ListboxWidgetObjCmd(
if (result != TCL_OK) {
break;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
result = TCL_OK;
break;
@@ -905,7 +906,7 @@ ListboxWidgetObjCmd(
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
- "index ?-option? ?value? ?-option value ...?");
+ "index ?-option value ...?");
result = TCL_ERROR;
break;
}
@@ -926,7 +927,7 @@ ListboxWidgetObjCmd(
attrPtr = ListboxGetItemAttributes(interp, listPtr, index);
if (objc <= 4) {
- objPtr = Tk_GetOptionInfo(interp, (char *) attrPtr,
+ objPtr = Tk_GetOptionInfo(interp, attrPtr,
listPtr->itemAttrOptionTable,
(objc == 4) ? objv[3] : NULL, listPtr->tkwin);
if (objPtr == NULL) {
@@ -956,7 +957,7 @@ ListboxWidgetObjCmd(
break;
}
index = NearestListboxElement(listPtr, y);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
result = TCL_OK;
break;
}
@@ -1044,7 +1045,7 @@ ListboxWidgetObjCmd(
result = TCL_ERROR;
break;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(listPtr->nElements));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(listPtr->nElements));
result = TCL_OK;
break;
case COMMAND_XVIEW:
@@ -1102,7 +1103,8 @@ ListboxBboxSubCmd(
if ((listPtr->topIndex <= index) && (index < lastVisibleIndex)) {
Tcl_Obj *el, *results[4];
const char *stringRep;
- int pixelWidth, stringLen, x, y, result;
+ int pixelWidth, x, y, result;
+ TkSizeT stringLen;
Tk_FontMetrics fm;
/*
@@ -1129,10 +1131,10 @@ ListboxBboxSubCmd(
}
y = ((index - listPtr->topIndex)*listPtr->lineHeight)
+ listPtr->inset + listPtr->selBorderWidth;
- results[0] = Tcl_NewIntObj(x);
- results[1] = Tcl_NewIntObj(y);
- results[2] = Tcl_NewIntObj(pixelWidth);
- results[3] = Tcl_NewIntObj(fm.linespace);
+ results[0] = Tcl_NewWideIntObj(x);
+ results[1] = Tcl_NewWideIntObj(y);
+ results[2] = Tcl_NewWideIntObj(pixelWidth);
+ results[3] = Tcl_NewWideIntObj(fm.linespace);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
@@ -1410,16 +1412,16 @@ ListboxGetItemAttributes(
entry = Tcl_CreateHashEntry(listPtr->itemAttrTable, KEY(index), &isNew);
if (isNew) {
- attrs = ckalloc(sizeof(ItemAttr));
+ attrs = (ItemAttr *)ckalloc(sizeof(ItemAttr));
attrs->border = NULL;
attrs->selBorder = NULL;
attrs->fgColor = NULL;
attrs->selFgColor = NULL;
- Tk_InitOptions(interp, (char *)attrs, listPtr->itemAttrOptionTable,
+ Tk_InitOptions(interp, attrs, listPtr->itemAttrOptionTable,
listPtr->tkwin);
Tcl_SetHashValue(entry, attrs);
} else {
- attrs = Tcl_GetHashValue(entry);
+ attrs = (ItemAttr *)Tcl_GetHashValue(entry);
}
return attrs;
}
@@ -1446,7 +1448,7 @@ static void
DestroyListbox(
void *memPtr) /* Info about listbox widget. */
{
- Listbox *listPtr = memPtr;
+ Listbox *listPtr = (Listbox *)memPtr;
Tcl_HashEntry *entry;
Tcl_HashSearch search;
@@ -1526,8 +1528,10 @@ DestroyListbox(
static void
DestroyListboxOptionTables(
ClientData clientData, /* Pointer to the OptionTables struct */
- Tcl_Interp *interp) /* Pointer to the calling interp */
+ Tcl_Interp *dummy) /* Pointer to the calling interp */
{
+ (void)dummy;
+
ckfree(clientData);
return;
}
@@ -1578,7 +1582,7 @@ ConfigureListbox(
* First pass: set options to new values.
*/
- if (Tk_SetOptions(interp, (char *) listPtr,
+ if (Tk_SetOptions(interp, listPtr,
listPtr->optionTable, objc, objv,
listPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
@@ -1724,7 +1728,7 @@ ConfigureListboxItem(
{
Tk_SavedOptions savedOptions;
- if (Tk_SetOptions(interp, (char *)attrs,
+ if (Tk_SetOptions(interp, attrs,
listPtr->itemAttrOptionTable, objc, objv, listPtr->tkwin,
&savedOptions, NULL) != TCL_OK) {
Tk_RestoreSavedOptions(&savedOptions);
@@ -1766,7 +1770,7 @@ ListboxWorldChanged(
XGCValues gcValues;
GC gc;
unsigned long mask;
- Listbox *listPtr = instanceData;
+ Listbox *listPtr = (Listbox *)instanceData;
if (listPtr->state & STATE_NORMAL) {
gcValues.foreground = listPtr->fgColorPtr->pixel;
@@ -1837,10 +1841,11 @@ static void
DisplayListbox(
ClientData clientData) /* Information about window. */
{
- Listbox *listPtr = clientData;
+ Listbox *listPtr = (Listbox *)clientData;
Tk_Window tkwin = listPtr->tkwin;
GC gc;
- int i, limit, x, y, prevSelected, freeGC, stringLen;
+ int i, limit, x, y, prevSelected, freeGC;
+ TkSizeT stringLen;
Tk_FontMetrics fm;
Tcl_Obj *curElement;
Tcl_HashEntry *entry;
@@ -1956,7 +1961,7 @@ DisplayListbox(
*/
if (entry != NULL) {
- attrs = Tcl_GetHashValue(entry);
+ attrs = (ItemAttr *)Tcl_GetHashValue(entry);
/*
* Default GC has the values from the widget at large.
@@ -2037,7 +2042,7 @@ DisplayListbox(
*/
if (entry != NULL) {
- attrs = Tcl_GetHashValue(entry);
+ attrs = (ItemAttr *)Tcl_GetHashValue(entry);
gcValues.foreground = listPtr->fgColorPtr->pixel;
gcValues.font = Tk_FontId(listPtr->tkfont);
gcValues.graphics_exposures = False;
@@ -2236,7 +2241,8 @@ ListboxComputeGeometry(
* Tk_UnsetGrid to update gridding for the
* window. */
{
- int width, height, pixelWidth, pixelHeight, textLength, i, result;
+ int width, height, pixelWidth, pixelHeight, i, result;
+ TkSizeT textLength;
Tk_FontMetrics fm;
Tcl_Obj *element;
const char *text;
@@ -2323,7 +2329,8 @@ ListboxInsertSubCmd(
int objc, /* Number of new elements to add. */
Tcl_Obj *const objv[]) /* New elements (one per entry). */
{
- int i, oldMaxWidth, pixelWidth, result, length;
+ int i, oldMaxWidth, pixelWidth, result;
+ TkSizeT length;
Tcl_Obj *newListObj;
const char *stringRep;
@@ -2437,7 +2444,8 @@ ListboxDeleteSubCmd(
int first, /* Index of first element to delete. */
int last) /* Index of last element to delete. */
{
- int count, i, widthChanged, length, result, pixelWidth;
+ int count, i, widthChanged, result, pixelWidth;
+ TkSizeT length;
Tcl_Obj *newListObj, *element;
const char *stringRep;
Tcl_HashEntry *entry;
@@ -2610,7 +2618,7 @@ ListboxEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- Listbox *listPtr = clientData;
+ Listbox *listPtr = (Listbox *)clientData;
if (eventPtr->type == Expose) {
EventuallyRedrawRange(listPtr,
@@ -2685,7 +2693,7 @@ static void
ListboxCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- Listbox *listPtr = clientData;
+ Listbox *listPtr = (Listbox *)clientData;
/*
* This procedure could be invoked either because the window was destroyed
@@ -2723,14 +2731,24 @@ GetListboxIndex(
Listbox *listPtr, /* Listbox for which the index is being
* specified. */
Tcl_Obj *indexObj, /* Specifies an element in the listbox. */
- int endIsSize, /* If 1, "end" refers to the number of entries
+ int lastOK, /* If 1, "end" refers to the number of entries
* in the listbox. If 0, "end" refers to 1
* less than the number of entries. */
int *indexPtr) /* Where to store converted index. */
{
int result, index;
+ TkSizeT idx;
const char *stringRep;
+ result = TkGetIntForIndex(indexObj, listPtr->nElements - 1, lastOK, &idx);
+ if (result == TCL_OK) {
+ if ((idx != TCL_INDEX_NONE) && (idx > (TkSizeT)listPtr->nElements)) {
+ idx = listPtr->nElements;
+ }
+ *indexPtr = (int)idx;
+ return TCL_OK;
+ }
+
/*
* First see if the index is one of the named indices.
*/
@@ -2746,14 +2764,6 @@ GetListboxIndex(
/* "anchor" index */
*indexPtr = listPtr->selectAnchor;
break;
- case INDEX_END:
- /* "end" index */
- if (endIsSize) {
- *indexPtr = listPtr->nElements;
- } else {
- *indexPtr = listPtr->nElements - 1;
- }
- break;
}
return TCL_OK;
}
@@ -2788,14 +2798,6 @@ GetListboxIndex(
}
/*
- * Maybe the index is just an integer.
- */
-
- if (Tcl_GetIntFromObj(interp, indexObj, indexPtr) == TCL_OK) {
- return TCL_OK;
- }
-
- /*
* Everything failed, nothing matched. Throw up an error message.
*/
@@ -3110,19 +3112,20 @@ ListboxSelect(
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
ListboxFetchSelection(
ClientData clientData, /* Information about listbox widget. */
- int offset, /* Offset within selection of first byte to be
+ TkSizeT offset, /* Offset within selection of first byte to be
* returned. */
char *buffer, /* Location in which to place selection. */
- int maxBytes) /* Maximum number of bytes to place at buffer,
+ TkSizeT maxBytes) /* Maximum number of bytes to place at buffer,
* not including terminating NULL
* character. */
{
- Listbox *listPtr = clientData;
+ Listbox *listPtr = (Listbox *)clientData;
Tcl_DString selection;
- int length, count, needNewline, stringLen, i;
+ int count, needNewline, i;
+ TkSizeT length, stringLen;
Tcl_Obj *curElement;
const char *stringRep;
Tcl_HashEntry *entry;
@@ -3160,14 +3163,14 @@ ListboxFetchSelection(
* Copy the requested portion of the selection to the buffer.
*/
- count = length - offset;
- if (count <= 0) {
+ if (length <= offset) {
count = 0;
} else {
- if (count > maxBytes) {
- count = maxBytes;
+ count = length - offset;
+ if (count > (int)maxBytes) {
+ count = (int)maxBytes;
}
- memcpy(buffer, Tcl_DStringValue(&selection) + offset, (size_t) count);
+ memcpy(buffer, Tcl_DStringValue(&selection) + offset, count);
}
buffer[count] = '\0';
Tcl_DStringFree(&selection);
@@ -3196,7 +3199,7 @@ static void
ListboxLostSelection(
ClientData clientData) /* Information about listbox widget. */
{
- Listbox *listPtr = clientData;
+ Listbox *listPtr = (Listbox *)clientData;
if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp))
&& (listPtr->nElements > 0)) {
@@ -3226,7 +3229,7 @@ static void
GenerateListboxSelectEvent(
Listbox *listPtr) /* Information about widget. */
{
- TkSendVirtualEvent(listPtr->tkwin, "ListboxSelect", NULL);
+ Tk_SendVirtualEvent(listPtr->tkwin, "ListboxSelect", NULL);
}
/*
@@ -3255,8 +3258,11 @@ EventuallyRedrawRange(
* be redrawn. May be less than first; these
* just bracket a range. */
{
+ (void)first;
+ (void)last;
+
/*
- * We don't have to a redraw callback if one is already pending,
+ * We don't have to register a redraw callback if one is already pending,
* or if the window doesn't exist, or if the window isn't mapped.
*/
@@ -3435,10 +3441,12 @@ ListboxListVarProc(
const char *name2, /* Not used. */
int flags) /* Information about what happened. */
{
- Listbox *listPtr = clientData;
+ Listbox *listPtr = (Listbox *)clientData;
Tcl_Obj *oldListObj, *varListObj;
int oldLength, i;
Tcl_HashEntry *entry;
+ (void)name1;
+ (void)name2;
/*
* Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable!
diff --git a/generic/tkMacWinMenu.c b/generic/tkMacWinMenu.c
index 7749c6d..eb8eb2f 100644
--- a/generic/tkMacWinMenu.c
+++ b/generic/tkMacWinMenu.c
@@ -4,7 +4,7 @@
* This module implements the common elements of the Mac and Windows
* specific features of menus. This file is not used for UNIX.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -43,7 +43,7 @@ PreprocessMenu(
TkMenu *menuPtr)
{
int index, result, finished;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_Preserve(menuPtr);
@@ -66,7 +66,7 @@ PreprocessMenu(
do {
finished = 1;
- for (index = 0; index < menuPtr->numEntries; index++) {
+ for (index = 0; index < (int)menuPtr->numEntries; index++) {
TkMenuEntry *entryPtr = menuPtr->entries[index];
if ((entryPtr->type == CASCADE_ENTRY)
@@ -129,7 +129,7 @@ int
TkPreprocessMenu(
TkMenu *menuPtr)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->postCommandGeneration++;
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 953a54f..41afc06 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -38,7 +38,7 @@ extern "C" {
/* Little hack to eliminate the need for "tclInt.h" here:
Just copy a small portion of TclIntPlatStubs, just
enough to make it work. See [600b72bfbc] */
-typedef struct {
+typedef struct TclIntPlatStubs {
int magic;
void *hooks;
void (*dummy[16]) (void); /* dummy entries 0-15, not used */
@@ -68,7 +68,7 @@ NewNativeObj(
Tcl_Obj *obj;
Tcl_DString ds;
-#if defined(_WIN32) && defined(UNICODE)
+#ifdef UNICODE
Tcl_DStringInit(&ds);
Tcl_WCharToUtfDString(string, wcslen(string), &ds);
#else
@@ -100,7 +100,7 @@ static int WinIsTty(int fd) {
*/
#if !defined(STATIC_BUILD)
- if (tclStubsPtr->reserved9 && tclIntPlatStubsPtr->tclpIsAtty) {
+ if (tclStubsPtr->tcl_CreateFileHandler && tclIntPlatStubsPtr->tclpIsAtty) {
/* We are running on Cygwin */
return tclIntPlatStubsPtr->tclpIsAtty(fd);
}
@@ -179,7 +179,7 @@ Tk_MainEx(
* Ensure that we are getting a compatible version of Tcl.
*/
- if (Tcl_InitStubs(interp, "8.6", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
abort();
} else {
@@ -189,7 +189,7 @@ Tk_MainEx(
#if defined(_WIN32) && !defined(UNICODE) && !defined(STATIC_BUILD)
- if (tclStubsPtr->reserved9) {
+ if (tclStubsPtr->tcl_CreateFileHandler) {
/* We are running win32 Tk under Cygwin, so let's check
* whether the env("DISPLAY") variable or the -display
* argument is set. If so, we really want to run the
@@ -221,7 +221,7 @@ Tk_MainEx(
#if defined(_WIN32)
#if !defined(STATIC_BUILD)
/* If compiled for Win32 but running on Cygwin, don't use console */
- if (!tclStubsPtr->reserved9)
+ if (!tclStubsPtr->tcl_CreateFileHandler)
#endif
Tk_InitConsoleChannels(interp);
#endif
@@ -280,7 +280,7 @@ Tk_MainEx(
argc--;
argv++;
- Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewIntObj(argc), TCL_GLOBAL_ONLY);
+ Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewWideIntObj(argc), TCL_GLOBAL_ONLY);
argvPtr = Tcl_NewListObj(0, NULL);
while (argc--) {
@@ -307,7 +307,7 @@ Tk_MainEx(
}
#endif
Tcl_SetVar2Ex(interp, "tcl_interactive", NULL,
- Tcl_NewIntObj(!path && (is.tty || nullStdin)), TCL_GLOBAL_ONLY);
+ Tcl_NewWideIntObj(!path && (is.tty || nullStdin)), TCL_GLOBAL_ONLY);
/*
* Invoke application-specific initialization.
@@ -403,19 +403,24 @@ Tk_MainEx(
static void
StdinProc(
ClientData clientData, /* The state of interactive cmd line */
- int mask) /* Not used. */
+ TCL_UNUSED(int))
{
char *cmd;
int code;
- int count;
+ TkSizeT count;
InteractiveState *isPtr = (InteractiveState *)clientData;
Tcl_Channel chan = isPtr->input;
Tcl_Interp *interp = isPtr->interp;
- (void)mask;
+ Tcl_DString savedEncoding;
+ Tcl_DStringInit(&savedEncoding);
+ Tcl_GetChannelOption(NULL, chan, "-encoding", &savedEncoding);
+ Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8");
count = Tcl_Gets(chan, &isPtr->line);
+ Tcl_SetChannelOption(NULL, chan, "-encoding", Tcl_DStringValue(&savedEncoding));
+ Tcl_DStringFree(&savedEncoding);
- if ((count == -1) && !isPtr->gotPartial) {
+ if ((count == TCL_IO_FAILURE) && !isPtr->gotPartial) {
if (isPtr->tty) {
Tcl_Exit(0);
} else {
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 18f59a8..da5815f 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -6,8 +6,8 @@
* supplemented by platform-specific files. The geometry calculation and
* drawing code for menus is in the file tkMenuDraw.c
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1998 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -38,7 +38,7 @@
* implemented using menu clones. Menu clones are full menus in their own
* right; they have a Tk window and pathname associated with them; they have a
* TkMenu structure and array of entries. However, they are linked with the
- * original menu that they were cloned from. The reflect the attributes of the
+ * original menu that they were cloned from. They reflect the attributes of the
* original, or "main", menu. So if an item is added to a menu, and that
* menu has clones, then the item must be added to all of its clones also.
* Menus are cloned when a menu is torn-off or when a menu is assigned as a
@@ -118,117 +118,117 @@ static const char *const compoundStrings[] = {
static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", NULL, NULL,
- DEF_MENU_ENTRY_ACTIVE_BG, Tk_Offset(TkMenuEntry, activeBorderPtr), -1,
+ DEF_MENU_ENTRY_ACTIVE_BG, offsetof(TkMenuEntry, activeBorderPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_COLOR, "-activeforeground", NULL, NULL,
DEF_MENU_ENTRY_ACTIVE_FG,
- Tk_Offset(TkMenuEntry, activeFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, activeFgPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING, "-accelerator", NULL, NULL,
DEF_MENU_ENTRY_ACCELERATOR,
- Tk_Offset(TkMenuEntry, accelPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, accelPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_BORDER, "-background", NULL, NULL,
DEF_MENU_ENTRY_BG,
- Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, borderPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_BITMAP, "-bitmap", NULL, NULL,
DEF_MENU_ENTRY_BITMAP,
- Tk_Offset(TkMenuEntry, bitmapPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, bitmapPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_BOOLEAN, "-columnbreak", NULL, NULL,
DEF_MENU_ENTRY_COLUMN_BREAK,
- -1, Tk_Offset(TkMenuEntry, columnBreak), 0, NULL, 0},
+ TCL_INDEX_NONE, offsetof(TkMenuEntry, columnBreak), 0, NULL, 0},
{TK_OPTION_STRING, "-command", NULL, NULL,
DEF_MENU_ENTRY_COMMAND,
- Tk_Offset(TkMenuEntry, commandPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_MENU_ENTRY_COMPOUND, -1, Tk_Offset(TkMenuEntry, compound), 0,
+ DEF_MENU_ENTRY_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuEntry, compound), 0,
(ClientData) compoundStrings, 0},
{TK_OPTION_FONT, "-font", NULL, NULL,
DEF_MENU_ENTRY_FONT,
- Tk_Offset(TkMenuEntry, fontPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, fontPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_COLOR, "-foreground", NULL, NULL,
DEF_MENU_ENTRY_FG,
- Tk_Offset(TkMenuEntry, fgPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, fgPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_BOOLEAN, "-hidemargin", NULL, NULL,
DEF_MENU_ENTRY_HIDE_MARGIN,
- -1, Tk_Offset(TkMenuEntry, hideMargin), 0, NULL, 0},
+ TCL_INDEX_NONE, offsetof(TkMenuEntry, hideMargin), 0, NULL, 0},
{TK_OPTION_STRING, "-image", NULL, NULL,
DEF_MENU_ENTRY_IMAGE,
- Tk_Offset(TkMenuEntry, imagePtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, imagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING, "-label", NULL, NULL,
DEF_MENU_ENTRY_LABEL,
- Tk_Offset(TkMenuEntry, labelPtr), -1, 0, NULL, 0},
+ offsetof(TkMenuEntry, labelPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
DEF_MENU_ENTRY_STATE,
- -1, Tk_Offset(TkMenuEntry, state), 0,
+ TCL_INDEX_NONE, offsetof(TkMenuEntry, state), 0,
(ClientData) menuStateStrings, 0},
{TK_OPTION_INT, "-underline", NULL, NULL,
- DEF_MENU_ENTRY_UNDERLINE, -1, Tk_Offset(TkMenuEntry, underline), 0, NULL, 0},
+ TK_OPTION_UNDERLINE_DEF(TkMenuEntry, underline), 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
};
static const Tk_OptionSpec tkSeparatorEntryConfigSpecs[] = {
{TK_OPTION_BORDER, "-background", NULL, NULL,
DEF_MENU_ENTRY_BG,
- Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, borderPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
};
static const Tk_OptionSpec tkCheckButtonEntryConfigSpecs[] = {
{TK_OPTION_BOOLEAN, "-indicatoron", NULL, NULL,
DEF_MENU_ENTRY_INDICATOR,
- -1, Tk_Offset(TkMenuEntry, indicatorOn), 0, NULL, 0},
+ TCL_INDEX_NONE, offsetof(TkMenuEntry, indicatorOn), 0, NULL, 0},
{TK_OPTION_STRING, "-offvalue", NULL, NULL,
DEF_MENU_ENTRY_OFF_VALUE,
- Tk_Offset(TkMenuEntry, offValuePtr), -1, 0, NULL, 0},
+ offsetof(TkMenuEntry, offValuePtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-onvalue", NULL, NULL,
DEF_MENU_ENTRY_ON_VALUE,
- Tk_Offset(TkMenuEntry, onValuePtr), -1, 0, NULL, 0},
+ offsetof(TkMenuEntry, onValuePtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_COLOR, "-selectcolor", NULL, NULL,
DEF_MENU_ENTRY_SELECT,
- Tk_Offset(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, indicatorFgPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING, "-selectimage", NULL, NULL,
DEF_MENU_ENTRY_SELECT_IMAGE,
- Tk_Offset(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, selectImagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING, "-variable", NULL, NULL,
DEF_MENU_ENTRY_CHECK_VARIABLE,
- Tk_Offset(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, namePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL,
- NULL, 0, -1, 0, tkBasicMenuEntryConfigSpecs, 0}
+ NULL, 0, TCL_INDEX_NONE, 0, tkBasicMenuEntryConfigSpecs, 0}
};
static const Tk_OptionSpec tkRadioButtonEntryConfigSpecs[] = {
{TK_OPTION_BOOLEAN, "-indicatoron", NULL, NULL,
DEF_MENU_ENTRY_INDICATOR,
- -1, Tk_Offset(TkMenuEntry, indicatorOn), 0, NULL, 0},
+ TCL_INDEX_NONE, offsetof(TkMenuEntry, indicatorOn), 0, NULL, 0},
{TK_OPTION_COLOR, "-selectcolor", NULL, NULL,
DEF_MENU_ENTRY_SELECT,
- Tk_Offset(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, indicatorFgPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING, "-selectimage", NULL, NULL,
DEF_MENU_ENTRY_SELECT_IMAGE,
- Tk_Offset(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, selectImagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING, "-value", NULL, NULL,
DEF_MENU_ENTRY_VALUE,
- Tk_Offset(TkMenuEntry, onValuePtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, onValuePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING, "-variable", NULL, NULL,
DEF_MENU_ENTRY_RADIO_VARIABLE,
- Tk_Offset(TkMenuEntry, namePtr), -1, 0, NULL, 0},
+ offsetof(TkMenuEntry, namePtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL,
- NULL, 0, -1, 0, tkBasicMenuEntryConfigSpecs, 0}
+ NULL, 0, TCL_INDEX_NONE, 0, tkBasicMenuEntryConfigSpecs, 0}
};
static const Tk_OptionSpec tkCascadeEntryConfigSpecs[] = {
{TK_OPTION_STRING, "-menu", NULL, NULL,
DEF_MENU_ENTRY_MENU,
- Tk_Offset(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, namePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL,
- NULL, 0, -1, 0, tkBasicMenuEntryConfigSpecs, 0}
+ NULL, 0, TCL_INDEX_NONE, 0, tkBasicMenuEntryConfigSpecs, 0}
};
static const Tk_OptionSpec tkTearoffEntryConfigSpecs[] = {
{TK_OPTION_BORDER, "-background", NULL, NULL,
DEF_MENU_ENTRY_BG,
- Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenuEntry, borderPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
- DEF_MENU_ENTRY_STATE, -1, Tk_Offset(TkMenuEntry, state), 0,
+ DEF_MENU_ENTRY_STATE, TCL_INDEX_NONE, offsetof(TkMenuEntry, state), 0,
(ClientData) menuStateStrings, 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
};
@@ -250,59 +250,62 @@ static const char *const menuTypeStrings[] = {
static const Tk_OptionSpec tkMenuConfigSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground",
"Foreground", DEF_MENU_ACTIVE_BG_COLOR,
- Tk_Offset(TkMenu, activeBorderPtr), -1, 0,
+ offsetof(TkMenu, activeBorderPtr), TCL_INDEX_NONE, 0,
(ClientData) DEF_MENU_ACTIVE_BG_MONO, 0},
{TK_OPTION_PIXELS, "-activeborderwidth", "activeBorderWidth",
"BorderWidth", DEF_MENU_ACTIVE_BORDER_WIDTH,
- Tk_Offset(TkMenu, activeBorderWidthPtr), -1, 0, NULL, 0},
+ offsetof(TkMenu, activeBorderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_COLOR, "-activeforeground", "activeForeground",
"Background", DEF_MENU_ACTIVE_FG_COLOR,
- Tk_Offset(TkMenu, activeFgPtr), -1, 0,
+ offsetof(TkMenu, activeFgPtr), TCL_INDEX_NONE, 0,
(ClientData) DEF_MENU_ACTIVE_FG_MONO, 0},
+ {TK_OPTION_RELIEF, "-activerelief", "activeRelief", "Relief",
+ DEF_MENU_ACTIVE_RELIEF, offsetof(TkMenu, activeReliefPtr),
+ TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_MENU_BG_COLOR, Tk_Offset(TkMenu, borderPtr), -1, 0,
+ DEF_MENU_BG_COLOR, offsetof(TkMenu, borderPtr), TCL_INDEX_NONE, 0,
(ClientData) DEF_MENU_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_MENU_BORDER_WIDTH,
- Tk_Offset(TkMenu, borderWidthPtr), -1, 0, NULL, 0},
+ offsetof(TkMenu, borderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_MENU_CURSOR,
- Tk_Offset(TkMenu, cursorPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenu, cursorPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_MENU_DISABLED_FG_COLOR,
- Tk_Offset(TkMenu, disabledFgPtr), -1, TK_OPTION_NULL_OK,
+ offsetof(TkMenu, disabledFgPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK,
(ClientData) DEF_MENU_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", NULL, NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_MENU_FONT, Tk_Offset(TkMenu, fontPtr), -1, 0, NULL, 0},
+ DEF_MENU_FONT, offsetof(TkMenu, fontPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_MENU_FG, Tk_Offset(TkMenu, fgPtr), -1, 0, NULL, 0},
+ DEF_MENU_FG, offsetof(TkMenu, fgPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-postcommand", "postCommand", "Command",
DEF_MENU_POST_COMMAND,
- Tk_Offset(TkMenu, postCommandPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenu, postCommandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_MENU_RELIEF, Tk_Offset(TkMenu, reliefPtr), -1, 0, NULL, 0},
+ DEF_MENU_RELIEF, offsetof(TkMenu, reliefPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_COLOR, "-selectcolor", "selectColor", "Background",
- DEF_MENU_SELECT_COLOR, Tk_Offset(TkMenu, indicatorFgPtr), -1, 0,
+ DEF_MENU_SELECT_COLOR, offsetof(TkMenu, indicatorFgPtr), TCL_INDEX_NONE, 0,
(ClientData) DEF_MENU_SELECT_MONO, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_MENU_TAKE_FOCUS,
- Tk_Offset(TkMenu, takeFocusPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenu, takeFocusPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_BOOLEAN, "-tearoff", "tearOff", "TearOff",
- DEF_MENU_TEAROFF, -1, Tk_Offset(TkMenu, tearoff), 0, NULL, 0},
+ DEF_MENU_TEAROFF, TCL_INDEX_NONE, offsetof(TkMenu, tearoff), 0, NULL, 0},
{TK_OPTION_STRING, "-tearoffcommand", "tearOffCommand",
"TearOffCommand", DEF_MENU_TEAROFF_CMD,
- Tk_Offset(TkMenu, tearoffCommandPtr), -1, TK_OPTION_NULL_OK, NULL, 0},
+ offsetof(TkMenu, tearoffCommandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING, "-title", "title", "Title",
- DEF_MENU_TITLE, Tk_Offset(TkMenu, titlePtr), -1,
+ DEF_MENU_TITLE, offsetof(TkMenu, titlePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING_TABLE, "-type", "type", "Type",
- DEF_MENU_TYPE, Tk_Offset(TkMenu, menuTypePtr), -1, TK_OPTION_NULL_OK,
+ DEF_MENU_TYPE, offsetof(TkMenu, menuTypePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK,
(ClientData) menuTypeStrings, 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
};
@@ -343,9 +346,9 @@ static void DestroyMenuHashTable(ClientData clientData,
Tcl_Interp *interp);
static void DestroyMenuInstance(TkMenu *menuPtr);
static void DestroyMenuEntry(void *memPtr);
-static int GetIndexFromCoords(Tcl_Interp *interp,
+static TkSizeT GetIndexFromCoords(Tcl_Interp *interp,
TkMenu *menuPtr, const char *string,
- int *indexPtr);
+ TkSizeT *indexPtr);
static int MenuDoYPosition(Tcl_Interp *interp,
TkMenu *menuPtr, Tcl_Obj *objPtr);
static int MenuDoXPosition(Tcl_Interp *interp,
@@ -354,7 +357,7 @@ static int MenuAddOrInsert(Tcl_Interp *interp,
TkMenu *menuPtr, Tcl_Obj *indexPtr, int objc,
Tcl_Obj *const objv[]);
static void MenuCmdDeletedProc(ClientData clientData);
-static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, int index, int type);
+static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, TkSizeT index, int type);
static char * MenuVarProc(ClientData clientData,
Tcl_Interp *interp, const char *name1,
const char *name2, int flags);
@@ -365,7 +368,9 @@ static void MenuWorldChanged(ClientData instanceData);
static int PostProcessEntry(TkMenuEntry *mePtr);
static void RecursivelyDeleteMenu(TkMenu *menuPtr);
static void UnhookCascadeEntry(TkMenuEntry *mePtr);
-static void TkMenuCleanup(ClientData unused);
+static void MenuCleanup(ClientData unused);
+static int GetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr,
+ Tcl_Obj *objPtr, int lastOK, TkSizeT *indexPtr);
/*
* The structure below is a list of procs that respond to certain window
@@ -404,14 +409,14 @@ Tk_MenuObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
Tk_Window newWin;
TkMenu *menuPtr;
TkMenuReferences *menuRefPtr;
int i, index, toplevel;
const char *windowName;
static const char *const typeStringList[] = {"-type", NULL};
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (objc < 2) {
@@ -446,7 +451,7 @@ Tk_MenuObjCmd(
* Tcl_EventuallyFree is called.
*/
- menuPtr = ckalloc(sizeof(TkMenu));
+ menuPtr = (TkMenu *)ckalloc(sizeof(TkMenu));
memset(menuPtr, 0, sizeof(TkMenu));
menuPtr->tkwin = newWin;
menuPtr->display = Tk_Display(newWin);
@@ -454,9 +459,9 @@ Tk_MenuObjCmd(
menuPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr,
MenuCmdDeletedProc);
- menuPtr->active = -1;
+ menuPtr->active = TCL_INDEX_NONE;
menuPtr->cursorPtr = NULL;
- menuPtr->masterMenuPtr = menuPtr;
+ menuPtr->mainMenuPtr = menuPtr;
menuPtr->menuType = UNKNOWN_TYPE;
TkMenuInitializeDrawingFields(menuPtr);
@@ -465,7 +470,7 @@ Tk_MenuObjCmd(
Tk_CreateEventHandler(newWin,
ExposureMask|StructureNotifyMask|ActivateMask,
TkMenuEventProc, menuPtr);
- if (Tk_InitOptions(interp, (char *) menuPtr,
+ if (Tk_InitOptions(interp, menuPtr,
tsdPtr->menuOptionTable, menuPtr->tkwin)
!= TCL_OK) {
Tk_DestroyWindow(menuPtr->tkwin);
@@ -521,9 +526,9 @@ Tk_MenuObjCmd(
* creating exists.
*/
- if ((menuPtr->masterMenuPtr != menuPtr)
- || ((menuPtr->masterMenuPtr == menuPtr)
- && ((cascadeListPtr->menuPtr->masterMenuPtr
+ if ((menuPtr->mainMenuPtr != menuPtr)
+ || ((menuPtr->mainMenuPtr == menuPtr)
+ && ((cascadeListPtr->menuPtr->mainMenuPtr
== cascadeListPtr->menuPtr)))) {
newObjv[0] = Tcl_NewStringObj("-menu", -1);
newObjv[1] = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin),-1);
@@ -588,7 +593,7 @@ Tk_MenuObjCmd(
}
}
- Tcl_SetObjResult(interp, TkNewWindowObj(menuPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(menuPtr->tkwin));
return TCL_OK;
}
@@ -617,11 +622,11 @@ MenuWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TkMenu *menuPtr = clientData;
+ TkMenu *menuPtr = (TkMenu *)clientData;
TkMenuEntry *mePtr;
int result = TCL_OK;
int option;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (objc < 2) {
@@ -636,21 +641,21 @@ MenuWidgetObjCmd(
switch ((enum options) option) {
case MENU_ACTIVATE: {
- int index;
+ TkSizeT index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "index");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
if (menuPtr->active == index) {
goto done;
}
- if ((index >= 0) && ((menuPtr->entries[index]->type==SEPARATOR_ENTRY)
+ if ((index != TCL_INDEX_NONE) && ((menuPtr->entries[index]->type==SEPARATOR_ENTRY)
|| (menuPtr->entries[index]->state == ENTRY_DISABLED))) {
- index = -1;
+ index = TCL_INDEX_NONE;
}
result = TkActivateMenuEntry(menuPtr, index);
break;
@@ -672,7 +677,7 @@ MenuWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "option");
goto error;
}
- resultPtr = Tk_GetOptionValue(interp, (char *) menuPtr,
+ resultPtr = Tk_GetOptionValue(interp, menuPtr,
tsdPtr->menuOptionTable, objv[2],
menuPtr->tkwin);
if (resultPtr == NULL) {
@@ -692,7 +697,7 @@ MenuWidgetObjCmd(
Tcl_Obj *resultPtr;
if (objc == 2) {
- resultPtr = Tk_GetOptionInfo(interp, (char *) menuPtr,
+ resultPtr = Tk_GetOptionInfo(interp, menuPtr,
tsdPtr->menuOptionTable, NULL,
menuPtr->tkwin);
if (resultPtr == NULL) {
@@ -702,7 +707,7 @@ MenuWidgetObjCmd(
Tcl_SetObjResult(interp, resultPtr);
}
} else if (objc == 3) {
- resultPtr = Tk_GetOptionInfo(interp, (char *) menuPtr,
+ resultPtr = Tk_GetOptionInfo(interp, menuPtr,
tsdPtr->menuOptionTable, objv[2],
menuPtr->tkwin);
if (resultPtr == NULL) {
@@ -720,7 +725,8 @@ MenuWidgetObjCmd(
break;
}
case MENU_DELETE: {
- int first, last;
+ TkSizeT first, last;
+ Tcl_WideInt w;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "first ?last?");
@@ -733,16 +739,17 @@ MenuWidgetObjCmd(
*/
if (isdigit(UCHAR(Tcl_GetString(objv[2])[0]))
- && Tcl_GetIntFromObj(NULL, objv[2], &first) == TCL_OK) {
+ && Tcl_GetWideIntFromObj(NULL, objv[2], &w) == TCL_OK) {
+ first = w;
if (first >= menuPtr->numEntries) {
goto done;
}
- } else if (TkGetMenuIndex(interp,menuPtr,objv[2],0,&first) != TCL_OK){
+ } else if (GetMenuIndex(interp,menuPtr,objv[2],0,&first) != TCL_OK){
goto error;
}
if (objc == 3) {
last = first;
- } else if (TkGetMenuIndex(interp,menuPtr,objv[3],0,&last) != TCL_OK) {
+ } else if (GetMenuIndex(interp,menuPtr,objv[3],0,&last) != TCL_OK) {
goto error;
}
@@ -754,29 +761,29 @@ MenuWidgetObjCmd(
first = 1;
}
- if ((first == -1) || (last < first)) {
+ if ((first == TCL_INDEX_NONE) || (last < first)) {
goto done;
}
DeleteMenuCloneEntries(menuPtr, first, last);
break;
}
case MENU_ENTRYCGET: {
- int index;
+ TkSizeT index;
Tcl_Obj *resultPtr;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "index option");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
goto done;
}
mePtr = menuPtr->entries[index];
Tcl_Preserve(mePtr);
- resultPtr = Tk_GetOptionValue(interp, (char *) mePtr,
+ resultPtr = Tk_GetOptionValue(interp, mePtr,
mePtr->optionTable, objv[3], menuPtr->tkwin);
Tcl_Release(mePtr);
if (resultPtr == NULL) {
@@ -786,23 +793,23 @@ MenuWidgetObjCmd(
break;
}
case MENU_ENTRYCONFIGURE: {
- int index;
+ TkSizeT index;
Tcl_Obj *resultPtr;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "index ?-option value ...?");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
goto done;
}
mePtr = menuPtr->entries[index];
Tcl_Preserve(mePtr);
if (objc == 3) {
- resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr,
+ resultPtr = Tk_GetOptionInfo(interp, mePtr,
mePtr->optionTable, NULL, menuPtr->tkwin);
if (resultPtr == NULL) {
result = TCL_ERROR;
@@ -811,7 +818,7 @@ MenuWidgetObjCmd(
Tcl_SetObjResult(interp, resultPtr);
}
} else if (objc == 4) {
- resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr,
+ resultPtr = Tk_GetOptionInfo(interp, mePtr,
mePtr->optionTable, objv[3], menuPtr->tkwin);
if (resultPtr == NULL) {
result = TCL_ERROR;
@@ -827,20 +834,19 @@ MenuWidgetObjCmd(
break;
}
case MENU_INDEX: {
- int index;
+ TkSizeT index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "string");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1));
- } else {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
- }
+ } else
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
break;
}
case MENU_INSERT:
@@ -854,23 +860,24 @@ MenuWidgetObjCmd(
}
break;
case MENU_INVOKE: {
- int index;
+ TkSizeT index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "index");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
goto done;
}
result = TkInvokeMenu(interp, menuPtr, index);
break;
}
case MENU_POST: {
- int x, y, index = -1;
+ int x, y;
+ TkSizeT index = TCL_INDEX_NONE;
if (objc != 4 && objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "x y ?index?");
@@ -881,7 +888,7 @@ MenuWidgetObjCmd(
goto error;
}
if (objc == 5) {
- if (TkGetMenuIndex(interp, menuPtr, objv[4], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[4], 0, &index) != TCL_OK) {
goto error;
}
}
@@ -905,17 +912,17 @@ MenuWidgetObjCmd(
break;
}
case MENU_POSTCASCADE: {
- int index;
+ TkSizeT index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "index");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if ((index < 0) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) {
+ if ((index == TCL_INDEX_NONE) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) {
result = TkPostSubmenu(interp, menuPtr, NULL);
} else {
result = TkPostSubmenu(interp, menuPtr, menuPtr->entries[index]);
@@ -923,17 +930,17 @@ MenuWidgetObjCmd(
break;
}
case MENU_TYPE: {
- int index;
+ TkSizeT index;
const char *typeStr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "index");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
goto done;
}
if (menuPtr->entries[index]->type == TEAROFF_ENTRY) {
@@ -998,13 +1005,13 @@ int
TkInvokeMenu(
Tcl_Interp *interp, /* The interp that the menu lives in. */
TkMenu *menuPtr, /* The menu we are invoking. */
- int index) /* The zero based index of the item we are
+ TkSizeT index) /* The zero based index of the item we are
* invoking. */
{
int result = TCL_OK;
TkMenuEntry *mePtr;
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
goto done;
}
mePtr = menuPtr->entries[index];
@@ -1102,7 +1109,7 @@ DestroyMenuInstance(
Tcl_Obj *newObjv[2];
TkMenu *parentMainMenuPtr;
TkMenuEntry *parentMainEntryPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1132,10 +1139,10 @@ DestroyMenuInstance(
for (; cascadePtr != NULL; cascadePtr = nextCascadePtr) {
nextCascadePtr = cascadePtr->nextCascadePtr;
- if (menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->mainMenuPtr != menuPtr) {
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
- parentMainMenuPtr = cascadePtr->menuPtr->masterMenuPtr;
+ parentMainMenuPtr = cascadePtr->menuPtr->mainMenuPtr;
parentMainEntryPtr =
parentMainMenuPtr->entries[cascadePtr->index];
newObjv[0] = menuNamePtr;
@@ -1158,8 +1165,8 @@ DestroyMenuInstance(
}
}
- if (menuPtr->masterMenuPtr != menuPtr) {
- for (menuInstancePtr = menuPtr->masterMenuPtr;
+ if (menuPtr->mainMenuPtr != menuPtr) {
+ for (menuInstancePtr = menuPtr->mainMenuPtr;
menuInstancePtr != NULL;
menuInstancePtr = menuInstancePtr->nextInstancePtr) {
if (menuInstancePtr->nextInstancePtr == menuPtr) {
@@ -1256,7 +1263,7 @@ TkDestroyMenu(
topLevelListPtr = nextTopLevelPtr;
}
}
- if (menuPtr->masterMenuPtr == menuPtr) {
+ if (menuPtr->mainMenuPtr == menuPtr) {
while (menuPtr->nextInstancePtr != NULL) {
menuInstancePtr = menuPtr->nextInstancePtr;
menuPtr->nextInstancePtr = menuInstancePtr->nextInstancePtr;
@@ -1385,7 +1392,7 @@ static void
DestroyMenuEntry(
void *memPtr) /* Pointer to entry to be freed. */
{
- TkMenuEntry *mePtr = memPtr;
+ TkMenuEntry *mePtr = (TkMenuEntry *)memPtr;
TkMenu *menuPtr = mePtr->menuPtr;
if (menuPtr->postedCascade == mePtr) {
@@ -1404,7 +1411,7 @@ DestroyMenuEntry(
*/
if (mePtr->type == CASCADE_ENTRY) {
- if (menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->mainMenuPtr != menuPtr) {
TkMenu *destroyThis = NULL;
TkMenuReferences *menuRefPtr = mePtr->childMenuRefPtr;
@@ -1424,7 +1431,7 @@ DestroyMenuEntry(
*/
if ((destroyThis != NULL)
- && (destroyThis->masterMenuPtr == destroyThis)) {
+ && (destroyThis->mainMenuPtr == destroyThis)) {
destroyThis = NULL;
}
}
@@ -1485,8 +1492,8 @@ static void
MenuWorldChanged(
ClientData instanceData) /* Information about widget. */
{
- TkMenu *menuPtr = instanceData;
- int i;
+ TkMenu *menuPtr = (TkMenu *)instanceData;
+ TkSizeT i;
TkMenuConfigureDrawOptions(menuPtr);
for (i = 0; i < menuPtr->numEntries; i++) {
@@ -1527,17 +1534,17 @@ ConfigureMenu(
int i;
TkMenu *menuListPtr, *cleanupPtr;
int result;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
- menuListPtr->errorStructPtr = ckalloc(sizeof(Tk_SavedOptions));
- result = Tk_SetOptions(interp, (char *) menuListPtr,
+ menuListPtr->errorStructPtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions));
+ result = Tk_SetOptions(interp, menuListPtr,
tsdPtr->menuOptionTable, objc, objv,
menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL);
if (result != TCL_OK) {
- for (cleanupPtr = menuPtr->masterMenuPtr;
+ for (cleanupPtr = menuPtr->mainMenuPtr;
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
@@ -1606,7 +1613,7 @@ ConfigureMenu(
if ((menuListPtr->numEntries == 0)
|| (menuListPtr->entries[0]->type != TEAROFF_ENTRY)) {
if (MenuNewEntry(menuListPtr, 0, TEAROFF_ENTRY) == NULL) {
- for (cleanupPtr = menuPtr->masterMenuPtr;
+ for (cleanupPtr = menuPtr->mainMenuPtr;
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
@@ -1626,12 +1633,11 @@ ConfigureMenu(
Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry);
- for (i = 0; i < menuListPtr->numEntries - 1; i++) {
+ for (i = 0; i < (int)menuListPtr->numEntries - 1; i++) {
menuListPtr->entries[i] = menuListPtr->entries[i + 1];
menuListPtr->entries[i]->index = i;
}
- menuListPtr->numEntries--;
- if (menuListPtr->numEntries == 0) {
+ if (--menuListPtr->numEntries == 0) {
ckfree(menuListPtr->entries);
menuListPtr->entries = NULL;
}
@@ -1646,7 +1652,7 @@ ConfigureMenu(
* parent.
*/
- for (i = 0; i < menuListPtr->numEntries; i++) {
+ for (i = 0; i < (int)menuListPtr->numEntries; i++) {
TkMenuEntry *mePtr;
mePtr = menuListPtr->entries[i];
@@ -1656,7 +1662,7 @@ ConfigureMenu(
TkEventuallyRecomputeMenu(menuListPtr);
}
- for (cleanupPtr = menuPtr->masterMenuPtr; cleanupPtr != NULL;
+ for (cleanupPtr = menuPtr->mainMenuPtr; cleanupPtr != NULL;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_FreeSavedOptions(cleanupPtr->errorStructPtr);
ckfree(cleanupPtr->errorStructPtr);
@@ -1704,12 +1710,12 @@ PostProcessEntry(
if (mePtr->labelPtr == NULL) {
mePtr->labelLength = 0;
} else {
- Tcl_GetStringFromObj(mePtr->labelPtr, &mePtr->labelLength);
+ (void)Tcl_GetStringFromObj(mePtr->labelPtr, &mePtr->labelLength);
}
if (mePtr->accelPtr == NULL) {
mePtr->accelLength = 0;
} else {
- Tcl_GetStringFromObj(mePtr->accelPtr, &mePtr->accelLength);
+ (void)Tcl_GetStringFromObj(mePtr->accelPtr, &mePtr->accelLength);
}
/*
@@ -1736,7 +1742,7 @@ PostProcessEntry(
name = Tcl_GetString(mePtr->namePtr);
if (mePtr->childMenuRefPtr != NULL) {
- oldHashKey = Tcl_GetHashKey(TkGetMenuHashTable(menuPtr->interp),
+ oldHashKey = (char *)Tcl_GetHashKey(TkGetMenuHashTable(menuPtr->interp),
mePtr->childMenuRefPtr->hashEntryPtr);
if (strcmp(oldHashKey, name) != 0) {
UnhookCascadeEntry(mePtr);
@@ -1927,7 +1933,7 @@ ConfigureMenuEntry(
result = TCL_OK;
if (menuPtr->tkwin != NULL) {
- if (Tk_SetOptions(menuPtr->interp, (char *) mePtr,
+ if (Tk_SetOptions(menuPtr->interp, mePtr,
mePtr->optionTable, objc, objv, menuPtr->tkwin,
&errorStruct, NULL) != TCL_OK) {
return TCL_ERROR;
@@ -1965,7 +1971,7 @@ ConfigureMenuEntry(
static int
ConfigureMenuCloneEntries(
- Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Interp *dummy, /* Used for error reporting. */
TkMenu *menuPtr, /* Information about whole menu. */
int index, /* Index of mePtr within menuPtr's entries. */
int objc, /* Number of valid entries in argv. */
@@ -1977,6 +1983,7 @@ ConfigureMenuCloneEntries(
TkMenuReferences *oldCascadeMenuRefPtr, *cascadeMenuRefPtr = NULL;
Tcl_Obj *oldCascadePtr = NULL;
const char *newCascadeName;
+ (void)dummy;
/*
* Cascades are kind of tricky here. This is special case #3 in the
@@ -1987,7 +1994,7 @@ ConfigureMenuCloneEntries(
* configure the entry to point to the new clone.
*/
- mePtr = menuPtr->masterMenuPtr->entries[index];
+ mePtr = menuPtr->mainMenuPtr->entries[index];
if (mePtr->type == CASCADE_ENTRY) {
oldCascadePtr = mePtr->namePtr;
if (oldCascadePtr != NULL) {
@@ -2032,7 +2039,7 @@ ConfigureMenuCloneEntries(
}
}
- for (menuListPtr = menuPtr->masterMenuPtr->nextInstancePtr;
+ for (menuListPtr = menuPtr->mainMenuPtr->nextInstancePtr;
menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
@@ -2087,7 +2094,7 @@ ConfigureMenuCloneEntries(
/*
*--------------------------------------------------------------
*
- * TkGetMenuIndex --
+ * GetMenuIndex --
*
* Parse a textual index into a menu and return the numerical index of
* the indicated entry.
@@ -2105,7 +2112,7 @@ ConfigureMenuCloneEntries(
*/
int
-TkGetMenuIndex(
+GetMenuIndex(
Tcl_Interp *interp, /* For error messages. */
TkMenu *menuPtr, /* Menu for which the index is being
* specified. */
@@ -2113,52 +2120,46 @@ TkGetMenuIndex(
* manual entry for valid .*/
int lastOK, /* Non-zero means its OK to return index just
* *after* last entry. */
- int *indexPtr) /* Where to store converted index. */
+ TkSizeT *indexPtr) /* Where to store converted index. */
{
int i;
- const char *string = Tcl_GetString(objPtr);
+ const char *string;
+
+ if (TkGetIntForIndex(objPtr, menuPtr->numEntries - 1, lastOK, indexPtr) == TCL_OK) {
+ /* TCL_INDEX_NONE is only accepted if it does not result from a negative number */
+ if (*indexPtr != TCL_INDEX_NONE || Tcl_GetString(objPtr)[0] != '-') {
+ if (*indexPtr >= menuPtr->numEntries) {
+ *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1);
+ }
+ return TCL_OK;
+ }
+ }
+
+ string = Tcl_GetString(objPtr);
if ((string[0] == 'a') && (strcmp(string, "active") == 0)) {
*indexPtr = menuPtr->active;
goto success;
}
- if (((string[0] == 'l') && (strcmp(string, "last") == 0))
- || ((string[0] == 'e') && (strcmp(string, "end") == 0))) {
+ if ((string[0] == 'l') && (strcmp(string, "last") == 0)) {
*indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1);
goto success;
}
if ((string[0] == 'n') && (strcmp(string, "none") == 0)) {
- *indexPtr = -1;
+ *indexPtr = TCL_INDEX_NONE;
goto success;
}
if (string[0] == '@') {
- if (GetIndexFromCoords(interp, menuPtr, string, indexPtr)
+ if (GetIndexFromCoords(NULL, menuPtr, string, indexPtr)
== TCL_OK) {
goto success;
}
}
- if (isdigit(UCHAR(string[0]))) {
- if (Tcl_GetIntFromObj(interp, objPtr, &i) == TCL_OK) {
- if (i >= menuPtr->numEntries) {
- if (lastOK) {
- i = menuPtr->numEntries;
- } else {
- i = menuPtr->numEntries-1;
- }
- } else if (i < 0) {
- i = -1;
- }
- *indexPtr = i;
- goto success;
- }
- Tcl_ResetResult(interp);
- }
-
- for (i = 0; i < menuPtr->numEntries; i++) {
+ for (i = 0; i < (int)menuPtr->numEntries; i++) {
Tcl_Obj *labelPtr = menuPtr->entries[i]->labelPtr;
const char *label = (labelPtr == NULL) ? NULL : Tcl_GetString(labelPtr);
@@ -2199,7 +2200,7 @@ static void
MenuCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkMenu *menuPtr = clientData;
+ TkMenu *menuPtr = (TkMenu *)clientData;
Tk_Window tkwin = menuPtr->tkwin;
/*
@@ -2241,21 +2242,21 @@ MenuCmdDeletedProc(
static TkMenuEntry *
MenuNewEntry(
TkMenu *menuPtr, /* Menu that will hold the new entry. */
- int index, /* Where in the menu the new entry is to
+ TkSizeT index, /* Where in the menu the new entry is to
* go. */
int type) /* The type of the new entry. */
{
TkMenuEntry *mePtr;
TkMenuEntry **newEntries;
- int i;
- ThreadSpecificData *tsdPtr =
+ TkSizeT i;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Create a new array of entries with an empty slot for the new entry.
*/
- newEntries = ckalloc((menuPtr->numEntries+1) * sizeof(TkMenuEntry *));
+ newEntries = (TkMenuEntry **)ckalloc((menuPtr->numEntries+1) * sizeof(TkMenuEntry *));
for (i = 0; i < index; i++) {
newEntries[i] = menuPtr->entries[i];
}
@@ -2268,7 +2269,7 @@ MenuNewEntry(
}
menuPtr->entries = newEntries;
menuPtr->numEntries++;
- mePtr = ckalloc(sizeof(TkMenuEntry));
+ mePtr = (TkMenuEntry *)ckalloc(sizeof(TkMenuEntry));
menuPtr->entries[index] = mePtr;
mePtr->type = type;
mePtr->optionTable = tsdPtr->entryOptionTables[type];
@@ -2301,7 +2302,7 @@ MenuNewEntry(
mePtr->entryFlags = 0;
mePtr->index = index;
mePtr->nextCascadePtr = NULL;
- if (Tk_InitOptions(menuPtr->interp, (char *) mePtr,
+ if (Tk_InitOptions(menuPtr->interp, mePtr,
mePtr->optionTable, menuPtr->tkwin) != TCL_OK) {
ckfree(mePtr);
return NULL;
@@ -2344,20 +2345,21 @@ MenuAddOrInsert(
Tcl_Obj *const objv[]) /* Arguments to command: first arg is type of
* entry, others are config options. */
{
- int type, index;
+ int type;
+ TkSizeT index;
TkMenuEntry *mePtr;
TkMenu *menuListPtr;
if (indexPtr != NULL) {
- if (TkGetMenuIndex(interp, menuPtr, indexPtr, 1, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, indexPtr, 1, &index) != TCL_OK) {
return TCL_ERROR;
}
} else {
index = menuPtr->numEntries;
}
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad index \"%s\"", Tcl_GetString(indexPtr)));
+ "bad menu entry index \"%s\"", Tcl_GetString(indexPtr)));
Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL);
return TCL_ERROR;
}
@@ -2378,7 +2380,7 @@ MenuAddOrInsert(
* Now we have to add an entry for every instance related to this menu.
*/
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
mePtr = MenuNewEntry(menuListPtr, index, type);
@@ -2387,9 +2389,9 @@ MenuAddOrInsert(
}
if (ConfigureMenuEntry(mePtr, objc - 1, objv + 1) != TCL_OK) {
TkMenu *errorMenuPtr;
- int i;
+ TkSizeT i;
- for (errorMenuPtr = menuPtr->masterMenuPtr;
+ for (errorMenuPtr = menuPtr->mainMenuPtr;
errorMenuPtr != NULL;
errorMenuPtr = errorMenuPtr->nextInstancePtr) {
Tcl_EventuallyFree(errorMenuPtr->entries[index],
@@ -2398,8 +2400,7 @@ MenuAddOrInsert(
errorMenuPtr->entries[i] = errorMenuPtr->entries[i + 1];
errorMenuPtr->entries[i]->index = i;
}
- errorMenuPtr->numEntries--;
- if (errorMenuPtr->numEntries == 0) {
+ if (--errorMenuPtr->numEntries == 0) {
ckfree(errorMenuPtr->entries);
errorMenuPtr->entries = NULL;
}
@@ -2423,7 +2424,7 @@ MenuAddOrInsert(
&& (mePtr->childMenuRefPtr != NULL)
&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {
TkMenu *cascadeMenuPtr =
- mePtr->childMenuRefPtr->menuPtr->masterMenuPtr;
+ mePtr->childMenuRefPtr->menuPtr->mainMenuPtr;
Tcl_Obj *newCascadePtr, *newObjv[2];
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
Tcl_Obj *windowNamePtr =
@@ -2484,10 +2485,12 @@ MenuVarProc(
const char *name2, /* Second part of variable's name. */
int flags) /* Describes what just happened. */
{
- TkMenuEntry *mePtr = clientData;
+ TkMenuEntry *mePtr = (TkMenuEntry *)clientData;
TkMenu *menuPtr;
const char *value;
const char *name, *onValue;
+ (void)name1;
+ (void)name2;
if (Tcl_InterpDeleted(interp) || (mePtr->namePtr == NULL)) {
/*
@@ -2590,13 +2593,13 @@ MenuVarProc(
int
TkActivateMenuEntry(
TkMenu *menuPtr, /* Menu in which to activate. */
- int index) /* Index of entry to activate, or -1 to
- * deactivate all entries. */
+ TkSizeT index) /* Index of entry to activate, or
+ * TCL_INDEX_NONE to deactivate all entries. */
{
TkMenuEntry *mePtr;
int result = TCL_OK;
- if (menuPtr->active >= 0) {
+ if (menuPtr->active != TCL_INDEX_NONE) {
mePtr = menuPtr->entries[menuPtr->active];
/*
@@ -2610,7 +2613,7 @@ TkActivateMenuEntry(
TkEventuallyRedrawMenu(menuPtr, menuPtr->entries[menuPtr->active]);
}
menuPtr->active = index;
- if (index >= 0) {
+ if (index != TCL_INDEX_NONE) {
mePtr = menuPtr->entries[index];
mePtr->state = ENTRY_ACTIVE;
TkEventuallyRedrawMenu(menuPtr, mePtr);
@@ -2739,14 +2742,14 @@ CloneMenu(
if (menuPtr->nextInstancePtr == NULL) {
menuPtr->nextInstancePtr = newMenuPtr;
- newMenuPtr->masterMenuPtr = menuPtr->masterMenuPtr;
+ newMenuPtr->mainMenuPtr = menuPtr->mainMenuPtr;
} else {
- TkMenu *masterMenuPtr;
+ TkMenu *mainMenuPtr;
- masterMenuPtr = menuPtr->masterMenuPtr;
- newMenuPtr->nextInstancePtr = masterMenuPtr->nextInstancePtr;
- masterMenuPtr->nextInstancePtr = newMenuPtr;
- newMenuPtr->masterMenuPtr = masterMenuPtr;
+ mainMenuPtr = menuPtr->mainMenuPtr;
+ newMenuPtr->nextInstancePtr = mainMenuPtr->nextInstancePtr;
+ mainMenuPtr->nextInstancePtr = newMenuPtr;
+ newMenuPtr->mainMenuPtr = mainMenuPtr;
}
/*
@@ -2776,7 +2779,7 @@ CloneMenu(
if (strcmp(windowName, Tk_PathName(newMenuPtr->tkwin))
== 0) {
Tcl_Obj *newElementPtr = Tcl_NewStringObj(
- Tk_PathName(newMenuPtr->masterMenuPtr->tkwin), -1);
+ Tk_PathName(newMenuPtr->mainMenuPtr->tkwin), -1);
/*
* The newElementPtr will have its refCount incremented
@@ -2801,7 +2804,7 @@ CloneMenu(
* Clone all of the cascade menus that this menu points to.
*/
- for (i = 0; i < menuPtr->numEntries; i++) {
+ for (i = 0; i < (int)menuPtr->numEntries; i++) {
TkMenuReferences *cascadeRefPtr;
TkMenu *oldCascadePtr;
@@ -2865,17 +2868,17 @@ MenuDoXPosition(
TkMenu *menuPtr,
Tcl_Obj *objPtr)
{
- int index;
+ TkSizeT index;
TkRecomputeMenu(menuPtr);
- if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
return TCL_ERROR;
}
Tcl_ResetResult(interp);
- if (index < 0) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+ if (index == TCL_INDEX_NONE) {
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
} else {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(menuPtr->entries[index]->x));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->x));
}
return TCL_OK;
}
@@ -2902,17 +2905,17 @@ MenuDoYPosition(
TkMenu *menuPtr,
Tcl_Obj *objPtr)
{
- int index;
+ TkSizeT index;
TkRecomputeMenu(menuPtr);
- if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
goto error;
}
Tcl_ResetResult(interp);
- if (index < 0) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+ if (index == TCL_INDEX_NONE) {
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
} else {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(menuPtr->entries[index]->y));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->y));
}
return TCL_OK;
@@ -2940,12 +2943,12 @@ MenuDoYPosition(
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
GetIndexFromCoords(
Tcl_Interp *interp, /* Interpreter of menu. */
TkMenu *menuPtr, /* The menu we are searching. */
const char *string, /* The @string we are parsing. */
- int *indexPtr) /* The index of the item that matches. */
+ TkSizeT *indexPtr) /* The index of the item that matches. */
{
int x, y, i;
const char *p;
@@ -2980,7 +2983,7 @@ GetIndexFromCoords(
? Tk_Width(menuPtr->tkwin) : Tk_ReqWidth(menuPtr->tkwin);
max -= borderwidth;
- for (i = 0; i < menuPtr->numEntries; i++) {
+ for (i = 0; i < (int)menuPtr->numEntries; i++) {
if (menuPtr->entries[i]->entryFlags & ENTRY_LAST_COLUMN) {
x2 = max;
} else {
@@ -3023,7 +3026,7 @@ static void
RecursivelyDeleteMenu(
TkMenu *menuPtr) /* The menubar instance we are deleting. */
{
- int i;
+ TkSizeT i;
TkMenuEntry *mePtr;
/*
@@ -3110,7 +3113,7 @@ TkNewMenuName(
Tcl_AppendToObj(resultPtr, ".", -1);
}
Tcl_AppendObjToObj(resultPtr, childPtr);
- intPtr = Tcl_NewIntObj(i);
+ intPtr = Tcl_NewWideIntObj(i);
Tcl_AppendObjToObj(resultPtr, intPtr);
Tcl_DecrRefCount(intPtr);
}
@@ -3176,7 +3179,7 @@ TkSetWindowMenuBar(
menuPtr = menuRefPtr->menuPtr;
- for (instancePtr = menuPtr->masterMenuPtr;
+ for (instancePtr = menuPtr->mainMenuPtr;
instancePtr != NULL;
instancePtr = instancePtr->nextInstancePtr) {
if (instancePtr->menuType == MENUBAR
@@ -3279,7 +3282,7 @@ TkSetWindowMenuBar(
* menu.
*/
- topLevelListPtr = ckalloc(sizeof(TkMenuTopLevelList));
+ topLevelListPtr = (TkMenuTopLevelList *)ckalloc(sizeof(TkMenuTopLevelList));
topLevelListPtr->tkwin = tkwin;
topLevelListPtr->nextPtr = menuRefPtr->topLevelListPtr;
menuRefPtr->topLevelListPtr = topLevelListPtr;
@@ -3309,9 +3312,11 @@ TkSetWindowMenuBar(
static void
DestroyMenuHashTable(
ClientData clientData, /* The menu hash table we are destroying. */
- Tcl_Interp *interp) /* The interpreter we are destroying. */
+ Tcl_Interp *dummy) /* The interpreter we are destroying. */
{
- Tcl_DeleteHashTable(clientData);
+ (void)dummy;
+
+ Tcl_DeleteHashTable((Tcl_HashTable *)clientData);
ckfree(clientData);
}
@@ -3337,11 +3342,11 @@ Tcl_HashTable *
TkGetMenuHashTable(
Tcl_Interp *interp) /* The interp we need the hash table in.*/
{
- Tcl_HashTable *menuTablePtr =
+ Tcl_HashTable *menuTablePtr = (Tcl_HashTable *)
Tcl_GetAssocData(interp, MENU_HASH_KEY, NULL);
if (menuTablePtr == NULL) {
- menuTablePtr = ckalloc(sizeof(Tcl_HashTable));
+ menuTablePtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(menuTablePtr, TCL_STRING_KEYS);
Tcl_SetAssocData(interp, MENU_HASH_KEY, DestroyMenuHashTable,
menuTablePtr);
@@ -3382,14 +3387,14 @@ TkCreateMenuReferences(
hashEntryPtr = Tcl_CreateHashEntry(menuTablePtr, pathName, &newEntry);
if (newEntry) {
- menuRefPtr = ckalloc(sizeof(TkMenuReferences));
+ menuRefPtr = (TkMenuReferences *)ckalloc(sizeof(TkMenuReferences));
menuRefPtr->menuPtr = NULL;
menuRefPtr->topLevelListPtr = NULL;
menuRefPtr->parentEntryPtr = NULL;
menuRefPtr->hashEntryPtr = hashEntryPtr;
Tcl_SetHashValue(hashEntryPtr, menuRefPtr);
} else {
- menuRefPtr = Tcl_GetHashValue(hashEntryPtr);
+ menuRefPtr = (TkMenuReferences *)Tcl_GetHashValue(hashEntryPtr);
}
return menuRefPtr;
}
@@ -3426,7 +3431,7 @@ TkFindMenuReferences(
menuTablePtr = TkGetMenuHashTable(interp);
hashEntryPtr = Tcl_FindHashEntry(menuTablePtr, pathName);
if (hashEntryPtr != NULL) {
- menuRefPtr = Tcl_GetHashValue(hashEntryPtr);
+ menuRefPtr = (TkMenuReferences *)Tcl_GetHashValue(hashEntryPtr);
}
return menuRefPtr;
}
@@ -3522,12 +3527,12 @@ DeleteMenuCloneEntries(
int numDeleted, i, j;
numDeleted = last + 1 - first;
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
for (i = last; i >= first; i--) {
Tcl_EventuallyFree(menuListPtr->entries[i], (Tcl_FreeProc *) DestroyMenuEntry);
}
- for (i = last + 1; i < menuListPtr->numEntries; i++) {
+ for (i = last + 1; i < (int)menuListPtr->numEntries; i++) {
j = i - numDeleted;
menuListPtr->entries[j] = menuListPtr->entries[i];
menuListPtr->entries[j]->index = j;
@@ -3537,10 +3542,10 @@ DeleteMenuCloneEntries(
ckfree(menuListPtr->entries);
menuListPtr->entries = NULL;
}
- if ((menuListPtr->active >= first)
- && (menuListPtr->active <= last)) {
+ if (((int)menuListPtr->active >= first)
+ && ((int)menuListPtr->active <= last)) {
menuListPtr->active = -1;
- } else if (menuListPtr->active > last) {
+ } else if ((int)menuListPtr->active > last) {
menuListPtr->active -= numDeleted;
}
TkEventuallyRecomputeMenu(menuListPtr);
@@ -3550,7 +3555,7 @@ DeleteMenuCloneEntries(
/*
*----------------------------------------------------------------------
*
- * TkMenuCleanup --
+ * MenuCleanup --
*
* Resets menusInitialized to allow Tk to be finalized and reused without
* the DLL being unloaded.
@@ -3565,9 +3570,11 @@ DeleteMenuCloneEntries(
*/
static void
-TkMenuCleanup(
- ClientData unused)
+MenuCleanup(
+ ClientData dummy)
{
+ (void)dummy;
+
menusInitialized = 0;
}
@@ -3591,7 +3598,7 @@ TkMenuCleanup(
void
TkMenuInit(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!menusInitialized) {
@@ -3605,7 +3612,7 @@ TkMenuInit(void)
* Make sure we cleanup on finalize.
*/
- TkCreateExitHandler((Tcl_ExitProc *) TkMenuCleanup, NULL);
+ TkCreateExitHandler((Tcl_ExitProc *) MenuCleanup, NULL);
Tcl_MutexUnlock(&menuMutex);
}
if (!tsdPtr->menusInitialized) {
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index 386b204..16ea507 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -4,7 +4,7 @@
* Declarations shared among all of the files that implement menu
* widgets.
*
- * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
+ * Copyright © 1996-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -64,11 +64,11 @@ typedef struct TkMenuEntry {
Tk_OptionTable optionTable; /* Option table for this menu entry. */
Tcl_Obj *labelPtr; /* Main text label displayed in entry (NULL if
* no label). */
- int labelLength; /* Number of non-NULL characters in label. */
+ TkSizeT labelLength; /* Number of non-NULL characters in label. */
int state; /* State of button for display purposes:
* normal, active, or disabled. */
int underline; /* Value of -underline option: specifies index
- * of character to underline (<0 means don't
+ * of character to underline (-1 means don't
* underline anything). */
Tcl_Obj *underlinePtr; /* Index of character to underline. */
Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or NULL.
@@ -85,7 +85,7 @@ typedef struct TkMenuEntry {
Tcl_Obj *accelPtr; /* Accelerator string displayed at right of
* menu entry. NULL means no such accelerator.
* Malloc'ed. */
- int accelLength; /* Number of non-NULL characters in
+ TkSizeT accelLength; /* Number of non-NULL characters in
* accelerator. */
int indicatorOn; /* True means draw indicator, false means
* don't draw it. This field is ignored unless
@@ -263,9 +263,9 @@ typedef struct TkMenu {
Tcl_Command widgetCmd; /* Token for menu's widget command. */
TkMenuEntry **entries; /* Array of pointers to all the entries in the
* menu. NULL means no entries. */
- int numEntries; /* Number of elements in entries. */
- int active; /* Index of active entry. -1 means nothing
- * active. */
+ TkSizeT numEntries; /* Number of elements in entries. */
+ TkSizeT active; /* Index of active entry. TCL_INDEX_NONE means
+ * nothing active. */
int menuType; /* MAIN_MENU, TEAROFF_MENU, or MENUBAR. See
* below for definitions. */
Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin is a
@@ -351,7 +351,7 @@ typedef struct TkMenu {
struct TkMenu *nextInstancePtr;
/* The next instance of this menu in the
* chain. */
- struct TkMenu *masterMenuPtr;
+ struct TkMenu *mainMenuPtr;
/* A pointer to the original menu for this
* clone chain. Points back to this structure
* if this menu is a main menu. */
@@ -378,6 +378,7 @@ typedef struct TkMenu {
/* We actually have to allocate these because
* multiple menus get changed during one
* ConfigureMenu call. */
+ Tcl_Obj *activeReliefPtr; /* 3-d effect for active element. */
} TkMenu;
/*
@@ -461,7 +462,6 @@ typedef struct TkMenuReferences {
#define UNKNOWN_TYPE -1
#define MAIN_MENU 0
-#define MASTER_MENU 0
#define TEAROFF_MENU 1
#define MENUBAR 2
@@ -478,7 +478,7 @@ typedef struct TkMenuReferences {
* the outside world:
*/
-MODULE_SCOPE int TkActivateMenuEntry(TkMenu *menuPtr, int index);
+MODULE_SCOPE int TkActivateMenuEntry(TkMenu *menuPtr, TkSizeT index);
MODULE_SCOPE void TkBindMenu(Tk_Window tkwin, TkMenu *menuPtr);
MODULE_SCOPE TkMenuReferences*TkCreateMenuReferences(Tcl_Interp *interp,
const char *name);
@@ -491,15 +491,13 @@ MODULE_SCOPE TkMenuReferences*TkFindMenuReferencesObj(Tcl_Interp *interp,
Tcl_Obj *namePtr);
MODULE_SCOPE int TkFreeMenuReferences(TkMenuReferences *menuRefPtr);
MODULE_SCOPE Tcl_HashTable *TkGetMenuHashTable(Tcl_Interp *interp);
-MODULE_SCOPE int TkGetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr,
- Tcl_Obj *objPtr, int lastOK, int *indexPtr);
MODULE_SCOPE void TkMenuInitializeDrawingFields(TkMenu *menuPtr);
MODULE_SCOPE void TkMenuInitializeEntryDrawingFields(TkMenuEntry *mePtr);
MODULE_SCOPE int TkInvokeMenu(Tcl_Interp *interp, TkMenu *menuPtr,
- int index);
+ TkSizeT index);
MODULE_SCOPE void TkMenuConfigureDrawOptions(TkMenu *menuPtr);
MODULE_SCOPE int TkMenuConfigureEntryDrawOptions(
- TkMenuEntry *mePtr, int index);
+ TkMenuEntry *mePtr, TkSizeT index);
MODULE_SCOPE void TkMenuFreeDrawOptions(TkMenu *menuPtr);
MODULE_SCOPE void TkMenuEntryFreeDrawOptions(TkMenuEntry *mePtr);
MODULE_SCOPE void TkMenuEventProc(ClientData clientData,
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index 3851a06..fd059bf 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -4,7 +4,7 @@
* This module implements the platform-independent drawing and geometry
* calculations of menu widgets.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -298,7 +298,7 @@ TkMenuConfigureDrawOptions(
int
TkMenuConfigureEntryDrawOptions(
TkMenuEntry *mePtr,
- int index)
+ TkSizeT index)
{
XGCValues gcValues;
GC newGC, newActiveGC, newDisabledGC, newIndicatorGC;
@@ -487,7 +487,7 @@ TkEventuallyRedrawMenu(
TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the
* entries in the menu. */
{
- int i;
+ TkSizeT i;
if (menuPtr->tkwin == NULL) {
return;
@@ -530,7 +530,7 @@ static void
ComputeMenuGeometry(
ClientData clientData) /* Structure describing menu. */
{
- TkMenu *menuPtr = clientData;
+ TkMenu *menuPtr = (TkMenu *)clientData;
if (menuPtr->tkwin == NULL) {
return;
@@ -586,7 +586,13 @@ TkMenuSelectImageProc(
* <=0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- TkMenuEntry *mePtr = clientData;
+ TkMenuEntry *mePtr = (TkMenuEntry *)clientData;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imgWidth;
+ (void)imgHeight;
if ((mePtr->entryFlags & ENTRY_SELECTED)
&& !(mePtr->menuPtr->menuFlags & REDRAW_PENDING)) {
@@ -615,10 +621,11 @@ static void
DisplayMenu(
ClientData clientData) /* Information about widget. */
{
- TkMenu *menuPtr = clientData;
+ TkMenu *menuPtr = (TkMenu *)clientData;
TkMenuEntry *mePtr;
Tk_Window tkwin = menuPtr->tkwin;
- int index, strictMotif;
+ TkSizeT index;
+ int strictMotif;
Tk_Font tkfont;
Tk_FontMetrics menuMetrics;
int width;
@@ -759,7 +766,7 @@ TkMenuEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkMenu *menuPtr = clientData;
+ TkMenu *menuPtr = (TkMenu *)clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
TkEventuallyRedrawMenu(menuPtr, NULL);
@@ -824,7 +831,13 @@ TkMenuImageProc(
* <=0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- TkMenu *menuPtr = ((TkMenuEntry *) clientData)->menuPtr;
+ TkMenu *menuPtr = (TkMenu *)((TkMenuEntry *) clientData)->menuPtr;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imgWidth;
+ (void)imgHeight;
if ((menuPtr->tkwin != NULL) && !(menuPtr->menuFlags & RESIZE_PENDING)) {
menuPtr->menuFlags |= RESIZE_PENDING;
@@ -941,8 +954,8 @@ TkPostSubmenu(
menuPtr->postedCascade = mePtr;
subary[0] = mePtr->namePtr;
subary[1] = Tcl_NewStringObj("post", -1);
- subary[2] = Tcl_NewIntObj(x);
- subary[3] = Tcl_NewIntObj(y);
+ subary[2] = Tcl_NewWideIntObj(x);
+ subary[3] = Tcl_NewWideIntObj(y);
Tcl_IncrRefCount(subary[1]);
Tcl_IncrRefCount(subary[2]);
Tcl_IncrRefCount(subary[3]);
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 5f4f40f..ede28dd 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -4,8 +4,8 @@
* This module implements button-like widgets that are used to invoke
* pull-down menus.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -13,7 +13,6 @@
#include "tkInt.h"
#include "tkMenubutton.h"
-#include "default.h"
/*
* The structure below defines menubutton class behavior by means of
@@ -60,99 +59,98 @@ static const char *const compoundStrings[] = {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
- DEF_MENUBUTTON_ACTIVE_BG_COLOR, -1,
- Tk_Offset(TkMenuButton, activeBorder), 0,
+ DEF_MENUBUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE,
+ offsetof(TkMenuButton, activeBorder), 0,
(ClientData) DEF_MENUBUTTON_ACTIVE_BG_MONO, 0},
{TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background",
- DEF_MENUBUTTON_ACTIVE_FG_COLOR, -1,
- Tk_Offset(TkMenuButton, activeFg),
+ DEF_MENUBUTTON_ACTIVE_FG_COLOR, TCL_INDEX_NONE,
+ offsetof(TkMenuButton, activeFg),
0, DEF_MENUBUTTON_ACTIVE_FG_MONO, 0},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- DEF_MENUBUTTON_ANCHOR, -1,
- Tk_Offset(TkMenuButton, anchor), 0, 0, 0},
+ DEF_MENUBUTTON_ANCHOR, TCL_INDEX_NONE,
+ offsetof(TkMenuButton, anchor), 0, 0, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_MENUBUTTON_BG_COLOR, -1, Tk_Offset(TkMenuButton, normalBorder),
+ DEF_MENUBUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkMenuButton, normalBorder),
0, DEF_MENUBUTTON_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0,
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
(ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0,
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
(ClientData) "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
- DEF_MENUBUTTON_BITMAP, -1, Tk_Offset(TkMenuButton, bitmap),
+ DEF_MENUBUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkMenuButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_MENUBUTTON_BORDER_WIDTH, -1,
- Tk_Offset(TkMenuButton, borderWidth), 0, 0, 0},
+ DEF_MENUBUTTON_BORDER_WIDTH, TCL_INDEX_NONE,
+ offsetof(TkMenuButton, borderWidth), 0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_MENUBUTTON_CURSOR, -1, Tk_Offset(TkMenuButton, cursor),
+ DEF_MENUBUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkMenuButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction",
- DEF_MENUBUTTON_DIRECTION, -1, Tk_Offset(TkMenuButton, direction),
+ DEF_MENUBUTTON_DIRECTION, TCL_INDEX_NONE, offsetof(TkMenuButton, direction),
0, directionStrings, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_MENUBUTTON_DISABLED_FG_COLOR,
- -1, Tk_Offset(TkMenuButton, disabledFg), TK_OPTION_NULL_OK,
+ TCL_INDEX_NONE, offsetof(TkMenuButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_MENUBUTTON_DISABLED_FG_MONO, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0,
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0,
(ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_MENUBUTTON_FONT, -1, Tk_Offset(TkMenuButton, tkfont), 0, 0, 0},
+ DEF_MENUBUTTON_FONT, TCL_INDEX_NONE, offsetof(TkMenuButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_MENUBUTTON_FG, -1, Tk_Offset(TkMenuButton, normalFg), 0, 0, 0},
+ DEF_MENUBUTTON_FG, TCL_INDEX_NONE, offsetof(TkMenuButton, normalFg), 0, 0, 0},
{TK_OPTION_STRING, "-height", "height", "Height",
- DEF_MENUBUTTON_HEIGHT, -1, Tk_Offset(TkMenuButton, heightString),
+ DEF_MENUBUTTON_HEIGHT, TCL_INDEX_NONE, offsetof(TkMenuButton, heightString),
0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR,
- -1, Tk_Offset(TkMenuButton, highlightBgColorPtr), 0, 0, 0},
+ TCL_INDEX_NONE, offsetof(TkMenuButton, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_MENUBUTTON_HIGHLIGHT, -1,
- Tk_Offset(TkMenuButton, highlightColorPtr), 0, 0, 0},
+ DEF_MENUBUTTON_HIGHLIGHT, TCL_INDEX_NONE,
+ offsetof(TkMenuButton, highlightColorPtr), 0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness", DEF_MENUBUTTON_HIGHLIGHT_WIDTH,
- -1, Tk_Offset(TkMenuButton, highlightWidth), 0, 0, 0},
+ TCL_INDEX_NONE, offsetof(TkMenuButton, highlightWidth), 0, 0, 0},
{TK_OPTION_STRING, "-image", "image", "Image",
- DEF_MENUBUTTON_IMAGE, -1, Tk_Offset(TkMenuButton, imageString),
+ DEF_MENUBUTTON_IMAGE, TCL_INDEX_NONE, offsetof(TkMenuButton, imageString),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn",
- DEF_MENUBUTTON_INDICATOR, -1, Tk_Offset(TkMenuButton, indicatorOn),
+ DEF_MENUBUTTON_INDICATOR, TCL_INDEX_NONE, offsetof(TkMenuButton, indicatorOn),
0, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_MENUBUTTON_JUSTIFY, -1, Tk_Offset(TkMenuButton, justify), 0, 0, 0},
+ DEF_MENUBUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkMenuButton, justify), 0, 0, 0},
{TK_OPTION_STRING, "-menu", "menu", "Menu",
- DEF_MENUBUTTON_MENU, -1, Tk_Offset(TkMenuButton, menuName),
+ DEF_MENUBUTTON_MENU, TCL_INDEX_NONE, offsetof(TkMenuButton, menuName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
- DEF_MENUBUTTON_PADX, -1, Tk_Offset(TkMenuButton, padX),
+ DEF_MENUBUTTON_PADX, TCL_INDEX_NONE, offsetof(TkMenuButton, padX),
0, 0, 0},
{TK_OPTION_PIXELS, "-pady", "padY", "Pad",
- DEF_MENUBUTTON_PADY, -1, Tk_Offset(TkMenuButton, padY),
+ DEF_MENUBUTTON_PADY, TCL_INDEX_NONE, offsetof(TkMenuButton, padY),
0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_MENUBUTTON_RELIEF, -1, Tk_Offset(TkMenuButton, relief),
+ DEF_MENUBUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkMenuButton, relief),
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkMenuButton, compound), 0,
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuButton, compound), 0,
compoundStrings, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_MENUBUTTON_STATE, -1, Tk_Offset(TkMenuButton, state),
+ DEF_MENUBUTTON_STATE, TCL_INDEX_NONE, offsetof(TkMenuButton, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_MENUBUTTON_TAKE_FOCUS, -1,
- Tk_Offset(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0},
+ DEF_MENUBUTTON_TAKE_FOCUS, TCL_INDEX_NONE,
+ offsetof(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-text", "text", "Text",
- DEF_MENUBUTTON_TEXT, -1, Tk_Offset(TkMenuButton, text), 0, 0, 0},
+ DEF_MENUBUTTON_TEXT, TCL_INDEX_NONE, offsetof(TkMenuButton, text), 0, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- DEF_MENUBUTTON_TEXT_VARIABLE, -1,
- Tk_Offset(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0},
+ DEF_MENUBUTTON_TEXT_VARIABLE, TCL_INDEX_NONE,
+ offsetof(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_MENUBUTTON_UNDERLINE, -1, Tk_Offset(TkMenuButton, underline),
- 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkMenuButton, underline), 0},
{TK_OPTION_STRING, "-width", "width", "Width",
- DEF_MENUBUTTON_WIDTH, -1, Tk_Offset(TkMenuButton, widthString),
+ DEF_MENUBUTTON_WIDTH, TCL_INDEX_NONE, offsetof(TkMenuButton, widthString),
0, 0, 0},
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
- DEF_MENUBUTTON_WRAP_LENGTH, -1, Tk_Offset(TkMenuButton, wrapLength),
+ DEF_MENUBUTTON_WRAP_LENGTH, TCL_INDEX_NONE, offsetof(TkMenuButton, wrapLength),
0, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
@@ -212,7 +210,7 @@ static void DestroyMenuButton(char *memPtr);
int
Tk_MenubuttonObjCmd(
- ClientData clientData, /* NULL. */
+ ClientData dummy, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -220,6 +218,7 @@ Tk_MenubuttonObjCmd(
TkMenuButton *mbPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -308,7 +307,7 @@ Tk_MenubuttonObjCmd(
ExposureMask|StructureNotifyMask|FocusChangeMask,
MenuButtonEventProc, mbPtr);
- if (Tk_InitOptions(interp, (char *) mbPtr, optionTable, tkwin) != TCL_OK) {
+ if (Tk_InitOptions(interp, mbPtr, optionTable, tkwin) != TCL_OK) {
Tk_DestroyWindow(mbPtr->tkwin);
return TCL_ERROR;
}
@@ -318,7 +317,7 @@ Tk_MenubuttonObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(mbPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(mbPtr->tkwin));
return TCL_OK;
}
@@ -347,7 +346,7 @@ MenuButtonWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- TkMenuButton *mbPtr = clientData;
+ TkMenuButton *mbPtr = (TkMenuButton *)clientData;
int result, index;
Tcl_Obj *objPtr;
@@ -369,7 +368,7 @@ MenuButtonWidgetObjCmd(
goto error;
}
- objPtr = Tk_GetOptionValue(interp, (char *) mbPtr,
+ objPtr = Tk_GetOptionValue(interp, mbPtr,
mbPtr->optionTable, objv[2], mbPtr->tkwin);
if (objPtr == NULL) {
goto error;
@@ -379,7 +378,7 @@ MenuButtonWidgetObjCmd(
case COMMAND_CONFIGURE:
if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) mbPtr,
+ objPtr = Tk_GetOptionInfo(interp, mbPtr,
mbPtr->optionTable, (objc == 3) ? objv[2] : NULL,
mbPtr->tkwin);
if (objPtr == NULL) {
@@ -524,7 +523,7 @@ ConfigureMenuButton(
* First pass: set options to new values.
*/
- if (Tk_SetOptions(interp, (char *) mbPtr,
+ if (Tk_SetOptions(interp, mbPtr,
mbPtr->optionTable, objc, objv,
mbPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
@@ -633,7 +632,7 @@ ConfigureMenuButton(
if (mbPtr->text != NULL) {
ckfree(mbPtr->text);
}
- mbPtr->text = ckalloc(strlen(value) + 1);
+ mbPtr->text = (char *)ckalloc(strlen(value) + 1);
strcpy(mbPtr->text, value);
}
Tcl_TraceVar2(interp, mbPtr->textVarName, NULL,
@@ -675,7 +674,7 @@ TkMenuButtonWorldChanged(
XGCValues gcValues;
GC gc;
unsigned long mask;
- TkMenuButton *mbPtr = instanceData;
+ TkMenuButton *mbPtr = (TkMenuButton *)instanceData;
gcValues.font = Tk_FontId(mbPtr->tkfont);
gcValues.foreground = mbPtr->normalFg->pixel;
@@ -776,7 +775,7 @@ MenuButtonEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkMenuButton *mbPtr = clientData;
+ TkMenuButton *mbPtr = (TkMenuButton *)clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
goto redraw;
@@ -835,7 +834,7 @@ static void
MenuButtonCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkMenuButton *mbPtr = clientData;
+ TkMenuButton *mbPtr = (TkMenuButton *)clientData;
Tk_Window tkwin = mbPtr->tkwin;
/*
@@ -868,7 +867,6 @@ MenuButtonCmdDeletedProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static char *
MenuButtonTextVarProc(
ClientData clientData, /* Information about button. */
@@ -877,9 +875,11 @@ MenuButtonTextVarProc(
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- TkMenuButton *mbPtr = clientData;
+ TkMenuButton *mbPtr = (TkMenuButton *)clientData;
const char *value;
- unsigned len;
+ size_t len;
+ (void)name1;
+ (void)name2;
/*
* If the variable is unset, then immediately recreate it unless the whole
@@ -924,8 +924,8 @@ MenuButtonTextVarProc(
if (mbPtr->text != NULL) {
ckfree(mbPtr->text);
}
- len = 1 + (unsigned) strlen(value);
- mbPtr->text = ckalloc(len);
+ len = 1 + strlen(value);
+ mbPtr->text = (char *)ckalloc(len);
memcpy(mbPtr->text, value, len);
TkpComputeMenuButtonGeometry(mbPtr);
@@ -964,7 +964,13 @@ MenuButtonImageProc(
* 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- TkMenuButton *mbPtr = clientData;
+ TkMenuButton *mbPtr = (TkMenuButton *)clientData;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imgWidth;
+ (void)imgHeight;
if (mbPtr->tkwin != NULL) {
TkpComputeMenuButtonGeometry(mbPtr);
diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h
index 1dbacb3..1dc0f75 100644
--- a/generic/tkMenubutton.h
+++ b/generic/tkMenubutton.h
@@ -4,7 +4,7 @@
* Declarations of types and functions used to implement the menubutton
* widget.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index cc67b46..c0b9963 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -5,16 +5,16 @@
* widget displays a multi-line string in a window according to a
* particular aspect ratio.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 by Ajuba Solutions.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Ajuba Solutions.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
+#include "default.h"
/*
* A data structure of the following type is kept for each message widget
@@ -109,57 +109,57 @@ typedef struct {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MESSAGE_ANCHOR,
- -1, Tk_Offset(Message, anchor), 0, 0, 0},
+ TCL_INDEX_NONE, offsetof(Message, anchor), 0, 0, 0},
{TK_OPTION_INT, "-aspect", "aspect", "Aspect", DEF_MESSAGE_ASPECT,
- -1, Tk_Offset(Message, aspect), 0, 0, 0},
+ TCL_INDEX_NONE, offsetof(Message, aspect), 0, 0, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_MESSAGE_BG_COLOR, -1, Tk_Offset(Message, border), 0,
+ DEF_MESSAGE_BG_COLOR, TCL_INDEX_NONE, offsetof(Message, border), 0,
DEF_MESSAGE_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL,
- 0, -1, 0, "-borderwidth", 0},
+ 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL,
- 0, -1, 0, "-background", 0},
+ 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_MESSAGE_BORDER_WIDTH, -1,
- Tk_Offset(Message, borderWidth), 0, 0, 0},
+ DEF_MESSAGE_BORDER_WIDTH, TCL_INDEX_NONE,
+ offsetof(Message, borderWidth), 0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_MESSAGE_CURSOR, -1, Tk_Offset(Message, cursor),
+ DEF_MESSAGE_CURSOR, TCL_INDEX_NONE, offsetof(Message, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL,
- 0, -1, 0, "-foreground", 0},
+ 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_MESSAGE_FONT, -1, Tk_Offset(Message, tkfont), 0, 0, 0},
+ DEF_MESSAGE_FONT, TCL_INDEX_NONE, offsetof(Message, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_MESSAGE_FG, -1, Tk_Offset(Message, fgColorPtr), 0, 0, 0},
+ DEF_MESSAGE_FG, TCL_INDEX_NONE, offsetof(Message, fgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
- "HighlightBackground", DEF_MESSAGE_HIGHLIGHT_BG, -1,
- Tk_Offset(Message, highlightBgColorPtr), 0, 0, 0},
+ "HighlightBackground", DEF_MESSAGE_HIGHLIGHT_BG, TCL_INDEX_NONE,
+ offsetof(Message, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_MESSAGE_HIGHLIGHT, -1, Tk_Offset(Message, highlightColorPtr),
+ DEF_MESSAGE_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Message, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_MESSAGE_HIGHLIGHT_WIDTH, -1,
- Tk_Offset(Message, highlightWidth), 0, 0, 0},
+ "HighlightThickness", DEF_MESSAGE_HIGHLIGHT_WIDTH, TCL_INDEX_NONE,
+ offsetof(Message, highlightWidth), 0, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_MESSAGE_JUSTIFY, -1, Tk_Offset(Message, justify), 0, 0, 0},
+ DEF_MESSAGE_JUSTIFY, TCL_INDEX_NONE, offsetof(Message, justify), 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
- DEF_MESSAGE_PADX, Tk_Offset(Message, padXPtr),
- Tk_Offset(Message, padX), 0, 0, 0},
+ DEF_MESSAGE_PADX, offsetof(Message, padXPtr),
+ offsetof(Message, padX), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", "padY", "Pad",
- DEF_MESSAGE_PADY, Tk_Offset(Message, padYPtr),
- Tk_Offset(Message, padY), 0, 0, 0},
+ DEF_MESSAGE_PADY, offsetof(Message, padYPtr),
+ offsetof(Message, padY), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_MESSAGE_RELIEF, -1, Tk_Offset(Message, relief), 0, 0, 0},
+ DEF_MESSAGE_RELIEF, TCL_INDEX_NONE, offsetof(Message, relief), 0, 0, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_MESSAGE_TAKE_FOCUS, -1, Tk_Offset(Message, takeFocus),
+ DEF_MESSAGE_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Message, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-text", "text", "Text",
- DEF_MESSAGE_TEXT, -1, Tk_Offset(Message, string), 0, 0, 0},
+ DEF_MESSAGE_TEXT, TCL_INDEX_NONE, offsetof(Message, string), 0, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- DEF_MESSAGE_TEXT_VARIABLE, -1, Tk_Offset(Message, textVarName),
+ DEF_MESSAGE_TEXT_VARIABLE, TCL_INDEX_NONE, offsetof(Message, textVarName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-width", "width", "Width",
- DEF_MESSAGE_WIDTH, -1, Tk_Offset(Message, width), 0, 0 ,0},
+ DEF_MESSAGE_WIDTH, TCL_INDEX_NONE, offsetof(Message, width), 0, 0 ,0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -180,7 +180,7 @@ static void MessageWorldChanged(ClientData instanceData);
static void ComputeMessageGeometry(Message *msgPtr);
static int ConfigureMessage(Tcl_Interp *interp, Message *msgPtr,
int objc, Tcl_Obj *const objv[], int flags);
-static void DestroyMessage(char *memPtr);
+static void DestroyMessage(void *memPtr);
static void DisplayMessage(ClientData clientData);
/*
@@ -214,7 +214,7 @@ static const Tk_ClassProcs messageClass = {
int
Tk_MessageObjCmd(
- ClientData clientData, /* NULL. */
+ ClientData dummy, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
@@ -222,6 +222,7 @@ Tk_MessageObjCmd(
Message *msgPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -241,8 +242,8 @@ Tk_MessageObjCmd(
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
- msgPtr = ckalloc(sizeof(Message));
- memset(msgPtr, 0, (size_t) sizeof(Message));
+ msgPtr = (Message *)ckalloc(sizeof(Message));
+ memset(msgPtr, 0, sizeof(Message));
/*
* Set values for those fields that don't take a 0 or NULL value.
@@ -267,7 +268,7 @@ Tk_MessageObjCmd(
Tk_CreateEventHandler(msgPtr->tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
MessageEventProc, msgPtr);
- if (Tk_InitOptions(interp, (char *)msgPtr, optionTable, tkwin) != TCL_OK) {
+ if (Tk_InitOptions(interp, msgPtr, optionTable, tkwin) != TCL_OK) {
Tk_DestroyWindow(msgPtr->tkwin);
return TCL_ERROR;
}
@@ -277,7 +278,7 @@ Tk_MessageObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(msgPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(msgPtr->tkwin));
return TCL_OK;
}
@@ -306,7 +307,7 @@ MessageWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- Message *msgPtr = clientData;
+ Message *msgPtr = (Message *)clientData;
static const char *const optionStrings[] = { "cget", "configure", NULL };
enum options { MESSAGE_CGET, MESSAGE_CONFIGURE };
int index;
@@ -331,7 +332,7 @@ MessageWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "option");
result = TCL_ERROR;
} else {
- objPtr = Tk_GetOptionValue(interp, (char *) msgPtr,
+ objPtr = Tk_GetOptionValue(interp, msgPtr,
msgPtr->optionTable, objv[2], msgPtr->tkwin);
if (objPtr == NULL) {
result = TCL_ERROR;
@@ -343,7 +344,7 @@ MessageWidgetObjCmd(
break;
case MESSAGE_CONFIGURE:
if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) msgPtr,
+ objPtr = Tk_GetOptionInfo(interp, msgPtr,
msgPtr->optionTable, (objc == 3) ? objv[2] : NULL,
msgPtr->tkwin);
if (objPtr == NULL) {
@@ -382,7 +383,7 @@ MessageWidgetObjCmd(
static void
DestroyMessage(
- char *memPtr) /* Info about message widget. */
+ void *memPtr) /* Info about message widget. */
{
Message *msgPtr = (Message *) memPtr;
@@ -444,6 +445,7 @@ ConfigureMessage(
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
Tk_SavedOptions savedOptions;
+ (void)flags;
/*
* Eliminate any existing trace on a variable monitored by the message.
@@ -455,7 +457,7 @@ ConfigureMessage(
MessageTextVarProc, msgPtr);
}
- if (Tk_SetOptions(interp, (char *) msgPtr, msgPtr->optionTable, objc, objv,
+ if (Tk_SetOptions(interp, msgPtr, msgPtr->optionTable, objc, objv,
msgPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
Tk_RestoreSavedOptions(&savedOptions);
return TCL_ERROR;
@@ -478,7 +480,7 @@ ConfigureMessage(
if (msgPtr->string != NULL) {
ckfree(msgPtr->string);
}
- msgPtr->string = strcpy(ckalloc(strlen(value) + 1), value);
+ msgPtr->string = strcpy((char *)ckalloc(strlen(value) + 1), value);
}
Tcl_TraceVar2(interp, msgPtr->textVarName, NULL,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
@@ -527,7 +529,7 @@ MessageWorldChanged(
XGCValues gcValues;
GC gc = NULL;
Tk_FontMetrics fm;
- Message *msgPtr = instanceData;
+ Message *msgPtr = (Message *)instanceData;
if (msgPtr->border != NULL) {
Tk_SetBackgroundFromBorder(msgPtr->tkwin, msgPtr->border);
@@ -666,7 +668,7 @@ static void
DisplayMessage(
ClientData clientData) /* Information about window. */
{
- Message *msgPtr = clientData;
+ Message *msgPtr = (Message *)clientData;
Tk_Window tkwin = msgPtr->tkwin;
int x, y;
int borderWidth = msgPtr->highlightWidth;
@@ -742,7 +744,7 @@ MessageEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- Message *msgPtr = clientData;
+ Message *msgPtr = (Message *)clientData;
if (((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0))
|| (eventPtr->type == ConfigureNotify)) {
@@ -795,7 +797,7 @@ static void
MessageCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- Message *msgPtr = clientData;
+ Message *msgPtr = (Message *)clientData;
/*
* This function could be invoked either because the window was destroyed
@@ -826,7 +828,6 @@ MessageCmdDeletedProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static char *
MessageTextVarProc(
ClientData clientData, /* Information about message. */
@@ -835,8 +836,10 @@ MessageTextVarProc(
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- Message *msgPtr = clientData;
+ Message *msgPtr = (Message *)clientData;
const char *value;
+ (void)name1;
+ (void)name2;
/*
* If the variable is unset, then immediately recreate it unless the whole
@@ -882,7 +885,7 @@ MessageTextVarProc(
ckfree(msgPtr->string);
}
msgPtr->numChars = Tcl_NumUtfChars(value, -1);
- msgPtr->string = ckalloc(strlen(value) + 1);
+ msgPtr->string = (char *)ckalloc(strlen(value) + 1);
strcpy(msgPtr->string, value);
ComputeMessageGeometry(msgPtr);
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 1552d11..618281d 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -3,7 +3,7 @@
*
* This file contains functions that implement the common Tk object types
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
+ * Copyright © 1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -50,6 +50,7 @@ typedef struct PixelRep {
typedef struct {
const Tcl_ObjType *doubleTypePtr;
const Tcl_ObjType *intTypePtr;
+ const Tcl_ObjType *endTypePtr;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -73,8 +74,12 @@ typedef struct MMRep {
typedef struct WindowRep {
Tk_Window tkwin; /* Cached window; NULL if not found. */
TkMainInfo *mainPtr; /* MainWindow associated with tkwin. */
- long epoch; /* Value of mainPtr->deletionEpoch at last
+#if TCL_MAJOR_VERSION > 8
+ size_t epoch; /* Value of mainPtr->deletionEpoch at last
* successful lookup. */
+#else
+ long epoch;
+#endif
} WindowRep;
/*
@@ -93,6 +98,35 @@ static int SetMMFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
+#if TCL_MAJOR_VERSION < 9
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if defined(USE_TCL_STUBS)
+/* Little hack to eliminate the need for "tclInt.h" here:
+ Just copy a small portion of TclIntStubs, just
+ enough to make it work */
+typedef struct TclIntStubs {
+ int magic;
+ void *hooks;
+ void (*dummy[34]) (void); /* dummy entries 0-33, not used */
+ int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */
+} TclIntStubs;
+extern const TclIntStubs *tclIntStubsPtr;
+
+# undef Tcl_GetIntForIndex
+# define Tcl_GetIntForIndex(interp, obj, max, ptr) ((tclIntStubsPtr->tclGetIntForIndex == NULL)? \
+ ((int (*)(Tcl_Interp*, Tcl_Obj *, int, int*))(void *)((&(tclStubsPtr->tcl_PkgProvideEx))[645]))((interp), (obj), (max), (ptr)): \
+ tclIntStubsPtr->tclGetIntForIndex((interp), (obj), (max), (ptr)))
+#elif TCL_MINOR_VERSION < 7
+extern int TclGetIntForIndex(Tcl_Interp*, Tcl_Obj *, int, int*);
+# define Tcl_GetIntForIndex(interp, obj, max, ptr) TclGetIntForIndex(interp, obj, max, ptr)
+#endif
+#ifdef __cplusplus
+}
+#endif
+#endif
+
/*
* The following structure defines the implementation of the "pixel" Tcl
* object, used for measuring distances. The pixel object remembers its
@@ -104,7 +138,7 @@ static const Tcl_ObjType pixelObjType = {
FreePixelInternalRep, /* freeIntRepProc */
DupPixelInternalRep, /* dupIntRepProc */
NULL, /* updateStringProc */
- SetPixelFromAny /* setFromAnyProc */
+ NULL /* setFromAnyProc */
};
/*
@@ -118,7 +152,7 @@ static const Tcl_ObjType mmObjType = {
FreeMMInternalRep, /* freeIntRepProc */
DupMMInternalRep, /* dupIntRepProc */
UpdateStringOfMM, /* updateStringProc */
- SetMMFromAny /* setFromAnyProc */
+ NULL /* setFromAnyProc */
};
/*
@@ -131,7 +165,7 @@ static const Tcl_ObjType windowObjType = {
FreeWindowInternalRep, /* freeIntRepProc */
DupWindowInternalRep, /* dupIntRepProc */
NULL, /* updateStringProc */
- SetWindowFromAny /* setFromAnyProc */
+ NULL /* setFromAnyProc */
};
/*
@@ -156,12 +190,17 @@ GetTypeCache(void)
/* Smart initialization of doubleTypePtr/intTypePtr without
* hash-table lookup or creating complete Tcl_Obj's */
Tcl_Obj obj;
+ obj.bytes = (char *)"end";
obj.length = 3;
+ obj.typePtr = NULL;
+ Tcl_GetIntForIndex(NULL, &obj, TCL_INDEX_NONE, (TkSizeT *)&obj.internalRep.doubleValue);
+ tsdPtr->endTypePtr = obj.typePtr;
obj.bytes = (char *)"0.0";
+ obj.length = 3;
obj.typePtr = NULL;
Tcl_GetDoubleFromObj(NULL, &obj, &obj.internalRep.doubleValue);
tsdPtr->doubleTypePtr = obj.typePtr;
- obj.bytes += 2;
+ obj.bytes = (char *)"0";
obj.length = 1;
obj.typePtr = NULL;
Tcl_GetLongFromObj(NULL, &obj, &obj.internalRep.longValue);
@@ -173,6 +212,56 @@ GetTypeCache(void)
/*
*----------------------------------------------------------------------
*
+ * TkGetIntForIndex --
+ *
+ * Almost the same as Tcl_GetIntForIndex, but it return an int, and it is
+ * more restricted. For example it only accepts "end", not "end-1", and
+ * only "2", not "1+1"
+ *
+ * Results:
+ * The return value is a standard Tcl object result.
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkGetIntForIndex(
+ Tcl_Obj *indexObj,
+ TkSizeT end,
+ int lastOK,
+ TkSizeT *indexPtr)
+{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ if (Tcl_GetIntForIndex(NULL, indexObj, end + lastOK, indexPtr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (indexObj->typePtr == tsdPtr->endTypePtr) {
+ /* check for "end", but not "end-??" or "end+??" */
+ return (*indexPtr == (end + lastOK)) ? TCL_OK : TCL_ERROR;
+ }
+ if (indexObj->typePtr != tsdPtr->intTypePtr) {
+ /* Neither do we accept "??-??" or "??+??" */
+ return TCL_ERROR;
+ }
+#if TCL_MAJOR_VERSION < 9
+ if ((*indexPtr < -1) || (end < -1)) {
+ *indexPtr = TCL_INDEX_NONE;
+ } else
+#endif
+ if ((*indexPtr + 1) > (end + 1)) {
+ *indexPtr = end + 1;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* GetPixelsFromObjEx --
*
* Attempt to return a pixel value from the Tcl object "objPtr". If the
@@ -668,7 +757,7 @@ UpdateStringOfMM(
{
MMRep *mmPtr;
char buffer[TCL_DOUBLE_SPACE];
- size_t len;
+ TkSizeT len;
mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1;
/* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */
@@ -973,7 +1062,7 @@ FreeWindowInternalRep(
/*
*----------------------------------------------------------------------
*
- * TkNewWindowObj --
+ * Tk_NewWindowObj --
*
* This function allocates a new Tcl_Obj that refers to a particular to a
* particular Tk window.
@@ -988,7 +1077,7 @@ FreeWindowInternalRep(
*/
Tcl_Obj *
-TkNewWindowObj(
+Tk_NewWindowObj(
Tk_Window tkwin)
{
Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 7bb02b4..63b65d6 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -5,8 +5,8 @@
* FOR BACKWARD COMPATIBILITY; THE NEW CONFIGURATION PACKAGE SHOULD BE
* USED FOR NEW PROJECTS.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -25,20 +25,24 @@
#define INIT 0x20
+#ifndef TK_CONFIG_OPTION_SPECIFIED
+# define TK_CONFIG_OPTION_SPECIFIED (1 << 4)
+#endif
+
/*
* Forward declarations for functions defined later in this file:
*/
static int DoConfig(Tcl_Interp *interp, Tk_Window tkwin,
Tk_ConfigSpec *specPtr, Tk_Uid value,
- int valueIsUid, char *widgRec);
+ int valueIsUid, void *widgRec);
static Tk_ConfigSpec * FindConfigSpec(Tcl_Interp *interp,
Tk_ConfigSpec *specs, const char *argvName,
int needFlags, int hateFlags);
static char * FormatConfigInfo(Tcl_Interp *interp, Tk_Window tkwin,
- const Tk_ConfigSpec *specPtr, char *widgRec);
+ const Tk_ConfigSpec *specPtr, void *widgRec);
static const char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin,
- const Tk_ConfigSpec *specPtr, char *widgRec,
+ const Tk_ConfigSpec *specPtr, void *widgRec,
char *buffer, Tcl_FreeProc **freeProcPtr);
static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp,
const Tk_ConfigSpec *staticSpecs);
@@ -340,10 +344,10 @@ DoConfig(
Tk_Uid value, /* Value to use to fill in widgRec. */
int valueIsUid, /* Non-zero means value is a Tk_Uid; zero
* means it's an ordinary string. */
- char *widgRec) /* Record whose fields are to be modified.
+ void *widgRec) /* Record whose fields are to be modified.
* Values must be properly initialized. */
{
- char *ptr;
+ void *ptr;
Tk_Uid uid;
int nullValue;
@@ -353,7 +357,7 @@ DoConfig(
}
do {
- ptr = widgRec + specPtr->offset;
+ ptr = (char *)widgRec + specPtr->offset;
switch (specPtr->type) {
case TK_CONFIG_BOOLEAN:
if (Tcl_GetBoolean(interp, value, (int *) ptr) != TCL_OK) {
@@ -546,7 +550,7 @@ DoConfig(
}
case TK_CONFIG_CUSTOM:
if (specPtr->customPtr->parseProc(specPtr->customPtr->clientData,
- interp, tkwin, value, widgRec, specPtr->offset)!=TCL_OK) {
+ interp, tkwin, value, (char *)widgRec, specPtr->offset)!=TCL_OK) {
return TCL_ERROR;
}
break;
@@ -689,7 +693,7 @@ FormatConfigInfo(
const Tk_ConfigSpec *specPtr,
/* Pointer to information describing
* option. */
- char *widgRec) /* Pointer to record holding current values of
+ void *widgRec) /* Pointer to record holding current values of
* info for widget. */
{
const char *argv[6];
@@ -755,7 +759,7 @@ FormatConfigValue(
Tk_Window tkwin, /* Window corresponding to widget. */
const Tk_ConfigSpec *specPtr, /* Pointer to information describing option.
* Must not point to a synonym option. */
- char *widgRec, /* Pointer to record holding current values of
+ void *widgRec, /* Pointer to record holding current values of
* info for widget. */
char *buffer, /* Static buffer to use for small values.
* Must have at least 200 bytes of storage. */
@@ -763,35 +767,36 @@ FormatConfigValue(
* function to free the result, or NULL if
* result is static. */
{
- const char *ptr, *result;
+ void *ptr;
+ const char *result;
*freeProcPtr = NULL;
- ptr = widgRec + specPtr->offset;
+ ptr = (char *)widgRec + specPtr->offset;
result = "";
switch (specPtr->type) {
case TK_CONFIG_BOOLEAN:
- if (*((int *) ptr) == 0) {
+ if (*((int *)ptr) == 0) {
result = "0";
} else {
result = "1";
}
break;
case TK_CONFIG_INT:
- sprintf(buffer, "%d", *((int *) ptr));
+ sprintf(buffer, "%d", *((int *)ptr));
result = buffer;
break;
case TK_CONFIG_DOUBLE:
- Tcl_PrintDouble(interp, *((double *) ptr), buffer);
+ Tcl_PrintDouble(interp, *((double *)ptr), buffer);
result = buffer;
break;
case TK_CONFIG_STRING:
- result = (*(char **) ptr);
+ result = (*(char **)ptr);
if (result == NULL) {
result = "";
}
break;
case TK_CONFIG_UID: {
- Tk_Uid uid = *((Tk_Uid *) ptr);
+ Tk_Uid uid = *((Tk_Uid *)ptr);
if (uid != NULL) {
result = uid;
@@ -799,7 +804,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_COLOR: {
- XColor *colorPtr = *((XColor **) ptr);
+ XColor *colorPtr = *((XColor **)ptr);
if (colorPtr != NULL) {
result = Tk_NameOfColor(colorPtr);
@@ -807,7 +812,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_FONT: {
- Tk_Font tkfont = *((Tk_Font *) ptr);
+ Tk_Font tkfont = *((Tk_Font *)ptr);
if (tkfont != NULL) {
result = Tk_NameOfFont(tkfont);
@@ -815,7 +820,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_BITMAP: {
- Pixmap pixmap = *((Pixmap *) ptr);
+ Pixmap pixmap = *((Pixmap *)ptr);
if (pixmap != None) {
result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap);
@@ -823,7 +828,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_BORDER: {
- Tk_3DBorder border = *((Tk_3DBorder *) ptr);
+ Tk_3DBorder border = *((Tk_3DBorder *)ptr);
if (border != NULL) {
result = Tk_NameOf3DBorder(border);
@@ -831,11 +836,11 @@ FormatConfigValue(
break;
}
case TK_CONFIG_RELIEF:
- result = Tk_NameOfRelief(*((int *) ptr));
+ result = Tk_NameOfRelief(*((int *)ptr));
break;
case TK_CONFIG_CURSOR:
case TK_CONFIG_ACTIVE_CURSOR: {
- Tk_Cursor cursor = *((Tk_Cursor *) ptr);
+ Tk_Cursor cursor = *((Tk_Cursor *)ptr);
if (cursor != NULL) {
result = Tk_NameOfCursor(Tk_Display(tkwin), cursor);
@@ -843,27 +848,27 @@ FormatConfigValue(
break;
}
case TK_CONFIG_JUSTIFY:
- result = Tk_NameOfJustify(*((Tk_Justify *) ptr));
+ result = Tk_NameOfJustify(*((Tk_Justify *)ptr));
break;
case TK_CONFIG_ANCHOR:
- result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr));
+ result = Tk_NameOfAnchor(*((Tk_Anchor *)ptr));
break;
case TK_CONFIG_CAP_STYLE:
- result = Tk_NameOfCapStyle(*((int *) ptr));
+ result = Tk_NameOfCapStyle(*((int *)ptr));
break;
case TK_CONFIG_JOIN_STYLE:
- result = Tk_NameOfJoinStyle(*((int *) ptr));
+ result = Tk_NameOfJoinStyle(*((int *)ptr));
break;
case TK_CONFIG_PIXELS:
- sprintf(buffer, "%d", *((int *) ptr));
+ sprintf(buffer, "%d", *((int *)ptr));
result = buffer;
break;
case TK_CONFIG_MM:
- Tcl_PrintDouble(interp, *((double *) ptr), buffer);
+ Tcl_PrintDouble(interp, *((double *)ptr), buffer);
result = buffer;
break;
case TK_CONFIG_WINDOW: {
- tkwin = *((Tk_Window *) ptr);
+ tkwin = *((Tk_Window *)ptr);
if (tkwin != NULL) {
result = Tk_PathName(tkwin);
}
@@ -871,7 +876,7 @@ FormatConfigValue(
}
case TK_CONFIG_CUSTOM:
result = specPtr->customPtr->printProc(specPtr->customPtr->clientData,
- tkwin, widgRec, specPtr->offset, freeProcPtr);
+ tkwin, (char *)widgRec, specPtr->offset, freeProcPtr);
break;
default:
result = "?? unknown type ??";
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
index 8996f31..b64b6cc 100644
--- a/generic/tkOldTest.c
+++ b/generic/tkOldTest.c
@@ -6,9 +6,9 @@
* interfaces. These commands are not normally included in Tcl/Tk
* applications; they're only used for testing.
*
- * Copyright (c) 1993-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1993-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
* Contributions by Don Porter, NIST, 2007. (not subject to US copyright)
*
* See the file "license.terms" for information on usage and redistribution of
@@ -24,6 +24,7 @@
#endif
#include "tkInt.h"
+#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
/*
* The following data structure represents the model for a test image:
*/
@@ -84,7 +85,7 @@ static Tk_ImageType imageType = {
static int ImageObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
-
+#endif
/*
*----------------------------------------------------------------------
@@ -106,13 +107,16 @@ static int ImageObjCmd(ClientData dummy,
int
TkOldTestInit(
- Tcl_Interp *interp)
+ Tcl_Interp *dummy)
{
static int initialized = 0;
+ (void)dummy;
if (!initialized) {
initialized = 1;
+#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
Tk_CreateImageType(&imageType);
+#endif
}
return TCL_OK;
}
@@ -132,8 +136,7 @@ TkOldTestInit(
*
*----------------------------------------------------------------------
*/
-
- /* ARGSUSED */
+#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
static int
ImageCreate(
Tcl_Interp *interp, /* Interpreter for application containing
@@ -151,6 +154,7 @@ ImageCreate(
TImageModel *timPtr;
const char *varName;
int i;
+ (void)typePtr;
varName = "log";
for (i = 0; i < argc; i += 2) {
@@ -167,14 +171,14 @@ ImageCreate(
varName = argv[i+1];
}
- timPtr = ckalloc(sizeof(TImageModel));
+ timPtr = (TImageModel *)ckalloc(sizeof(TImageModel));
timPtr->model = model;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
- timPtr->imageName = ckalloc(strlen(name) + 1);
+ timPtr->imageName = (char *)ckalloc(strlen(name) + 1);
strcpy(timPtr->imageName, name);
- timPtr->varName = ckalloc(strlen(varName) + 1);
+ timPtr->varName = (char *)ckalloc(strlen(varName) + 1);
strcpy(timPtr->varName, varName);
Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL);
*clientDataPtr = timPtr;
@@ -199,7 +203,6 @@ ImageCreate(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ImageObjCmd(
ClientData clientData, /* Main window for application. */
@@ -207,7 +210,7 @@ ImageObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TImageModel *timPtr = clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
int x, y, width, height;
if (objc < 2) {
@@ -262,7 +265,7 @@ ImageGet(
* used. */
ClientData clientData) /* Pointer to TImageModel for image. */
{
- TImageModel *timPtr = clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -271,7 +274,7 @@ ImageGet(
Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer,
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
- instPtr = ckalloc(sizeof(TImageInstance));
+ instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance));
instPtr->modelPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
@@ -309,7 +312,7 @@ ImageDisplay(
/* Coordinates in drawable corresponding to
* imageX and imageY. */
{
- TImageInstance *instPtr = clientData;
+ TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200 + TCL_INTEGER_SPACE * 6];
sprintf(buffer, "%s display %d %d %d %d %d %d",
@@ -354,7 +357,7 @@ ImageFree(
ClientData clientData, /* Pointer to TImageInstance for instance. */
Display *display) /* Display where image was to be drawn. */
{
- TImageInstance *instPtr = clientData;
+ TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200];
sprintf(buffer, "%s free", instPtr->modelPtr->imageName);
@@ -388,7 +391,7 @@ ImageDelete(
* this function is called, no more instances
* exist. */
{
- TImageModel *timPtr = clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
char buffer[100];
sprintf(buffer, "%s delete", timPtr->imageName);
@@ -400,6 +403,7 @@ ImageDelete(
ckfree(timPtr->varName);
ckfree(timPtr);
}
+#endif
/*
* Local Variables:
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 15fc405..4668f28 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -5,8 +5,8 @@
* allows various strings to be associated with windows either by name or
* by class or both.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -521,7 +521,7 @@ Tk_GetOption(
if (masqName != NULL) {
char *masqClass;
Tk_Uid nodeId, winClassId, winNameId;
- size_t classNameLength;
+ TkSizeT classNameLength;
Element *nodePtr, *leafPtr;
static const int searchOrder[] = {
EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS,
@@ -534,7 +534,7 @@ Tk_GetOption(
* Extract the masquerade class name from the name field.
*/
- classNameLength = (size_t) (masqName - name);
+ classNameLength = masqName - name;
masqClass = (char *)ckalloc(classNameLength + 1);
strncpy(masqClass, name, classNameLength);
masqClass[classNameLength] = '\0';
@@ -1084,7 +1084,8 @@ ReadOptionFile(
{
const char *realName;
Tcl_Obj *buffer;
- int result, bufferSize;
+ int result;
+ TkSizeT bufferSize;
Tcl_Channel chan;
Tcl_DString newName;
@@ -1115,7 +1116,7 @@ ReadOptionFile(
Tcl_IncrRefCount(buffer);
Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8");
bufferSize = Tcl_ReadChars(chan, buffer, -1, 0);
- if (bufferSize == -1) {
+ if (bufferSize == TCL_IO_FAILURE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"error reading file \"%s\": %s",
fileName, Tcl_PosixError(interp)));
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 67267e7..ac5d73f 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -4,8 +4,8 @@
* This file contains code to implement the "packer" geometry manager for
* Tk.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -20,7 +20,7 @@ static const char *const sideNames[] = {
/*
* For each window that the packer cares about (either because the window is
- * managed by the packer or because the window has content managed by
+ * managed by the packer or because the window has content that are managed by
* the packer), there is a structure of the following type:
*/
@@ -122,8 +122,10 @@ static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyPacker(void *memPtr);
static Packer * GetPacker(Tk_Window tkwin);
+#ifndef TK_NO_DEPRECATED
static int PackAfter(Tcl_Interp *interp, Packer *prevPtr,
Packer *containerPtr, int objc,Tcl_Obj *const objv[]);
+#endif /* !TK_NO_DEPRECATED */
static void PackStructureProc(ClientData clientData,
XEvent *eventPtr);
static void Unlink(Packer *packPtr);
@@ -161,10 +163,10 @@ TkAppendPadAmount(
if (halfSpace*2 == allSpace) {
Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, -1),
- Tcl_NewIntObj(halfSpace));
+ Tcl_NewWideIntObj(halfSpace));
} else {
- padding[0] = Tcl_NewIntObj(halfSpace);
- padding[1] = Tcl_NewIntObj(allSpace - halfSpace);
+ padding[0] = Tcl_NewWideIntObj(halfSpace);
+ padding[1] = Tcl_NewWideIntObj(allSpace - halfSpace);
Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, -1),
Tcl_NewListObj(2, padding));
}
@@ -197,12 +199,17 @@ Tk_PackObjCmd(
Tk_Window tkwin = (Tk_Window)clientData;
const char *argv2;
static const char *const optionStrings[] = {
- /* after, append, before and unpack are deprecated */
- "after", "append", "before", "unpack", "configure",
- "content", "forget", "info", "propagate", "slaves", NULL };
+#ifndef TK_NO_DEPRECATED
+ "after", "append", "before", "unpack",
+#endif /* !TK_NO_DEPRECATED */
+ "configure", "content", "forget", "info", "propagate", "slaves", NULL };
+ static const char *const optionStringsNoDep[] = {
+ "configure", "content", "forget", "info", "propagate", NULL };
enum options {
- PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, PACK_CONFIGURE,
- PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
+#ifndef TK_NO_DEPRECATED
+ PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK,
+#endif /* !TK_NO_DEPRECATED */
+ PACK_CONFIGURE, PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
int index;
if (objc >= 2) {
@@ -217,7 +224,7 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
+ if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
/*
* Call it again without the deprecated ones to get a proper error
@@ -225,14 +232,14 @@ Tk_PackObjCmd(
* deprecated and new options.
*/
- Tcl_ResetResult(interp);
- Tcl_GetIndexFromObjStruct(interp, objv[1], &optionStrings[4],
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
sizeof(char *), "option", 0, &index);
return TCL_ERROR;
}
argv2 = Tcl_GetString(objv[2]);
switch ((enum options) index) {
+#ifndef TK_NO_DEPRECATED
case PACK_AFTER: {
Packer *prevPtr;
Tk_Window tkwin2;
@@ -297,6 +304,7 @@ Tk_PackObjCmd(
}
return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3);
}
+#endif /* !TK_NO_DEPRECATED */
case PACK_CONFIGURE:
if (argv2[0] != '.') {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -349,7 +357,7 @@ Tk_PackObjCmd(
infoObj = Tcl_NewObj();
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1),
- TkNewWindowObj(contentPtr->containerPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1),
Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), -1));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1),
@@ -436,8 +444,8 @@ Tk_PackObjCmd(
}
break;
}
- case PACK_CONTENT:
- case PACK_SLAVES: {
+ case PACK_SLAVES:
+ case PACK_CONTENT: {
Tk_Window container;
Packer *containerPtr, *contentPtr;
Tcl_Obj *resultObj;
@@ -454,11 +462,12 @@ Tk_PackObjCmd(
for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
contentPtr = contentPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj(contentPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, resultObj);
break;
}
+#ifndef TK_NO_DEPRECATED
case PACK_UNPACK: {
Tk_Window tkwin2;
Packer *packPtr;
@@ -482,6 +491,7 @@ Tk_PackObjCmd(
}
break;
}
+#endif /* !TK_NO_DEPRECATED */
}
return TCL_OK;
@@ -598,7 +608,7 @@ ArrangePacking(
containerPtr->flags &= ~REQUESTED_REPACK;
/*
- * If the container has no content anymore, then leave the container size as-is.
+ * If the container has no content anymore, then leave the container's size as-is.
* Otherwise there is no way to "relinquish" control over the container
* so another geometry manager can take over.
*/
@@ -1087,6 +1097,7 @@ GetPacker(
*------------------------------------------------------------------------
*/
+#ifndef TK_NO_DEPRECATED
static int
PackAfter(
Tcl_Interp *interp, /* Interpreter for error reporting. */
@@ -1138,7 +1149,7 @@ PackAfter(
if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) {
badWindow:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't pack %s inside %s", Tcl_GetString(objv[0]),
+ "can't pack \"%s\" inside \"%s\"", Tcl_GetString(objv[0]),
Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
return TCL_ERROR;
@@ -1169,7 +1180,7 @@ PackAfter(
packPtr->flags |= OLD_STYLE;
for (index = 0 ; index < optionCount; index++) {
Tcl_Obj *curOptPtr = options[index];
- int length;
+ TkSizeT length;
const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length);
c = curOpt[0];
@@ -1307,6 +1318,7 @@ PackAfter(
}
return TCL_OK;
}
+#endif /* !TK_NO_DEPRECATED */
/*
*----------------------------------------------------------------------
@@ -1360,11 +1372,15 @@ Unlink(
/*
* If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
+ *
+ * Send the event "NoManagedChild" to the container to inform it about there
+ * being no managed children inside it.
*/
if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) {
TkFreeGeometryContainer(containerPtr->tkwin, "pack");
containerPtr->flags &= ~ALLOCED_CONTAINER;
+ Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL);
}
}
@@ -1456,7 +1472,7 @@ PackStructureProc(
if (packPtr->tkwin != NULL) {
TkDisplay *dispPtr = ((TkWindow *) packPtr->tkwin)->dispPtr;
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable,
- (void *)packPtr->tkwin));
+ packPtr->tkwin));
}
if (packPtr->flags & REQUESTED_REPACK) {
@@ -1786,7 +1802,7 @@ ConfigureContent(
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't pack %s inside %s", Tcl_GetString(objv[j]),
+ "can't pack \"%s\" inside \"%s\"", Tcl_GetString(objv[j]),
Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
return TCL_ERROR;
@@ -1794,7 +1810,7 @@ ConfigureContent(
}
if (content == containerPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't pack %s inside itself", Tcl_GetString(objv[j])));
+ "can't pack \"%s\" inside itself", Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL);
return TCL_ERROR;
}
@@ -1807,7 +1823,7 @@ ConfigureContent(
container = (TkWindow *)TkGetContainer(container)) {
if (container == (TkWindow *)content) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s, would cause management loop",
+ "can't put \"%s\" inside \"%s\": would cause management loop",
Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
return TCL_ERROR;
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 06a42d4..60d4fc0 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -6,8 +6,8 @@
* of other widgets, placing a movable "sash" between them, which can be
* used to alter the relative sizes of adjacent widgets.
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
- * Copyright (c) 2000 Ajuba Solutions.
+ * Copyright © 1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Ajuba Solutions.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -225,10 +225,10 @@ static void DestroyOptionTables(ClientData clientData,
Tcl_Interp *interp);
static int SetSticky(ClientData clientData, Tcl_Interp *interp,
Tk_Window tkwin, Tcl_Obj **value, char *recordPtr,
- int internalOffset, char *oldInternalPtr,
+ TkSizeT internalOffset, char *oldInternalPtr,
int flags);
static Tcl_Obj * GetSticky(ClientData clientData, Tk_Window tkwin,
- char *recordPtr, int internalOffset);
+ char *recordPtr, TkSizeT internalOffset);
static void RestoreSticky(ClientData clientData, Tk_Window tkwin,
char *internalPtr, char *oldInternalPtr);
static void AdjustForSticky(int sticky, int cavityWidth,
@@ -236,7 +236,7 @@ static void AdjustForSticky(int sticky, int cavityWidth,
int *paneWidthPtr, int *paneHeightPtr);
static void MoveSash(PanedWindow *pwPtr, int sash, int diff);
static int ObjectIsEmpty(Tcl_Obj *objPtr);
-static char * ComputeSlotAddress(char *recordPtr, int offset);
+static void * ComputeSlotAddress(void *recordPtr, TkSizeT offset);
static int PanedWindowIdentifyCoords(PanedWindow *pwPtr,
Tcl_Interp *interp, int x, int y);
@@ -275,92 +275,92 @@ static const Tk_ObjCustomOption stickyOption = {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_PANEDWINDOW_BG_COLOR, -1, Tk_Offset(PanedWindow, background), 0,
+ DEF_PANEDWINDOW_BG_COLOR, TCL_INDEX_NONE, offsetof(PanedWindow, background), 0,
DEF_PANEDWINDOW_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_PANEDWINDOW_BORDERWIDTH, -1, Tk_Offset(PanedWindow, borderWidth),
+ DEF_PANEDWINDOW_BORDERWIDTH, TCL_INDEX_NONE, offsetof(PanedWindow, borderWidth),
0, 0, GEOMETRY},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_PANEDWINDOW_CURSOR, -1, Tk_Offset(PanedWindow, cursor),
+ DEF_PANEDWINDOW_CURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad",
- DEF_PANEDWINDOW_HANDLEPAD, -1, Tk_Offset(PanedWindow, handlePad),
+ DEF_PANEDWINDOW_HANDLEPAD, TCL_INDEX_NONE, offsetof(PanedWindow, handlePad),
0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize",
- DEF_PANEDWINDOW_HANDLESIZE, Tk_Offset(PanedWindow, handleSizePtr),
- Tk_Offset(PanedWindow, handleSize), 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr),
+ offsetof(PanedWindow, handleSize), 0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-height", "height", "Height",
- DEF_PANEDWINDOW_HEIGHT, Tk_Offset(PanedWindow, heightPtr),
- Tk_Offset(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY},
+ DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightPtr),
+ offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_BOOLEAN, "-opaqueresize", "opaqueResize", "OpaqueResize",
- DEF_PANEDWINDOW_OPAQUERESIZE, -1,
- Tk_Offset(PanedWindow, resizeOpaque), 0, 0, 0},
+ DEF_PANEDWINDOW_OPAQUERESIZE, TCL_INDEX_NONE,
+ offsetof(PanedWindow, resizeOpaque), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
- DEF_PANEDWINDOW_ORIENT, -1, Tk_Offset(PanedWindow, orient),
+ DEF_PANEDWINDOW_ORIENT, TCL_INDEX_NONE, offsetof(PanedWindow, orient),
0, orientStrings, GEOMETRY},
{TK_OPTION_BORDER, "-proxybackground", "proxyBackground", "ProxyBackground",
- 0, -1, Tk_Offset(PanedWindow, proxyBackground), TK_OPTION_NULL_OK,
+ 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyBackground), TK_OPTION_NULL_OK,
(ClientData) DEF_PANEDWINDOW_BG_MONO, 0},
{TK_OPTION_PIXELS, "-proxyborderwidth", "proxyBorderWidth", "ProxyBorderWidth",
- DEF_PANEDWINDOW_PROXYBORDER, Tk_Offset(PanedWindow, proxyBorderWidthPtr),
- Tk_Offset(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthPtr),
+ offsetof(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY},
{TK_OPTION_RELIEF, "-proxyrelief", "proxyRelief", "Relief",
- 0, -1, Tk_Offset(PanedWindow, proxyRelief),
+ 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyRelief),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_PANEDWINDOW_RELIEF, -1, Tk_Offset(PanedWindow, relief), 0, 0, 0},
+ DEF_PANEDWINDOW_RELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, relief), 0, 0, 0},
{TK_OPTION_CURSOR, "-sashcursor", "sashCursor", "Cursor",
- DEF_PANEDWINDOW_SASHCURSOR, -1, Tk_Offset(PanedWindow, sashCursor),
+ DEF_PANEDWINDOW_SASHCURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, sashCursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad",
- DEF_PANEDWINDOW_SASHPAD, -1, Tk_Offset(PanedWindow, sashPad),
+ DEF_PANEDWINDOW_SASHPAD, TCL_INDEX_NONE, offsetof(PanedWindow, sashPad),
0, 0, GEOMETRY},
{TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief",
- DEF_PANEDWINDOW_SASHRELIEF, -1, Tk_Offset(PanedWindow, sashRelief),
+ DEF_PANEDWINDOW_SASHRELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, sashRelief),
0, 0, 0},
{TK_OPTION_PIXELS, "-sashwidth", "sashWidth", "Width",
- DEF_PANEDWINDOW_SASHWIDTH, Tk_Offset(PanedWindow, sashWidthPtr),
- Tk_Offset(PanedWindow, sashWidth), 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthPtr),
+ offsetof(PanedWindow, sashWidth), 0, 0, GEOMETRY},
{TK_OPTION_BOOLEAN, "-showhandle", "showHandle", "ShowHandle",
- DEF_PANEDWINDOW_SHOWHANDLE, -1, Tk_Offset(PanedWindow, showHandle),
+ DEF_PANEDWINDOW_SHOWHANDLE, TCL_INDEX_NONE, offsetof(PanedWindow, showHandle),
0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-width", "width", "Width",
- DEF_PANEDWINDOW_WIDTH, Tk_Offset(PanedWindow, widthPtr),
- Tk_Offset(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY},
+ DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthPtr),
+ offsetof(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
static const Tk_OptionSpec paneOptionSpecs[] = {
{TK_OPTION_WINDOW, "-after", NULL, NULL,
- DEF_PANEDWINDOW_PANE_AFTER, -1, Tk_Offset(Pane, after),
+ DEF_PANEDWINDOW_PANE_AFTER, TCL_INDEX_NONE, offsetof(Pane, after),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_WINDOW, "-before", NULL, NULL,
- DEF_PANEDWINDOW_PANE_BEFORE, -1, Tk_Offset(Pane, before),
+ DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Pane, before),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-height", NULL, NULL,
- DEF_PANEDWINDOW_PANE_HEIGHT, Tk_Offset(Pane, heightPtr),
- Tk_Offset(Pane, height), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightPtr),
+ offsetof(Pane, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
- DEF_PANEDWINDOW_PANE_HIDE, -1, Tk_Offset(Pane, hide), 0,0,GEOMETRY},
+ DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY},
{TK_OPTION_PIXELS, "-minsize", NULL, NULL,
- DEF_PANEDWINDOW_PANE_MINSIZE, -1, Tk_Offset(Pane, minSize), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Pane, minSize), 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADX, -1, Tk_Offset(Pane, padx), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Pane, padx), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADY, -1, Tk_Offset(Pane, pady), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Pane, pady), 0, 0, 0},
{TK_OPTION_CUSTOM, "-sticky", NULL, NULL,
- DEF_PANEDWINDOW_PANE_STICKY, -1, Tk_Offset(Pane, sticky), 0,
+ DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky), 0,
&stickyOption, 0},
{TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch",
- DEF_PANEDWINDOW_PANE_STRETCH, -1, Tk_Offset(Pane, stretch), 0,
+ DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Pane, stretch), 0,
(ClientData) stretchStrings, 0},
{TK_OPTION_PIXELS, "-width", NULL, NULL,
- DEF_PANEDWINDOW_PANE_WIDTH, Tk_Offset(Pane, widthPtr),
- Tk_Offset(Pane, width), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Pane, widthPtr),
+ offsetof(Pane, width), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -414,7 +414,7 @@ Tk_PanedWindowObjCmd(
* easy access to it in the future.
*/
- pwOpts = ckalloc(sizeof(OptionTables));
+ pwOpts = (OptionTables *)ckalloc(sizeof(OptionTables));
/*
* Set up an exit handler to free the optionTables struct.
@@ -459,7 +459,7 @@ Tk_PanedWindowObjCmd(
Tcl_Preserve(pwPtr->tkwin);
- if (Tk_InitOptions(interp, (char *) pwPtr, pwOpts->pwOptions,
+ if (Tk_InitOptions(interp, pwPtr, pwOpts->pwOptions,
tkwin) != TCL_OK) {
Tk_DestroyWindow(pwPtr->tkwin);
return TCL_ERROR;
@@ -506,7 +506,7 @@ Tk_PanedWindowObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(pwPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(pwPtr->tkwin));
return TCL_OK;
}
@@ -551,7 +551,7 @@ PanedWindowWidgetObjCmd(
Pane *panePtr;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
@@ -578,7 +578,7 @@ PanedWindowWidgetObjCmd(
result = TCL_ERROR;
break;
}
- resultObj = Tk_GetOptionValue(interp, (char *) pwPtr,
+ resultObj = Tk_GetOptionValue(interp, pwPtr,
pwPtr->optionTable, objv[2], pwPtr->tkwin);
if (resultObj == NULL) {
result = TCL_ERROR;
@@ -590,7 +590,7 @@ PanedWindowWidgetObjCmd(
case PW_CONFIGURE:
resultObj = NULL;
if (objc <= 3) {
- resultObj = Tk_GetOptionInfo(interp, (char *) pwPtr,
+ resultObj = Tk_GetOptionInfo(interp, pwPtr,
pwPtr->optionTable,
(objc == 3) ? objv[2] : NULL, pwPtr->tkwin);
if (resultObj == NULL) {
@@ -668,7 +668,7 @@ PanedWindowWidgetObjCmd(
for (i = 0; i < pwPtr->numPanes; i++) {
if (pwPtr->panes[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionValue(interp,
- (char *) pwPtr->panes[i], pwPtr->paneOpts,
+ pwPtr->panes[i], pwPtr->paneOpts,
objv[3], tkwin);
}
}
@@ -688,7 +688,7 @@ PanedWindowWidgetObjCmd(
case PW_PANECONFIGURE:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
- "pane ?option? ?value option value ...?");
+ "pane ?-option value ...?");
result = TCL_ERROR;
break;
}
@@ -708,7 +708,7 @@ PanedWindowWidgetObjCmd(
for (i = 0; i < pwPtr->numPanes; i++) {
if (pwPtr->panes[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionInfo(interp,
- (char *) pwPtr->panes[i], pwPtr->paneOpts,
+ pwPtr->panes[i], pwPtr->paneOpts,
(objc == 4) ? objv[3] : NULL,
pwPtr->tkwin);
if (resultObj == NULL) {
@@ -728,7 +728,7 @@ PanedWindowWidgetObjCmd(
resultObj = Tcl_NewObj();
for (i = 0; i < pwPtr->numPanes; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj(pwPtr->panes[i]->tkwin));
+ Tk_NewWindowObj(pwPtr->panes[i]->tkwin));
}
Tcl_SetObjResult(interp, resultObj);
break;
@@ -847,7 +847,7 @@ ConfigurePanes(
*/
memset((void *)&options, 0, sizeof(Pane));
- if (Tk_SetOptions(interp, (char *) &options, pwPtr->paneOpts,
+ if (Tk_SetOptions(interp, &options, pwPtr->paneOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
@@ -924,7 +924,7 @@ ConfigurePanes(
found = 0;
for (j = 0; j < pwPtr->numPanes; j++) {
if (pwPtr->panes[j] != NULL && pwPtr->panes[j]->tkwin == tkwin) {
- Tk_SetOptions(interp, (char *) pwPtr->panes[j],
+ Tk_SetOptions(interp, pwPtr->panes[j],
pwPtr->paneOpts, objc - firstOptionArg,
objv + firstOptionArg, pwPtr->tkwin, NULL, NULL);
if (pwPtr->panes[j]->minSize < 0) {
@@ -971,9 +971,9 @@ ConfigurePanes(
panePtr = (Pane *)ckalloc(sizeof(Pane));
memset(panePtr, 0, sizeof(Pane));
- Tk_InitOptions(interp, (char *)panePtr, pwPtr->paneOpts,
+ Tk_InitOptions(interp, panePtr, pwPtr->paneOpts,
pwPtr->tkwin);
- Tk_SetOptions(interp, (char *)panePtr, pwPtr->paneOpts,
+ Tk_SetOptions(interp, panePtr, pwPtr->paneOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL);
panePtr->tkwin = tkwin;
@@ -1131,8 +1131,8 @@ PanedWindowSashCommand(
}
panePtr = pwPtr->panes[sash];
- coords[0] = Tcl_NewIntObj(panePtr->sashx);
- coords[1] = Tcl_NewIntObj(panePtr->sashy);
+ coords[0] = Tcl_NewWideIntObj(panePtr->sashx);
+ coords[1] = Tcl_NewWideIntObj(panePtr->sashy);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
break;
@@ -1165,8 +1165,8 @@ PanedWindowSashCommand(
pwPtr->panes[sash]->markx = x;
pwPtr->panes[sash]->marky = y;
} else {
- coords[0] = Tcl_NewIntObj(pwPtr->panes[sash]->markx);
- coords[1] = Tcl_NewIntObj(pwPtr->panes[sash]->marky);
+ coords[0] = Tcl_NewWideIntObj(pwPtr->panes[sash]->markx);
+ coords[1] = Tcl_NewWideIntObj(pwPtr->panes[sash]->marky);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
}
break;
@@ -1248,7 +1248,7 @@ ConfigurePanedWindow(
Tk_SavedOptions savedOptions;
int typemask = 0;
- if (Tk_SetOptions(interp, (char *)pwPtr, pwPtr->optionTable, objc, objv,
+ if (Tk_SetOptions(interp, pwPtr, pwPtr->optionTable, objc, objv,
pwPtr->tkwin, &savedOptions, &typemask) != TCL_OK) {
Tk_RestoreSavedOptions(&savedOptions);
return TCL_ERROR;
@@ -2396,7 +2396,7 @@ GetSticky(
TCL_UNUSED(void *),
TCL_UNUSED(Tk_Window),
char *recordPtr, /* Pointer to widget record. */
- int internalOffset) /* Offset within *recordPtr containing the
+ TkSizeT internalOffset) /* Offset within *recordPtr containing the
* sticky value. */
{
int sticky = *(int *)(recordPtr + internalOffset);
@@ -2448,13 +2448,14 @@ SetSticky(
* We use a pointer to the pointer because we
* may need to return a value (NULL). */
char *recordPtr, /* Pointer to storage for the widget record. */
- int internalOffset, /* Offset within *recordPtr at which the
+ TkSizeT internalOffset, /* Offset within *recordPtr at which the
* internal value is to be stored. */
char *oldInternalPtr, /* Pointer to storage for the old value. */
int flags) /* Flags for the option, set Tk_SetOptions. */
{
int sticky = 0;
- char c, *internalPtr;
+ char c;
+ void *internalPtr;
const char *string;
internalPtr = ComputeSlotAddress(recordPtr, internalOffset);
@@ -2875,8 +2876,8 @@ PanedWindowProxyCommand(
return TCL_ERROR;
}
- coords[0] = Tcl_NewIntObj(pwPtr->proxyx);
- coords[1] = Tcl_NewIntObj(pwPtr->proxyy);
+ coords[0] = Tcl_NewWideIntObj(pwPtr->proxyx);
+ coords[1] = Tcl_NewWideIntObj(pwPtr->proxyy);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
break;
@@ -3018,13 +3019,13 @@ ObjectIsEmpty(
*----------------------------------------------------------------------
*/
-static char *
+static void *
ComputeSlotAddress(
- char *recordPtr, /* Pointer to the start of a record. */
- int offset) /* Offset of a slot within that record; may be < 0. */
+ void *recordPtr, /* Pointer to the start of a record. */
+ TkSizeT offset) /* Offset of a slot within that record; may be TCL_INDEX_NONE. */
{
- if (offset >= 0) {
- return recordPtr + offset;
+ if (offset != TCL_INDEX_NONE) {
+ return (char *)recordPtr + offset;
} else {
return NULL;
}
@@ -3140,7 +3141,7 @@ PanedWindowIdentifyCoords(
if (found != -1) {
Tcl_Obj *list[2];
- list[0] = Tcl_NewIntObj(found);
+ list[0] = Tcl_NewWideIntObj(found);
list[1] = Tcl_NewStringObj((isHandle ? "handle" : "sash"), -1);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, list));
}
diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c
new file mode 100644
index 0000000..2c0615d
--- /dev/null
+++ b/generic/tkPkgConfig.c
@@ -0,0 +1,172 @@
+/*
+ * tkPkgConfig.c --
+ *
+ * This file contains the configuration information to embed into the tcl
+ * binary library.
+ *
+ * Copyright © 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+ * Copyright © 2017 Stuart Cassoff <stwo@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+/* Note, the definitions in this module are influenced by the following C
+ * preprocessor macros:
+ *
+ * OSCMa = shortcut for "old style configuration macro activates"
+ * NSCMdt = shortcut for "new style configuration macro declares that"
+ *
+ * - TCL_THREADS OSCMa compilation as threaded.
+ * - TCL_MEM_DEBUG OSCMa memory debugging.
+ *
+ * - TCL_CFG_DO64BIT NSCMdt tk is compiled for a 64bit system.
+ * - NDEBUG NSCMdt tk is compiled with symbol info off.
+ * - TCL_CFG_OPTIMIZED NSCMdt tk is compiled with cc optimizations on
+ * - TCL_CFG_PROFILED NSCMdt tk is compiled with profiling info.
+ *
+ * - _WIN32 || __CYGWIN__ The value for the fontsytem key will be
+ * MAC_OSX_TK chosen based on these macros/defines.
+ * HAVE_XFT NSCMdt xft font support was requested.
+ *
+ * - CFG_RUNTIME_* Paths to various stuff at runtime.
+ * - CFG_INSTALL_* Paths to various stuff at installation time.
+ *
+ * - TCL_CFGVAL_ENCODING string containing the encoding used for the
+ * configuration values.
+ */
+
+#include "tkInt.h"
+
+
+#ifndef TCL_CFGVAL_ENCODING
+#define TCL_CFGVAL_ENCODING "utf-8"
+#endif
+
+/*
+ * Use C preprocessor statements to define the various values for the embedded
+ * configuration information.
+ */
+
+#ifdef TCL_THREADS
+# define CFG_THREADED "1"
+#else
+# define CFG_THREADED "0"
+#endif
+
+#ifdef TCL_MEM_DEBUG
+# define CFG_MEMDEBUG "1"
+#else
+# define CFG_MEMDEBUG "0"
+#endif
+
+#ifdef TCL_CFG_DO64BIT
+# define CFG_64 "1"
+#else
+# define CFG_64 "0"
+#endif
+
+#ifndef NDEBUG
+# define CFG_DEBUG "1"
+#else
+# define CFG_DEBUG "0"
+#endif
+
+#ifdef TCL_CFG_OPTIMIZED
+# define CFG_OPTIMIZED "1"
+#else
+# define CFG_OPTIMIZED "0"
+#endif
+
+#ifdef TCL_CFG_PROFILED
+# define CFG_PROFILED "1"
+#else
+# define CFG_PROFILED "0"
+#endif
+
+#if defined(_WIN32)
+# define CFG_FONTSYSTEM "gdi"
+#elif defined(MAC_OSX_TK)
+# define CFG_FONTSYSTEM "cocoa"
+#elif defined(HAVE_XFT)
+# define CFG_FONTSYSTEM "xft"
+#else
+# define CFG_FONTSYSTEM "x11"
+#endif
+
+static const Tcl_Config cfg[] = {
+ {"debug", CFG_DEBUG},
+ {"threaded", CFG_THREADED},
+ {"profiled", CFG_PROFILED},
+ {"64bit", CFG_64},
+ {"optimized", CFG_OPTIMIZED},
+#ifdef TK_NO_DEPRECATED
+ {"nodeprecated", "1"},
+#endif
+ {"mem_debug", CFG_MEMDEBUG},
+ {"fontsystem", CFG_FONTSYSTEM},
+
+ /* Runtime paths to various stuff */
+
+#ifdef CFG_RUNTIME_LIBDIR
+ {"libdir,runtime", CFG_RUNTIME_LIBDIR},
+#endif
+#ifdef CFG_RUNTIME_BINDIR
+ {"bindir,runtime", CFG_RUNTIME_BINDIR},
+#endif
+#ifdef CFG_RUNTIME_SCRDIR
+ {"scriptdir,runtime", CFG_RUNTIME_SCRDIR},
+#endif
+#ifdef CFG_RUNTIME_INCDIR
+ {"includedir,runtime", CFG_RUNTIME_INCDIR},
+#endif
+#ifdef CFG_RUNTIME_DOCDIR
+ {"docdir,runtime", CFG_RUNTIME_DOCDIR},
+#endif
+#ifdef CFG_RUNTIME_DEMODIR
+ {"demodir,runtime", CFG_RUNTIME_DEMODIR},
+#endif
+#if !defined(STATIC_BUILD)
+ {"dllfile,runtime", CFG_RUNTIME_DLLFILE},
+#endif
+
+ /* Installation paths to various stuff */
+
+#ifdef CFG_INSTALL_LIBDIR
+ {"libdir,install", CFG_INSTALL_LIBDIR},
+#endif
+#ifdef CFG_INSTALL_BINDIR
+ {"bindir,install", CFG_INSTALL_BINDIR},
+#endif
+#ifdef CFG_INSTALL_SCRDIR
+ {"scriptdir,install", CFG_INSTALL_SCRDIR},
+#endif
+#ifdef CFG_INSTALL_INCDIR
+ {"includedir,install", CFG_INSTALL_INCDIR},
+#endif
+#ifdef CFG_INSTALL_DOCDIR
+ {"docdir,install", CFG_INSTALL_DOCDIR},
+#endif
+#ifdef CFG_INSTALL_DEMODIR
+ {"demodir,install", CFG_INSTALL_DEMODIR},
+#endif
+
+ /* Last entry, closes the array */
+ {NULL, NULL}
+};
+
+void
+TkInitEmbeddedConfigurationInformation(
+ Tcl_Interp *interp) /* Interpreter the configuration command is
+ * registered in. */
+{
+ Tcl_RegisterConfig(interp, "tk", cfg, TCL_CFGVAL_ENCODING);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 47ceee2..8e26c71 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -4,8 +4,8 @@
* This file contains code to implement a simple geometry manager for Tk
* based on absolute placement or "rubber-sheet" placement.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -81,31 +81,31 @@ typedef struct Content {
#define IN_MASK 1
static const Tk_OptionSpec optionSpecs[] = {
- {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", -1,
- Tk_Offset(Content, anchor), 0, 0, 0},
- {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", -1,
- Tk_Offset(Content, borderMode), 0, borderModeStrings, 0},
- {TK_OPTION_PIXELS, "-height", NULL, NULL, "", Tk_Offset(Content, heightPtr),
- Tk_Offset(Content, height), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, Tk_Offset(Content, inTkwin),
+ {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", TCL_INDEX_NONE,
+ offsetof(Content, anchor), 0, 0, 0},
+ {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", TCL_INDEX_NONE,
+ offsetof(Content, borderMode), 0, borderModeStrings, 0},
+ {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Content, heightPtr),
+ offsetof(Content, height), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Content, inTkwin),
0, 0, IN_MASK},
{TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "",
- Tk_Offset(Content, relHeightPtr), Tk_Offset(Content, relHeight),
+ offsetof(Content, relHeightPtr), offsetof(Content, relHeight),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "",
- Tk_Offset(Content, relWidthPtr), Tk_Offset(Content, relWidth),
+ offsetof(Content, relWidthPtr), offsetof(Content, relWidth),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", -1,
- Tk_Offset(Content, relX), 0, 0, 0},
- {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", -1,
- Tk_Offset(Content, relY), 0, 0, 0},
- {TK_OPTION_PIXELS, "-width", NULL, NULL, "", Tk_Offset(Content, widthPtr),
- Tk_Offset(Content, width), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", Tk_Offset(Content, xPtr),
- Tk_Offset(Content, x), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", Tk_Offset(Content, yPtr),
- Tk_Offset(Content, y), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", TCL_INDEX_NONE,
+ offsetof(Content, relX), 0, 0, 0},
+ {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", TCL_INDEX_NONE,
+ offsetof(Content, relY), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Content, widthPtr),
+ offsetof(Content, width), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xPtr),
+ offsetof(Content, x), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yPtr),
+ offsetof(Content, y), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
/*
@@ -129,7 +129,7 @@ static const Tk_OptionSpec optionSpecs[] = {
typedef struct Container {
Tk_Window tkwin; /* Tk's token for container window. */
- struct Content *contentPtr; /* First in linked list of content placed
+ struct Content *contentPtr; /* First in linked list of content windowslaced
* relative to this container. */
int *abortPtr; /* If non-NULL, it means that there is a nested
* call to RecomputePlacement already working on
@@ -216,6 +216,9 @@ Tk_PlaceObjCmd(
static const char *const optionStrings[] = {
"configure", "content", "forget", "info", "slaves", NULL
};
+ static const char *const optionStringsNoDep[] = {
+ "configure", "content", "forget", "info", NULL
+ };
enum options { PLACE_CONFIGURE, PLACE_CONTENT, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
int index;
@@ -247,8 +250,8 @@ Tk_PlaceObjCmd(
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->placeInit) {
- Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS);
- Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS);
dispPtr->placeInit = 1;
}
@@ -271,13 +274,21 @@ Tk_PlaceObjCmd(
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->placeInit) {
- Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS);
- Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS);
dispPtr->placeInit = 1;
}
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
+ /*
+ * Call it again without the deprecated ones to get a proper error
+ * message. This works well since there can't be any ambiguity between
+ * deprecated and new options.
+ */
+
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
+ sizeof(char *), "option", 0, &index);
return TCL_ERROR;
}
@@ -290,7 +301,7 @@ Tk_PlaceObjCmd(
if (contentPtr == NULL) {
return TCL_OK;
}
- objPtr = Tk_GetOptionInfo(interp, (char *)contentPtr, optionTable,
+ objPtr = Tk_GetOptionInfo(interp, contentPtr, optionTable,
(objc == 4) ? objv[3] : NULL, tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -314,8 +325,8 @@ Tk_PlaceObjCmd(
Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
UnlinkContent(contentPtr);
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
- (void *)tkwin));
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable,
+ tkwin));
Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
contentPtr);
Tk_ManageGeometry(tkwin, NULL, NULL);
@@ -330,8 +341,8 @@ Tk_PlaceObjCmd(
}
return PlaceInfoCommand(interp, tkwin);
- case PLACE_CONTENT:
- case PLACE_SLAVES: {
+ case PLACE_SLAVES:
+ case PLACE_CONTENT: {
Container *containerPtr;
if (objc != 3) {
@@ -345,7 +356,7 @@ Tk_PlaceObjCmd(
for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
contentPtr = contentPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, listPtr,
- TkNewWindowObj(contentPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, listPtr);
}
@@ -383,7 +394,7 @@ CreateContent(
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->contentTable, (char *) tkwin, &isNew);
if (!isNew) {
return (Content *)Tcl_GetHashValue(hPtr);
}
@@ -456,7 +467,7 @@ FindContent(
Tcl_HashEntry *hPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin);
+ hPtr = Tcl_FindHashEntry(&dispPtr->contentTable, tkwin);
if (hPtr == NULL) {
return NULL;
}
@@ -468,7 +479,7 @@ FindContent(
*
* UnlinkContent --
*
- * This function removes a content window from the chain of content in its
+ * This function removes a content window from the chain of content windows in its
* container.
*
* Results:
@@ -496,7 +507,7 @@ UnlinkContent(
} else {
for (prevPtr = containerPtr->contentPtr; ; prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
- Tcl_Panic("UnlinkContent couldn't find slave to unlink");
+ Tcl_Panic("UnlinkContent couldn't find content to unlink");
}
if (prevPtr->nextPtr == contentPtr) {
prevPtr->nextPtr = contentPtr->nextPtr;
@@ -537,7 +548,7 @@ CreateContainer(
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *)tkwin, &isNew);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->containerTable, (char *)tkwin, &isNew);
if (isNew) {
containerPtr = (Container *)ckalloc(sizeof(Container));
containerPtr->tkwin = tkwin;
@@ -579,7 +590,7 @@ FindContainer(
Tcl_HashEntry *hPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, (char *) tkwin);
+ hPtr = Tcl_FindHashEntry(&dispPtr->containerTable, tkwin);
if (hPtr == NULL) {
return NULL;
}
@@ -630,7 +641,7 @@ ConfigureContent(
contentPtr = CreateContent(tkwin, table);
- if (Tk_SetOptions(interp, (char *)contentPtr, table, objc, objv,
+ if (Tk_SetOptions(interp, contentPtr, table, objc, objv,
contentPtr->tkwin, &savedOptions, &mask) != TCL_OK) {
goto error;
}
@@ -673,7 +684,7 @@ ConfigureContent(
/*
* Make sure that the new container is either the logical parent of the
- * content or a descendant of that window, and that the container and content
+ * content window or a descendant of that window, and that the container and content
* aren't the same.
*/
@@ -683,7 +694,7 @@ ConfigureContent(
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't place %s relative to %s",
+ "can't place \"%s\" relative to \"%s\"",
Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
goto error;
@@ -691,7 +702,7 @@ ConfigureContent(
}
if (contentPtr->tkwin == win) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't place %s relative to itself",
+ "can't place \"%s\" relative to itself",
Tk_PathName(contentPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
@@ -705,7 +716,7 @@ ConfigureContent(
container = (TkWindow *)TkGetContainer(container)) {
if (container == (TkWindow *)contentPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s, would cause management loop",
+ "can't put \"%s\" inside \"%s\": would cause management loop",
Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
@@ -807,7 +818,7 @@ PlaceInfoCommand(
if (contentPtr->containerPtr != NULL) {
Tcl_AppendToObj(infoObj, "-in", -1);
Tcl_ListObjAppendElement(NULL, infoObj,
- TkNewWindowObj(contentPtr->containerPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_AppendToObj(infoObj, " ", -1);
}
Tcl_AppendPrintfToObj(infoObj,
@@ -888,7 +899,7 @@ RecomputePlacement(
Tcl_Preserve(containerPtr);
/*
- * Iterate over all the content for the container. Each content's geometry can
+ * Iterate over all the content windows for the container. Each content's geometry can
* be computed independently of the other content. Changes to the window's
* structure could cause almost anything to happen, including deleting the
* parent or child. If this happens, we'll be told to abort.
@@ -1104,8 +1115,8 @@ PlaceStructureProc(
nextPtr = contentPtr->nextPtr;
contentPtr->nextPtr = NULL;
}
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable,
- (char *) containerPtr->tkwin));
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->containerTable,
+ containerPtr->tkwin));
if (containerPtr->flags & PARENT_RECONFIG_PENDING) {
Tcl_CancelIdleCall(RecomputePlacement, containerPtr);
}
@@ -1171,8 +1182,8 @@ ContentStructureProc(
if (contentPtr->containerPtr != NULL) {
UnlinkContent(contentPtr);
}
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
- (char *) contentPtr->tkwin));
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable,
+ contentPtr->tkwin));
FreeContent(contentPtr);
}
}
@@ -1254,8 +1265,8 @@ PlaceLostContentProc(
}
Tk_UnmapWindow(tkwin);
UnlinkContent(contentPtr);
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
- (char *) tkwin));
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable,
+ tkwin));
Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
contentPtr);
FreeContent(contentPtr);
diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h
index bad633f..422407f 100644
--- a/generic/tkPlatDecls.h
+++ b/generic/tkPlatDecls.h
@@ -3,7 +3,7 @@
*
* Declarations of functions in the platform-specific public Tcl API.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -54,28 +54,18 @@ EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message,
LRESULT *result);
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
-/* 0 */
-EXTERN void Tk_MacOSXSetEmbedHandler(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc);
-/* 1 */
-EXTERN void Tk_MacOSXTurnOffMenus(void);
-/* 2 */
-EXTERN void Tk_MacOSXTkOwnsCursor(int tkOwnsIt);
-/* 3 */
-EXTERN void TkMacOSXInitMenus(Tcl_Interp *interp);
+/* Slot 0 is reserved */
+/* Slot 1 is reserved */
+/* Slot 2 is reserved */
+/* Slot 3 is reserved */
/* 4 */
EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp);
/* 5 */
-EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
+EXTERN void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y,
int width, int height, int flags);
/* 6 */
EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin);
-/* 7 */
-EXTERN void * TkMacOSXGetDrawablePort(Drawable drawable);
+/* Slot 7 is reserved */
/* 8 */
EXTERN void * TkMacOSXGetRootControl(Drawable drawable);
/* 9 */
@@ -91,7 +81,7 @@ EXTERN void * Tk_MacOSXGetNSWindowForDrawable(Drawable drawable);
/* Slot 14 is reserved */
/* Slot 15 is reserved */
/* 16 */
-EXTERN void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y,
+EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
int width, int height, int flags);
#endif /* AQUA */
@@ -108,14 +98,14 @@ typedef struct TkPlatStubs {
int (*tk_TranslateWinEvent) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- void (*tk_MacOSXSetEmbedHandler) (Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacOSXEmbedGetClipProc *getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); /* 0 */
- void (*tk_MacOSXTurnOffMenus) (void); /* 1 */
- void (*tk_MacOSXTkOwnsCursor) (int tkOwnsIt); /* 2 */
- void (*tkMacOSXInitMenus) (Tcl_Interp *interp); /* 3 */
+ void (*reserved0)(void);
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
void (*tkMacOSXInitAppleEvents) (Tcl_Interp *interp); /* 4 */
- void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
+ void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */
- void * (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */
+ void (*reserved7)(void);
void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */
void (*tk_MacOSXSetupTkNotifier) (void); /* 9 */
int (*tk_MacOSXIsAppInFront) (void); /* 10 */
@@ -124,7 +114,7 @@ typedef struct TkPlatStubs {
void * (*tk_MacOSXGetNSWindowForDrawable) (Drawable drawable); /* 13 */
void (*reserved14)(void);
void (*reserved15)(void);
- void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 16 */
+ void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 16 */
#endif /* AQUA */
} TkPlatStubs;
@@ -155,22 +145,17 @@ extern const TkPlatStubs *tkPlatStubsPtr;
(tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
-#define Tk_MacOSXSetEmbedHandler \
- (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler) /* 0 */
-#define Tk_MacOSXTurnOffMenus \
- (tkPlatStubsPtr->tk_MacOSXTurnOffMenus) /* 1 */
-#define Tk_MacOSXTkOwnsCursor \
- (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor) /* 2 */
-#define TkMacOSXInitMenus \
- (tkPlatStubsPtr->tkMacOSXInitMenus) /* 3 */
+/* Slot 0 is reserved */
+/* Slot 1 is reserved */
+/* Slot 2 is reserved */
+/* Slot 3 is reserved */
#define TkMacOSXInitAppleEvents \
(tkPlatStubsPtr->tkMacOSXInitAppleEvents) /* 4 */
-#define TkGenWMConfigureEvent \
- (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 5 */
+#define TkGenWMConfigureEvent_ \
+ (tkPlatStubsPtr->tkGenWMConfigureEvent_) /* 5 */
#define TkMacOSXInvalClipRgns \
(tkPlatStubsPtr->tkMacOSXInvalClipRgns) /* 6 */
-#define TkMacOSXGetDrawablePort \
- (tkPlatStubsPtr->tkMacOSXGetDrawablePort) /* 7 */
+/* Slot 7 is reserved */
#define TkMacOSXGetRootControl \
(tkPlatStubsPtr->tkMacOSXGetRootControl) /* 8 */
#define Tk_MacOSXSetupTkNotifier \
@@ -185,8 +170,8 @@ extern const TkPlatStubs *tkPlatStubsPtr;
(tkPlatStubsPtr->tk_MacOSXGetNSWindowForDrawable) /* 13 */
/* Slot 14 is reserved */
/* Slot 15 is reserved */
-#define TkGenWMConfigureEvent_ \
- (tkPlatStubsPtr->tkGenWMConfigureEvent_) /* 16 */
+#define TkGenWMConfigureEvent \
+ (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 16 */
#endif /* AQUA */
#endif /* defined(USE_TK_STUBS) */
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index 7753c36..2fea8d8 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.c
@@ -6,7 +6,7 @@
* to generate appropriate enter/leave events, and to update the global
* grab window information.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -20,7 +20,6 @@
#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
-#define Cursor XCursor
#endif
typedef struct {
@@ -126,7 +125,7 @@ GenerateEnterLeave(
int state) /* State flags. */
{
int crossed = 0; /* 1 if mouse crossed a window boundary */
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
TkWindow *restrictWinPtr = tsdPtr->restrictWinPtr;
TkWindow *lastWinPtr = tsdPtr->lastWinPtr;
@@ -219,7 +218,7 @@ Tk_UpdatePointer(
int x, int y, /* Pointer location in root coords. */
int state) /* Modifier state mask. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
TkWindow *winPtr = (TkWindow *)tkwin;
TkWindow *targetWinPtr;
@@ -255,8 +254,8 @@ Tk_UpdatePointer(
* between the current button state and the last known button state.
*/
- for (b = Button1; b <= Button5; b++) {
- mask = TkGetButtonMask(b);
+ for (b = Button1; b <= Button9; b++) {
+ mask = Tk_GetButtonMask(b);
if (changes & mask) {
if (state & mask) {
type = ButtonPress;
@@ -425,8 +424,15 @@ XGrabPointer(
Cursor cursor,
Time time)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ (void)owner_events;
+ (void)event_mask;
+ (void)pointer_mode;
+ (void)keyboard_mode;
+ (void)confine_to;
+ (void)cursor;
+ (void)time;
display->request++;
tsdPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow(display, grab_window);
@@ -460,8 +466,9 @@ XUngrabPointer(
Display *display,
Time time)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ (void)time;
display->request++;
tsdPtr->grabWinPtr = NULL;
@@ -491,7 +498,7 @@ void
TkPointerDeadWindow(
TkWindow *winPtr)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr == tsdPtr->lastWinPtr) {
@@ -538,7 +545,7 @@ UpdateCursor(
TkWindow *winPtr)
{
Cursor cursor = None;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -584,8 +591,9 @@ XDefineCursor(
Cursor cursor)
{
TkWindow *winPtr = (TkWindow *) Tk_IdToWindow(display, w);
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ (void)cursor;
if (tsdPtr->cursorWinPtr == winPtr) {
UpdateCursor(winPtr);
diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c
index 87114c1..bf83453 100644
--- a/generic/tkRectOval.c
+++ b/generic/tkRectOval.c
@@ -3,8 +3,8 @@
*
* This file implements rectangle and oval items for canvas widgets.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -47,7 +47,7 @@ static const Tk_CustomOption stateOption = {
TkStateParseProc, TkStatePrintProc, INT2PTR(2)
};
static const Tk_CustomOption tagsOption = {
- Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
+ TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL
};
static const Tk_CustomOption dashOption = {
TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL
@@ -61,62 +61,62 @@ static const Tk_CustomOption pixelOption = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, outline.activeDash),
+ NULL, offsetof(RectOvalItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-activefill", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, activeFillColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(RectOvalItem, activeFillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-activeoutline", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(RectOvalItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, outline.activeStipple),
+ NULL, offsetof(RectOvalItem, outline.activeStipple),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(RectOvalItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
- "0.0", Tk_Offset(RectOvalItem, outline.activeWidth),
+ "0.0", offsetof(RectOvalItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, outline.dash),
+ NULL, offsetof(RectOvalItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
- "0", Tk_Offset(RectOvalItem, outline.offset),
+ "0", offsetof(RectOvalItem, outline.offset),
TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, outline.disabledDash),
+ NULL, offsetof(RectOvalItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(RectOvalItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, outline.disabledColor),
+ NULL, offsetof(RectOvalItem, outline.disabledColor),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, outline.disabledStipple),
+ NULL, offsetof(RectOvalItem, outline.disabledStipple),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(RectOvalItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_PIXELS, "-disabledwidth", NULL, NULL,
- "0.0", Tk_Offset(RectOvalItem, outline.disabledWidth),
+ "0.0", offsetof(RectOvalItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, fillColor), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(RectOvalItem, fillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
- "0,0", Tk_Offset(RectOvalItem, tsoffset),
+ "0,0", offsetof(RectOvalItem, tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
{TK_CONFIG_COLOR, "-outline", NULL, NULL,
- DEF_CANVITEM_OUTLINE, Tk_Offset(RectOvalItem, outline.color), TK_CONFIG_NULL_OK, NULL},
+ DEF_CANVITEM_OUTLINE, offsetof(RectOvalItem, outline.color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL,
- "0,0", Tk_Offset(RectOvalItem, outline.tsoffset),
+ "0,0", offsetof(RectOvalItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
{TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, outline.stipple), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(RectOvalItem, outline.stipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
- NULL, Tk_Offset(Tk_Item, state),TK_CONFIG_NULL_OK, &stateOption},
+ NULL, offsetof(Tk_Item, state),TK_CONFIG_NULL_OK, &stateOption},
{TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
- NULL, Tk_Offset(RectOvalItem, fillStipple),TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(RectOvalItem, fillStipple),TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
{TK_CONFIG_CUSTOM, "-width", NULL, NULL,
- "1.0", Tk_Offset(RectOvalItem, outline.width),
+ "1.0", offsetof(RectOvalItem, outline.width),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -149,6 +149,8 @@ static int RectToArea(Tk_Canvas canvas, Tk_Item *itemPtr,
double *areaPtr);
static double RectToPoint(Tk_Canvas canvas, Tk_Item *itemPtr,
double *pointPtr);
+static void RotateRectOval(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRad);
static void ScaleRectOval(Tk_Canvas canvas, Tk_Item *itemPtr,
double originX, double originY,
double scaleX, double scaleY);
@@ -181,7 +183,8 @@ Tk_ItemType tkRectangleType = {
NULL, /* insertProc */
NULL, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotateRectOval, /* rotateProc */
+ 0, NULL, NULL
};
Tk_ItemType tkOvalType = {
@@ -205,7 +208,8 @@ Tk_ItemType tkOvalType = {
NULL, /* insertProc */
NULL, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotateRectOval, /* rotateProc */
+ 0, NULL, NULL
};
/*
@@ -575,6 +579,7 @@ DeleteRectOval(
Display *display) /* Display containing window for canvas. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
+ (void)canvas;
Tk_DeleteOutline(display, &(rectOvalPtr->outline));
if (rectOvalPtr->fillColor != NULL) {
@@ -617,7 +622,6 @@ DeleteRectOval(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
ComputeRectOvalBbox(
Tk_Canvas canvas, /* Canvas that contains item. */
@@ -748,6 +752,10 @@ DisplayRectOval(
short x1, y1, x2, y2;
Pixmap fillStipple;
Tk_State state = itemPtr->state;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
/*
* Compute the screen coordinates of the bounding box for the item. Make
@@ -957,7 +965,6 @@ DisplayRectOval(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static double
RectToPoint(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1077,7 +1084,6 @@ RectToPoint(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static double
OvalToPoint(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1132,7 +1138,6 @@ OvalToPoint(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
RectToArea(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1206,7 +1211,6 @@ RectToArea(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
OvalToArea(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1286,6 +1290,57 @@ OvalToArea(
/*
*--------------------------------------------------------------
*
+ * RotateRectOval --
+ *
+ * This function is invoked to rotate a rectangle or oval item's
+ * coordinates. It works by rotating a computed point in the centre of
+ * the bounding box, NOT by rotating the corners of the bounding box.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The position of the rectangle or oval is rotated by angleRad about
+ * (originX, originY), and the bounding box is updated in the generic
+ * part of the item structure.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+RotateRectOval(
+ Tk_Canvas canvas, /* Canvas containing rectangle. */
+ Tk_Item *itemPtr, /* Rectangle to be scaled. */
+ double originX, double originY,
+ /* Origin about which to rotate rect. */
+ double angleRad) /* Amount to scale in X direction. */
+{
+ RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
+ double newX, newY, oldX, oldY;
+
+ /*
+ * Compute the centre of the box, then rotate that about the origin.
+ */
+
+ newX = oldX = (rectOvalPtr->bbox[0] + rectOvalPtr->bbox[2]) / 2.0;
+ newY = oldY = (rectOvalPtr->bbox[1] + rectOvalPtr->bbox[3]) / 2.0;
+ TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad),
+ &newX, &newY);
+
+ /*
+ * Apply the translation to the box.
+ */
+
+ rectOvalPtr->bbox[0] += newX - oldX;
+ rectOvalPtr->bbox[1] += newY - oldY;
+ rectOvalPtr->bbox[2] += newX - oldX;
+ rectOvalPtr->bbox[3] += newY - oldY;
+ ComputeRectOvalBbox(canvas, rectOvalPtr);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* ScaleRectOval --
*
* This function is invoked to rescale a rectangle or oval item.
@@ -1391,6 +1446,7 @@ RectOvalToPostscript(
Pixmap fillStipple;
Tk_State state = itemPtr->state;
Tcl_InterpState interpState;
+ (void)prepass;
y1 = Tk_CanvasPsY(canvas, rectOvalPtr->bbox[1]);
y2 = Tk_CanvasPsY(canvas, rectOvalPtr->bbox[3]);
@@ -1465,18 +1521,14 @@ RectOvalToPostscript(
Tcl_AppendObjToObj(psObj, pathObj);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsColor(interp, canvas, fillColor);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (fillStipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsStipple(interp, canvas, fillStipple);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (color != NULL) {
Tcl_AppendToObj(psObj, "grestore gsave\n", -1);
@@ -1495,10 +1547,7 @@ RectOvalToPostscript(
Tcl_AppendToObj(psObj, "0 setlinejoin 2 setlinecap\n", -1);
Tcl_ResetResult(interp);
- if (Tk_CanvasPsOutline(canvas, itemPtr,
- &rectOvalPtr->outline)!= TCL_OK) {
- goto error;
- }
+ Tk_CanvasPsOutline(canvas, itemPtr, &rectOvalPtr->outline);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
}
@@ -1511,12 +1560,6 @@ RectOvalToPostscript(
Tcl_DecrRefCount(psObj);
Tcl_DecrRefCount(pathObj);
return TCL_OK;
-
- error:
- Tcl_DiscardInterpState(interpState);
- Tcl_DecrRefCount(psObj);
- Tcl_DecrRefCount(pathObj);
- return TCL_ERROR;
}
/*
diff --git a/generic/tkScale.c b/generic/tkScale.c
index fa2a5d5..c67e35c 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -9,17 +9,17 @@
* implementation by Paul Mackerras. The -variable option is due to
* Henning Schulzrinne. All of these are used with permission.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 by Scriptics Corporation.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
#include "tkScale.h"
+#include "default.h"
#if defined(_WIN32)
#define snprintf _snprintf
@@ -45,97 +45,97 @@ static const char *const stateStrings[] = {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
- DEF_SCALE_ACTIVE_BG_COLOR, -1, Tk_Offset(TkScale, activeBorder),
+ DEF_SCALE_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, activeBorder),
0, DEF_SCALE_ACTIVE_BG_MONO, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_SCALE_BG_COLOR, -1, Tk_Offset(TkScale, bgBorder),
+ DEF_SCALE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, bgBorder),
0, DEF_SCALE_BG_MONO, 0},
{TK_OPTION_DOUBLE, "-bigincrement", "bigIncrement", "BigIncrement",
- DEF_SCALE_BIG_INCREMENT, -1, Tk_Offset(TkScale, bigIncrement),
+ DEF_SCALE_BIG_INCREMENT, TCL_INDEX_NONE, offsetof(TkScale, bigIncrement),
0, 0, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_SCALE_BORDER_WIDTH, -1, Tk_Offset(TkScale, borderWidth),
+ DEF_SCALE_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(TkScale, borderWidth),
0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
- DEF_SCALE_COMMAND, -1, Tk_Offset(TkScale, command),
+ DEF_SCALE_COMMAND, TCL_INDEX_NONE, offsetof(TkScale, command),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_SCALE_CURSOR, -1, Tk_Offset(TkScale, cursor),
+ DEF_SCALE_CURSOR, TCL_INDEX_NONE, offsetof(TkScale, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-digits", "digits", "Digits",
- DEF_SCALE_DIGITS, -1, Tk_Offset(TkScale, digits),
+ DEF_SCALE_DIGITS, TCL_INDEX_NONE, offsetof(TkScale, digits),
0, 0, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_SCALE_FONT, -1, Tk_Offset(TkScale, tkfont), 0, 0, 0},
+ DEF_SCALE_FONT, TCL_INDEX_NONE, offsetof(TkScale, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_SCALE_FG_COLOR, -1, Tk_Offset(TkScale, textColorPtr), 0,
+ DEF_SCALE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, textColorPtr), 0,
(ClientData) DEF_SCALE_FG_MONO, 0},
- {TK_OPTION_DOUBLE, "-from", "from", "From", DEF_SCALE_FROM, -1,
- Tk_Offset(TkScale, fromValue), 0, 0, 0},
+ {TK_OPTION_DOUBLE, "-from", "from", "From", DEF_SCALE_FROM, TCL_INDEX_NONE,
+ offsetof(TkScale, fromValue), 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_SCALE_HIGHLIGHT_BG_COLOR,
- -1, Tk_Offset(TkScale, highlightBorder),
+ TCL_INDEX_NONE, offsetof(TkScale, highlightBorder),
0, DEF_SCALE_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_SCALE_HIGHLIGHT, -1, Tk_Offset(TkScale, highlightColorPtr),
+ DEF_SCALE_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkScale, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_SCALE_HIGHLIGHT_WIDTH, -1,
- Tk_Offset(TkScale, highlightWidth), 0, 0, 0},
+ "HighlightThickness", DEF_SCALE_HIGHLIGHT_WIDTH, TCL_INDEX_NONE,
+ offsetof(TkScale, highlightWidth), 0, 0, 0},
{TK_OPTION_STRING, "-label", "label", "Label",
- DEF_SCALE_LABEL, -1, Tk_Offset(TkScale, label),
+ DEF_SCALE_LABEL, TCL_INDEX_NONE, offsetof(TkScale, label),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-length", "length", "Length",
- DEF_SCALE_LENGTH, -1, Tk_Offset(TkScale, length), 0, 0, 0},
+ DEF_SCALE_LENGTH, TCL_INDEX_NONE, offsetof(TkScale, length), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
- DEF_SCALE_ORIENT, -1, Tk_Offset(TkScale, orient),
+ DEF_SCALE_ORIENT, TCL_INDEX_NONE, offsetof(TkScale, orient),
0, orientStrings, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_SCALE_RELIEF, -1, Tk_Offset(TkScale, relief), 0, 0, 0},
+ DEF_SCALE_RELIEF, TCL_INDEX_NONE, offsetof(TkScale, relief), 0, 0, 0},
{TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
- DEF_SCALE_REPEAT_DELAY, -1, Tk_Offset(TkScale, repeatDelay),
+ DEF_SCALE_REPEAT_DELAY, TCL_INDEX_NONE, offsetof(TkScale, repeatDelay),
0, 0, 0},
{TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval",
- DEF_SCALE_REPEAT_INTERVAL, -1, Tk_Offset(TkScale, repeatInterval),
+ DEF_SCALE_REPEAT_INTERVAL, TCL_INDEX_NONE, offsetof(TkScale, repeatInterval),
0, 0, 0},
{TK_OPTION_DOUBLE, "-resolution", "resolution", "Resolution",
- DEF_SCALE_RESOLUTION, -1, Tk_Offset(TkScale, resolution),
+ DEF_SCALE_RESOLUTION, TCL_INDEX_NONE, offsetof(TkScale, resolution),
0, 0, 0},
{TK_OPTION_BOOLEAN, "-showvalue", "showValue", "ShowValue",
- DEF_SCALE_SHOW_VALUE, -1, Tk_Offset(TkScale, showValue),
+ DEF_SCALE_SHOW_VALUE, TCL_INDEX_NONE, offsetof(TkScale, showValue),
0, 0, 0},
{TK_OPTION_PIXELS, "-sliderlength", "sliderLength", "SliderLength",
- DEF_SCALE_SLIDER_LENGTH, -1, Tk_Offset(TkScale, sliderLength),
+ DEF_SCALE_SLIDER_LENGTH, TCL_INDEX_NONE, offsetof(TkScale, sliderLength),
0, 0, 0},
{TK_OPTION_RELIEF, "-sliderrelief", "sliderRelief", "SliderRelief",
- DEF_SCALE_SLIDER_RELIEF, -1, Tk_Offset(TkScale, sliderRelief),
+ DEF_SCALE_SLIDER_RELIEF, TCL_INDEX_NONE, offsetof(TkScale, sliderRelief),
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_SCALE_STATE, -1, Tk_Offset(TkScale, state),
+ DEF_SCALE_STATE, TCL_INDEX_NONE, offsetof(TkScale, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_SCALE_TAKE_FOCUS, Tk_Offset(TkScale, takeFocusPtr), -1,
+ DEF_SCALE_TAKE_FOCUS, offsetof(TkScale, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-tickinterval", "tickInterval", "TickInterval",
- DEF_SCALE_TICK_INTERVAL, -1, Tk_Offset(TkScale, tickInterval),
+ DEF_SCALE_TICK_INTERVAL, TCL_INDEX_NONE, offsetof(TkScale, tickInterval),
0, 0, 0},
{TK_OPTION_DOUBLE, "-to", "to", "To",
- DEF_SCALE_TO, -1, Tk_Offset(TkScale, toValue), 0, 0, 0},
+ DEF_SCALE_TO, TCL_INDEX_NONE, offsetof(TkScale, toValue), 0, 0, 0},
{TK_OPTION_COLOR, "-troughcolor", "troughColor", "Background",
- DEF_SCALE_TROUGH_COLOR, -1, Tk_Offset(TkScale, troughColorPtr),
+ DEF_SCALE_TROUGH_COLOR, TCL_INDEX_NONE, offsetof(TkScale, troughColorPtr),
0, DEF_SCALE_TROUGH_MONO, 0},
{TK_OPTION_STRING, "-variable", "variable", "Variable",
- DEF_SCALE_VARIABLE, Tk_Offset(TkScale, varNamePtr), -1,
+ DEF_SCALE_VARIABLE, offsetof(TkScale, varNamePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-width", "width", "Width",
- DEF_SCALE_WIDTH, -1, Tk_Offset(TkScale, width), 0, 0, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
+ DEF_SCALE_WIDTH, TCL_INDEX_NONE, offsetof(TkScale, width), 0, 0, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
/*
@@ -161,7 +161,7 @@ static void ComputeFormat(TkScale *scalePtr, int forTicks);
static void ComputeScaleGeometry(TkScale *scalePtr);
static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr,
int objc, Tcl_Obj *const objv[]);
-static void DestroyScale(char *memPtr);
+static void DestroyScale(void *memPtr);
static double MaxTickRoundingError(TkScale *scalePtr,
double tickResolution);
static void ScaleCmdDeletedProc(ClientData clientData);
@@ -248,7 +248,7 @@ ScaleRound(
int
Tk_ScaleObjCmd(
- ClientData clientData, /* NULL. */
+ ClientData dummy, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -256,6 +256,7 @@ Tk_ScaleObjCmd(
TkScale *scalePtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -343,7 +344,7 @@ Tk_ScaleObjCmd(
ExposureMask|StructureNotifyMask|FocusChangeMask,
ScaleEventProc, scalePtr);
- if ((Tk_InitOptions(interp, (char *) scalePtr, optionTable, tkwin)
+ if ((Tk_InitOptions(interp, scalePtr, optionTable, tkwin)
!= TCL_OK) ||
(ConfigureScale(interp, scalePtr, objc - 2, objv + 2) != TCL_OK)) {
Tk_DestroyWindow(scalePtr->tkwin);
@@ -356,7 +357,7 @@ Tk_ScaleObjCmd(
scalePtr->flags &= ~INVOKE_COMMAND;
- Tcl_SetObjResult(interp, TkNewWindowObj(scalePtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(scalePtr->tkwin));
return TCL_OK;
}
@@ -385,7 +386,7 @@ ScaleWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TkScale *scalePtr = clientData;
+ TkScale *scalePtr = (TkScale *)clientData;
Tcl_Obj *objPtr;
int index, result;
@@ -406,7 +407,7 @@ ScaleWidgetObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "cget option");
goto error;
}
- objPtr = Tk_GetOptionValue(interp, (char *) scalePtr,
+ objPtr = Tk_GetOptionValue(interp, scalePtr,
scalePtr->optionTable, objv[2], scalePtr->tkwin);
if (objPtr == NULL) {
goto error;
@@ -415,7 +416,7 @@ ScaleWidgetObjCmd(
break;
case COMMAND_CONFIGURE:
if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) scalePtr,
+ objPtr = Tk_GetOptionInfo(interp, scalePtr,
scalePtr->optionTable,
(objc == 3) ? objv[2] : NULL, scalePtr->tkwin);
if (objPtr == NULL) {
@@ -451,8 +452,8 @@ ScaleWidgetObjCmd(
y = scalePtr->horizTroughY + scalePtr->width/2
+ scalePtr->borderWidth;
}
- coords[0] = Tcl_NewIntObj(x);
- coords[1] = Tcl_NewIntObj(y);
+ coords[0] = Tcl_NewWideIntObj(x);
+ coords[1] = Tcl_NewWideIntObj(y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
break;
}
@@ -540,7 +541,7 @@ ScaleWidgetObjCmd(
static void
DestroyScale(
- char *memPtr) /* Info about scale widget. */
+ void *memPtr) /* Info about scale widget. */
{
TkScale *scalePtr = (TkScale *) memPtr;
@@ -625,7 +626,7 @@ ConfigureScale(
* First pass: set options to new values.
*/
- if (Tk_SetOptions(interp, (char *) scalePtr,
+ if (Tk_SetOptions(interp, scalePtr,
scalePtr->optionTable, objc, objv, scalePtr->tkwin,
&savedOptions, NULL) != TCL_OK) {
continue;
@@ -680,7 +681,7 @@ ConfigureScale(
ComputeFormat(scalePtr, 0);
ComputeFormat(scalePtr, 1);
- scalePtr->labelLength = scalePtr->label ? (int)strlen(scalePtr->label) : 0;
+ scalePtr->labelLength = scalePtr->label ? strlen(scalePtr->label) : 0;
Tk_SetBackgroundFromBorder(scalePtr->tkwin, scalePtr->bgBorder);
@@ -767,7 +768,7 @@ ScaleWorldChanged(
{
XGCValues gcValues;
GC gc;
- TkScale *scalePtr = instanceData;
+ TkScale *scalePtr = (TkScale *)instanceData;
gcValues.foreground = scalePtr->troughColorPtr->pixel;
gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues);
@@ -1161,7 +1162,7 @@ ScaleEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkScale *scalePtr = clientData;
+ TkScale *scalePtr = (TkScale *)clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
TkEventuallyRedrawScale(scalePtr, REDRAW_ALL);
@@ -1209,7 +1210,7 @@ static void
ScaleCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkScale *scalePtr = clientData;
+ TkScale *scalePtr = (TkScale *)clientData;
Tk_Window tkwin = scalePtr->tkwin;
/*
@@ -1335,7 +1336,6 @@ TkRoundIntervalToResolution(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static char *
ScaleVarProc(
ClientData clientData, /* Information about button. */
@@ -1344,11 +1344,13 @@ ScaleVarProc(
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- TkScale *scalePtr = clientData;
+ TkScale *scalePtr = (TkScale *)clientData;
const char *resultStr;
double value;
Tcl_Obj *valuePtr;
int result;
+ (void)name1;
+ (void)name2;
/*
* If the variable is unset, then immediately recreate it unless the whole
diff --git a/generic/tkScale.h b/generic/tkScale.h
index e68b786..6320e3e 100644
--- a/generic/tkScale.h
+++ b/generic/tkScale.h
@@ -4,8 +4,8 @@
* Declarations of types and functions used to implement the scale
* widget.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- * Copyright (c) 1999-2000 by Scriptics Corporation.
+ * Copyright © 1996 Sun Microsystems, Inc.
+ * Copyright © 1999-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -87,7 +87,7 @@ typedef struct TkScale {
int repeatInterval; /* Interval between autorepeats (in ms). */
char *label; /* Label to display above or to right of
* scale; NULL means don't display a label. */
- int labelLength; /* Number of non-NULL chars. in label. */
+ TkSizeT labelLength; /* Number of non-NULL chars. in label. */
enum state state; /* Values are active, normal, or disabled.
* Value of scale cannot be changed when
* disabled. */
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 8c80846..0b09b84 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -5,8 +5,8 @@
* scrollbar displays a slider and two arrows; mouse clicks on features
* within the scrollbar cause scrolling commands to be invoked.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -33,62 +33,62 @@ char tkDefScrollbarWidth[TCL_INTEGER_SPACE] = DEF_SCROLLBAR_WIDTH;
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_BORDER, "-activebackground", "activeBackground", "Foreground",
- DEF_SCROLLBAR_ACTIVE_BG_COLOR, Tk_Offset(TkScrollbar, activeBorder),
+ DEF_SCROLLBAR_ACTIVE_BG_COLOR, offsetof(TkScrollbar, activeBorder),
TK_CONFIG_COLOR_ONLY, NULL},
{TK_CONFIG_BORDER, "-activebackground", "activeBackground", "Foreground",
- DEF_SCROLLBAR_ACTIVE_BG_MONO, Tk_Offset(TkScrollbar, activeBorder),
+ DEF_SCROLLBAR_ACTIVE_BG_MONO, offsetof(TkScrollbar, activeBorder),
TK_CONFIG_MONO_ONLY, NULL},
{TK_CONFIG_RELIEF, "-activerelief", "activeRelief", "Relief",
- DEF_SCROLLBAR_ACTIVE_RELIEF, Tk_Offset(TkScrollbar, activeRelief), 0, NULL},
+ DEF_SCROLLBAR_ACTIVE_RELIEF, offsetof(TkScrollbar, activeRelief), 0, NULL},
{TK_CONFIG_BORDER, "-background", "background", "Background",
- DEF_SCROLLBAR_BG_COLOR, Tk_Offset(TkScrollbar, bgBorder),
+ DEF_SCROLLBAR_BG_COLOR, offsetof(TkScrollbar, bgBorder),
TK_CONFIG_COLOR_ONLY, NULL},
{TK_CONFIG_BORDER, "-background", "background", "Background",
- DEF_SCROLLBAR_BG_MONO, Tk_Offset(TkScrollbar, bgBorder),
+ DEF_SCROLLBAR_BG_MONO, offsetof(TkScrollbar, bgBorder),
TK_CONFIG_MONO_ONLY, NULL},
{TK_CONFIG_SYNONYM, "-bd", "borderWidth", NULL, NULL, 0, 0, NULL},
{TK_CONFIG_SYNONYM, "-bg", "background", NULL, NULL, 0, 0, NULL},
{TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_SCROLLBAR_BORDER_WIDTH, Tk_Offset(TkScrollbar, borderWidth), 0, NULL},
+ DEF_SCROLLBAR_BORDER_WIDTH, offsetof(TkScrollbar, borderWidth), 0, NULL},
{TK_CONFIG_STRING, "-command", "command", "Command",
- DEF_SCROLLBAR_COMMAND, Tk_Offset(TkScrollbar, command),
+ DEF_SCROLLBAR_COMMAND, offsetof(TkScrollbar, command),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_SCROLLBAR_CURSOR, Tk_Offset(TkScrollbar, cursor), TK_CONFIG_NULL_OK, NULL},
+ DEF_SCROLLBAR_CURSOR, offsetof(TkScrollbar, cursor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_PIXELS, "-elementborderwidth", "elementBorderWidth",
"BorderWidth", DEF_SCROLLBAR_EL_BORDER_WIDTH,
- Tk_Offset(TkScrollbar, elementBorderWidth), 0, NULL},
+ offsetof(TkScrollbar, elementBorderWidth), 0, NULL},
{TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_SCROLLBAR_HIGHLIGHT_BG,
- Tk_Offset(TkScrollbar, highlightBgColorPtr), 0, NULL},
+ offsetof(TkScrollbar, highlightBgColorPtr), 0, NULL},
{TK_CONFIG_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
DEF_SCROLLBAR_HIGHLIGHT,
- Tk_Offset(TkScrollbar, highlightColorPtr), 0, NULL},
+ offsetof(TkScrollbar, highlightColorPtr), 0, NULL},
{TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness",
- DEF_SCROLLBAR_HIGHLIGHT_WIDTH, Tk_Offset(TkScrollbar, highlightWidth), 0, NULL},
+ DEF_SCROLLBAR_HIGHLIGHT_WIDTH, offsetof(TkScrollbar, highlightWidth), 0, NULL},
{TK_CONFIG_BOOLEAN, "-jump", "jump", "Jump",
- DEF_SCROLLBAR_JUMP, Tk_Offset(TkScrollbar, jump), 0, NULL},
+ DEF_SCROLLBAR_JUMP, offsetof(TkScrollbar, jump), 0, NULL},
{TK_CONFIG_CUSTOM, "-orient", "orient", "Orient",
- DEF_SCROLLBAR_ORIENT, Tk_Offset(TkScrollbar, vertical), 0,
+ DEF_SCROLLBAR_ORIENT, offsetof(TkScrollbar, vertical), 0,
&orientOption},
{TK_CONFIG_RELIEF, "-relief", "relief", "Relief",
- DEF_SCROLLBAR_RELIEF, Tk_Offset(TkScrollbar, relief), 0, NULL},
+ DEF_SCROLLBAR_RELIEF, offsetof(TkScrollbar, relief), 0, NULL},
{TK_CONFIG_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
- DEF_SCROLLBAR_REPEAT_DELAY, Tk_Offset(TkScrollbar, repeatDelay), 0, NULL},
+ DEF_SCROLLBAR_REPEAT_DELAY, offsetof(TkScrollbar, repeatDelay), 0, NULL},
{TK_CONFIG_INT, "-repeatinterval", "repeatInterval", "RepeatInterval",
- DEF_SCROLLBAR_REPEAT_INTERVAL, Tk_Offset(TkScrollbar, repeatInterval), 0, NULL},
+ DEF_SCROLLBAR_REPEAT_INTERVAL, offsetof(TkScrollbar, repeatInterval), 0, NULL},
{TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_SCROLLBAR_TAKE_FOCUS, Tk_Offset(TkScrollbar, takeFocus),
+ DEF_SCROLLBAR_TAKE_FOCUS, offsetof(TkScrollbar, takeFocus),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-troughcolor", "troughColor", "Background",
- DEF_SCROLLBAR_TROUGH_COLOR, Tk_Offset(TkScrollbar, troughColorPtr),
+ DEF_SCROLLBAR_TROUGH_COLOR, offsetof(TkScrollbar, troughColorPtr),
TK_CONFIG_COLOR_ONLY, NULL},
{TK_CONFIG_COLOR, "-troughcolor", "troughColor", "Background",
- DEF_SCROLLBAR_TROUGH_MONO, Tk_Offset(TkScrollbar, troughColorPtr),
+ DEF_SCROLLBAR_TROUGH_MONO, offsetof(TkScrollbar, troughColorPtr),
TK_CONFIG_MONO_ONLY, NULL},
{TK_CONFIG_PIXELS, "-width", "width", "Width",
- tkDefScrollbarWidth, Tk_Offset(TkScrollbar, width), 0, NULL},
+ tkDefScrollbarWidth, offsetof(TkScrollbar, width), 0, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -179,10 +179,12 @@ Tk_ScrollbarObjCmd(
scrollPtr->sliderLast = 0;
scrollPtr->activeField = 0;
scrollPtr->activeRelief = TK_RELIEF_RAISED;
+#ifndef TK_NO_DEPRECATED
scrollPtr->totalUnits = 0;
scrollPtr->windowUnits = 0;
scrollPtr->firstUnit = 0;
scrollPtr->lastUnit = 0;
+#endif /* TK_NO_DEPRECATED */
scrollPtr->firstFraction = 0.0;
scrollPtr->lastFraction = 0.0;
scrollPtr->cursor = NULL;
@@ -194,7 +196,7 @@ Tk_ScrollbarObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(scrollPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(scrollPtr->tkwin));
return TCL_OK;
}
@@ -224,8 +226,8 @@ ScrollbarWidgetObjCmd(
Tcl_Obj *const objv[]) /* Argument strings. */
{
TkScrollbar *scrollPtr = (TkScrollbar *)clientData;
- int result = TCL_OK;
- int length, cmdIndex;
+ int result = TCL_OK, cmdIndex, length;
+ TkSizeT len;
static const char *const commandNames[] = {
"activate", "cget", "configure", "delta", "fraction",
"get", "identify", "set", NULL
@@ -269,13 +271,13 @@ ScrollbarWidgetObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "activate element");
goto error;
}
- c = Tcl_GetStringFromObj(objv[2], &length)[0];
+ c = Tcl_GetStringFromObj(objv[2], &len)[0];
oldActiveField = scrollPtr->activeField;
if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow1") == 0)) {
scrollPtr->activeField = TOP_ARROW;
} else if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow2") == 0)) {
scrollPtr->activeField = BOTTOM_ARROW;
- } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", length) == 0)) {
+ } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", len) == 0)) {
scrollPtr->activeField = SLIDER;
} else {
scrollPtr->activeField = OUTSIDE;
@@ -377,17 +379,19 @@ ScrollbarWidgetObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "get");
goto error;
}
- if (scrollPtr->flags & NEW_STYLE_COMMANDS) {
- resObjs[0] = Tcl_NewDoubleObj(scrollPtr->firstFraction);
- resObjs[1] = Tcl_NewDoubleObj(scrollPtr->lastFraction);
- Tcl_SetObjResult(interp, Tcl_NewListObj(2, resObjs));
- } else {
- resObjs[0] = Tcl_NewIntObj(scrollPtr->totalUnits);
- resObjs[1] = Tcl_NewIntObj(scrollPtr->windowUnits);
- resObjs[2] = Tcl_NewIntObj(scrollPtr->firstUnit);
- resObjs[3] = Tcl_NewIntObj(scrollPtr->lastUnit);
+#ifndef TK_NO_DEPRECATED
+ if (scrollPtr->flags & OLD_STYLE_COMMANDS) {
+ resObjs[0] = Tcl_NewWideIntObj(scrollPtr->totalUnits);
+ resObjs[1] = Tcl_NewWideIntObj(scrollPtr->windowUnits);
+ resObjs[2] = Tcl_NewWideIntObj(scrollPtr->firstUnit);
+ resObjs[3] = Tcl_NewWideIntObj(scrollPtr->lastUnit);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, resObjs));
+ break;
}
+#endif /* TK_NO_DEPRECATED */
+ resObjs[0] = Tcl_NewDoubleObj(scrollPtr->firstFraction);
+ resObjs[1] = Tcl_NewDoubleObj(scrollPtr->lastFraction);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, resObjs));
break;
}
case COMMAND_IDENTIFY: {
@@ -413,8 +417,6 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_SET: {
- int totalUnits, windowUnits, firstUnit, lastUnit;
-
if (objc == 4) {
double first, last;
@@ -438,8 +440,10 @@ ScrollbarWidgetObjCmd(
} else {
scrollPtr->lastFraction = last;
}
- scrollPtr->flags |= NEW_STYLE_COMMANDS;
+#ifndef TK_NO_DEPRECATED
+ scrollPtr->flags &= ~OLD_STYLE_COMMANDS;
} else if (objc == 6) {
+ int totalUnits, windowUnits, firstUnit, lastUnit;
if (Tcl_GetIntFromObj(interp, objv[2], &totalUnits) != TCL_OK) {
goto error;
}
@@ -476,11 +480,10 @@ ScrollbarWidgetObjCmd(
scrollPtr->firstFraction = ((double) firstUnit)/totalUnits;
scrollPtr->lastFraction = ((double) (lastUnit+1))/totalUnits;
}
- scrollPtr->flags &= ~NEW_STYLE_COMMANDS;
+ scrollPtr->flags |= OLD_STYLE_COMMANDS;
+#endif /* !TK_NO_DEPRECATED */
} else {
Tcl_WrongNumArgs(interp, 1, objv, "set firstFraction lastFraction");
- Tcl_AppendResult(interp, " or \"", Tcl_GetString(objv[0]),
- " set totalUnits windowUnits firstUnit lastUnit\"", NULL);
goto error;
}
TkpComputeScrollbarGeometry(scrollPtr);
diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h
index 2d521ae..2108a00 100644
--- a/generic/tkScrollbar.h
+++ b/generic/tkScrollbar.h
@@ -4,7 +4,7 @@
* Declarations of types and functions used to implement the scrollbar
* widget.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -93,21 +93,25 @@ typedef struct TkScrollbar {
* form (totalUnits, windowUnits, firstUnit, and lastUnit), or the "new"
* form (firstFraction and lastFraction). FirstFraction and lastFraction
* will always be valid, but the old-style information is only valid if
- * the NEW_STYLE_COMMANDS flag is 0.
+ * the OLD_STYLE_COMMANDS flag is 1.
*/
+#ifndef TK_NO_DEPRECATED
int totalUnits; /* Total dimension of application, in units.
- * Valid only if the NEW_STYLE_COMMANDS flag
- * isn't set. */
+ * Valid only if the OLD_STYLE_COMMANDS flag
+ * is set. */
int windowUnits; /* Maximum number of units that can be
* displayed in the window at once. Valid only
- * if the NEW_STYLE_COMMANDS flag isn't set. */
+ * if the OLD_STYLE_COMMANDS flag is set. */
int firstUnit; /* Number of last unit visible in
* application's window. Valid only if the
- * NEW_STYLE_COMMANDS flag isn't set. */
+ * OLD_STYLE_COMMANDS flag is set. */
int lastUnit; /* Index of last unit visible in window.
- * Valid only if the NEW_STYLE_COMMANDS flag
+ * Valid only if the OLD_STYLE_COMMANDS flag
* isn't set. */
+#else
+ int dummy1,dummy2,dummy3,dummy4; /* sizeof(TkScrollbar) should not depend on TK_NO_DEPRECATED */
+#endif /* TK_NO_DEPRECATED */
double firstFraction; /* Position of first visible thing in window,
* specified as a fraction between 0 and
* 1.0. */
@@ -144,16 +148,18 @@ typedef struct TkScrollbar {
*
* REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
* already been queued to redraw this window.
- * NEW_STYLE_COMMANDS: Non-zero means the new style of commands
+ * OLD_STYLE_COMMANDS: Non-zero means the old style of commands
* should be used to communicate with the widget:
- * ".t yview scroll 2 lines", instead of
- * ".t yview 40", for example.
+ * ".t yview 40", instead of
+ * ".t yview scroll 2 lines", for example.
* GOT_FOCUS: Non-zero means this window has the input
* focus.
*/
#define REDRAW_PENDING 1
-#define NEW_STYLE_COMMANDS 2
+#ifndef TK_NO_DEPRECATED
+# define OLD_STYLE_COMMANDS 2
+#endif /* TK_NO_DEPRECATED */
#define GOT_FOCUS 4
/*
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index ef636da..c37a320 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -4,8 +4,8 @@
* This file manages the selection for the Tk toolkit, translating
* between the standard X ICCCM conventions and Tcl commands.
*
- * Copyright (c) 1990-1993 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1993 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -26,7 +26,7 @@ typedef struct {
int charOffset; /* The offset of the next char to retrieve. */
int byteOffset; /* The expected byte offset of the next
* chunk. */
- char buffer[4]; /* A buffer to hold part of a UTF character
+ char buffer[4]; /* A buffer to hold part of a UTF character
* that is split across chunks. */
char command[TKFLEXARRAY]; /* Command to invoke. Actual space is
* allocated as large as necessary. This must
@@ -59,8 +59,8 @@ static Tcl_ThreadDataKey dataKey;
* Forward declarations for functions defined in this file:
*/
-static int HandleTclCommand(ClientData clientData,
- int offset, char *buffer, int maxBytes);
+static TkSizeT HandleTclCommand(ClientData clientData,
+ TkSizeT offset, char *buffer, TkSizeT maxBytes);
static void LostSelection(ClientData clientData);
static int SelGetProc(ClientData clientData,
Tcl_Interp *interp, const char *portion);
@@ -190,7 +190,7 @@ Tk_CreateSelHandler(
* should make a copy for this selPtr.
*/
- unsigned cmdInfoLen = Tk_Offset(CommandInfo, command) + 1 +
+ size_t cmdInfoLen = offsetof(CommandInfo, command) + 1 +
((CommandInfo *)clientData)->cmdLength;
selPtr->clientData = ckalloc(cmdInfoLen);
@@ -357,7 +357,7 @@ Tk_OwnSelection(
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
Tk_LostSelProc *clearProc = NULL;
- ClientData clearData = NULL;/* Initialization needed only to prevent
+ void *clearData = NULL;/* Initialization needed only to prevent
* compiler warning. */
if (dispPtr->multipleAtom == None) {
@@ -466,7 +466,7 @@ Tk_ClearSelection(
TkSelectionInfo *prevPtr;
TkSelectionInfo *nextPtr;
Tk_LostSelProc *clearProc = NULL;
- ClientData clearData = NULL;/* Initialization needed only to prevent
+ void *clearData = NULL;/* Initialization needed only to prevent
* compiler warning. */
if (dispPtr->multipleAtom == None) {
@@ -831,7 +831,7 @@ Tk_SelectionObjCmd(
const char *targetName = NULL;
const char *formatName = NULL;
CommandInfo *cmdInfoPtr;
- int cmdLength;
+ TkSizeT cmdLength;
static const char *const handleOptionStrings[] = {
"-format", "-selection", "-type", NULL
};
@@ -904,7 +904,7 @@ Tk_SelectionObjCmd(
if (cmdLength == 0) {
Tk_DeleteSelHandler(tkwin, selection, target);
} else {
- cmdInfoPtr = (CommandInfo *)ckalloc(Tk_Offset(CommandInfo, command)
+ cmdInfoPtr = (CommandInfo *)ckalloc(offsetof(CommandInfo, command)
+ 1 + cmdLength);
cmdInfoPtr->interp = interp;
cmdInfoPtr->charOffset = 0;
@@ -992,7 +992,7 @@ Tk_SelectionObjCmd(
if ((infoPtr != NULL)
&& (infoPtr->owner != winPtr->dispPtr->clipWindow)) {
- Tcl_SetObjResult(interp, TkNewWindowObj(infoPtr->owner));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(infoPtr->owner));
}
return TCL_OK;
}
@@ -1246,7 +1246,7 @@ TkSelClearSelection(
}
if (infoPtr != NULL && (infoPtr->owner == tkwin) &&
- (eventPtr->xselectionclear.serial >= (unsigned) infoPtr->serial)) {
+ (eventPtr->xselectionclear.serial >= (unsigned long) infoPtr->serial)) {
if (prevPtr == NULL) {
dispPtr->selectionInfoPtr = infoPtr->nextPtr;
} else {
@@ -1317,13 +1317,13 @@ SelGetProc(
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
HandleTclCommand(
ClientData clientData, /* Information about command to execute. */
- int offset, /* Return selection bytes starting at this
+ TkSizeT offset, /* Return selection bytes starting at this
* offset. */
char *buffer, /* Place to store converted selection. */
- int maxBytes) /* Maximum # of bytes to store at buffer. */
+ TkSizeT maxBytes) /* Maximum # of bytes to store at buffer. */
{
CommandInfo *cmdInfoPtr = (CommandInfo *)clientData;
int length;
@@ -1347,7 +1347,7 @@ HandleTclCommand(
* character.
*/
- if (offset == cmdInfoPtr->byteOffset) {
+ if ((int)offset == cmdInfoPtr->byteOffset) {
charOffset = cmdInfoPtr->charOffset;
extraBytes = strlen(cmdInfoPtr->buffer);
if (extraBytes > 0) {
@@ -1368,7 +1368,7 @@ HandleTclCommand(
*/
command = Tcl_ObjPrintf("%s %d %d",
- cmdInfoPtr->command, charOffset, maxBytes);
+ cmdInfoPtr->command, charOffset, (int)maxBytes);
Tcl_IncrRefCount(command);
/*
@@ -1385,8 +1385,8 @@ HandleTclCommand(
*/
string = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &length);
- count = (length > maxBytes) ? maxBytes : length;
- memcpy(buffer, string, (size_t) count);
+ count = (length > (int)maxBytes) ? (int)maxBytes : length;
+ memcpy(buffer, string, count);
buffer[count] = '\0';
/*
@@ -1395,7 +1395,7 @@ HandleTclCommand(
*/
if (cmdInfoPtr->interp != NULL) {
- if (length <= maxBytes) {
+ if (length <= (int)maxBytes) {
cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, -1);
cmdInfoPtr->buffer[0] = '\0';
} else {
diff --git a/generic/tkSelect.h b/generic/tkSelect.h
index 74326d0..ceff8cb 100644
--- a/generic/tkSelect.h
+++ b/generic/tkSelect.h
@@ -4,7 +4,7 @@
* Declarations of types shared among the files that implement selection
* support.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -25,14 +25,18 @@
typedef struct TkSelectionInfo {
Atom selection; /* Selection name, e.g. XA_PRIMARY. */
Tk_Window owner; /* Current owner of this selection. */
- int serial; /* Serial number of last XSelectionSetOwner
+#if TCL_MAJOR_VERSION > 8
+ unsigned long serial; /* Serial number of last XSelectionSetOwner
* request made to server for this selection
* (used to filter out redundant
* SelectionClear events). */
+#else
+ int serial;
+#endif
Time time; /* Timestamp used to acquire selection. */
Tk_LostSelProc *clearProc; /* Procedure to call when owner loses
* selection. */
- ClientData clearData; /* Info to pass to clearProc. */
+ void *clearData; /* Info to pass to clearProc. */
struct TkSelectionInfo *nextPtr;
/* Next in list of current selections on this
* display. NULL means end of list. */
@@ -52,8 +56,8 @@ typedef struct TkSelHandler {
* returned, such as STRING or ATOM. */
Tk_SelectionProc *proc; /* Procedure to generate selection in this
* format. */
- ClientData clientData; /* Argument to pass to proc. */
- int size; /* Size of units returned by proc (8 for
+ void *clientData; /* Argument to pass to proc. */
+ TkSizeT size; /* Size of units returned by proc (8 for
* STRING, 32 for almost anything else). */
struct TkSelHandler *nextPtr;
/* Next selection handler associated with same
@@ -103,7 +107,7 @@ typedef struct TkSelRetrievalInfo {
typedef struct TkClipboardBuffer {
char *buffer; /* Null terminated data buffer. */
- long length; /* Length of string in buffer. */
+ TkSizeT length; /* Length of string in buffer. */
struct TkClipboardBuffer *nextPtr;
/* Next in list of buffers. NULL means end of
* list . */
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 61f86c5..c78edc7 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -7,7 +7,7 @@
* build a widget; it isn't included in the normal wish, but it is
* included in "tktest".
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
+ * Copyright © 1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -66,29 +66,29 @@ typedef struct {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
- "#d9d9d9", Tk_Offset(Square, bgBorderPtr), -1, 0,
+ "#d9d9d9", offsetof(Square, bgBorderPtr), TCL_INDEX_NONE, 0,
"white", 0},
- {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0,
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
"-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0,
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
"-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- "2", Tk_Offset(Square, borderWidthPtr), -1, 0, NULL, 0},
+ "2", offsetof(Square, borderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_BOOLEAN, "-dbl", "doubleBuffer", "DoubleBuffer",
- "1", Tk_Offset(Square, doubleBufferPtr), -1, 0 , NULL, 0},
- {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, -1, 0,
+ "1", offsetof(Square, doubleBufferPtr), TCL_INDEX_NONE, 0 , NULL, 0},
+ {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
"-foreground", 0},
{TK_OPTION_BORDER, "-foreground", "foreground", "Foreground",
- "#b03060", Tk_Offset(Square, fgBorderPtr), -1, 0,
+ "#b03060", offsetof(Square, fgBorderPtr), TCL_INDEX_NONE, 0,
"black", 0},
{TK_OPTION_PIXELS, "-posx", "posx", "PosX", "0",
- Tk_Offset(Square, xPtr), -1, 0, NULL, 0},
+ offsetof(Square, xPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_PIXELS, "-posy", "posy", "PosY", "0",
- Tk_Offset(Square, yPtr), -1, 0, NULL, 0},
+ offsetof(Square, yPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- "raised", Tk_Offset(Square, reliefPtr), -1, 0, NULL, 0},
+ "raised", offsetof(Square, reliefPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_PIXELS, "-size", "size", "Size", "20",
- Tk_Offset(Square, sizeObjPtr), -1, 0, NULL, 0},
+ offsetof(Square, sizeObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
@@ -125,7 +125,7 @@ static int SquareWidgetObjCmd(ClientData clientData,
int
SquareObjCmd(
- ClientData clientData, /* NULL. */
+ ClientData dummy, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -133,6 +133,7 @@ SquareObjCmd(
Square *squarePtr;
Tk_Window tkwin;
Tk_OptionTable optionTable;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -160,7 +161,7 @@ SquareObjCmd(
* just the non-NULL/0 items.
*/
- squarePtr = ckalloc(sizeof(Square));
+ squarePtr = (Square *)ckalloc(sizeof(Square));
memset(squarePtr, 0, sizeof(Square));
squarePtr->tkwin = tkwin;
@@ -172,7 +173,7 @@ SquareObjCmd(
squarePtr->gc = NULL;
squarePtr->optionTable = optionTable;
- if (Tk_InitOptions(interp, (char *) squarePtr, optionTable, tkwin)
+ if (Tk_InitOptions(interp, squarePtr, optionTable, tkwin)
!= TCL_OK) {
Tk_DestroyWindow(squarePtr->tkwin);
ckfree(squarePtr);
@@ -181,7 +182,7 @@ SquareObjCmd(
Tk_CreateEventHandler(squarePtr->tkwin, ExposureMask|StructureNotifyMask,
SquareObjEventProc, squarePtr);
- if (Tk_SetOptions(interp, (char *) squarePtr, optionTable, objc - 2,
+ if (Tk_SetOptions(interp, squarePtr, optionTable, objc - 2,
objv + 2, tkwin, NULL, NULL) != TCL_OK) {
goto error;
}
@@ -223,7 +224,7 @@ SquareWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj * const objv[]) /* Argument objects. */
{
- Square *squarePtr = clientData;
+ Square *squarePtr = (Square *)clientData;
int result = TCL_OK;
static const char *const squareOptions[] = {"cget", "configure", NULL};
enum {
@@ -233,7 +234,7 @@ SquareWidgetObjCmd(
int index;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
@@ -250,7 +251,7 @@ SquareWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "option");
goto error;
}
- resultObjPtr = Tk_GetOptionValue(interp, (char *) squarePtr,
+ resultObjPtr = Tk_GetOptionValue(interp, squarePtr,
squarePtr->optionTable, objv[2], squarePtr->tkwin);
if (resultObjPtr == NULL) {
result = TCL_ERROR;
@@ -261,19 +262,19 @@ SquareWidgetObjCmd(
case SQUARE_CONFIGURE:
resultObjPtr = NULL;
if (objc == 2) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
+ resultObjPtr = Tk_GetOptionInfo(interp, squarePtr,
squarePtr->optionTable, NULL, squarePtr->tkwin);
if (resultObjPtr == NULL) {
result = TCL_ERROR;
}
} else if (objc == 3) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
+ resultObjPtr = Tk_GetOptionInfo(interp, squarePtr,
squarePtr->optionTable, objv[2], squarePtr->tkwin);
if (resultObjPtr == NULL) {
result = TCL_ERROR;
}
} else {
- result = Tk_SetOptions(interp, (char *) squarePtr,
+ result = Tk_SetOptions(interp, squarePtr,
squarePtr->optionTable, objc - 2, objv + 2,
squarePtr->tkwin, NULL, NULL);
if (result == TCL_OK) {
@@ -318,12 +319,13 @@ SquareWidgetObjCmd(
static int
SquareConfigure(
- Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Interp *dummy, /* Used for error reporting. */
Square *squarePtr) /* Information about widget. */
{
int borderWidth;
Tk_3DBorder bgBorder;
int doubleBuffer;
+ (void)dummy;
/*
* Set the background for the window and create a graphics context for use
@@ -383,7 +385,7 @@ SquareObjEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- Square *squarePtr = clientData;
+ Square *squarePtr = (Square *)clientData;
if (eventPtr->type == Expose) {
if (!squarePtr->updatePending) {
@@ -436,7 +438,7 @@ static void
SquareDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- Square *squarePtr = clientData;
+ Square *squarePtr = (Square *)clientData;
Tk_Window tkwin = squarePtr->tkwin;
/*
@@ -473,7 +475,7 @@ static void
SquareDisplay(
ClientData clientData) /* Information about window. */
{
- Square *squarePtr = clientData;
+ Square *squarePtr = (Square *)clientData;
Tk_Window tkwin = squarePtr->tkwin;
Pixmap pm = None;
Drawable d;
@@ -556,7 +558,7 @@ static void
SquareDestroy(
void *memPtr) /* Info about square widget. */
{
- Square *squarePtr = memPtr;
+ Square *squarePtr = (Square *)memPtr;
ckfree(squarePtr);
}
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index e637f8e..ac3e95a 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -3,7 +3,7 @@
*
* This file contains the initializers for the Tk stub vectors.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -31,7 +31,6 @@
#include "tkPlatDecls.h"
#include "tkIntXlibDecls.h"
-static const TkIntStubs tkIntStubs;
MODULE_SCOPE const TkStubs tkStubs;
/*
@@ -39,14 +38,56 @@ MODULE_SCOPE const TkStubs tkStubs;
*/
#undef Tk_MainEx
-#undef XVisualIDFromVisual
-#undef XSynchronize
-#undef XUngrabServer
-#undef XNoOp
-#undef XGrabServer
-#undef XFree
-#undef XFlush
-#define TkUnusedStubEntry 0
+#undef Tk_FreeXId
+#undef Tk_FreeStyleFromObj
+#undef Tk_GetStyleFromObj
+#undef TkWinGetPlatformId
+#undef TkPutImage
+#undef XPutImage
+#define TkMacOSXSetUpClippingRgn (void (*)(Drawable))(void *)doNothing
+
+#if defined(_WIN32) && !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
+# define Tk_TranslateWinEvent TkTranslateWinEvent
+# define Tk_PointerEvent TkWinPointerEvent
+#define TkWinGetPlatformId winGetPlatformId
+static int TkWinGetPlatformId(void) {
+ return 2;
+}
+#else
+# define Tk_TranslateWinEvent 0
+# define Tk_PointerEvent 0
+# define TkWinGetPlatformId 0
+#endif
+
+static int
+doNothing(void)
+{
+ /* dummy implementation, no need to do anything */
+ return 0;
+}
+
+#if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
+#define Tk_MainEx 0
+#define Tk_FreeXId 0
+#define Tk_FreeStyleFromObj 0
+#define Tk_GetStyleFromObj 0
+#define TkWinGetPlatformId 0
+#define Tk_PhotoPutBlock_NoComposite 0
+#define Tk_PhotoPutZoomedBlock_NoComposite 0
+#define Tk_PhotoExpand_Panic 0
+#define Tk_PhotoPutBlock_Panic 0
+#define Tk_PhotoPutZoomedBlock_Panic 0
+#define Tk_PhotoSetSize_Panic 0
+#define Tk_CreateOldPhotoImageFormat 0
+#else
+#define Tk_FreeXId ((void (*)(Display *, XID))(void *)doNothing)
+#define Tk_FreeStyleFromObj ((void (*)(Tcl_Obj *))(void *)doNothing)
+#define Tk_GetStyleFromObj getStyleFromObj
+static Tk_Style Tk_GetStyleFromObj(Tcl_Obj *obj)
+{
+ return Tk_AllocStyleFromObj(NULL, obj);
+}
+#endif /* !TK_NO_DEPRECATED */
#define TkpCmapStressed_ TkpCmapStressed
#define TkpSync_ TkpSync
@@ -58,39 +99,36 @@ MODULE_SCOPE const TkStubs tkStubs;
#define TkpTestsendCmd_ TkpTestsendCmd
#define TkGenWMConfigureEvent_ TkGenWMConfigureEvent
#define TkGenerateActivateEvents_ TkGenerateActivateEvents
+#define TkMacOSXDrawable Tk_MacOSXGetNSWindowForDrawable
+#define Tk_CanvasTagsParseProc \
+ (int (*) (void *, Tcl_Interp *,Tk_Window, const char *, char *, \
+ int offset))(void *)TkCanvasTagsParseProc
+#define Tk_CanvasTagsPrintProc \
+ (const char *(*) (void *,Tk_Window, char *, int, \
+ Tcl_FreeProc **))(void *)TkCanvasTagsPrintProc
#if !defined(MAC_OSX_TK) && defined(MAC_OSX_TCL)
# undef TkpWillDrawWidget
# undef TkpRedrawWidget
-static int
-doNothing(void)
-{
- /* dummy implementation, no need to do anything */
- return 0;
-}
# define TkpWillDrawWidget ((int (*)(Tk_Window))(void *)doNothing)
# define TkpRedrawWidget ((void (*)(Tk_Window))(void *)doNothing)
#endif
-#if defined(MAC_OSX_TK)
-# define Tk_MacOSXGetNSWindowForDrawable TkMacOSXDrawable
-# define Tk_MacOSXGetCGContextForDrawable GetCGContextForDrawable
-static void *GetCGContextForDrawable(Drawable d) {
- return TkMacOSXGetCGContextForDrawable(d);
-}
-#endif
-
#ifdef _WIN32
int
TkpCmapStressed(Tk_Window tkwin, Colormap colormap)
{
+ (void)tkwin;
+ (void)colormap;
+
/* dummy implementation, no need to do anything */
return 0;
}
void
TkpSync(Display *display)
{
+ (void)display;
/* dummy implementation, no need to do anything */
}
@@ -103,11 +141,8 @@ TkCreateXEventSource(void)
# define TkUnixContainerId 0
# define TkUnixDoOneXEvent 0
# define TkUnixSetMenubar 0
-# define XCreateWindow 0
-# define XOffsetRegion 0
-# define XUnionRegion 0
-# define TkWmCleanup (void (*)(TkDisplay *)) TkpSync
-# define TkSendCleanup (void (*)(TkDisplay *)) TkpSync
+# define TkWmCleanup (void (*)(TkDisplay *))(void *)TkpSync
+# define TkSendCleanup (void (*)(TkDisplay *))(void *)TkpSync
# define TkpTestsendCmd 0
#else /* !_WIN32 */
@@ -126,22 +161,21 @@ TkCreateXEventSource(void)
*/
#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
+#ifdef __cplusplus
+extern "C" {
+#endif
int __stdcall GetModuleHandleExW(unsigned int, const char *, void *);
-
-void *Tk_GetHINSTANCE()
-{
- void *hInstance = NULL;
-
- GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
- (const char *) &tkIntStubs, &hInstance);
- return hInstance;
+#ifdef __cplusplus
}
+#endif
void
TkSetPixmapColormap(
Pixmap pixmap,
Colormap colormap)
{
+ (void)pixmap;
+ (void)colormap;
}
void
@@ -167,55 +201,16 @@ TkPutImage(
unsigned int width, unsigned int height)
/* Dimensions of subimage. */
{
- return XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height);
-}
-
-TkRegion TkCreateRegion()
-{
- return (TkRegion) XCreateRegion();
-}
-
-int TkDestroyRegion(TkRegion r)
-{
- return XDestroyRegion((Region)r);
-}
-
-int TkSetRegion(Display *d, GC g, TkRegion r)
-{
- return XSetRegion(d, g, (Region)r);
-}
-
-int TkUnionRectWithRegion(XRectangle *a, TkRegion b, TkRegion c)
-{
- return XUnionRectWithRegion(a, (Region) b, (Region) c);
-}
-
-int TkClipBox(TkRegion a, XRectangle *b)
-{
- return XClipBox((Region) a, b);
-}
+ (void)colors;
+ (void)ncolors;
-int TkIntersectRegion(TkRegion a, TkRegion b, TkRegion c)
-{
- return XIntersectRegion((Region) a, (Region) b, (Region) c);
-}
-
-int TkRectInRegion (TkRegion r, int a, int b, unsigned int c, unsigned int d)
-{
- return XRectInRegion((Region) r, a, b, c, d);
-}
-
-int TkSubtractRegion (TkRegion a, TkRegion b, TkRegion c)
-{
- return XSubtractRegion((Region) a, (Region) b, (Region) c);
+ return XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height);
}
/* TODO: To be implemented for Cygwin */
# define Tk_AttachHWND 0
# define Tk_GetHWND 0
# define Tk_HWNDToWindow 0
-# define Tk_PointerEvent 0
-# define Tk_TranslateWinEvent 0
# define TkAlignImageData 0
# define TkpGetMS 0
# define TkpGetCapture 0
@@ -244,33 +239,37 @@ int TkSubtractRegion (TkRegion a, TkRegion b, TkRegion c)
# define TkWinSetForegroundWindow 0
# define TkWinDialogDebug 0
# define TkWinGetMenuSystemDefault 0
-# define TkWinGetPlatformId 0
# define TkWinSetHINSTANCE 0
# define TkWinGetPlatformTheme 0
# define TkWinChildProc 0
-# elif !defined(MAC_OSX_TK) /* UNIX */
-
-# undef TkClipBox
-# undef TkCreateRegion
-# undef TkDestroyRegion
-# undef TkIntersectRegion
-# undef TkRectInRegion
-# undef TkSetRegion
-# undef TkUnionRectWithRegion
-# undef TkSubtractRegion
-
-# define TkClipBox (int (*) (TkRegion, XRectangle *)) XClipBox
-# define TkCreateRegion (TkRegion (*) ()) XCreateRegion
-# define TkDestroyRegion (int (*) (TkRegion)) XDestroyRegion
-# define TkIntersectRegion (int (*) (TkRegion, TkRegion, TkRegion)) XIntersectRegion
-# define TkRectInRegion (int (*) (TkRegion, int, int, unsigned int, unsigned int)) XRectInRegion
-# define TkSetRegion (int (*) (Display *, GC, TkRegion)) XSetRegion
-# define TkUnionRectWithRegion (int (*) (XRectangle *, TkRegion, TkRegion)) XUnionRectWithRegion
-# define TkSubtractRegion (int (*) (TkRegion, TkRegion, TkRegion)) XSubtractRegion
# endif
#endif /* !_WIN32 */
+#if defined(MAC_OSX_TCL)
+
+int
+TkPutImage(
+ unsigned long *colors, /* Array of pixel values used by this image.
+ * May be NULL. */
+ int ncolors, /* Number of colors used, or 0. */
+ Display *display,
+ Drawable d, /* Destination drawable. */
+ GC gc,
+ XImage *image, /* Source image. */
+ int src_x, int src_y, /* Offset of subimage. */
+ int dest_x, int dest_y, /* Position of subimage origin in drawable. */
+ unsigned int width, unsigned int height)
+ /* Dimensions of subimage. */
+{
+ (void)colors;
+ (void)ncolors;
+
+ return XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height);
+}
+#endif /* MAC_OSX_TCL */
+
+
/*
* WARNING: The contents of this file is automatically generated by the
* tools/genStubs.tcl script. Any modifications to the function declarations
@@ -403,13 +402,13 @@ static const TkIntStubs tkIntStubs = {
TkpGetSubFonts, /* 110 */
TkpGetSystemDefault, /* 111 */
TkpMenuThreadInit, /* 112 */
- TkClipBox, /* 113 */
- TkCreateRegion, /* 114 */
- TkDestroyRegion, /* 115 */
- TkIntersectRegion, /* 116 */
- TkRectInRegion, /* 117 */
- TkSetRegion, /* 118 */
- TkUnionRectWithRegion, /* 119 */
+ XClipBox, /* 113 */
+ XCreateRegion, /* 114 */
+ XDestroyRegion, /* 115 */
+ XIntersectRegion, /* 116 */
+ XRectInRegion, /* 117 */
+ XSetRegion, /* 118 */
+ XUnionRectWithRegion, /* 119 */
0, /* 120 */
#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
0, /* 121 */
@@ -462,7 +461,7 @@ static const TkIntStubs tkIntStubs = {
TkFocusFree, /* 142 */
TkClipCleanup, /* 143 */
TkGCCleanup, /* 144 */
- TkSubtractRegion, /* 145 */
+ XSubtractRegion, /* 145 */
TkStylePkgInit, /* 146 */
TkStylePkgFree, /* 147 */
TkToplevelWindowForCommand, /* 148 */
@@ -520,6 +519,7 @@ static const TkIntStubs tkIntStubs = {
#ifdef MAC_OSX_TCL /* MACOSX */
TkpWillDrawWidget, /* 186 */
#endif /* MACOSX */
+ TkDebugPhotoStringMatchDef, /* 187 */
};
static const TkIntPlatStubs tkIntPlatStubs = {
@@ -587,7 +587,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
TkMacOSXButtonKeyState, /* 8 */
TkMacOSXClearMenubarActive, /* 9 */
TkMacOSXDispatchMenuEvent, /* 10 */
- TkMacOSXInstallCursor, /* 11 */
+ 0, /* 11 */
TkMacOSXHandleTearoffMenu, /* 12 */
0, /* 13 */
TkMacOSXDoHLEvent, /* 14 */
@@ -623,9 +623,9 @@ static const TkIntPlatStubs tkIntPlatStubs = {
TkMacOSXGetHostToplevel, /* 44 */
TkMacOSXPreprocessMenu, /* 45 */
TkpIsWindowFloating, /* 46 */
- TkMacOSXGetCapture, /* 47 */
+ TkpGetCapture, /* 47 */
0, /* 48 */
- TkGetTransientMaster, /* 49 */
+ TkMacOSXGetContainer, /* 49 */
TkGenerateButtonEvent, /* 50 */
TkGenWMDestroyEvent, /* 51 */
TkMacOSXSetDrawingEnabled, /* 52 */
@@ -825,29 +825,29 @@ static const TkIntXlibStubs tkIntXlibStubs = {
XDrawPoints, /* 135 */
XReparentWindow, /* 136 */
XPutImage, /* 137 */
- 0, /* 138 */
- 0, /* 139 */
- 0, /* 140 */
- 0, /* 141 */
- 0, /* 142 */
- 0, /* 143 */
+ XPolygonRegion, /* 138 */
+ XPointInRegion, /* 139 */
+ XVaCreateNestedList, /* 140 */
+ XSetICValues, /* 141 */
+ XGetICValues, /* 142 */
+ XSetICFocus, /* 143 */
0, /* 144 */
0, /* 145 */
0, /* 146 */
- 0, /* 147 */
- 0, /* 148 */
- 0, /* 149 */
- 0, /* 150 */
- 0, /* 151 */
- 0, /* 152 */
- 0, /* 153 */
- 0, /* 154 */
- 0, /* 155 */
- 0, /* 156 */
- 0, /* 157 */
- TkUnusedStubEntry, /* 158 */
+ XFreeFontSet, /* 147 */
+ XCloseIM, /* 148 */
+ XRegisterIMInstantiateCallback, /* 149 */
+ XUnregisterIMInstantiateCallback, /* 150 */
+ XSetLocaleModifiers, /* 151 */
+ XOpenIM, /* 152 */
+ XGetIMValues, /* 153 */
+ XSetIMValues, /* 154 */
+ XCreateFontSet, /* 155 */
+ XFreeStringList, /* 156 */
+ XkbKeycodeToKeysym, /* 157 */
+ XkbOpenDisplay, /* 158 */
#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
+#ifdef MAC_OSX_TCL /* MACOSX */
XSetDashes, /* 0 */
XGetModifierMapping, /* 1 */
XCreateImage, /* 2 */
@@ -940,20 +940,20 @@ static const TkIntXlibStubs tkIntXlibStubs = {
XQueryColors, /* 89 */
XQueryTree, /* 90 */
XSync, /* 91 */
- 0, /* 92 */
- 0, /* 93 */
- 0, /* 94 */
- 0, /* 95 */
- 0, /* 96 */
- 0, /* 97 */
- 0, /* 98 */
- 0, /* 99 */
- 0, /* 100 */
- 0, /* 101 */
- 0, /* 102 */
- 0, /* 103 */
- 0, /* 104 */
- 0, /* 105 */
+ XTranslateCoordinates, /* 92 */
+ XDeleteProperty, /* 93 */
+ XFreeCursor, /* 94 */
+ XGetInputFocus, /* 95 */
+ XmbLookupString, /* 96 */
+ XNextEvent, /* 97 */
+ XPutBackEvent, /* 98 */
+ XSetCommand, /* 99 */
+ XWindowEvent, /* 100 */
+ XGetWindowAttributes, /* 101 */
+ XGetWMColormapWindows, /* 102 */
+ XIconifyWindow, /* 103 */
+ XWithdrawWindow, /* 104 */
+ XListHosts, /* 105 */
XSetClipRectangles, /* 106 */
XFlush, /* 107 */
XGrabServer, /* 108 */
@@ -961,7 +961,7 @@ static const TkIntXlibStubs tkIntXlibStubs = {
XFree, /* 110 */
XNoOp, /* 111 */
XSynchronize, /* 112 */
- 0, /* 113 */
+ XLookupColor, /* 113 */
XVisualIDFromVisual, /* 114 */
0, /* 115 */
0, /* 116 */
@@ -969,8 +969,8 @@ static const TkIntXlibStubs tkIntXlibStubs = {
0, /* 118 */
0, /* 119 */
XOffsetRegion, /* 120 */
- 0, /* 121 */
- 0, /* 122 */
+ XUnionRegion, /* 121 */
+ XCreateWindow, /* 122 */
0, /* 123 */
0, /* 124 */
0, /* 125 */
@@ -978,36 +978,36 @@ static const TkIntXlibStubs tkIntXlibStubs = {
0, /* 127 */
0, /* 128 */
XLowerWindow, /* 129 */
- 0, /* 130 */
- 0, /* 131 */
- 0, /* 132 */
+ XFillArcs, /* 130 */
+ XDrawArcs, /* 131 */
+ XDrawRectangles, /* 132 */
0, /* 133 */
0, /* 134 */
0, /* 135 */
- 0, /* 136 */
+ XReparentWindow, /* 136 */
XPutImage, /* 137 */
- 0, /* 138 */
- 0, /* 139 */
- 0, /* 140 */
- 0, /* 141 */
- 0, /* 142 */
- 0, /* 143 */
+ XPolygonRegion, /* 138 */
+ XPointInRegion, /* 139 */
+ XVaCreateNestedList, /* 140 */
+ XSetICValues, /* 141 */
+ XGetICValues, /* 142 */
+ XSetICFocus, /* 143 */
XDestroyIC, /* 144 */
XCreatePixmapCursor, /* 145 */
XCreateGlyphCursor, /* 146 */
- 0, /* 147 */
- 0, /* 148 */
- 0, /* 149 */
- 0, /* 150 */
- 0, /* 151 */
- 0, /* 152 */
- 0, /* 153 */
- 0, /* 154 */
- 0, /* 155 */
- 0, /* 156 */
+ XFreeFontSet, /* 147 */
+ XCloseIM, /* 148 */
+ XRegisterIMInstantiateCallback, /* 149 */
+ XUnregisterIMInstantiateCallback, /* 150 */
+ XSetLocaleModifiers, /* 151 */
+ XOpenIM, /* 152 */
+ XGetIMValues, /* 153 */
+ XSetIMValues, /* 154 */
+ XCreateFontSet, /* 155 */
+ XFreeStringList, /* 156 */
XkbKeycodeToKeysym, /* 157 */
- TkUnusedStubEntry, /* 158 */
-#endif /* AQUA */
+ XkbOpenDisplay, /* 158 */
+#endif /* MACOSX */
};
static const TkPlatStubs tkPlatStubs = {
@@ -1022,14 +1022,14 @@ static const TkPlatStubs tkPlatStubs = {
Tk_TranslateWinEvent, /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- Tk_MacOSXSetEmbedHandler, /* 0 */
- Tk_MacOSXTurnOffMenus, /* 1 */
- Tk_MacOSXTkOwnsCursor, /* 2 */
- TkMacOSXInitMenus, /* 3 */
+ 0, /* 0 */
+ 0, /* 1 */
+ 0, /* 2 */
+ 0, /* 3 */
TkMacOSXInitAppleEvents, /* 4 */
- TkGenWMConfigureEvent, /* 5 */
+ TkGenWMConfigureEvent_, /* 5 */
TkMacOSXInvalClipRgns, /* 6 */
- TkMacOSXGetDrawablePort, /* 7 */
+ 0, /* 7 */
TkMacOSXGetRootControl, /* 8 */
Tk_MacOSXSetupTkNotifier, /* 9 */
Tk_MacOSXIsAppInFront, /* 10 */
@@ -1038,7 +1038,7 @@ static const TkPlatStubs tkPlatStubs = {
Tk_MacOSXGetNSWindowForDrawable, /* 13 */
0, /* 14 */
0, /* 15 */
- TkGenWMConfigureEvent_, /* 16 */
+ TkGenWMConfigureEvent, /* 16 */
#endif /* AQUA */
};
@@ -1150,7 +1150,7 @@ const TkStubs tkStubs = {
Tk_GetFontMetrics, /* 95 */
Tk_GetGC, /* 96 */
Tk_GetImage, /* 97 */
- Tk_GetImageMasterData, /* 98 */
+ Tk_GetImageModelData, /* 98 */
Tk_GetItemTypes, /* 99 */
Tk_GetJoinStyle, /* 100 */
Tk_GetJustify, /* 101 */
@@ -1326,13 +1326,26 @@ const TkStubs tkStubs = {
Tk_Interp, /* 271 */
Tk_CreateOldImageType, /* 272 */
Tk_CreateOldPhotoImageFormat, /* 273 */
- 0, /* 274 */
- 0, /* 275 */
- 0, /* 276 */
- 0, /* 277 */
- 0, /* 278 */
- 0, /* 279 */
- TkUnusedStubEntry, /* 280 */
+ Tk_AlwaysShowSelection, /* 274 */
+ Tk_GetButtonMask, /* 275 */
+ Tk_GetDoublePixelsFromObj, /* 276 */
+ Tk_NewWindowObj, /* 277 */
+ Tk_SendVirtualEvent, /* 278 */
+ Tk_FontGetDescription, /* 279 */
+ Tk_CreatePhotoImageFormatVersion3 /* 280 */
};
/* !END!: Do not edit above this line. */
+
+
+#ifdef __CYGWIN__
+void *Tk_GetHINSTANCE(void)
+{
+ void *hInstance = NULL;
+
+ GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ (const char *) &tkIntStubs, &hInstance);
+ return hInstance;
+}
+#endif
+
diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c
index 0400bfa..8b669db 100644
--- a/generic/tkStubLib.c
+++ b/generic/tkStubLib.c
@@ -4,8 +4,8 @@
* Stub object that will be statically linked into extensions that want
* to access Tk.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
- * Copyright (c) 1998 Paul Duffin.
+ * Copyright © 1998-1999 Scriptics Corporation.
+ * Copyright © 1998 Paul Duffin.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -75,15 +75,19 @@ Tk_InitStubs(
const char *version,
int exact)
{
- const char *packageName = "Tk";
+ const char *packageName = "tk";
const char *errMsg = NULL;
- ClientData clientData = NULL;
+ void *clientData = NULL;
const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp,
packageName, version, 0, &clientData);
- const TkStubs *stubsPtr = (const TkStubs *)clientData;
if (actualVersion == NULL) {
- return NULL;
+ packageName = "Tk";
+ actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp,
+ packageName, version, 0, &clientData);
+ if (actualVersion == NULL) {
+ return NULL;
+ }
}
if (exact) {
@@ -113,15 +117,15 @@ Tk_InitStubs(
}
}
}
- if (stubsPtr == NULL) {
+ if (clientData == NULL) {
errMsg = "missing stub table pointer";
} else {
- tkStubsPtr = stubsPtr;
- if (stubsPtr->hooks) {
- tkPlatStubsPtr = stubsPtr->hooks->tkPlatStubs;
- tkIntStubsPtr = stubsPtr->hooks->tkIntStubs;
- tkIntPlatStubsPtr = stubsPtr->hooks->tkIntPlatStubs;
- tkIntXlibStubsPtr = stubsPtr->hooks->tkIntXlibStubs;
+ tkStubsPtr = (const TkStubs *)clientData;
+ if (tkStubsPtr->hooks) {
+ tkPlatStubsPtr = tkStubsPtr->hooks->tkPlatStubs;
+ tkIntStubsPtr = tkStubsPtr->hooks->tkIntStubs;
+ tkIntPlatStubsPtr = tkStubsPtr->hooks->tkIntPlatStubs;
+ tkIntXlibStubsPtr = tkStubsPtr->hooks->tkIntXlibStubs;
} else {
tkPlatStubsPtr = NULL;
tkIntStubsPtr = NULL;
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index 14bae66..418f74f 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -3,8 +3,8 @@
*
* This file implements the widget styles and themes support.
*
- * Copyright (c) 1990-1993 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1993 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -155,7 +155,7 @@ static const Tcl_ObjType styleObjType = {
FreeStyleObjProc, /* freeIntRepProc */
DupStyleObjProc, /* dupIntRepProc */
NULL, /* updateStringProc */
- SetStyleFromAny /* setFromAnyProc */
+ NULL /* setFromAnyProc */
};
/*
@@ -1076,7 +1076,7 @@ Tk_GetElementSize(
Tk_Style style, /* The widget style. */
Tk_StyledElement element, /* The styled element, previously returned by
* Tk_GetStyledElement. */
- char *recordPtr, /* The widget record. */
+ void *recordPtr, /* The widget record. */
Tk_Window tkwin, /* The widget window. */
int width, int height, /* Requested size. */
int inner, /* If TRUE, compute the outer size according
@@ -1090,7 +1090,7 @@ Tk_GetElementSize(
StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element;
widgetSpecPtr->elementPtr->specPtr->getSize(stylePtr->clientData,
- recordPtr, widgetSpecPtr->optionsPtr, tkwin, width, height, inner,
+ (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin, width, height, inner,
widthPtr, heightPtr);
}
@@ -1117,7 +1117,7 @@ Tk_GetElementBox(
Tk_Style style, /* The widget style. */
Tk_StyledElement element, /* The styled element, previously returned by
* Tk_GetStyledElement. */
- char *recordPtr, /* The widget record. */
+ void *recordPtr, /* The widget record. */
Tk_Window tkwin, /* The widget window. */
int x, int y, /* Top left corner of available area. */
int width, int height, /* Size of available area. */
@@ -1133,7 +1133,7 @@ Tk_GetElementBox(
StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element;
widgetSpecPtr->elementPtr->specPtr->getBox(stylePtr->clientData,
- recordPtr, widgetSpecPtr->optionsPtr, tkwin, x, y, width, height,
+ (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin, x, y, width, height,
inner, xPtr, yPtr, widthPtr, heightPtr);
}
@@ -1159,14 +1159,14 @@ Tk_GetElementBorderWidth(
Tk_Style style, /* The widget style. */
Tk_StyledElement element, /* The styled element, previously returned by
* Tk_GetStyledElement. */
- char *recordPtr, /* The widget record. */
+ void *recordPtr, /* The widget record. */
Tk_Window tkwin) /* The widget window. */
{
Style *stylePtr = (Style *) style;
StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element;
return widgetSpecPtr->elementPtr->specPtr->getBorderWidth(
- stylePtr->clientData, recordPtr, widgetSpecPtr->optionsPtr, tkwin);
+ stylePtr->clientData, (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin);
}
/*
@@ -1190,7 +1190,7 @@ Tk_DrawElement(
Tk_Style style, /* The widget style. */
Tk_StyledElement element, /* The styled element, previously returned by
* Tk_GetStyledElement. */
- char *recordPtr, /* The widget record. */
+ void *recordPtr, /* The widget record. */
Tk_Window tkwin, /* The widget window. */
Drawable d, /* Where to draw element. */
int x, int y, /* Top left corner of element. */
@@ -1201,7 +1201,7 @@ Tk_DrawElement(
StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element;
widgetSpecPtr->elementPtr->specPtr->draw(stylePtr->clientData,
- recordPtr, widgetSpecPtr->optionsPtr, tkwin, d, x, y, width,
+ (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin, d, x, y, width,
height, state);
}
@@ -1403,57 +1403,14 @@ Tk_AllocStyleFromObj(
* retrieve. */
{
if (objPtr->typePtr != &styleObjType) {
- SetStyleFromAny(interp, objPtr);
- }
- return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_GetStyleFromObj --
- *
- * Find the style that corresponds to a given object. The style must have
- * already been created by Tk_CreateStyle.
- *
- * Results:
- * The return value is a token for the style that matches objPtr, or NULL
- * if none found.
- *
- * Side effects:
- * If the object is not already a style ref, the conversion will free any
- * old internal representation.
- *
- *----------------------------------------------------------------------
- */
-
-Tk_Style
-Tk_GetStyleFromObj(
- Tcl_Obj *objPtr) /* The object from which to get the style. */
-{
- if (objPtr->typePtr != &styleObjType) {
- SetStyleFromAny(NULL, objPtr);
+ if (SetStyleFromAny(interp, objPtr) != TCL_OK) {
+ return NULL;
+ }
}
-
return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1;
}
/*
- *---------------------------------------------------------------------------
- *
- * Tk_FreeStyleFromObj --
- *
- * No-op. Present only for stubs compatibility.
- *
- *---------------------------------------------------------------------------
- */
-void
-Tk_FreeStyleFromObj(
- TCL_UNUSED(Tcl_Obj *))
-{
-}
-
-/*
*----------------------------------------------------------------------
*
* SetStyleFromAny --
@@ -1462,8 +1419,8 @@ Tk_FreeStyleFromObj(
* internal form.
*
* Results:
- * Always returns TCL_OK. If an error occurs is returned (e.g. the style
- * doesn't exist), an error message will be left in interp's result.
+ * If an error occurs is returned (e.g. the style doesn't exist), an
+ * error message will be left in interp's result and TCL_ERROR is returned.
*
* Side effects:
* The object is left with its typePtr pointing to styleObjType.
@@ -1478,6 +1435,7 @@ SetStyleFromAny(
{
const Tcl_ObjType *typePtr;
const char *name;
+ Tk_Style style;
/*
* Free the old internalRep before setting the new one.
@@ -1489,8 +1447,12 @@ SetStyleFromAny(
typePtr->freeIntRepProc(objPtr);
}
+ style = Tk_GetStyle(interp, name);
+ if (style == NULL) {
+ return TCL_ERROR;
+ }
objPtr->typePtr = &styleObjType;
- objPtr->internalRep.twoPtrValue.ptr1 = Tk_GetStyle(interp, name);
+ objPtr->internalRep.twoPtrValue.ptr1 = style;
return TCL_OK;
}
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 1fa821c..f89a946 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -6,9 +6,9 @@
* commands are not normally included in Tcl applications; they're only
* used for testing.
*
- * Copyright (c) 1993-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1993-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -48,7 +48,14 @@
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
+#ifdef __cplusplus
+extern "C" {
+#endif
EXTERN int Tktest_Init(Tcl_Interp *interp);
+#ifdef __cplusplus
+}
+#endif
+
/*
* The following data structure represents the model for a test image:
*/
@@ -181,22 +188,16 @@ static int TestmetricsObjCmd(ClientData dummy,
static int TestobjconfigObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
-static int CustomOptionSet(ClientData clientData,
- Tcl_Interp *interp, Tk_Window tkwin,
- Tcl_Obj **value, char *recordPtr,
- int internalOffset, char *saveInternalPtr,
- int flags);
-static Tcl_Obj * CustomOptionGet(ClientData clientData,
- Tk_Window tkwin, char *recordPtr,
- int internalOffset);
-static void CustomOptionRestore(ClientData clientData,
- Tk_Window tkwin, char *internalPtr,
- char *saveInternalPtr);
-static void CustomOptionFree(ClientData clientData,
- Tk_Window tkwin, char *internalPtr);
+static Tk_CustomOptionSetProc CustomOptionSet;
+static Tk_CustomOptionGetProc CustomOptionGet;
+static Tk_CustomOptionRestoreProc CustomOptionRestore;
+static Tk_CustomOptionFreeProc CustomOptionFree;
static int TestpropObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
+static int TestprintfObjCmd(ClientData dummy,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * const objv[]);
#if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__))
static int TestwrapperObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
@@ -208,6 +209,9 @@ static int TrivialConfigObjCmd(ClientData dummy,
Tcl_Obj * const objv[]);
static void TrivialEventProc(ClientData clientData,
XEvent *eventPtr);
+static int TestPhotoStringMatchCmd(ClientData dummy,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * const objv[]);
/*
*----------------------------------------------------------------------
@@ -232,7 +236,7 @@ Tktest_Init(
{
static int initialized = 0;
- if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
return TCL_ERROR;
}
if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) {
@@ -243,7 +247,7 @@ Tktest_Init(
* Create additional commands for testing Tk.
*/
- if (Tcl_PkgProvideEx(interp, "Tktest", TK_PATCH_LEVEL, NULL) == TCL_ERROR) {
+ if (Tcl_PkgProvideEx(interp, "tk::test", TK_PATCH_LEVEL, NULL) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -268,8 +272,12 @@ Tktest_Init(
(ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testprop", TestpropObjCmd,
(ClientData) Tk_MainWindow(interp), NULL);
+ Tcl_CreateObjCommand(interp, "testprintf", TestprintfObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testtext", TkpTesttextCmd,
(ClientData) Tk_MainWindow(interp), NULL);
+ Tcl_CreateObjCommand(interp, "testphotostringmatch",
+ TestPhotoStringMatchCmd, (ClientData) Tk_MainWindow(interp),
+ NULL);
#if defined(_WIN32)
Tcl_CreateObjCommand(interp, "testmetrics", TestmetricsObjCmd,
@@ -331,7 +339,6 @@ TestbitmapObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "bitmap");
return TCL_ERROR;
@@ -365,7 +372,6 @@ TestborderObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "border");
return TCL_ERROR;
@@ -523,7 +529,7 @@ TestobjconfigObjCmd(
CustomOptionFree,
INT2PTR(1)
};
- Tk_Window mainWin = (Tk_Window) clientData;
+ Tk_Window mainWin = (Tk_Window)clientData;
Tk_Window tkwin;
int index, result = TCL_OK;
@@ -532,7 +538,7 @@ TestobjconfigObjCmd(
* "chain2" subcommand:
*/
- typedef struct ExtensionWidgetRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *base1ObjPtr;
Tcl_Obj *base2ObjPtr;
@@ -542,9 +548,9 @@ TestobjconfigObjCmd(
} ExtensionWidgetRecord;
static const Tk_OptionSpec baseSpecs[] = {
{TK_OPTION_STRING, "-one", "one", "One", "one",
- Tk_Offset(ExtensionWidgetRecord, base1ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, base1ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-two", "two", "Two", "two",
- Tk_Offset(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, base2ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
@@ -560,7 +566,7 @@ TestobjconfigObjCmd(
switch (index) {
case ALL_TYPES: {
- typedef struct TypesRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *booleanPtr;
Tcl_Obj *integerPtr;
@@ -586,57 +592,57 @@ TestobjconfigObjCmd(
};
static const Tk_OptionSpec typesSpecs[] = {
{TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1",
- Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1},
+ offsetof(TypesRecord, booleanPtr), TCL_INDEX_NONE, 0, 0, 0x1},
{TK_OPTION_INT, "-integer", "integer", "Integer", "7",
- Tk_Offset(TypesRecord, integerPtr), -1, 0, 0, 0x2},
+ offsetof(TypesRecord, integerPtr), TCL_INDEX_NONE, 0, 0, 0x2},
{TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159",
- Tk_Offset(TypesRecord, doublePtr), -1, 0, 0, 0x4},
+ offsetof(TypesRecord, doublePtr), TCL_INDEX_NONE, 0, 0, 0x4},
{TK_OPTION_STRING, "-string", "string", "String",
- "foo", Tk_Offset(TypesRecord, stringPtr), -1,
+ "foo", offsetof(TypesRecord, stringPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x8},
{TK_OPTION_STRING_TABLE,
"-stringtable", "StringTable", "stringTable",
- "one", Tk_Offset(TypesRecord, stringTablePtr), -1,
+ "one", offsetof(TypesRecord, stringTablePtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, stringTable, 0x10},
{TK_OPTION_COLOR, "-color", "color", "Color",
- "red", Tk_Offset(TypesRecord, colorPtr), -1,
+ "red", offsetof(TypesRecord, colorPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, "black", 0x20},
{TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12",
- Tk_Offset(TypesRecord, fontPtr), -1,
+ offsetof(TypesRecord, fontPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x40},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50",
- Tk_Offset(TypesRecord, bitmapPtr), -1,
+ offsetof(TypesRecord, bitmapPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x80},
{TK_OPTION_BORDER, "-border", "border", "Border",
- "blue", Tk_Offset(TypesRecord, borderPtr), -1,
+ "blue", offsetof(TypesRecord, borderPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, "white", 0x100},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised",
- Tk_Offset(TypesRecord, reliefPtr), -1,
+ offsetof(TypesRecord, reliefPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x200},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm",
- Tk_Offset(TypesRecord, cursorPtr), -1,
+ offsetof(TypesRecord, cursorPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x400},
{TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left",
- Tk_Offset(TypesRecord, justifyPtr), -1,
+ offsetof(TypesRecord, justifyPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x800},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL,
- Tk_Offset(TypesRecord, anchorPtr), -1,
+ offsetof(TypesRecord, anchorPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x1000},
{TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel",
- "1", Tk_Offset(TypesRecord, pixelPtr), -1,
+ "1", offsetof(TypesRecord, pixelPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x2000},
{TK_OPTION_CUSTOM, "-custom", NULL, NULL,
- "", Tk_Offset(TypesRecord, customPtr), -1,
+ "", offsetof(TypesRecord, customPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, &CustomOption, 0x4000},
{TK_OPTION_SYNONYM, "-synonym", NULL, NULL,
- NULL, 0, -1, 0, "-color", 0x8000},
+ NULL, 0, TCL_INDEX_NONE, 0, "-color", 0x8000},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
optionTable = Tk_CreateOptionTable(interp, typesSpecs);
tables[index] = optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
@@ -663,7 +669,7 @@ TestobjconfigObjCmd(
recordPtr->mmPtr = NULL;
recordPtr->stringTablePtr = NULL;
recordPtr->customPtr = NULL;
- result = Tk_InitOptions(interp, (char *) recordPtr, optionTable,
+ result = Tk_InitOptions(interp, recordPtr, optionTable,
tkwin);
if (result == TCL_OK) {
recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
@@ -671,7 +677,7 @@ TestobjconfigObjCmd(
(ClientData) recordPtr, TrivialCmdDeletedProc);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
TrivialEventProc, (ClientData) recordPtr);
- result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
+ result = Tk_SetOptions(interp, recordPtr, optionTable,
objc-3, objv+3, tkwin, NULL, NULL);
if (result != TCL_OK) {
Tk_DestroyWindow(tkwin);
@@ -690,7 +696,7 @@ TestobjconfigObjCmd(
ExtensionWidgetRecord *recordPtr;
Tk_OptionTable optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
@@ -705,12 +711,12 @@ TestobjconfigObjCmd(
recordPtr->header.tkwin = tkwin;
recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL;
recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL;
- result = Tk_InitOptions(interp, (char *)recordPtr, optionTable, tkwin);
+ result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin);
if (result == TCL_OK) {
- result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
+ result = Tk_SetOptions(interp, recordPtr, optionTable,
objc-3, objv+3, tkwin, NULL, NULL);
if (result != TCL_OK) {
- Tk_FreeConfigOptions((char *) recordPtr, optionTable, tkwin);
+ Tk_FreeConfigOptions(recordPtr, optionTable, tkwin);
}
}
if (result == TCL_OK) {
@@ -729,20 +735,20 @@ TestobjconfigObjCmd(
ExtensionWidgetRecord *recordPtr;
static const Tk_OptionSpec extensionSpecs[] = {
{TK_OPTION_STRING, "-three", "three", "Three", "three",
- Tk_Offset(ExtensionWidgetRecord, extension3ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, extension3ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-four", "four", "Four", "four",
- Tk_Offset(ExtensionWidgetRecord, extension4ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, extension4ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-two", "two", "Two", "two and a half",
- Tk_Offset(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, base2ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING,
"-oneAgain", "oneAgain", "OneAgain", "one again",
- Tk_Offset(ExtensionWidgetRecord, extension5ObjPtr), -1, 0, NULL, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0,
+ offsetof(ExtensionWidgetRecord, extension5ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
(ClientData) baseSpecs, 0}
};
Tk_OptionTable optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
@@ -758,9 +764,9 @@ TestobjconfigObjCmd(
recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL;
recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL;
recordPtr->extension5ObjPtr = NULL;
- result = Tk_InitOptions(interp, (char *)recordPtr, optionTable, tkwin);
+ result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin);
if (result == TCL_OK) {
- result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
+ result = Tk_SetOptions(interp, recordPtr, optionTable,
objc-3, objv+3, tkwin, NULL, NULL);
if (result != TCL_OK) {
Tk_FreeConfigOptions((char *) recordPtr, optionTable, tkwin);
@@ -778,13 +784,13 @@ TestobjconfigObjCmd(
}
case CONFIG_ERROR: {
- typedef struct ErrorWidgetRecord {
+ typedef struct {
Tcl_Obj *intPtr;
} ErrorWidgetRecord;
ErrorWidgetRecord widgetRecord;
static const Tk_OptionSpec errorSpecs[] = {
{TK_OPTION_INT, "-int", "integer", "Integer", "bogus",
- Tk_Offset(ErrorWidgetRecord, intPtr), 0, 0, NULL, 0},
+ offsetof(ErrorWidgetRecord, intPtr), 0, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
@@ -792,7 +798,7 @@ TestobjconfigObjCmd(
widgetRecord.intPtr = NULL;
optionTable = Tk_CreateOptionTable(interp, errorSpecs);
tables[index] = optionTable;
- return Tk_InitOptions(interp, (char *) &widgetRecord, optionTable,
+ return Tk_InitOptions(interp, &widgetRecord, optionTable,
(Tk_Window) NULL);
}
@@ -832,7 +838,7 @@ TestobjconfigObjCmd(
* objects.
*/
- typedef struct InternalRecord {
+ typedef struct {
TrivialCommandHeader header;
int boolean;
int integer;
@@ -858,67 +864,67 @@ TestobjconfigObjCmd(
};
static const Tk_OptionSpec internalSpecs[] = {
{TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1",
- -1, Tk_Offset(InternalRecord, boolean), 0, 0, 0x1},
+ TCL_INDEX_NONE, offsetof(InternalRecord, boolean), 0, 0, 0x1},
{TK_OPTION_INT, "-integer", "integer", "Integer", "148962237",
- -1, Tk_Offset(InternalRecord, integer), 0, 0, 0x2},
+ TCL_INDEX_NONE, offsetof(InternalRecord, integer), 0, 0, 0x2},
{TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159",
- -1, Tk_Offset(InternalRecord, doubleValue), 0, 0, 0x4},
+ TCL_INDEX_NONE, offsetof(InternalRecord, doubleValue), 0, 0, 0x4},
{TK_OPTION_STRING, "-string", "string", "String", "foo",
- -1, Tk_Offset(InternalRecord, string),
+ TCL_INDEX_NONE, offsetof(InternalRecord, string),
TK_CONFIG_NULL_OK, 0, 0x8},
{TK_OPTION_STRING_TABLE,
"-stringtable", "StringTable", "stringTable", "one",
- -1, Tk_Offset(InternalRecord, index),
+ TCL_INDEX_NONE, offsetof(InternalRecord, index),
TK_CONFIG_NULL_OK, internalStringTable, 0x10},
{TK_OPTION_COLOR, "-color", "color", "Color", "red",
- -1, Tk_Offset(InternalRecord, colorPtr),
+ TCL_INDEX_NONE, offsetof(InternalRecord, colorPtr),
TK_CONFIG_NULL_OK, "black", 0x20},
{TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12",
- -1, Tk_Offset(InternalRecord, tkfont),
+ TCL_INDEX_NONE, offsetof(InternalRecord, tkfont),
TK_CONFIG_NULL_OK, 0, 0x40},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50",
- -1, Tk_Offset(InternalRecord, bitmap),
+ TCL_INDEX_NONE, offsetof(InternalRecord, bitmap),
TK_CONFIG_NULL_OK, 0, 0x80},
{TK_OPTION_BORDER, "-border", "border", "Border", "blue",
- -1, Tk_Offset(InternalRecord, border),
+ TCL_INDEX_NONE, offsetof(InternalRecord, border),
TK_CONFIG_NULL_OK, "white", 0x100},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised",
- -1, Tk_Offset(InternalRecord, relief),
+ TCL_INDEX_NONE, offsetof(InternalRecord, relief),
TK_CONFIG_NULL_OK, 0, 0x200},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm",
- -1, Tk_Offset(InternalRecord, cursor),
+ TCL_INDEX_NONE, offsetof(InternalRecord, cursor),
TK_CONFIG_NULL_OK, 0, 0x400},
{TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left",
- -1, Tk_Offset(InternalRecord, justify),
+ TCL_INDEX_NONE, offsetof(InternalRecord, justify),
TK_CONFIG_NULL_OK, 0, 0x800},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL,
- -1, Tk_Offset(InternalRecord, anchor),
+ TCL_INDEX_NONE, offsetof(InternalRecord, anchor),
TK_CONFIG_NULL_OK, 0, 0x1000},
{TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1",
- -1, Tk_Offset(InternalRecord, pixels),
+ TCL_INDEX_NONE, offsetof(InternalRecord, pixels),
TK_CONFIG_NULL_OK, 0, 0x2000},
{TK_OPTION_WINDOW, "-window", "window", "Window", NULL,
- -1, Tk_Offset(InternalRecord, tkwin),
+ TCL_INDEX_NONE, offsetof(InternalRecord, tkwin),
TK_CONFIG_NULL_OK, 0, 0},
{TK_OPTION_CUSTOM, "-custom", NULL, NULL, "",
- -1, Tk_Offset(InternalRecord, custom),
+ TCL_INDEX_NONE, offsetof(InternalRecord, custom),
TK_CONFIG_NULL_OK, &CustomOption, 0x4000},
{TK_OPTION_SYNONYM, "-synonym", NULL, NULL,
- NULL, -1, -1, 0, "-color", 0x8000},
+ NULL, TCL_INDEX_NONE, TCL_INDEX_NONE, 0, "-color", 0x8000},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
optionTable = Tk_CreateOptionTable(interp, internalSpecs);
tables[index] = optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
Tk_SetClass(tkwin, "Test");
- recordPtr = ckalloc(sizeof(InternalRecord));
+ recordPtr = (InternalRecord *)ckalloc(sizeof(InternalRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -939,7 +945,7 @@ TestobjconfigObjCmd(
recordPtr->mm = 0.0;
recordPtr->tkwin = NULL;
recordPtr->custom = NULL;
- result = Tk_InitOptions(interp, (char *) recordPtr, optionTable,
+ result = Tk_InitOptions(interp, recordPtr, optionTable,
tkwin);
if (result == TCL_OK) {
recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
@@ -947,7 +953,7 @@ TestobjconfigObjCmd(
recordPtr, TrivialCmdDeletedProc);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
TrivialEventProc, recordPtr);
- result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
+ result = Tk_SetOptions(interp, recordPtr, optionTable,
objc - 3, objv + 3, tkwin, NULL, NULL);
if (result != TCL_OK) {
Tk_DestroyWindow(tkwin);
@@ -963,7 +969,7 @@ TestobjconfigObjCmd(
}
case NEW: {
- typedef struct FiveRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *one;
Tcl_Obj *two;
@@ -974,15 +980,15 @@ TestobjconfigObjCmd(
FiveRecord *recordPtr;
static const Tk_OptionSpec smallSpecs[] = {
{TK_OPTION_INT, "-one", "one", "One", "1",
- Tk_Offset(FiveRecord, one), -1, 0, NULL, 0},
+ offsetof(FiveRecord, one), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_INT, "-two", "two", "Two", "2",
- Tk_Offset(FiveRecord, two), -1, 0, NULL, 0},
+ offsetof(FiveRecord, two), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_INT, "-three", "three", "Three", "3",
- Tk_Offset(FiveRecord, three), -1, 0, NULL, 0},
+ offsetof(FiveRecord, three), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_INT, "-four", "four", "Four", "4",
- Tk_Offset(FiveRecord, four), -1, 0, NULL, 0},
+ offsetof(FiveRecord, four), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-five", NULL, NULL, NULL,
- Tk_Offset(FiveRecord, five), -1, 0, NULL, 0},
+ offsetof(FiveRecord, five), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
@@ -991,7 +997,7 @@ TestobjconfigObjCmd(
return TCL_ERROR;
}
- recordPtr = ckalloc(sizeof(FiveRecord));
+ recordPtr = (FiveRecord *)ckalloc(sizeof(FiveRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
smallSpecs);
@@ -1000,10 +1006,10 @@ TestobjconfigObjCmd(
recordPtr->one = recordPtr->two = recordPtr->three = NULL;
recordPtr->four = recordPtr->five = NULL;
Tcl_SetObjResult(interp, objv[2]);
- result = Tk_InitOptions(interp, (char *) recordPtr,
+ result = Tk_InitOptions(interp, recordPtr,
recordPtr->header.optionTable, (Tk_Window) NULL);
if (result == TCL_OK) {
- result = Tk_SetOptions(interp, (char *) recordPtr,
+ result = Tk_SetOptions(interp, recordPtr,
recordPtr->header.optionTable, objc - 3, objv + 3,
(Tk_Window) NULL, NULL, NULL);
if (result == TCL_OK) {
@@ -1011,7 +1017,7 @@ TestobjconfigObjCmd(
Tcl_GetString(objv[2]), TrivialConfigObjCmd,
(ClientData) recordPtr, TrivialCmdDeletedProc);
} else {
- Tk_FreeConfigOptions((char *) recordPtr,
+ Tk_FreeConfigOptions(recordPtr,
recordPtr->header.optionTable, (Tk_Window) NULL);
}
}
@@ -1022,13 +1028,13 @@ TestobjconfigObjCmd(
break;
}
case NOT_ENOUGH_PARAMS: {
- typedef struct NotEnoughRecord {
+ typedef struct {
Tcl_Obj *fooObjPtr;
} NotEnoughRecord;
NotEnoughRecord record;
static const Tk_OptionSpec errorSpecs[] = {
{TK_OPTION_INT, "-foo", "foo", "Foo", "0",
- Tk_Offset(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0},
+ offsetof(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tcl_Obj *newObjPtr = Tcl_NewStringObj("-foo", -1);
@@ -1040,8 +1046,8 @@ TestobjconfigObjCmd(
Tk_SetClass(tkwin, "Config");
optionTable = Tk_CreateOptionTable(interp, errorSpecs);
tables[index] = optionTable;
- Tk_InitOptions(interp, (char *) &record, optionTable, tkwin);
- if (Tk_SetOptions(interp, (char *) &record, optionTable, 1,
+ Tk_InitOptions(interp, &record, optionTable, tkwin);
+ if (Tk_SetOptions(interp, &record, optionTable, 1,
&newObjPtr, tkwin, NULL, NULL) != TCL_OK) {
result = TCL_ERROR;
}
@@ -1052,18 +1058,18 @@ TestobjconfigObjCmd(
}
case TWO_WINDOWS: {
- typedef struct ContentRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *windowPtr;
} ContentRecord;
ContentRecord *recordPtr;
static const Tk_OptionSpec contentSpecs[] = {
{TK_OPTION_WINDOW, "-window", "window", "Window", ".bar",
- Tk_Offset(ContentRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0},
+ offsetof(ContentRecord, windowPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
tkwin = Tk_CreateWindowFromPath(interp,
- (Tk_Window) clientData, Tcl_GetString(objv[2]), NULL);
+ (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
@@ -1078,10 +1084,10 @@ TestobjconfigObjCmd(
recordPtr->header.tkwin = tkwin;
recordPtr->windowPtr = NULL;
- result = Tk_InitOptions(interp, (char *) recordPtr,
+ result = Tk_InitOptions(interp, recordPtr,
recordPtr->header.optionTable, tkwin);
if (result == TCL_OK) {
- result = Tk_SetOptions(interp, (char *) recordPtr,
+ result = Tk_SetOptions(interp, recordPtr,
recordPtr->header.optionTable, objc - 3, objv + 3,
tkwin, NULL, NULL);
if (result == TCL_OK) {
@@ -1092,7 +1098,7 @@ TestobjconfigObjCmd(
TrivialEventProc, recordPtr);
Tcl_SetObjResult(interp, objv[2]);
} else {
- Tk_FreeConfigOptions((char *) recordPtr,
+ Tk_FreeConfigOptions(recordPtr,
recordPtr->header.optionTable, tkwin);
}
}
@@ -1139,12 +1145,12 @@ TrivialConfigObjCmd(
};
Tcl_Obj *resultObjPtr;
int index, mask;
- TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData;
+ TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData;
Tk_Window tkwin = headerPtr->tkwin;
Tk_SavedOptions saved;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
@@ -1162,7 +1168,7 @@ TrivialConfigObjCmd(
result = TCL_ERROR;
goto done;
}
- resultObjPtr = Tk_GetOptionValue(interp, (char *) clientData,
+ resultObjPtr = Tk_GetOptionValue(interp, clientData,
headerPtr->optionTable, objv[2], tkwin);
if (resultObjPtr != NULL) {
Tcl_SetObjResult(interp, resultObjPtr);
@@ -1173,7 +1179,7 @@ TrivialConfigObjCmd(
break;
case CONFIGURE:
if (objc == 2) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) clientData,
+ resultObjPtr = Tk_GetOptionInfo(interp, clientData,
headerPtr->optionTable, NULL, tkwin);
if (resultObjPtr == NULL) {
result = TCL_ERROR;
@@ -1181,7 +1187,7 @@ TrivialConfigObjCmd(
Tcl_SetObjResult(interp, resultObjPtr);
}
} else if (objc == 3) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) clientData,
+ resultObjPtr = Tk_GetOptionInfo(interp, clientData,
headerPtr->optionTable, objv[2], tkwin);
if (resultObjPtr == NULL) {
result = TCL_ERROR;
@@ -1189,21 +1195,21 @@ TrivialConfigObjCmd(
Tcl_SetObjResult(interp, resultObjPtr);
}
} else {
- result = Tk_SetOptions(interp, (char *) clientData,
+ result = Tk_SetOptions(interp, clientData,
headerPtr->optionTable, objc - 2, objv + 2,
tkwin, NULL, &mask);
if (result == TCL_OK) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(mask));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(mask));
}
}
break;
case CSAVE:
- result = Tk_SetOptions(interp, (char *) clientData,
+ result = Tk_SetOptions(interp, clientData,
headerPtr->optionTable, objc - 2, objv + 2,
tkwin, &saved, &mask);
Tk_FreeSavedOptions(&saved);
if (result == TCL_OK) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(mask));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(mask));
}
break;
}
@@ -1246,7 +1252,7 @@ TrivialCmdDeletedProc(
* here.
*/
- Tk_FreeConfigOptions((char *)clientData,
+ Tk_FreeConfigOptions(clientData,
headerPtr->optionTable, NULL);
Tcl_EventuallyFree(clientData, TCL_DYNAMIC);
}
@@ -1277,7 +1283,7 @@ TrivialEventProc(
if (eventPtr->type == DestroyNotify) {
if (headerPtr->tkwin != NULL) {
- Tk_FreeConfigOptions((char *)clientData,
+ Tk_FreeConfigOptions(clientData,
headerPtr->optionTable, headerPtr->tkwin);
headerPtr->optionTable = NULL;
headerPtr->tkwin = NULL;
@@ -1901,6 +1907,56 @@ TestpropObjCmd(
return TCL_OK;
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * TestpropObjCmd --
+ *
+ * This function implements the "testprop" command. It fetches and prints
+ * the value of a property on a window.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TestprintfObjCmd(
+ ClientData dummy, /* Not used */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
+{
+ char buffer[256];
+ Tcl_WideInt wideInt;
+ long long longLongInt;
+ (void)dummy;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "wideint");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetWideIntFromObj(interp, objv[1], &wideInt) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ longLongInt = wideInt;
+
+ /* Just add a lot of arguments to sprintf. Reason: on AMD64, the first
+ * 4 or 6 arguments (we assume 8, just in case) might be put in registers,
+ * which still woudn't tell if the assumed size is correct: We want this
+ * test-case to fail if the 64-bit value is printed as truncated to 32-bit.
+ */
+ sprintf(buffer, "%s%s%s%s%s%s%s%s%" TCL_LL_MODIFIER "d %"
+ TCL_LL_MODIFIER "u", "", "", "", "", "", "", "", "",
+ longLongInt, (unsigned long long)longLongInt);
+ Tcl_AppendResult(interp, buffer, NULL);
+ return TCL_OK;
+}
+
#if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__))
/*
*----------------------------------------------------------------------
@@ -1984,7 +2040,7 @@ CustomOptionSet(
TCL_UNUSED(Tk_Window),
Tcl_Obj **value,
char *recordPtr,
- int internalOffset,
+ TkSizeT internalOffset,
char *saveInternalPtr,
int flags)
{
@@ -1993,7 +2049,7 @@ CustomOptionSet(
objEmpty = 0;
- if (internalOffset >= 0) {
+ if (internalOffset != TCL_INDEX_NONE) {
internalPtr = recordPtr + internalOffset;
} else {
internalPtr = NULL;
@@ -2043,32 +2099,86 @@ CustomOptionGet(
TCL_UNUSED(void *),
TCL_UNUSED(Tk_Window),
char *recordPtr,
- int internalOffset)
+ TkSizeT internalOffset)
{
return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), -1));
}
static void
CustomOptionRestore(
- ClientData clientData,
+ ClientData dummy,
Tk_Window tkwin,
char *internalPtr,
char *saveInternalPtr)
{
+ (void)dummy;
+ (void)tkwin;
+
*(char **)internalPtr = *(char **)saveInternalPtr;
return;
}
static void
CustomOptionFree(
- ClientData clientData,
+ ClientData dummy,
Tk_Window tkwin,
char *internalPtr)
{
+ (void)dummy;
+ (void)tkwin;
+
if (*(char **)internalPtr != NULL) {
ckfree(*(char **)internalPtr);
}
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * TestPhotoStringMatchCmd --
+ *
+ * This function implements the "testphotostringmatch" command. It
+ * provides a way from Tcl to call the string match function for the
+ * default image handler directly.
+ *
+ * Results:
+ * A standard Tcl result. If data is in the proper format, the result in
+ * interp will contain width and height as a list. If the data cannot be
+ * parsed as default image format, returns TCL_ERROR and leaves an
+ * appropriate error message in interp.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TestPhotoStringMatchCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
+{
+ Tcl_Obj *dummy = NULL;
+ Tcl_Obj *resultObj[2];
+ int width, height;
+ (void)clientData;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "imageData");
+ return TCL_ERROR;
+ }
+ if (TkDebugPhotoStringMatchDef(interp, objv[1], dummy, &width, &height)) {
+ resultObj[0] = Tcl_NewWideIntObj(width);
+ resultObj[1] = Tcl_NewWideIntObj(height);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, resultObj));
+ return TCL_OK;
+ } else {
+ return TCL_ERROR;
+ }
+}
+
+
/*
* Local Variables:
diff --git a/generic/tkText.c b/generic/tkText.c
index 90ec575..74f6730 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -6,9 +6,9 @@
* command interfaces to text widgets. The B-tree representation of text
* and its actual display are implemented elsewhere.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1996 Sun Microsystems, Inc.
- * Copyright (c) 1999 by Scriptics Corporation.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1996 Sun Microsystems, Inc.
+ * Copyright © 1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -96,11 +96,11 @@ static const char *const insertUnfocussedStrings[] = {
static int SetLineStartEnd(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
Tcl_Obj **value, char *recordPtr,
- int internalOffset, char *oldInternalPtr,
+ TkSizeT internalOffset, char *oldInternalPtr,
int flags);
static Tcl_Obj * GetLineStartEnd(ClientData clientData,
Tk_Window tkwin, char *recordPtr,
- int internalOffset);
+ TkSizeT internalOffset);
static void RestoreLineStartEnd(ClientData clientData,
Tk_Window tkwin, char *internalPtr,
char *oldInternalPtr);
@@ -121,139 +121,139 @@ static const Tk_ObjCustomOption lineOption = {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BOOLEAN, "-autoseparators", "autoSeparators",
- "AutoSeparators", DEF_TEXT_AUTO_SEPARATORS, -1,
- Tk_Offset(TkText, autoSeparators),
+ "AutoSeparators", DEF_TEXT_AUTO_SEPARATORS, TCL_INDEX_NONE,
+ offsetof(TkText, autoSeparators),
TK_OPTION_DONT_SET_DEFAULT, 0, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_TEXT_BG_COLOR, -1, Tk_Offset(TkText, border),
+ DEF_TEXT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkText, border),
0, DEF_TEXT_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, -1, 0, "-borderwidth",
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth",
TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, -1, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_BOOLEAN, "-blockcursor", "blockCursor",
- "BlockCursor", DEF_TEXT_BLOCK_CURSOR, -1,
- Tk_Offset(TkText, insertCursorType), 0, 0, 0},
+ "BlockCursor", DEF_TEXT_BLOCK_CURSOR, TCL_INDEX_NONE,
+ offsetof(TkText, insertCursorType), 0, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_TEXT_BORDER_WIDTH, -1, Tk_Offset(TkText, borderWidth),
+ DEF_TEXT_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(TkText, borderWidth),
0, 0, TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_TEXT_CURSOR, -1, Tk_Offset(TkText, cursor),
+ DEF_TEXT_CURSOR, TCL_INDEX_NONE, offsetof(TkText, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_CUSTOM, "-endline", NULL, NULL,
- NULL, -1, Tk_Offset(TkText, end), TK_OPTION_NULL_OK,
+ NULL, TCL_INDEX_NONE, offsetof(TkText, end), TK_OPTION_NULL_OK,
&lineOption, TK_TEXT_LINE_RANGE},
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
- "ExportSelection", DEF_TEXT_EXPORT_SELECTION, -1,
- Tk_Offset(TkText, exportSelection), 0, 0, 0},
+ "ExportSelection", DEF_TEXT_EXPORT_SELECTION, TCL_INDEX_NONE,
+ offsetof(TkText, exportSelection), 0, 0, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
- NULL, 0, -1, 0, "-foreground", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_TEXT_FONT, -1, Tk_Offset(TkText, tkfont), 0, 0,
+ DEF_TEXT_FONT, TCL_INDEX_NONE, offsetof(TkText, tkfont), 0, 0,
TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_TEXT_FG, -1, Tk_Offset(TkText, fgColor), 0,
+ DEF_TEXT_FG, TCL_INDEX_NONE, offsetof(TkText, fgColor), 0,
0, 0},
{TK_OPTION_PIXELS, "-height", "height", "Height",
- DEF_TEXT_HEIGHT, -1, Tk_Offset(TkText, height), 0, 0, 0},
+ DEF_TEXT_HEIGHT, TCL_INDEX_NONE, offsetof(TkText, height), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_TEXT_HIGHLIGHT_BG,
- -1, Tk_Offset(TkText, highlightBgColorPtr),
+ TCL_INDEX_NONE, offsetof(TkText, highlightBgColorPtr),
0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_TEXT_HIGHLIGHT, -1, Tk_Offset(TkText, highlightColorPtr),
+ DEF_TEXT_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkText, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_TEXT_HIGHLIGHT_WIDTH, -1,
- Tk_Offset(TkText, highlightWidth), 0, 0, TK_TEXT_LINE_GEOMETRY},
+ "HighlightThickness", DEF_TEXT_HIGHLIGHT_WIDTH, TCL_INDEX_NONE,
+ offsetof(TkText, highlightWidth), 0, 0, TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_BORDER, "-inactiveselectbackground","inactiveSelectBackground",
"Foreground",
DEF_TEXT_INACTIVE_SELECT_COLOR,
- -1, Tk_Offset(TkText, inactiveSelBorder),
+ TCL_INDEX_NONE, offsetof(TkText, inactiveSelBorder),
TK_OPTION_NULL_OK, DEF_TEXT_SELECT_MONO, 0},
{TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground",
DEF_TEXT_INSERT_BG,
- -1, Tk_Offset(TkText, insertBorder),
+ TCL_INDEX_NONE, offsetof(TkText, insertBorder),
0, 0, 0},
{TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
- "BorderWidth", DEF_TEXT_INSERT_BD_COLOR, -1,
- Tk_Offset(TkText, insertBorderWidth), 0,
+ "BorderWidth", DEF_TEXT_INSERT_BD_COLOR, TCL_INDEX_NONE,
+ offsetof(TkText, insertBorderWidth), 0,
(ClientData) DEF_TEXT_INSERT_BD_MONO, 0},
{TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime",
- DEF_TEXT_INSERT_OFF_TIME, -1, Tk_Offset(TkText, insertOffTime),
+ DEF_TEXT_INSERT_OFF_TIME, TCL_INDEX_NONE, offsetof(TkText, insertOffTime),
0, 0, 0},
{TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime",
- DEF_TEXT_INSERT_ON_TIME, -1, Tk_Offset(TkText, insertOnTime),
+ DEF_TEXT_INSERT_ON_TIME, TCL_INDEX_NONE, offsetof(TkText, insertOnTime),
0, 0, 0},
{TK_OPTION_STRING_TABLE,
"-insertunfocussed", "insertUnfocussed", "InsertUnfocussed",
- DEF_TEXT_INSERT_UNFOCUSSED, -1, Tk_Offset(TkText, insertUnfocussed),
+ DEF_TEXT_INSERT_UNFOCUSSED, TCL_INDEX_NONE, offsetof(TkText, insertUnfocussed),
0, insertUnfocussedStrings, 0},
{TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
- DEF_TEXT_INSERT_WIDTH, -1, Tk_Offset(TkText, insertWidth),
+ DEF_TEXT_INSERT_WIDTH, TCL_INDEX_NONE, offsetof(TkText, insertWidth),
0, 0, 0},
{TK_OPTION_INT, "-maxundo", "maxUndo", "MaxUndo",
- DEF_TEXT_MAX_UNDO, -1, Tk_Offset(TkText, maxUndo),
+ DEF_TEXT_MAX_UNDO, TCL_INDEX_NONE, offsetof(TkText, maxUndo),
TK_OPTION_DONT_SET_DEFAULT, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
- DEF_TEXT_PADX, -1, Tk_Offset(TkText, padX), 0, 0,
+ DEF_TEXT_PADX, TCL_INDEX_NONE, offsetof(TkText, padX), 0, 0,
TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_PIXELS, "-pady", "padY", "Pad",
- DEF_TEXT_PADY, -1, Tk_Offset(TkText, padY), 0, 0, 0},
+ DEF_TEXT_PADY, TCL_INDEX_NONE, offsetof(TkText, padY), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_TEXT_RELIEF, -1, Tk_Offset(TkText, relief), 0, 0, 0},
+ DEF_TEXT_RELIEF, TCL_INDEX_NONE, offsetof(TkText, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_TEXT_SELECT_COLOR, -1, Tk_Offset(TkText, selBorder),
+ DEF_TEXT_SELECT_COLOR, TCL_INDEX_NONE, offsetof(TkText, selBorder),
0, DEF_TEXT_SELECT_MONO, 0},
{TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth",
"BorderWidth", DEF_TEXT_SELECT_BD_COLOR,
- Tk_Offset(TkText, selBorderWidthPtr),
- Tk_Offset(TkText, selBorderWidth),
+ offsetof(TkText, selBorderWidthPtr),
+ offsetof(TkText, selBorderWidth),
TK_OPTION_NULL_OK, DEF_TEXT_SELECT_BD_MONO, 0},
{TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
- DEF_TEXT_SELECT_FG_COLOR, -1, Tk_Offset(TkText, selFgColorPtr),
+ DEF_TEXT_SELECT_FG_COLOR, TCL_INDEX_NONE, offsetof(TkText, selFgColorPtr),
TK_OPTION_NULL_OK, DEF_TEXT_SELECT_FG_MONO, 0},
{TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid",
- DEF_TEXT_SET_GRID, -1, Tk_Offset(TkText, setGrid), 0, 0, 0},
+ DEF_TEXT_SET_GRID, TCL_INDEX_NONE, offsetof(TkText, setGrid), 0, 0, 0},
{TK_OPTION_PIXELS, "-spacing1", "spacing1", "Spacing",
- DEF_TEXT_SPACING1, -1, Tk_Offset(TkText, spacing1),
+ DEF_TEXT_SPACING1, TCL_INDEX_NONE, offsetof(TkText, spacing1),
0, 0 , TK_TEXT_LINE_GEOMETRY },
{TK_OPTION_PIXELS, "-spacing2", "spacing2", "Spacing",
- DEF_TEXT_SPACING2, -1, Tk_Offset(TkText, spacing2),
+ DEF_TEXT_SPACING2, TCL_INDEX_NONE, offsetof(TkText, spacing2),
0, 0 , TK_TEXT_LINE_GEOMETRY },
{TK_OPTION_PIXELS, "-spacing3", "spacing3", "Spacing",
- DEF_TEXT_SPACING3, -1, Tk_Offset(TkText, spacing3),
+ DEF_TEXT_SPACING3, TCL_INDEX_NONE, offsetof(TkText, spacing3),
0, 0 , TK_TEXT_LINE_GEOMETRY },
{TK_OPTION_CUSTOM, "-startline", NULL, NULL,
- NULL, -1, Tk_Offset(TkText, start), TK_OPTION_NULL_OK,
+ NULL, TCL_INDEX_NONE, offsetof(TkText, start), TK_OPTION_NULL_OK,
&lineOption, TK_TEXT_LINE_RANGE},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_TEXT_STATE, -1, Tk_Offset(TkText, state),
+ DEF_TEXT_STATE, TCL_INDEX_NONE, offsetof(TkText, state),
0, stateStrings, 0},
{TK_OPTION_STRING, "-tabs", "tabs", "Tabs",
- DEF_TEXT_TABS, Tk_Offset(TkText, tabOptionPtr), -1,
+ DEF_TEXT_TABS, offsetof(TkText, tabOptionPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_STRING_TABLE, "-tabstyle", "tabStyle", "TabStyle",
- DEF_TEXT_TABSTYLE, -1, Tk_Offset(TkText, tabStyle),
+ DEF_TEXT_TABSTYLE, TCL_INDEX_NONE, offsetof(TkText, tabStyle),
0, tabStyleStrings, TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_TEXT_TAKE_FOCUS, -1, Tk_Offset(TkText, takeFocus),
+ DEF_TEXT_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(TkText, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-undo", "undo", "Undo",
- DEF_TEXT_UNDO, -1, Tk_Offset(TkText, undo),
+ DEF_TEXT_UNDO, TCL_INDEX_NONE, offsetof(TkText, undo),
TK_OPTION_DONT_SET_DEFAULT, 0 , 0},
{TK_OPTION_INT, "-width", "width", "Width",
- DEF_TEXT_WIDTH, -1, Tk_Offset(TkText, width), 0, 0,
+ DEF_TEXT_WIDTH, TCL_INDEX_NONE, offsetof(TkText, width), 0, 0,
TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_STRING_TABLE, "-wrap", "wrap", "Wrap",
- DEF_TEXT_WRAP, -1, Tk_Offset(TkText, wrapMode),
+ DEF_TEXT_WRAP, TCL_INDEX_NONE, offsetof(TkText, wrapMode),
0, wrapStrings, TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
- DEF_TEXT_XSCROLL_COMMAND, -1, Tk_Offset(TkText, xScrollCmd),
+ DEF_TEXT_XSCROLL_COMMAND, TCL_INDEX_NONE, offsetof(TkText, xScrollCmd),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand",
- DEF_TEXT_YSCROLL_COMMAND, -1, Tk_Offset(TkText, yScrollCmd),
+ DEF_TEXT_YSCROLL_COMMAND, TCL_INDEX_NONE, offsetof(TkText, yScrollCmd),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0}
};
@@ -279,10 +279,10 @@ typedef ClientData SearchAddLineProc(int lineNum,
typedef int SearchMatchProc(int lineNum,
struct SearchSpec *searchSpecPtr,
ClientData clientData, Tcl_Obj *theLine,
- int matchOffset, int matchLength);
+ TkSizeT matchOffset, TkSizeT matchLength);
typedef int SearchLineIndexProc(Tcl_Interp *interp,
Tcl_Obj *objPtr, struct SearchSpec *searchSpecPtr,
- int *linePosPtr, int *offsetPosPtr);
+ int *linePosPtr, TkSizeT *offsetPosPtr);
typedef struct SearchSpec {
int exact; /* Whether search is exact or regexp. */
@@ -298,10 +298,10 @@ typedef struct SearchSpec {
int all; /* Whether all or the first match should be
* reported. */
int startLine; /* First line to examine. */
- int startOffset; /* Index in first line to start at. */
+ TkSizeT startOffset; /* Index in first line to start at. */
int stopLine; /* Last line to examine, or -1 when we search
* all available text. */
- int stopOffset; /* Index to stop at, provided stopLine is not
+ TkSizeT stopOffset; /* Index to stop at, provided stopLine is not
* -1. */
int numLines; /* Total lines which are available. */
int backwards; /* Searching forwards or backwards. */
@@ -365,8 +365,8 @@ static int CreateWidget(TkSharedText *sharedPtr, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void TextEventProc(ClientData clientData,
XEvent *eventPtr);
-static int TextFetchSelection(ClientData clientData, int offset,
- char *buffer, int maxBytes);
+static TkSizeT TextFetchSelection(ClientData clientData, TkSizeT offset,
+ char *buffer, TkSizeT maxBytes);
static int TextIndexSortProc(const void *first,
const void *second);
static int TextInsertCmd(TkSharedText *sharedTextPtr,
@@ -410,8 +410,8 @@ static void TextPushUndoAction(TkText *textPtr,
Tcl_Obj *undoString, int insert,
const TkTextIndex *index1Ptr,
const TkTextIndex *index2Ptr);
-static int TextSearchIndexInLine(const SearchSpec *searchSpecPtr,
- TkTextLine *linePtr, int byteIndex);
+static TkSizeT TextSearchIndexInLine(const SearchSpec *searchSpecPtr,
+ TkTextLine *linePtr, TkSizeT byteIndex);
static int TextPeerCmd(TkText *textPtr, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static TkUndoProc TextUndoRedoCallback;
@@ -660,7 +660,7 @@ CreateWidget(
Tk_CreateSelHandler(textPtr->tkwin, XA_PRIMARY, XA_STRING,
TextFetchSelection, textPtr, XA_STRING);
- if (Tk_InitOptions(interp, (char *) textPtr, optionTable, textPtr->tkwin)
+ if (Tk_InitOptions(interp, textPtr, optionTable, textPtr->tkwin)
!= TCL_OK) {
Tk_DestroyWindow(textPtr->tkwin);
return TCL_ERROR;
@@ -670,7 +670,7 @@ CreateWidget(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(textPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(textPtr->tkwin));
return TCL_OK;
}
@@ -748,10 +748,10 @@ TextWidgetObjCmd(
NULL) == 0) {
Tcl_Obj *listObj = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(x));
- Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(y));
- Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(width));
- Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(height));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(x));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(y));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(width));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(height));
Tcl_SetObjResult(interp, listObj);
}
@@ -763,7 +763,7 @@ TextWidgetObjCmd(
result = TCL_ERROR;
goto done;
} else {
- Tcl_Obj *objPtr = Tk_GetOptionValue(interp, (char *) textPtr,
+ Tcl_Obj *objPtr = Tk_GetOptionValue(interp, textPtr,
textPtr->optionTable, objv[2], textPtr->tkwin);
if (objPtr == NULL) {
@@ -826,7 +826,7 @@ TextWidgetObjCmd(
}
case TEXT_CONFIGURE:
if (objc <= 3) {
- Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *) textPtr,
+ Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, textPtr,
textPtr->optionTable, ((objc == 3) ? objv[2] : NULL),
textPtr->tkwin);
@@ -864,7 +864,7 @@ TextWidgetObjCmd(
for (i = 2; i < objc-2; i++) {
int value;
- int length;
+ TkSizeT length;
const char *option = Tcl_GetStringFromObj(objv[i], &length);
char c;
@@ -1019,7 +1019,7 @@ TextWidgetObjCmd(
countDone:
found++;
if (found == 1) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value));
} else {
if (found == 2) {
/*
@@ -1031,7 +1031,7 @@ TextWidgetObjCmd(
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_GetObjResult(interp));
}
- Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewIntObj(value));
+ Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(value));
}
}
@@ -1043,7 +1043,7 @@ TextWidgetObjCmd(
int value = CountIndices(textPtr, indexFromPtr, indexToPtr,
COUNT_INDICES);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value));
} else if (found > 1) {
Tcl_SetObjResult(interp, objPtr);
}
@@ -1051,7 +1051,7 @@ TextWidgetObjCmd(
badOption:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad option \"%s\" must be -chars, -displaychars, "
+ "bad option \"%s\": must be -chars, -displaychars, "
"-displayindices, -displaylines, -indices, -lines, -update, "
"-xpixels, or -ypixels", Tcl_GetString(objv[i])));
Tcl_SetErrorCode(interp, "TK", "TEXT", "INDEX_OPTION", NULL);
@@ -1239,11 +1239,11 @@ TextWidgetObjCmd(
&base) == 0) {
Tcl_Obj *listObj = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(x));
- Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(y));
- Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(width));
- Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(height));
- Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(base));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(x));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(y));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(width));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(height));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(base));
Tcl_SetObjResult(interp, listObj);
}
@@ -1259,7 +1259,7 @@ TextWidgetObjCmd(
Tcl_Obj *objPtr = NULL;
int i, found = 0, visible = 0;
const char *name;
- int length;
+ TkSizeT length;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -1753,7 +1753,7 @@ TextPeerCmd(
while (tPtr != NULL) {
if (tPtr != textPtr) {
Tcl_ListObjAppendElement(NULL, peersObj,
- TkNewWindowObj(tPtr->tkwin));
+ Tk_NewWindowObj(tPtr->tkwin));
}
tPtr = tPtr->next;
}
@@ -2631,7 +2631,7 @@ InsertChars(
int viewUpdate) /* Update the view if set. */
{
int lineIndex;
- int length;
+ TkSizeT length;
TkText *tPtr;
int *lineAndByteIndex;
int resetViewCount;
@@ -2778,6 +2778,9 @@ TextPushUndoAction(
{
TkUndoSubAtom *iAtom, *dAtom;
int canUndo, canRedo;
+ char lMarkName[20] = "tk::undoMarkL";
+ char rMarkName[20] = "tk::undoMarkR";
+ char stringUndoMarkId[16] = "";
/*
* Create the helpers.
@@ -2788,6 +2791,10 @@ TextPushUndoAction(
Tcl_Obj *markSet2InsertObj = NULL;
Tcl_Obj *insertCmdObj = Tcl_NewObj();
Tcl_Obj *deleteCmdObj = Tcl_NewObj();
+ Tcl_Obj *markSetLUndoMarkCmdObj = Tcl_NewObj();
+ Tcl_Obj *markSetRUndoMarkCmdObj = NULL;
+ Tcl_Obj *markGravityLUndoMarkCmdObj = Tcl_NewObj();
+ Tcl_Obj *markGravityRUndoMarkCmdObj = NULL;
/*
* Get the index positions.
@@ -2837,6 +2844,40 @@ TextPushUndoAction(
Tcl_ListObjAppendElement(NULL, deleteCmdObj, index1Obj);
Tcl_ListObjAppendElement(NULL, deleteCmdObj, index2Obj);
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj,
+ Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1));
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj,
+ Tcl_NewStringObj("mark", 4));
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj,
+ Tcl_NewStringObj("set", 3));
+ markSetRUndoMarkCmdObj = Tcl_DuplicateObj(markSetLUndoMarkCmdObj);
+ textPtr->sharedTextPtr->undoMarkId++;
+ sprintf(stringUndoMarkId, "%d", textPtr->sharedTextPtr->undoMarkId);
+ strcat(lMarkName, stringUndoMarkId);
+ strcat(rMarkName, stringUndoMarkId);
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj,
+ Tcl_NewStringObj(lMarkName, -1));
+ Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj,
+ Tcl_NewStringObj(rMarkName, -1));
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, index1Obj);
+ Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj, index2Obj);
+
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1));
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj("mark", 4));
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj("gravity", 7));
+ markGravityRUndoMarkCmdObj = Tcl_DuplicateObj(markGravityLUndoMarkCmdObj);
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj(lMarkName, -1));
+ Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj,
+ Tcl_NewStringObj(rMarkName, -1));
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj("left", 4));
+ Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj,
+ Tcl_NewStringObj("right", 5));
+
/*
* Note: we don't wish to use textPtr->widgetCmd in these callbacks
* because if we delete the textPtr, but peers still exist, we will then
@@ -2854,11 +2895,19 @@ TextPushUndoAction(
insertCmdObj, NULL);
TkUndoMakeCmdSubAtom(NULL, markSet2InsertObj, iAtom);
TkUndoMakeCmdSubAtom(NULL, seeInsertObj, iAtom);
+ TkUndoMakeCmdSubAtom(NULL, markSetLUndoMarkCmdObj, iAtom);
+ TkUndoMakeCmdSubAtom(NULL, markSetRUndoMarkCmdObj, iAtom);
+ TkUndoMakeCmdSubAtom(NULL, markGravityLUndoMarkCmdObj, iAtom);
+ TkUndoMakeCmdSubAtom(NULL, markGravityRUndoMarkCmdObj, iAtom);
dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr,
deleteCmdObj, NULL);
TkUndoMakeCmdSubAtom(NULL, markSet1InsertObj, dAtom);
TkUndoMakeCmdSubAtom(NULL, seeInsertObj, dAtom);
+ TkUndoMakeCmdSubAtom(NULL, markSetLUndoMarkCmdObj, dAtom);
+ TkUndoMakeCmdSubAtom(NULL, markSetRUndoMarkCmdObj, dAtom);
+ TkUndoMakeCmdSubAtom(NULL, markGravityLUndoMarkCmdObj, dAtom);
+ TkUndoMakeCmdSubAtom(NULL, markGravityRUndoMarkCmdObj, dAtom);
Tcl_DecrRefCount(seeInsertObj);
Tcl_DecrRefCount(index1Obj);
@@ -3356,19 +3405,20 @@ DeleteIndexRange(
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
TextFetchSelection(
ClientData clientData, /* Information about text widget. */
- int offset, /* Offset within selection of first character
+ TkSizeT offset, /* Offset within selection of first character
* to be returned. */
char *buffer, /* Location in which to place selection. */
- int maxBytes) /* Maximum number of bytes to place at buffer,
+ TkSizeT maxBytes) /* Maximum number of bytes to place at buffer,
* not including terminating NULL
* character. */
{
TkText *textPtr = (TkText *)clientData;
TkTextIndex eof;
- int count, chunkSize, offsetInSeg;
+ int count, chunkSize;
+ TkSizeT offsetInSeg;
TkTextSearch search;
TkTextSegment *segPtr;
@@ -3432,8 +3482,8 @@ TextFetchSelection(
}
segPtr = TkTextIndexToSeg(&textPtr->selIndex, &offsetInSeg);
chunkSize = segPtr->size - offsetInSeg;
- if (chunkSize > maxBytes) {
- chunkSize = maxBytes;
+ if (chunkSize > (int)maxBytes) {
+ chunkSize = (int)maxBytes;
}
if (textPtr->selIndex.linePtr == search.curIndex.linePtr) {
int leftInRange;
@@ -3499,7 +3549,7 @@ TkTextLostSelection(
{
TkText *textPtr = (TkText *)clientData;
- if (TkpAlwaysShowSelection(textPtr->tkwin)) {
+ if (Tk_AlwaysShowSelection(textPtr->tkwin)) {
TkTextIndex start, end;
if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) {
@@ -3557,7 +3607,7 @@ TkTextSelectionEvent(
* event generate $textWidget <<Selection>>
*/
- TkSendVirtualEvent(textPtr->tkwin, "Selection", NULL);
+ Tk_SendVirtualEvent(textPtr->tkwin, "Selection", NULL);
}
/*
@@ -3957,7 +4007,7 @@ TextSearchGetLineIndex(
Tcl_Obj *objPtr, /* Contains a textual index like "1.2" */
SearchSpec *searchSpecPtr, /* Contains other search parameters. */
int *linePosPtr, /* For returning the line number. */
- int *offsetPosPtr) /* For returning the text offset in the
+ TkSizeT *offsetPosPtr) /* For returning the text offset in the
* line. */
{
const TkTextIndex *indexPtr;
@@ -4017,28 +4067,29 @@ TextSearchGetLineIndex(
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
TextSearchIndexInLine(
const SearchSpec *searchSpecPtr,
/* Search parameters. */
TkTextLine *linePtr, /* The line we're looking at. */
- int byteIndex) /* Index into the line. */
+ TkSizeT byteIndex) /* Index into the line. */
{
TkTextSegment *segPtr;
TkTextIndex curIndex;
- int index, leftToScan;
+ TkSizeT index;
+ int leftToScan;
TkText *textPtr = (TkText *)searchSpecPtr->clientData;
index = 0;
curIndex.tree = textPtr->sharedTextPtr->tree;
curIndex.linePtr = linePtr; curIndex.byteIndex = 0;
for (segPtr = linePtr->segPtr, leftToScan = byteIndex;
- leftToScan > 0;
+ leftToScan + 1 > 1;
curIndex.byteIndex += segPtr->size, segPtr = segPtr->nextPtr) {
if ((segPtr->typePtr == &tkTextCharType) &&
(searchSpecPtr->searchElide
|| !TkTextIsElided(textPtr, &curIndex, NULL))) {
- if (leftToScan < segPtr->size) {
+ if (leftToScan + 1 < (int)segPtr->size + 1) {
if (searchSpecPtr->exact) {
index += leftToScan;
} else {
@@ -4209,12 +4260,12 @@ TextSearchFoundMatch(
Tcl_Obj *theLine, /* Text from current line, only accessed for
* exact searches, and is allowed to be NULL
* for regexp searches. */
- int matchOffset, /* Offset of found item in utf-8 bytes for
+ TkSizeT matchOffset, /* Offset of found item in utf-8 bytes for
* exact search, Unicode chars for regexp. */
- int matchLength) /* Length also in bytes/chars as per search
+ TkSizeT matchLength) /* Length also in bytes/chars as per search
* type. */
{
- int numChars;
+ TkSizeT numChars;
int leftToScan;
TkTextIndex curIndex, foundIndex;
TkTextSegment *segPtr;
@@ -4229,7 +4280,7 @@ TextSearchFoundMatch(
*/
if (searchSpecPtr->backwards ^
- (matchOffset >= searchSpecPtr->stopOffset)) {
+ (matchOffset + 1 >= searchSpecPtr->stopOffset + 1)) {
return 0;
}
}
@@ -4254,7 +4305,7 @@ TextSearchFoundMatch(
if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) {
if (searchSpecPtr->backwards ^
- ((matchOffset + numChars) > searchSpecPtr->stopOffset)) {
+ ((matchOffset + numChars + 1) > searchSpecPtr->stopOffset + 1)) {
return 0;
}
}
@@ -4305,7 +4356,7 @@ TextSearchFoundMatch(
}
} else {
if (searchSpecPtr->exact) {
- leftToScan -= segPtr->size;
+ leftToScan -= (int)segPtr->size;
} else {
leftToScan -= Tcl_NumUtfChars(segPtr->body.chars, -1);
}
@@ -4407,7 +4458,7 @@ TextSearchFoundMatch(
*/
if (searchSpecPtr->varPtr != NULL) {
- Tcl_Obj *tmpPtr = Tcl_NewIntObj(numChars);
+ Tcl_Obj *tmpPtr = Tcl_NewWideIntObj(numChars);
if (searchSpecPtr->all) {
if (searchSpecPtr->countPtr == NULL) {
searchSpecPtr->countPtr = Tcl_NewObj();
@@ -4480,7 +4531,7 @@ TkTextGetTabs(
* Parse the elements of the list one at a time to fill in the array.
*/
- tabArrayPtr = (TkTextTabArray *)ckalloc(Tk_Offset(TkTextTabArray, tabs)
+ tabArrayPtr = (TkTextTabArray *)ckalloc(offsetof(TkTextTabArray, tabs)
+ count * sizeof(TkTextTab));
tabArrayPtr->numTabs = 0;
prevStop = 0.0;
@@ -4694,7 +4745,7 @@ TextDumpCmd(
if (objc == arg) {
TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES);
} else {
- int length;
+ TkSizeT length;
const char *str;
if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) {
@@ -5016,7 +5067,7 @@ DumpSegment(
Tcl_DecrRefCount(tuple);
return 0;
} else {
- int oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree);
+ TkSizeT oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree);
Tcl_DString buf;
int code;
@@ -5059,6 +5110,8 @@ TextEditUndo(
TkText *textPtr) /* Overall information about text widget. */
{
int status;
+ Tcl_Obj *cmdObj;
+ int code;
if (!textPtr->sharedTextPtr->undo) {
return TCL_OK;
@@ -5082,6 +5135,22 @@ TextEditUndo(
}
textPtr->sharedTextPtr->undo = 1;
+ /*
+ * Convert undo/redo temporary marks set by TkUndoRevert() into
+ * indices left in the interp result.
+ */
+
+ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s",
+ Tk_PathName(textPtr->tkwin));
+ Tcl_IncrRefCount(cmdObj);
+ code = Tcl_EvalObjEx(textPtr->interp, cmdObj, TCL_EVAL_GLOBAL);
+ if (code != TCL_OK) {
+ Tcl_AddErrorInfo(textPtr->interp,
+ "\n (on undoing)");
+ Tcl_BackgroundException(textPtr->interp, code);
+ }
+ Tcl_DecrRefCount(cmdObj);
+
return status;
}
@@ -5107,6 +5176,8 @@ TextEditRedo(
TkText *textPtr) /* Overall information about text widget. */
{
int status;
+ Tcl_Obj *cmdObj;
+ int code;
if (!textPtr->sharedTextPtr->undo) {
return TCL_OK;
@@ -5129,6 +5200,23 @@ TextEditRedo(
textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
}
textPtr->sharedTextPtr->undo = 1;
+
+ /*
+ * Convert undo/redo temporary marks set by TkUndoApply() into
+ * indices left in the interp result.
+ */
+
+ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s",
+ Tk_PathName(textPtr->tkwin));
+ Tcl_IncrRefCount(cmdObj);
+ code = Tcl_EvalObjEx(textPtr->interp, cmdObj, TCL_EVAL_GLOBAL);
+ if (code != TCL_OK) {
+ Tcl_AddErrorInfo(textPtr->interp,
+ "\n (on undoing)");
+ Tcl_BackgroundException(textPtr->interp, code);
+ }
+ Tcl_DecrRefCount(cmdObj);
+
return status;
}
@@ -5338,7 +5426,7 @@ TextGetText(
if (TkTextIndexCmp(indexPtr1, indexPtr2) < 0) {
while (1) {
- int offset;
+ TkSizeT offset;
TkTextSegment *segPtr = TkTextIndexToSeg(&tmpIndex, &offset);
int last = segPtr->size, last2;
@@ -5393,7 +5481,7 @@ GenerateModifiedEvent(
for (textPtr = textPtr->sharedTextPtr->peers; textPtr != NULL;
textPtr = textPtr->next) {
Tk_MakeWindowExist(textPtr->tkwin);
- TkSendVirtualEvent(textPtr->tkwin, "Modified", NULL);
+ Tk_SendVirtualEvent(textPtr->tkwin, "Modified", NULL);
}
}
@@ -5423,7 +5511,7 @@ GenerateUndoStackEvent(
for (textPtr = textPtr->sharedTextPtr->peers; textPtr != NULL;
textPtr = textPtr->next) {
Tk_MakeWindowExist(textPtr->tkwin);
- TkSendVirtualEvent(textPtr->tkwin, "UndoStack", NULL);
+ Tk_SendVirtualEvent(textPtr->tkwin, "UndoStack", NULL);
}
}
@@ -5521,7 +5609,7 @@ TkTextRunAfterSyncCmd(
code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd, TCL_EVAL_GLOBAL);
if (code == TCL_ERROR) {
Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)");
- Tcl_BackgroundError(textPtr->interp);
+ Tcl_BackgroundException(textPtr->interp, TCL_ERROR);
}
Tcl_Release((ClientData) textPtr->interp);
Tcl_DecrRefCount(textPtr->afterSyncCmd);
@@ -5659,7 +5747,7 @@ SearchCore(
*/
int firstOffset, lastOffset;
- int matchOffset, matchLength;
+ TkSizeT matchOffset, matchLength;
int passes;
int lineNum = searchSpecPtr->startLine;
int code = TCL_OK;
@@ -5680,9 +5768,9 @@ SearchCore(
#define LOTS_OF_MATCHES 20
int matchNum = LOTS_OF_MATCHES;
- int smArray[2 * LOTS_OF_MATCHES];
- int *storeMatch = smArray;
- int *storeLength = smArray + LOTS_OF_MATCHES;
+ TkSizeT smArray[2 * LOTS_OF_MATCHES];
+ TkSizeT *storeMatch = smArray;
+ TkSizeT *storeLength = smArray + LOTS_OF_MATCHES;
int lastBackwardsLineMatch = -1;
int lastBackwardsMatchOffset = -1;
@@ -5831,7 +5919,7 @@ SearchCore(
* Only use the last part of the line.
*/
- if (searchSpecPtr->startOffset > firstOffset) {
+ if (searchSpecPtr->startOffset + 1 > (TkSizeT)firstOffset + 1) {
firstOffset = searchSpecPtr->startOffset;
}
if ((firstOffset >= lastOffset)
@@ -5843,7 +5931,7 @@ SearchCore(
* Use only the first part of the line.
*/
- if (searchSpecPtr->startOffset < lastOffset) {
+ if (searchSpecPtr->startOffset + 1 < (TkSizeT)lastOffset + 1) {
lastOffset = searchSpecPtr->startOffset;
}
}
@@ -5857,7 +5945,7 @@ SearchCore(
* begin.
*/
- matchOffset = -1;
+ matchOffset = TCL_INDEX_NONE;
if (searchSpecPtr->exact) {
int maxExtraLines = 0;
@@ -5867,11 +5955,11 @@ SearchCore(
do {
int ch;
const char *p;
- int lastFullLine = lastOffset;
+ TkSizeT lastFullLine = lastOffset;
if (firstNewLine == -1) {
if (searchSpecPtr->strictLimits
- && (firstOffset + matchLength > lastOffset)) {
+ && (firstOffset + matchLength + 1 > (TkSizeT)lastOffset + 1)) {
/*
* Not enough characters to match.
*/
@@ -5989,7 +6077,7 @@ SearchCore(
* exact searches.
*/
- if ((lastTotal - skipFirst) >= matchLength) {
+ if ((TkSizeT)lastTotal - skipFirst + 1 >= matchLength + 1) {
/*
* We now have enough text to match, so we
* make a final test and break whatever the
@@ -6071,7 +6159,7 @@ SearchCore(
}
} else {
firstOffset = matchLength ? p - startOfLine + matchLength
- : p - startOfLine + 1;
+ : p - startOfLine + (TkSizeT)1;
if (firstOffset >= lastOffset) {
/*
* Now, we have to be careful not to find
@@ -6111,7 +6199,7 @@ SearchCore(
do {
Tcl_RegExpInfo info;
int match;
- int lastFullLine = lastOffset;
+ TkSizeT lastFullLine = lastOffset;
match = Tcl_RegExpExecObj(interp, regexp, theLine,
firstOffset, 1, (firstOffset>0 ? TCL_REG_NOTBOL : 0));
@@ -6129,9 +6217,9 @@ SearchCore(
if (!match ||
((info.extendStart == info.matches[0].start)
- && (info.matches[0].end == lastOffset-firstOffset))) {
+ && (info.matches[0].end == (TkSizeT) (lastOffset - firstOffset)))) {
int extraLines = 0;
- int prevFullLine;
+ TkSizeT prevFullLine;
/*
* If we find a match that overlaps more than one line, we
@@ -6147,7 +6235,7 @@ SearchCore(
lastNonOverlap = lastTotal;
}
- if (info.extendStart < 0) {
+ if (info.extendStart == TCL_INDEX_NONE) {
/*
* No multi-line match is possible.
*/
@@ -6244,9 +6332,9 @@ SearchCore(
*/
if ((match &&
- firstOffset + info.matches[0].end != lastTotal &&
- firstOffset + info.matches[0].end < prevFullLine)
- || info.extendStart < 0) {
+ firstOffset + info.matches[0].end != (TkSizeT) lastTotal &&
+ firstOffset + info.matches[0].end + 1 < prevFullLine + 1)
+ || info.extendStart == TCL_INDEX_NONE) {
break;
}
@@ -6257,7 +6345,7 @@ SearchCore(
* that line.
*/
- if (match && (info.matches[0].start >= lastOffset)) {
+ if (match && (info.matches[0].start + 1 >= (TkSizeT) lastOffset + 1)) {
break;
}
if (match && ((firstOffset + info.matches[0].end)
@@ -6314,8 +6402,8 @@ SearchCore(
* Possible overlap or enclosure.
*/
- if (thisOffset - lastNonOverlap >=
- lastBackwardsMatchOffset + matchLength){
+ if ((TkSizeT)thisOffset - lastNonOverlap >=
+ lastBackwardsMatchOffset + matchLength + 1){
/*
* Totally encloses previous match, so
* forget the previous match.
@@ -6396,12 +6484,12 @@ SearchCore(
* previous match.
*/
- if (matchOffset == -1 ||
+ if (matchOffset == TCL_INDEX_NONE ||
((searchSpecPtr->all || searchSpecPtr->backwards)
- && ((firstOffset < matchOffset)
+ && (((TkSizeT)firstOffset + 1 < matchOffset + 1)
|| ((firstOffset + info.matches[0].end
- info.matches[0].start)
- > (matchOffset + matchLength))))) {
+ > matchOffset + matchLength)))) {
matchOffset = firstOffset;
matchLength = info.matches[0].end - info.matches[0].start;
@@ -6419,11 +6507,11 @@ SearchCore(
* matches on the heap.
*/
- int *newArray = (int *)
- ckalloc(4 * matchNum * sizeof(int));
- memcpy(newArray, storeMatch, matchNum*sizeof(int));
+ TkSizeT *newArray = (TkSizeT *)
+ ckalloc(4 * matchNum * sizeof(TkSizeT));
+ memcpy(newArray, storeMatch, matchNum*sizeof(TkSizeT));
memcpy(newArray + 2*matchNum, storeLength,
- matchNum * sizeof(int));
+ matchNum * sizeof(TkSizeT));
if (storeMatch != smArray) {
ckfree(storeMatch);
}
@@ -6458,7 +6546,7 @@ SearchCore(
* explicitly disallow overlapping matches.
*/
- if (matchLength > 0 && !searchSpecPtr->overlap
+ if (matchLength + 1 > 1 && !searchSpecPtr->overlap
&& !searchSpecPtr->backwards) {
firstOffset += matchLength;
if (firstOffset >= lastOffset) {
@@ -6515,8 +6603,8 @@ SearchCore(
* found which would exercise such a problem.
*/
}
- if (storeMatch[matches] + storeLength[matches]
- >= matchOffset + matchLength) {
+ if (storeMatch[matches] + storeLength[matches] + 1
+ >= matchOffset + matchLength + 1) {
/*
* The new match totally encloses the previous one, so
* we overwrite the previous one.
@@ -6564,7 +6652,7 @@ SearchCore(
* we are done.
*/
- if ((lastBackwardsLineMatch == -1) && (matchOffset >= 0)
+ if ((lastBackwardsLineMatch == -1) && (matchOffset != TCL_INDEX_NONE)
&& !searchSpecPtr->all) {
searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo,
theLine, matchOffset, matchLength);
@@ -6683,7 +6771,7 @@ GetLineStartEnd(
TCL_UNUSED(void *),
TCL_UNUSED(Tk_Window),
char *recordPtr, /* Pointer to widget record. */
- int internalOffset) /* Offset within *recordPtr containing the
+ TkSizeT internalOffset) /* Offset within *recordPtr containing the
* line value. */
{
TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset);
@@ -6691,7 +6779,7 @@ GetLineStartEnd(
if (linePtr == NULL) {
return Tcl_NewObj();
}
- return Tcl_NewIntObj(1 + TkBTreeLinesTo(NULL, linePtr));
+ return Tcl_NewWideIntObj(1 + TkBTreeLinesTo(NULL, linePtr));
}
/*
@@ -6722,7 +6810,7 @@ SetLineStartEnd(
* We use a pointer to the pointer because we
* may need to return a value (NULL). */
char *recordPtr, /* Pointer to storage for the widget record. */
- int internalOffset, /* Offset within *recordPtr at which the
+ TkSizeT internalOffset, /* Offset within *recordPtr at which the
* internal value is to be stored. */
char *oldInternalPtr, /* Pointer to storage for the old value. */
int flags) /* Flags for the option, set Tk_SetOptions. */
@@ -6731,8 +6819,8 @@ SetLineStartEnd(
char *internalPtr;
TkText *textPtr = (TkText *) recordPtr;
- if (internalOffset >= 0) {
- internalPtr = recordPtr + internalOffset;
+ if (internalOffset != TCL_INDEX_NONE) {
+ internalPtr = (char *)recordPtr + internalOffset;
} else {
internalPtr = NULL;
}
diff --git a/generic/tkText.h b/generic/tkText.h
index 9898462..faa6014 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -165,7 +165,7 @@ typedef struct TkTextSegment {
struct TkTextSegment *nextPtr;
/* Next in list of segments for this line, or
* NULL for end of list. */
- int size; /* Size of this segment (# of bytes of index
+ TkSizeT size; /* Size of this segment (# of bytes of index
* space it occupies). */
union {
char chars[TKFLEXARRAY]; /* Characters that make up character info.
@@ -532,8 +532,16 @@ typedef enum {
* that are peers.
*/
+#ifndef TkSizeT
+# if TCL_MAJOR_VERSION > 8
+# define TkSizeT size_t
+# else
+# define TkSizeT int
+# endif
+#endif
+
typedef struct TkSharedText {
- int refCount; /* Reference count this shared object. */
+ TkSizeT refCount; /* Reference count this shared object. */
TkTextBTree tree; /* B-tree representation of text and tags for
* widget. */
Tcl_HashTable tagTable; /* Hash table that maps from tag names to
@@ -562,7 +570,7 @@ typedef struct TkSharedText {
* exist, so the table hasn't been created.
* Each "object" used for this table is the
* name of a tag. */
- int stateEpoch; /* This is incremented each time the B-tree's
+ TkSizeT stateEpoch; /* This is incremented each time the B-tree's
* contents change structurally, or when the
* start/end limits change, and means that any
* cached TkTextIndex objects are no longer
@@ -580,6 +588,8 @@ typedef struct TkSharedText {
* statements. */
int autoSeparators; /* Non-zero means the separators will be
* inserted automatically. */
+ int undoMarkId; /* Counts undo marks temporarily used during
+ undo and redo operations. */
int isDirty; /* Flag indicating the 'dirtyness' of the
* text widget. If the flag is not zero,
* unsaved modifications have been applied to
@@ -781,7 +791,7 @@ typedef struct TkText {
* definitions. */
Tk_OptionTable optionTable; /* Token representing the configuration
* specifications. */
- int refCount; /* Number of cached TkTextIndex objects
+ TkSizeT refCount; /* Number of cached TkTextIndex objects
* refering to us. */
int insertCursorType; /* 0 = standard insertion cursor, 1 = block
* cursor. */
@@ -837,7 +847,7 @@ typedef struct TkText {
*/
typedef TkTextSegment * Tk_SegSplitProc(struct TkTextSegment *segPtr,
- int index);
+ TkSizeT index);
typedef int Tk_SegDeleteProc(struct TkTextSegment *segPtr,
TkTextLine *linePtr, int treeGone);
typedef TkTextSegment * Tk_SegCleanupProc(struct TkTextSegment *segPtr,
@@ -846,8 +856,8 @@ typedef void Tk_SegLineChangeProc(struct TkTextSegment *segPtr,
TkTextLine *linePtr);
typedef int Tk_SegLayoutProc(struct TkText *textPtr,
struct TkTextIndex *indexPtr,
- TkTextSegment *segPtr, int offset, int maxX,
- int maxChars, int noCharsYet, TkWrapMode wrapMode,
+ TkTextSegment *segPtr, TkSizeT offset, int maxX,
+ TkSizeT maxChars, int noCharsYet, TkWrapMode wrapMode,
struct TkTextDispChunk *chunkPtr);
typedef void Tk_SegCheckProc(TkTextSegment *segPtr,
TkTextLine *linePtr);
@@ -1007,7 +1017,7 @@ MODULE_SCOPE void TkBTreeRemoveClient(TkTextBTree tree,
MODULE_SCOPE void TkBTreeDestroy(TkTextBTree tree);
MODULE_SCOPE void TkBTreeDeleteIndexRange(TkTextBTree tree,
TkTextIndex *index1Ptr, TkTextIndex *index2Ptr);
-MODULE_SCOPE int TkBTreeEpoch(TkTextBTree tree);
+MODULE_SCOPE TkSizeT TkBTreeEpoch(TkTextBTree tree);
MODULE_SCOPE TkTextLine *TkBTreeFindLine(TkTextBTree tree,
const TkText *textPtr, int line);
MODULE_SCOPE TkTextLine *TkBTreeFindPixelLine(TkTextBTree tree,
@@ -1050,7 +1060,7 @@ MODULE_SCOPE int TkTextIndexBbox(TkText *textPtr,
int *widthPtr, int *heightPtr, int *charWidthPtr);
MODULE_SCOPE int TkTextCharLayoutProc(TkText *textPtr,
TkTextIndex *indexPtr, TkTextSegment *segPtr,
- int offset, int maxX, int maxChars, int noBreakYet,
+ TkSizeT offset, int maxX, TkSizeT maxChars, int noBreakYet,
TkWrapMode wrapMode, TkTextDispChunk *chunkPtr);
MODULE_SCOPE void TkTextCreateDInfo(TkText *textPtr);
MODULE_SCOPE int TkTextDLineInfo(TkText *textPtr,
@@ -1096,7 +1106,7 @@ MODULE_SCOPE void TkTextIndexOfX(TkText *textPtr, int x,
MODULE_SCOPE int TkTextIndexYPixels(TkText *textPtr,
const TkTextIndex *indexPtr);
MODULE_SCOPE TkTextSegment *TkTextIndexToSeg(const TkTextIndex *indexPtr,
- int *offsetPtr);
+ TkSizeT *offsetPtr);
MODULE_SCOPE void TkTextLostSelection(ClientData clientData);
MODULE_SCOPE TkTextIndex *TkTextMakeCharIndex(TkTextBTree tree, TkText *textPtr,
int lineIndex, int charIndex,
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index 1b65cbc..5988db7 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -5,8 +5,8 @@
* for Tk's text widget and implements character and toggle segment
* types.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1995 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -105,7 +105,7 @@ typedef struct BTree {
int clients; /* Number of clients of this B-tree. */
int pixelReferences; /* Number of clients of this B-tree which care
* about pixel heights. */
- int stateEpoch; /* Updated each time any aspect of the B-tree
+ TkSizeT stateEpoch; /* Updated each time any aspect of the B-tree
* changes. */
TkSharedText *sharedTextPtr;/* Used to find tagTable in consistency
* checking code, and to access list of all
@@ -140,10 +140,10 @@ int tkBTreeDebug = 0;
* Macros that determine how much space to allocate for new segments:
*/
-#define CSEG_SIZE(chars) ((unsigned)(Tk_Offset(TkTextSegment, body) \
- + 1 + (chars)))
-#define TSEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
- + sizeof(TkTextToggle)))
+#define CSEG_SIZE(chars) (offsetof(TkTextSegment, body) \
+ + 1 + (chars))
+#define TSEG_SIZE (offsetof(TkTextSegment, body) \
+ + sizeof(TkTextToggle))
/*
* Forward declarations for functions defined in this file:
@@ -161,7 +161,7 @@ static int CharDeleteProc(TkTextSegment *segPtr,
TkTextLine *linePtr, int treeGone);
static TkTextSegment * CharCleanupProc(TkTextSegment *segPtr,
TkTextLine *linePtr);
-static TkTextSegment * CharSplitProc(TkTextSegment *segPtr, int index);
+static TkTextSegment * CharSplitProc(TkTextSegment *segPtr, TkSizeT index);
static void CheckNodeConsistency(Node *nodePtr, int references);
static void CleanupLine(TkTextLine *linePtr);
static void DeleteSummaries(Summary *tagPtr);
@@ -501,7 +501,7 @@ TkBTreeDestroy(
*----------------------------------------------------------------------
*/
-int
+TkSizeT
TkBTreeEpoch(
TkTextBTree tree) /* Tree to get epoch for. */
{
@@ -1021,7 +1021,7 @@ TkBTreeInsertChars(
* this line). */
TkTextSegment *segPtr;
TkTextLine *newLinePtr;
- int chunkSize; /* # characters in current chunk. */
+ size_t chunkSize; /* # characters in current chunk. */
const char *eol; /* Pointer to character just after last one in
* current chunk. */
int changeToLineCount; /* Counts change to total number of lines in
@@ -1190,14 +1190,14 @@ SplitSeg(
{
TkTextSegment *prevPtr, *segPtr;
TkTextLine *linePtr;
- int count = indexPtr->byteIndex;
+ TkSizeT count = indexPtr->byteIndex;
linePtr = indexPtr->linePtr;
prevPtr = NULL;
segPtr = linePtr->segPtr;
while (segPtr != NULL) {
- if (segPtr->size > count) {
+ if (segPtr->size + 1 > count + 1) {
if (count == 0) {
return prevPtr;
}
@@ -2674,7 +2674,7 @@ TkBTreeStartSearch(
/* Where to store information about search's
* progress. */
{
- int offset;
+ TkSizeT offset;
TkTextIndex index0; /* First index of the tag. */
TkTextSegment *seg0Ptr; /* First segment of the tag. */
@@ -2770,7 +2770,7 @@ TkBTreeStartSearchBack(
/* Where to store information about search's
* progress. */
{
- int offset;
+ TkSizeT offset;
TkTextIndex index0; /* Last index of the tag. */
TkTextIndex backOne; /* One character before starting index. */
TkTextSegment *seg0Ptr; /* Last segment of the tag. */
@@ -3264,7 +3264,7 @@ TkBTreeCharTagged(
toggleSegPtr = NULL;
for (index = 0, segPtr = indexPtr->linePtr->segPtr;
- (index + segPtr->size) <= indexPtr->byteIndex;
+ (index + (int)segPtr->size) <= indexPtr->byteIndex;
index += segPtr->size, segPtr = segPtr->nextPtr) {
if (((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType))
@@ -3384,7 +3384,7 @@ TkBTreeGetTags(
linePtr = indexPtr->linePtr;
index = 0;
segPtr = linePtr->segPtr;
- while ((index + segPtr->size) <= indexPtr->byteIndex) {
+ while ((index + (int)segPtr->size) <= indexPtr->byteIndex) {
if ((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType)) {
IncCount(segPtr->body.toggle.tagPtr, 1, &tagInfo);
@@ -3548,7 +3548,7 @@ TkTextIsElided(
index = 0;
linePtr = indexPtr->linePtr;
segPtr = linePtr->segPtr;
- while ((index + segPtr->size) <= indexPtr->byteIndex) {
+ while ((index + (int)segPtr->size) <= indexPtr->byteIndex) {
if ((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType)) {
tagPtr = segPtr->body.toggle.tagPtr;
@@ -3885,7 +3885,7 @@ TkBTreeCheck(
}
if (segPtr->size != 1) {
Tcl_Panic("TkBTreeCheck: last line has wrong # characters: %d",
- segPtr->size);
+ (int)segPtr->size);
}
if ((segPtr->body.chars[0] != '\n') || (segPtr->body.chars[1] != 0)) {
Tcl_Panic("TkBTreeCheck: last line had bad value: %s",
@@ -4565,7 +4565,7 @@ TkBTreeNumPixels(
static TkTextSegment *
CharSplitProc(
TkTextSegment *segPtr, /* Pointer to segment to split. */
- int index) /* Position within segment at which to
+ TkSizeT index) /* Position within segment at which to
* split. */
{
TkTextSegment *newPtr1, *newPtr2;
@@ -4685,7 +4685,7 @@ CharCheckProc(
* to each other: they should be merged together.
*/
- if (segPtr->size <= 0) {
+ if (segPtr->size + 1 <= 1) {
Tcl_Panic("CharCheckProc: segment has size <= 0");
}
if (strlen(segPtr->body.chars) != (size_t)segPtr->size) {
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index a02544d..e6b04cc 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -6,8 +6,8 @@
* widgets. (Well, strictly, each TkTextLine and B-tree node caches its
* last observed pixel height, but that information originates here).
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -171,7 +171,7 @@ typedef struct StyleValues {
*/
typedef struct TextStyle {
- int refCount; /* Number of times this structure is
+ TkSizeT refCount; /* Number of times this structure is
* referenced in Chunks. */
GC bgGC; /* Graphics context for background. None means
* use widget background. */
@@ -418,7 +418,7 @@ typedef struct TextDInfo {
* to so far... */
int metricPixelHeight; /* ...and this is for the height calculation
* so far...*/
- int metricEpoch; /* ...and this for the epoch of the partial
+ TkSizeT metricEpoch; /* ...and this for the epoch of the partial
* calculation so it can be cancelled if
* things change once more. This field will be
* -1 if there is no long-line calculation in
@@ -440,7 +440,7 @@ typedef struct TextDInfo {
* points to one of the following structures:
*/
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
typedef struct CharInfo {
int numBytes; /* Number of bytes to display. */
@@ -552,7 +552,7 @@ static void CharDisplayProc(TkText *textPtr,
static int CharMeasureProc(TkTextDispChunk *chunkPtr, int x);
static void CharUndisplayProc(TkText *textPtr,
TkTextDispChunk *chunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
static void FinalizeBaseChunk(TkTextDispChunk *additionalChunkPtr);
static void FreeBaseChunk(TkTextDispChunk *baseChunkPtr);
static int IsSameFGStyle(TextStyle *style1, TextStyle *style2);
@@ -1177,7 +1177,8 @@ LayoutDLine(
/* Pointer to last chunk in display lines with
* numBytes > 0. Used to drop 0-sized chunks
* from the end of the line. */
- int byteOffset, ascent, descent, code, elide, elidesize;
+ TkSizeT byteOffset;
+ int ascent, descent, code, elide, elidesize;
StyleValues *sValuePtr;
TkTextElideInfo info; /* Keep track of elide state. */
@@ -1217,7 +1218,7 @@ LayoutDLine(
if (elide && indexPtr->byteIndex == 0) {
maxBytes = 0;
for (segPtr = info.segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) {
- if (segPtr->size > 0) {
+ if (segPtr->size + 1 > 1) {
if (elide == 0) {
/*
* We toggled a tag and the elide state changed to
@@ -1338,7 +1339,7 @@ LayoutDLine(
connectNextLogicalLine:
byteOffset = curIndex.byteIndex;
segPtr = curIndex.linePtr->segPtr;
- while ((byteOffset > 0) && (byteOffset >= segPtr->size)) {
+ while ((byteOffset + 1 > 1) && (byteOffset + 1 >= segPtr->size + 1)) {
byteOffset -= segPtr->size;
segPtr = segPtr->nextPtr;
@@ -1378,7 +1379,7 @@ LayoutDLine(
if (elide && (lastChunkPtr != NULL)
&& (lastChunkPtr->displayProc == NULL /*ElideDisplayProc*/)) {
elidesize = segPtr->size - byteOffset;
- if (elidesize > 0) {
+ if (segPtr->size + 1 > byteOffset + 1) {
curIndex.byteIndex += elidesize;
lastChunkPtr->numBytes += elidesize;
breakByteOffset = lastChunkPtr->breakIndex
@@ -1507,7 +1508,7 @@ LayoutDLine(
}
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr != NULL) {
int expectedX =
((BaseCharInfo *) baseCharChunkPtr->clientData)->width
@@ -1649,7 +1650,7 @@ LayoutDLine(
chunkPtr = NULL;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
if (noCharsYet) {
@@ -1708,7 +1709,7 @@ LayoutDLine(
segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr,
byteOffset, maxX, breakByteOffset, 0, wrapMode,
breakChunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
}
@@ -3063,7 +3064,7 @@ AsyncUpdateLineMetrics(
* and we've reached the last line, then we're done.
*/
- if (dInfoPtr->metricEpoch == -1
+ if (dInfoPtr->metricEpoch == TCL_INDEX_NONE
&& lineNum == dInfoPtr->lastMetricUpdateLine) {
/*
* We have looped over all lines, so we're done. We must release our
@@ -3081,7 +3082,7 @@ AsyncUpdateLineMetrics(
TCL_EVAL_GLOBAL);
if (code == TCL_ERROR) {
Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)");
- Tcl_BackgroundError(textPtr->interp);
+ Tcl_BackgroundException(textPtr->interp, TCL_ERROR);
}
Tcl_Release((ClientData) textPtr->interp);
Tcl_DecrRefCount(textPtr->afterSyncCmd);
@@ -3163,7 +3164,7 @@ GenerateWidgetViewSyncEvent(
} else {
textPtr->dInfoPtr->flags |= OUT_OF_SYNC;
}
- TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
+ Tk_SendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
Tcl_NewBooleanObj(NewSyncState));
}
}
@@ -3247,7 +3248,8 @@ TkTextUpdateLineMetrics(
* then we can't be done.
*/
- if (textPtr->dInfoPtr->metricEpoch == -1 && lineNum == endLine) {
+ if (textPtr->dInfoPtr->metricEpoch == TCL_INDEX_NONE && lineNum == endLine) {
+
/*
* We have looped over all lines, so we're done.
@@ -6160,7 +6162,7 @@ TkTextYviewCmd(
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
int pickPlace, type;
int pixels, count;
- int switchLength;
+ TkSizeT switchLength;
double fraction;
TkTextIndex index;
@@ -7557,6 +7559,7 @@ ElideBboxProc(
int *heightPtr) /* Gets filled in with height of character, in
* pixels. */
{
+
*xPtr = chunkPtr->x;
*yPtr = y;
*widthPtr = *heightPtr = 0;
@@ -7602,11 +7605,11 @@ TkTextCharLayoutProc(
TCL_UNUSED(TkTextIndex *), /* Index of first character to lay out
* (corresponds to segPtr and offset). */
TkTextSegment *segPtr, /* Segment being layed out. */
- int byteOffset, /* Byte offset within segment of first
+ TkSizeT byteOffset, /* Byte offset within segment of first
* character to consider. */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxBytes, /* Chunk must not include more than this many
+ TkSizeT maxBytes, /* Chunk must not include more than this many
* characters. */
int noCharsYet, /* Non-zero means no characters have been
* assigned to this display line yet. */
@@ -7619,12 +7622,13 @@ TkTextCharLayoutProc(
* set by the caller. */
{
Tk_Font tkfont;
- int nextX, bytesThatFit, count;
+ int nextX, count;
+ TkSizeT bytesThatFit;
CharInfo *ciPtr;
char *p;
TkTextSegment *nextPtr;
Tk_FontMetrics fm;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
const char *line;
int lineOffset;
BaseCharInfo *bciPtr;
@@ -7649,18 +7653,18 @@ TkTextCharLayoutProc(
p = segPtr->body.chars + byteOffset;
tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr == NULL) {
baseCharChunkPtr = chunkPtr;
- bciPtr = ckalloc(sizeof(BaseCharInfo));
+ bciPtr = (BaseCharInfo *)ckalloc(sizeof(BaseCharInfo));
baseString = &bciPtr->baseChars;
Tcl_DStringInit(baseString);
bciPtr->width = 0;
ciPtr = &bciPtr->ci;
} else {
- bciPtr = baseCharChunkPtr->clientData;
- ciPtr = ckalloc(sizeof(CharInfo));
+ bciPtr = (BaseCharInfo *)baseCharChunkPtr->clientData;
+ ciPtr = (CharInfo *)ckalloc(sizeof(CharInfo));
baseString = &bciPtr->baseChars;
}
@@ -7681,12 +7685,12 @@ TkTextCharLayoutProc(
chunkPtr->x, maxX, TK_ISOLATE_END, &nextX);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
- if (bytesThatFit < maxBytes) {
+ if (bytesThatFit + 1 <= maxBytes) {
if ((bytesThatFit == 0) && noCharsYet) {
int ch;
int chLen = TkUtfToUniChar(p, &ch);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
bytesThatFit = CharChunkMeasureChars(chunkPtr, line,
lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0,
&nextX);
@@ -7730,7 +7734,7 @@ TkTextCharLayoutProc(
bytesThatFit++;
}
if (bytesThatFit == 0) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
chunkPtr->clientData = NULL;
if (chunkPtr == baseCharChunkPtr) {
baseCharChunkPtr = NULL;
@@ -7763,8 +7767,8 @@ TkTextCharLayoutProc(
chunkPtr->width = nextX - chunkPtr->x;
chunkPtr->breakIndex = -1;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
- ciPtr = (CharInfo *)ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit);
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
+ ciPtr = (CharInfo *)ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit);
chunkPtr->clientData = ciPtr;
memcpy(ciPtr->chars, p, bytesThatFit);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
@@ -7774,7 +7778,7 @@ TkTextCharLayoutProc(
ciPtr->numBytes--;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
* Final update for the current base chunk data.
*/
@@ -7879,7 +7883,7 @@ CharChunkMeasureChars(
Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (chars == NULL) {
chars = ciPtr->chars;
charsLen = ciPtr->numBytes;
@@ -7971,7 +7975,7 @@ CharDisplayProc(
TextStyle *stylePtr;
StyleValues *sValuePtr;
int numBytes, offsetBytes, offsetX;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
BaseCharInfo *bciPtr;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -7983,12 +7987,12 @@ CharDisplayProc(
return;
}
-#if TK_DRAW_IN_CONTEXT
- bciPtr = ciPtr->baseChunkPtr->clientData;
+#ifdef TK_DRAW_IN_CONTEXT
+ bciPtr = (BaseCharInfo *)ciPtr->baseChunkPtr->clientData;
numBytes = Tcl_DStringLength(&bciPtr->baseChars);
string = Tcl_DStringValue(&bciPtr->baseChars);
-#elif TK_LAYOUT_WITH_BASE_CHUNKS
+#elif defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (ciPtr->baseChunkPtr != chunkPtr) {
/*
* Without context drawing only base chunks display their foreground.
@@ -8029,7 +8033,7 @@ CharDisplayProc(
if (!sValuePtr->elide && (numBytes > offsetBytes)
&& (stylePtr->fgGC != NULL)) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int start = ciPtr->baseOffset + offsetBytes;
int len = ciPtr->numBytes - offsetBytes;
int xDisplacement = x - chunkPtr->x;
@@ -8120,7 +8124,7 @@ CharUndisplayProc(
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
if (ciPtr) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (chunkPtr == ciPtr->baseChunkPtr) {
/*
* Basechunks are undisplayed first, when DLines are freed or
@@ -8702,7 +8706,7 @@ MeasureChars(
if ((maxX >= 0) && (curX >= maxX)) {
break;
}
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
start += TkpMeasureCharsInContext(tkfont, source, maxBytes,
start - source, special - start,
maxX >= 0 ? maxX - curX : -1, flags, &width);
@@ -8777,12 +8781,13 @@ TextGetScrollInfoObj(
VIEW_MOVETO, VIEW_SCROLL
};
static const char *const units[] = {
- "units", "pages", "pixels", NULL
+ "pages", "pixels", "units", NULL
};
enum viewUnits {
- VIEW_SCROLL_UNITS, VIEW_SCROLL_PAGES, VIEW_SCROLL_PIXELS
+ VIEW_SCROLL_PAGES, VIEW_SCROLL_PIXELS, VIEW_SCROLL_UNITS
};
int index;
+ double d;
if (Tcl_GetIndexFromObjStruct(interp, objv[2], subcommands,
sizeof(char *), "option", 0, &index) != TCL_OK) {
@@ -8801,7 +8806,7 @@ TextGetScrollInfoObj(
return TKTEXT_SCROLL_MOVETO;
case VIEW_SCROLL:
if (objc != 5) {
- Tcl_WrongNumArgs(interp, 3, objv, "number units|pages|pixels");
+ Tcl_WrongNumArgs(interp, 3, objv, "number pages|pixels|units");
return TKTEXT_SCROLL_ERROR;
}
if (Tcl_GetIndexFromObjStruct(interp, objv[4], units,
@@ -8810,29 +8815,39 @@ TextGetScrollInfoObj(
}
switch ((enum viewUnits) index) {
case VIEW_SCROLL_PAGES:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) {
- return TKTEXT_SCROLL_PAGES;
+ if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
}
- break;
+ *intPtr = (d > 0) ? ceil(d) : floor(d);
+ if (dblPtr) {
+ *dblPtr = d;
+ }
+ return TKTEXT_SCROLL_PAGES;
case VIEW_SCROLL_PIXELS:
if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[3],
- intPtr) == TCL_OK) {
- return TKTEXT_SCROLL_PIXELS;
+ intPtr) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
}
- break;
+ if (dblPtr) {
+ *dblPtr = (double)*intPtr;
+ }
+ return TKTEXT_SCROLL_PIXELS;
case VIEW_SCROLL_UNITS:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) {
- return TKTEXT_SCROLL_UNITS;
+ if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
}
- break;
- default:
- Tcl_Panic("unexpected switch fallthrough");
+ *intPtr = (d > 0) ? ceil(d) : floor(d);
+ if (dblPtr) {
+ *dblPtr = d;
+ }
+ return TKTEXT_SCROLL_UNITS;
}
}
+ Tcl_Panic("unexpected switch fallthrough");
return TKTEXT_SCROLL_ERROR;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
*----------------------------------------------------------------------
*
@@ -8863,7 +8878,7 @@ FinalizeBaseChunk(
const char *baseChars;
TkTextDispChunk *chunkPtr;
CharInfo *ciPtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int widthAdjust = 0;
int newwidth;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -8877,20 +8892,20 @@ FinalizeBaseChunk(
for (chunkPtr = baseCharChunkPtr; chunkPtr != NULL;
chunkPtr = chunkPtr->nextPtr) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
chunkPtr->x += widthAdjust;
#endif /* TK_DRAW_IN_CONTEXT */
if (chunkPtr->displayProc != CharDisplayProc) {
continue;
}
- ciPtr = chunkPtr->clientData;
+ ciPtr = (CharInfo *)chunkPtr->clientData;
if (ciPtr->baseChunkPtr != baseCharChunkPtr) {
break;
}
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
newwidth = 0;
CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth);
if (newwidth < chunkPtr->width) {
@@ -8901,10 +8916,10 @@ FinalizeBaseChunk(
}
if (addChunkPtr != NULL) {
- ciPtr = addChunkPtr->clientData;
+ ciPtr = (CharInfo *)addChunkPtr->clientData;
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
addChunkPtr->x += widthAdjust;
CharChunkMeasureChars(addChunkPtr, NULL, 0, 0, -1, 0, -1, 0,
&addChunkPtr->width);
@@ -8952,7 +8967,7 @@ FreeBaseChunk(
if (chunkPtr->undisplayProc != CharUndisplayProc) {
continue;
}
- ciPtr = chunkPtr->clientData;
+ ciPtr = (CharInfo *)chunkPtr->clientData;
if (ciPtr->baseChunkPtr != baseChunkPtr) {
break;
}
@@ -9002,7 +9017,7 @@ IsSameFGStyle(
return 1;
}
-#if !TK_DRAW_IN_CONTEXT
+#if !defined(TK_DRAW_IN_CONTEXT)
if (
#ifdef MAC_OSX_TK
!TkMacOSXCompareColors(style1->fgGC->foreground,
@@ -9018,7 +9033,7 @@ IsSameFGStyle(
sv1 = style1->sValuePtr;
sv2 = style2->sValuePtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
return sv1->tkfont == sv2->tkfont && sv1->offset == sv2->offset;
#else
return sv1->tkfont == sv2->tkfont
@@ -9072,14 +9087,14 @@ RemoveFromBaseChunk(
* Reinstitute this base chunk for re-layout.
*/
- ciPtr = chunkPtr->clientData;
+ ciPtr = (CharInfo *)chunkPtr->clientData;
baseCharChunkPtr = ciPtr->baseChunkPtr;
/*
* Remove the chunk data from the base chunk data.
*/
- bciPtr = baseCharChunkPtr->clientData;
+ bciPtr = (BaseCharInfo *)baseCharChunkPtr->clientData;
#ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS
if ((ciPtr->baseOffset + ciPtr->numBytes)
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index 776eb04..fdf1c43 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -4,7 +4,7 @@
* This file contains code that allows images to be nested inside text
* widgets. It also implements the "image" widget command for texts.
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
+ * Copyright © 1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -18,7 +18,7 @@
*/
#define EI_SEG_SIZE \
- ((unsigned)(Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage)))
+ (offsetof(TkTextSegment, body) + sizeof(TkTextEmbImage))
/*
* Prototypes for functions defined in this file:
@@ -43,7 +43,7 @@ static void EmbImageDisplayProc(TkText *textPtr,
Drawable dst, int screenY);
static int EmbImageLayoutProc(TkText *textPtr,
TkTextIndex *indexPtr, TkTextSegment *segPtr,
- int offset, int maxX, int maxChars,
+ TkSizeT offset, int maxX, TkSizeT maxChars,
int noCharsYet, TkWrapMode wrapMode,
TkTextDispChunk *chunkPtr);
static void EmbImageProc(ClientData clientData, int x, int y,
@@ -83,17 +83,17 @@ typedef enum {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-align", NULL, NULL,
- "center", -1, Tk_Offset(TkTextEmbImage, align),
+ "center", TCL_INDEX_NONE, offsetof(TkTextEmbImage, align),
0, alignStrings, 0},
{TK_OPTION_PIXELS, "-padx", NULL, NULL,
- "0", -1, Tk_Offset(TkTextEmbImage, padX), 0, 0, 0},
+ "0", TCL_INDEX_NONE, offsetof(TkTextEmbImage, padX), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", NULL, NULL,
- "0", -1, Tk_Offset(TkTextEmbImage, padY), 0, 0, 0},
+ "0", TCL_INDEX_NONE, offsetof(TkTextEmbImage, padY), 0, 0, 0},
{TK_OPTION_STRING, "-image", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextEmbImage, imageString),
+ NULL, TCL_INDEX_NONE, offsetof(TkTextEmbImage, imageString),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-name", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextEmbImage, imageName),
+ NULL, TCL_INDEX_NONE, offsetof(TkTextEmbImage, imageName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -161,7 +161,7 @@ TkTextImageCmd(
Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", NULL);
return TCL_ERROR;
}
- objPtr = Tk_GetOptionValue(interp, (char *)&eiPtr->body.ei,
+ objPtr = Tk_GetOptionValue(interp, &eiPtr->body.ei,
eiPtr->body.ei.optionTable, objv[4], textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -188,7 +188,7 @@ TkTextImageCmd(
}
if (objc <= 5) {
Tcl_Obj *objPtr = Tk_GetOptionInfo(interp,
- (char *)&eiPtr->body.ei, eiPtr->body.ei.optionTable,
+ &eiPtr->body.ei, eiPtr->body.ei.optionTable,
(objc == 5) ? objv[4] : NULL, textPtr->tkwin);
if (objPtr == NULL) {
@@ -279,18 +279,23 @@ TkTextImageCmd(
Tcl_HashEntry *hPtr;
Tcl_Obj *resultObj;
- if (objc == 3) {
- resultObj = Tcl_NewObj();
- for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
- &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1));
- }
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ return TCL_ERROR;
+ }
+ resultObj = Tcl_NewObj();
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
+ &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
+ (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
+ -1));
+ }
+ if (resultObj == NULL) {
+ return TCL_ERROR;
+ } else {
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
}
- Tcl_WrongNumArgs(interp, 3, objv, NULL);
- break;
}
default:
Tcl_Panic("unexpected switch fallthrough");
@@ -336,7 +341,7 @@ EmbImageConfigure(
int conflict = 0; /* True if we have a name conflict */
size_t len; /* length of image name */
- if (Tk_SetOptions(textPtr->interp, (char *)&eiPtr->body.ei,
+ if (Tk_SetOptions(textPtr->interp, &eiPtr->body.ei,
eiPtr->body.ei.optionTable,
objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
@@ -530,11 +535,11 @@ EmbImageLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */
- int offset, /* Offset within segPtr corresponding to
+ TkSizeT offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- TCL_UNUSED(int), /* Chunk must not include more than this many
+ TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many
* characters. */
int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
@@ -623,7 +628,7 @@ EmbImageCheckProc(
}
if (eiPtr->size != 1) {
Tcl_Panic("EmbImageCheckProc: embedded image has size %d",
- eiPtr->size);
+ (int)eiPtr->size);
}
}
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index e6632d0..bd93258 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -4,8 +4,8 @@
* This module provides functions that manipulate indices for text
* widgets.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -64,7 +64,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr);
#define SET_TEXTINDEX(objPtr, indexPtr) \
((objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(indexPtr))
#define SET_INDEXEPOCH(objPtr, epoch) \
- ((objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(epoch))
+ ((objPtr)->internalRep.twoPtrValue.ptr2 = (void *) (size_t) (epoch))
/*
* Define the 'textindex' object type, which Tk uses to represent indices in
@@ -104,7 +104,7 @@ DupTextIndexInternalRep(
Tcl_Obj *srcPtr, /* TextIndex obj with internal rep to copy. */
Tcl_Obj *copyPtr) /* TextIndex obj with internal rep to set. */
{
- int epoch;
+ TkSizeT epoch;
TkTextIndex *dupIndexPtr, *indexPtr;
dupIndexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex));
@@ -206,7 +206,7 @@ TkTextGetIndexFromObj(
int cache;
if (objPtr->typePtr == &tkTextIndexType) {
- int epoch;
+ TkSizeT epoch;
indexPtr = GET_TEXTINDEX(objPtr);
epoch = GET_INDEXEPOCH(objPtr);
@@ -425,7 +425,7 @@ TkTextMakeByteIndex(
indexPtr->byteIndex = index - sizeof(char);
break;
}
- if (index + segPtr->size > byteIndex) {
+ if (index + (int)segPtr->size > byteIndex) {
indexPtr->byteIndex = byteIndex;
if ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) {
/*
@@ -436,7 +436,7 @@ TkTextMakeByteIndex(
*/
start = segPtr->body.chars + (byteIndex - index);
- p = TkUtfPrev(start, segPtr->body.chars);
+ p = Tcl_UtfPrev(start, segPtr->body.chars);
p += TkUtfToUniChar(p, &ch);
indexPtr->byteIndex += p - start;
}
@@ -531,7 +531,7 @@ TkTextMakeCharIndex(
index += offset;
}
} else {
- if (charIndex < segPtr->size) {
+ if (charIndex < (int)segPtr->size) {
indexPtr->byteIndex = index;
break;
}
@@ -565,11 +565,11 @@ TkTextMakeCharIndex(
TkTextSegment *
TkTextIndexToSeg(
const TkTextIndex *indexPtr,/* Text index. */
- int *offsetPtr) /* Where to store offset within segment, or
+ TkSizeT *offsetPtr) /* Where to store offset within segment, or
* NULL if offset isn't wanted. */
{
TkTextSegment *segPtr;
- int offset;
+ TkSizeT offset;
for (offset = indexPtr->byteIndex, segPtr = indexPtr->linePtr->segPtr;
offset >= segPtr->size;
@@ -1086,7 +1086,7 @@ TkTextIndexAdjustToStartEnd(
*---------------------------------------------------------------------------
*/
-int
+TkSizeT
TkTextPrintIndex(
const TkText *textPtr,
const TkTextIndex *indexPtr,/* Pointer to index. */
@@ -1111,7 +1111,7 @@ TkTextPrintIndex(
linePtr = TkBTreeNextLine(NULL, linePtr);
segPtr = linePtr->segPtr;
}
- if (numBytes <= segPtr->size) {
+ if (numBytes <= (int)segPtr->size) {
break;
}
if (segPtr->typePtr == &tkTextCharType) {
@@ -1550,7 +1550,7 @@ TkTextIndexForwChars(
TkTextLine *linePtr;
TkTextSegment *segPtr;
TkTextElideInfo *infoPtr = NULL;
- int byteOffset;
+ TkSizeT byteOffset;
char *start, *end, *p;
int ch;
int elide = 0;
@@ -1738,7 +1738,7 @@ IndexCountBytesOrdered(
/* Index describing location of last character
* at which to stop the count. */
{
- int byteCount, offset;
+ TkSizeT byteCount, offset;
TkTextSegment *segPtr, *segPtr1;
TkTextLine *linePtr;
@@ -1815,7 +1815,8 @@ TkTextIndexCount(
TkTextLine *linePtr1;
TkTextSegment *segPtr, *seg2Ptr = NULL;
TkTextElideInfo *infoPtr = NULL;
- int byteOffset, maxBytes, count = 0, elide = 0;
+ TkSizeT byteOffset, maxBytes, count = 0;
+ int elide = 0;
int checkElided = (type & COUNT_DISPLAY);
/*
@@ -1905,10 +1906,10 @@ TkTextIndexCount(
}
if (segPtr->typePtr == &tkTextCharType) {
- int byteLen = segPtr->size - byteOffset;
+ TkSizeT byteLen = segPtr->size - byteOffset;
unsigned char *str = (unsigned char *)
segPtr->body.chars + byteOffset;
- int i;
+ TkSizeT i;
if (segPtr == seg2Ptr) {
if (byteLen + byteOffset > maxBytes) {
@@ -1938,7 +1939,7 @@ TkTextIndexCount(
}
} else {
if (type & COUNT_INDICES) {
- int byteLen = segPtr->size - byteOffset;
+ TkSizeT byteLen = segPtr->size - byteOffset;
if (segPtr == seg2Ptr) {
if (byteLen + byteOffset > maxBytes) {
@@ -2117,7 +2118,7 @@ TkTextIndexBackChars(
linePtr = TkBTreeNextLine(NULL, linePtr);
segPtr = linePtr->segPtr;
}
- if (segSize <= segPtr->size) {
+ if (segSize <= (int)segPtr->size) {
break;
}
segSize -= segPtr->size;
@@ -2187,7 +2188,7 @@ TkTextIndexBackChars(
if (segPtr->typePtr == &tkTextCharType) {
start = segPtr->body.chars;
end = segPtr->body.chars + segSize;
- for (p = end; ; p = TkUtfPrev(p, start)) {
+ for (p = end; ; p = Tcl_UtfPrev(p, start)) {
if (charCount == 0) {
dstPtr->byteIndex -= (end - p);
goto backwardCharDone;
@@ -2358,7 +2359,7 @@ StartEnd(
} else if ((*string == 'w') && (strncmp(string, "wordend", length) == 0)
&& (length >= 5)) {
int firstChar = 1;
- int offset;
+ TkSizeT offset;
/*
* If the current character isn't part of a word then just move
@@ -2401,7 +2402,7 @@ StartEnd(
} else if ((*string == 'w') && (strncmp(string, "wordstart", length) == 0)
&& (length >= 5)) {
int firstChar = 1;
- int offset;
+ TkSizeT offset;
if (modifier == TKINDEX_DISPLAY) {
TkTextIndexForwChars(textPtr, indexPtr, 0, indexPtr,
@@ -2426,9 +2427,9 @@ StartEnd(
if (!Tcl_UniCharIsWordChar(ch)) {
break;
}
- if (offset > 0) {
+ if (offset + 1 > 1) {
chSize = (segPtr->body.chars + offset
- - TkUtfPrev(segPtr->body.chars + offset,
+ - Tcl_UtfPrev(segPtr->body.chars + offset,
segPtr->body.chars));
}
firstChar = 0;
@@ -2445,7 +2446,7 @@ StartEnd(
indexPtr->byteIndex -= chSize;
}
offset -= chSize;
- if (offset < 0) {
+ if ((int)offset < 0) {
if (indexPtr->byteIndex == 0) {
goto done;
}
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index f77e6b4..9efa222 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -4,8 +4,8 @@
* This file contains the functions that implement marks for text
* widgets.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -19,8 +19,8 @@
* Macro that determines the size of a mark segment:
*/
-#define MSEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
- + sizeof(TkTextMark)))
+#define MSEG_SIZE (offsetof(TkTextSegment, body) \
+ + sizeof(TkTextMark))
/*
* Forward references for functions defined in this file:
@@ -36,8 +36,8 @@ static TkTextSegment * MarkCleanupProc(TkTextSegment *segPtr,
static void MarkCheckProc(TkTextSegment *segPtr,
TkTextLine *linePtr);
static int MarkLayoutProc(TkText *textPtr, TkTextIndex *indexPtr,
- TkTextSegment *segPtr, int offset, int maxX,
- int maxChars, int noCharsYet, TkWrapMode wrapMode,
+ TkTextSegment *segPtr, TkSizeT offset, int maxX,
+ TkSizeT maxChars, int noCharsYet, TkWrapMode wrapMode,
TkTextDispChunk *chunkPtr);
static int MarkFindNext(Tcl_Interp *interp,
TkText *textPtr, Tcl_Obj *markName);
@@ -126,7 +126,7 @@ TkTextMarkCmd(
switch ((enum markOptions) optionIndex) {
case MARK_GRAVITY: {
char c;
- int length;
+ TkSizeT length;
const char *str;
if (objc < 4 || objc > 5) {
@@ -547,11 +547,11 @@ MarkLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */
- TCL_UNUSED(int), /* Offset within segPtr corresponding to
+ TCL_UNUSED(TkSizeT), /* Offset within segPtr corresponding to
* indexPtr (always 0). */
TCL_UNUSED(int), /* Chunk must not occupy pixels at this
* position or higher. */
- TCL_UNUSED(int), /* Chunk must not include more than this many
+ TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many
* characters. */
TCL_UNUSED(int), /* Non-zero means no characters have been
* assigned to this line yet. */
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index c15773e..1ffa602 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -5,8 +5,8 @@
* text widgets, plus most of the other high-level functions related to
* tags.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -40,66 +40,66 @@ static const char *const tabStyleStrings[] = {
static const Tk_OptionSpec tagOptionSpecs[] = {
{TK_OPTION_BORDER, "-background", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BITMAP, "-bgstipple", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", NULL, NULL,
- NULL, Tk_Offset(TkTextTag, borderWidthPtr), Tk_Offset(TkTextTag, borderWidth),
+ NULL, offsetof(TkTextTag, borderWidthPtr), offsetof(TkTextTag, borderWidth),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0},
{TK_OPTION_STRING, "-elide", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, elideString),
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, elideString),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0},
{TK_OPTION_BITMAP, "-fgstipple", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_FONT, "-font", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, tkfont), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, tkfont), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-foreground", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-justify", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, justifyString), TK_OPTION_NULL_OK, 0,0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, justifyString), TK_OPTION_NULL_OK, 0,0},
{TK_OPTION_STRING, "-lmargin1", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,0,0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-lmargin2", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,0,0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,0,0},
{TK_OPTION_BORDER, "-lmargincolor", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-offset", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-overstrike", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, overstrikeString),
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeString),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-overstrikefg", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, overstrikeColor),
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeColor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-relief", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-rmargin", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0},
{TK_OPTION_BORDER, "-rmargincolor", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, rMarginColor), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, rMarginColor), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-selectforeground", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-spacing1", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-spacing2", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-spacing3", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, spacing3String), TK_OPTION_NULL_OK,0,0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing3String), TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-tabs", NULL, NULL,
- NULL, Tk_Offset(TkTextTag, tabStringPtr), -1, TK_OPTION_NULL_OK, 0, 0},
+ NULL, offsetof(TkTextTag, tabStringPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-tabstyle", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, tabStyle),
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, tabStyle),
TK_OPTION_NULL_OK, tabStyleStrings, 0},
{TK_OPTION_STRING, "-underline", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, underlineString),
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, underlineString),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-underlinefg", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, underlineColor),
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, underlineColor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-wrap", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextTag, wrapMode),
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, wrapMode),
TK_OPTION_NULL_OK, wrapStrings, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -343,7 +343,7 @@ TkTextTagCmd(
if (tagPtr == NULL) {
return TCL_ERROR;
}
- objPtr = Tk_GetOptionValue(interp, (char *)tagPtr,
+ objPtr = Tk_GetOptionValue(interp, tagPtr,
tagPtr->optionTable, objv[4], textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -357,12 +357,12 @@ TkTextTagCmd(
if (objc < 4) {
Tcl_WrongNumArgs(interp, 3, objv,
- "tagName ?-option? ?value? ?-option value ...?");
+ "tagName ?-option value ...?");
return TCL_ERROR;
}
tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), &newTag);
if (objc <= 5) {
- Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *)tagPtr,
+ Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, tagPtr,
tagPtr->optionTable,
(objc == 5) ? objv[4] : NULL, textPtr->tkwin);
@@ -374,7 +374,7 @@ TkTextTagCmd(
} else {
int result = TCL_OK;
- if (Tk_SetOptions(interp, (char *)tagPtr, tagPtr->optionTable,
+ if (Tk_SetOptions(interp, tagPtr, tagPtr->optionTable,
objc-4, objv+4, textPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
}
@@ -1108,7 +1108,7 @@ FindTag(
Tcl_Obj *tagName) /* Name of desired tag. */
{
Tcl_HashEntry *hPtr;
- int len;
+ TkSizeT len;
const char *str;
str = Tcl_GetStringFromObj(tagName, &len);
@@ -1457,9 +1457,9 @@ TkTextBindProc(
if (eventPtr->type == ButtonPress) {
textPtr->flags |= BUTTON_DOWN;
} else if (eventPtr->type == ButtonRelease) {
- unsigned int mask;
+ unsigned long mask;
- mask = TkGetButtonMask(eventPtr->xbutton.button);
+ mask = Tk_GetButtonMask(eventPtr->xbutton.button);
if ((eventPtr->xbutton.state & ALL_BUTTONS) == mask) {
textPtr->flags &= ~BUTTON_DOWN;
repick = 1;
@@ -1540,7 +1540,8 @@ TkTextPickCurrent(
TkTextTag **copyArrayPtr = NULL;
/* Initialization needed to prevent compiler
* warning. */
- int numOldTags, numNewTags, i, j, size, nearby;
+ int numOldTags, numNewTags, i, j, nearby;
+ size_t size;
XEvent event;
/*
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index fdd5378..d63ad32 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -5,8 +5,8 @@
* inside text widgets. It also implements the "window" widget command
* for texts.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -28,15 +28,15 @@ static void EmbWinLostContentProc(ClientData clientData,
static const Tk_GeomMgr textGeomType = {
"text", /* name */
EmbWinRequestProc, /* requestProc */
- EmbWinLostContentProc, /* lostSlaveProc */
+ EmbWinLostContentProc, /* lostContentProc */
};
/*
* Macro that determines the size of an embedded window segment:
*/
-#define EW_SEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
- + sizeof(TkTextEmbWindow)))
+#define EW_SEG_SIZE (offsetof(TkTextSegment, body) \
+ + sizeof(TkTextEmbWindow))
/*
* Prototypes for functions defined in this file:
@@ -57,7 +57,7 @@ static int EmbWinDeleteProc(TkTextSegment *segPtr,
TkTextLine *linePtr, int treeGone);
static int EmbWinLayoutProc(TkText *textPtr,
TkTextIndex *indexPtr, TkTextSegment *segPtr,
- int offset, int maxX, int maxChars,int noCharsYet,
+ TkSizeT offset, int maxX, TkSizeT maxChars,int noCharsYet,
TkWrapMode wrapMode, TkTextDispChunk *chunkPtr);
static void EmbWinStructureProc(ClientData clientData,
XEvent *eventPtr);
@@ -99,18 +99,18 @@ typedef enum {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-align", NULL, NULL,
- "center", -1, Tk_Offset(TkTextEmbWindow, align),
+ "center", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, align),
0, alignStrings, 0},
{TK_OPTION_STRING, "-create", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-padx", NULL, NULL,
- "0", -1, Tk_Offset(TkTextEmbWindow, padX), 0, 0, 0},
+ "0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, padX), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", NULL, NULL,
- "0", -1, Tk_Offset(TkTextEmbWindow, padY), 0, 0, 0},
+ "0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, padY), 0, 0, 0},
{TK_OPTION_BOOLEAN, "-stretch", NULL, NULL,
- "0", -1, Tk_Offset(TkTextEmbWindow, stretch), 0, 0, 0},
+ "0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, stretch), 0, 0, 0},
{TK_OPTION_WINDOW, "-window", NULL, NULL,
- NULL, -1, Tk_Offset(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -190,7 +190,7 @@ TkTextWindowCmd(
ewPtr->body.ew.tkwin = NULL;
}
- objPtr = Tk_GetOptionValue(interp, (char *)&ewPtr->body.ew,
+ objPtr = Tk_GetOptionValue(interp, &ewPtr->body.ew,
ewPtr->body.ew.optionTable, objv[4], textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -231,7 +231,7 @@ TkTextWindowCmd(
ewPtr->body.ew.tkwin = NULL;
}
- objPtr = Tk_GetOptionInfo(interp, (char *)&ewPtr->body.ew,
+ objPtr = Tk_GetOptionInfo(interp, &ewPtr->body.ew,
ewPtr->body.ew.optionTable, (objc == 5) ? objv[4] : NULL,
textPtr->tkwin);
if (objPtr == NULL) {
@@ -401,7 +401,7 @@ EmbWinConfigure(
}
oldWindow = ewPtr->body.ew.tkwin;
- if (Tk_SetOptions(textPtr->interp, (char *)&ewPtr->body.ew,
+ if (Tk_SetOptions(textPtr->interp, &ewPtr->body.ew,
ewPtr->body.ew.optionTable, objc, objv, textPtr->tkwin, NULL,
NULL) != TCL_OK) {
return TCL_ERROR;
@@ -817,11 +817,11 @@ EmbWinLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */
- int offset, /* Offset within segPtr corresponding to
+ TkSizeT offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- TCL_UNUSED(int), /* Chunk must not include more than this many
+ TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many
* characters. */
int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
@@ -1053,7 +1053,7 @@ EmbWinCheckProc(
Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line");
}
if (ewPtr->size != 1) {
- Tcl_Panic("EmbWinCheckProc: embedded window has size %d", ewPtr->size);
+ Tcl_Panic("EmbWinCheckProc: embedded window has size %d", (int)ewPtr->size);
}
}
diff --git a/generic/tkTrig.c b/generic/tkTrig.c
index 2e11db0..cac28e4 100644
--- a/generic/tkTrig.c
+++ b/generic/tkTrig.c
@@ -5,8 +5,8 @@
* are used by Tk and in particular by the canvas code. It also has
* miscellaneous geometry functions used by canvases.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -282,7 +282,6 @@ TkLineToArea(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
int
TkThickPolyLineToArea(
double *coordPtr, /* Points to an array of coordinates for the
@@ -652,7 +651,6 @@ TkPolygonToArea(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
double
TkOvalToPoint(
double ovalPtr[], /* Pointer to array of four coordinates (x1,
@@ -867,7 +865,6 @@ TkOvalToArea(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
void
TkIncludePoint(
Tk_Item *itemPtr, /* Item whose bounding box is being
diff --git a/generic/tkUndo.c b/generic/tkUndo.c
index 7494332..97ac25b 100644
--- a/generic/tkUndo.c
+++ b/generic/tkUndo.c
@@ -3,8 +3,8 @@
*
* This module provides the implementation of an undo stack.
*
- * Copyright (c) 2002 by Ludwig Callewaert.
- * Copyright (c) 2003-2004 by Vincent Darley.
+ * Copyright © 2002 Ludwig Callewaert.
+ * Copyright © 2003-2004 Vincent Darley.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkUndo.h b/generic/tkUndo.h
index 490ede9..c5cc37e 100644
--- a/generic/tkUndo.h
+++ b/generic/tkUndo.h
@@ -3,7 +3,7 @@
*
* Declarations shared among the files that implement an undo stack.
*
- * Copyright (c) 2002 Ludwig Callewaert.
+ * Copyright © 2002 Ludwig Callewaert.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 375bb83..da2ce95 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -4,8 +4,8 @@
* This file contains miscellaneous utility functions that are used by
* the rest of Tk, such as a function for drawing a focus highlight.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -48,10 +48,10 @@ int
TkStateParseProc(
ClientData clientData, /* some flags.*/
Tcl_Interp *interp, /* Used for reporting errors. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
- int offset) /* Offset into item. */
+ TkSizeT offset) /* Offset into item. */
{
int c;
int flags = PTR2INT(clientData);
@@ -125,11 +125,11 @@ TkStateParseProc(
const char *
TkStatePrintProc(
- ClientData clientData, /* Ignored. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(void *), /* Ignored. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
- int offset, /* Offset into item. */
- Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ TkSizeT offset, /* Offset into item. */
+ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
@@ -169,12 +169,12 @@ TkStatePrintProc(
int
TkOrientParseProc(
- ClientData clientData, /* some flags.*/
+ TCL_UNUSED(void *), /* some flags.*/
Tcl_Interp *interp, /* Used for reporting errors. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
- int offset) /* Offset into item. */
+ TkSizeT offset) /* Offset into item. */
{
int c;
size_t length;
@@ -227,11 +227,11 @@ TkOrientParseProc(
const char *
TkOrientPrintProc(
- ClientData clientData, /* Ignored. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(void *), /* Ignored. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
- int offset, /* Offset into item. */
- Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ TkSizeT offset, /* Offset into item. */
+ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
@@ -262,7 +262,7 @@ TkOffsetParseProc(
Tk_Window tkwin, /* Window on same display as tile */
const char *value, /* Name of image */
char *widgRec, /* Widget structure record */
- int offset) /* Offset of tile in record */
+ TkSizeT offset) /* Offset of tile in record */
{
Tk_TSOffset *offsetPtr = (Tk_TSOffset *) (widgRec + offset);
Tk_TSOffset tsoffset;
@@ -409,10 +409,10 @@ TkOffsetParseProc(
const char *
TkOffsetPrintProc(
- ClientData clientData, /* not used */
- Tk_Window tkwin, /* not used */
+ TCL_UNUSED(void *), /* not used */
+ TCL_UNUSED(Tk_Window), /* not used */
char *widgRec, /* Widget structure record */
- int offset, /* Offset of tile in record */
+ TkSizeT offset, /* Offset of tile in record */
Tcl_FreeProc **freeProcPtr) /* not used */
{
Tk_TSOffset *offsetPtr = (Tk_TSOffset *) (widgRec + offset);
@@ -479,7 +479,7 @@ TkPixelParseProc(
Tk_Window tkwin, /* Window on same display as tile */
const char *value, /* Name of image */
char *widgRec, /* Widget structure record */
- int offset) /* Offset of tile in record */
+ TkSizeT offset) /* Offset of tile in record */
{
double *doublePtr = (double *) (widgRec + offset);
int result;
@@ -510,10 +510,10 @@ TkPixelParseProc(
const char *
TkPixelPrintProc(
- ClientData clientData, /* not used */
- Tk_Window tkwin, /* not used */
+ TCL_UNUSED(void *), /* not used */
+ TCL_UNUSED(Tk_Window), /* not used */
char *widgRec, /* Widget structure record */
- int offset, /* Offset of tile in record */
+ TkSizeT offset, /* Offset of tile in record */
Tcl_FreeProc **freeProcPtr) /* not used */
{
double *doublePtr = (double *) (widgRec + offset);
@@ -664,16 +664,18 @@ Tk_GetScrollInfo(
return TK_SCROLL_MOVETO;
} else if ((c == 's')
&& (strncmp(argv[2], "scroll", length) == 0)) {
+ double d;
if (argc != 5) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"wrong # args: should be \"%s %s %s\"",
- argv[0], argv[1], "scroll number units|pages"));
+ argv[0], argv[1], "scroll number pages|units"));
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
return TK_SCROLL_ERROR;
}
- if (Tcl_GetInt(interp, argv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDouble(interp, argv[3], &d) != TCL_OK) {
return TK_SCROLL_ERROR;
}
+ *intPtr = (d > 0) ? ceil(d) : floor(d);
length = strlen(argv[4]);
c = argv[4][0];
if ((c == 'p') && (strncmp(argv[4], "pages", length) == 0)) {
@@ -683,7 +685,7 @@ Tk_GetScrollInfo(
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad argument \"%s\": must be units or pages", argv[4]));
+ "bad argument \"%s\": must be pages or units", argv[4]));
Tcl_SetErrorCode(interp, "TK", "VALUE", "SCROLL_UNITS", NULL);
return TK_SCROLL_ERROR;
}
@@ -728,8 +730,8 @@ Tk_GetScrollInfoObj(
int *intPtr) /* Filled in with number of pages or lines to
* scroll, if any. */
{
- const char *arg = Tcl_GetString(objv[2]);
- size_t length = objv[2]->length;
+ TkSizeT length;
+ const char *arg = Tcl_GetStringFromObj(objv[2], &length);
#define ArgPfxEq(str) \
((arg[0] == str[0]) && !strncmp(arg, str, length))
@@ -744,16 +746,20 @@ Tk_GetScrollInfoObj(
}
return TK_SCROLL_MOVETO;
} else if (ArgPfxEq("scroll")) {
+ double d;
if (objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "scroll number units|pages");
+ Tcl_WrongNumArgs(interp, 2, objv, "scroll number pages|units");
return TK_SCROLL_ERROR;
}
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) {
return TK_SCROLL_ERROR;
}
+ *intPtr = (d >= 0) ? ceil(d) : floor(d);
+ if (dblPtr) {
+ *dblPtr = d;
+ }
- arg = Tcl_GetString(objv[4]);
- length = objv[4]->length;
+ arg = Tcl_GetStringFromObj(objv[4], &length);
if (ArgPfxEq("pages")) {
return TK_SCROLL_PAGES;
} else if (ArgPfxEq("units")) {
@@ -761,7 +767,7 @@ Tk_GetScrollInfoObj(
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad argument \"%s\": must be units or pages", arg));
+ "bad argument \"%s\": must be pages or units", arg));
Tcl_SetErrorCode(interp, "TK", "VALUE", "SCROLL_UNITS", NULL);
return TK_SCROLL_ERROR;
}
@@ -1158,7 +1164,7 @@ TkMakeEnsemble(
/*
*----------------------------------------------------------------------
*
- * TkSendVirtualEvent --
+ * Tk_SendVirtualEvent --
*
* Send a virtual event notification to the specified target window.
* Equivalent to:
@@ -1171,7 +1177,7 @@ TkMakeEnsemble(
*/
void
-TkSendVirtualEvent(
+Tk_SendVirtualEvent(
Tk_Window target,
const char *eventName,
Tcl_Obj *detail)
@@ -1211,7 +1217,7 @@ TkSendVirtualEvent(
*---------------------------------------------------------------------------
*/
-int
+size_t
TkUtfToUniChar(
const char *src, /* The UTF-8 string. */
int *chPtr) /* Filled with the Unicode value represented by
@@ -1219,7 +1225,7 @@ TkUtfToUniChar(
{
Tcl_UniChar uniChar = 0;
- int len = Tcl_UtfToUniChar(src, &uniChar);
+ size_t len = Tcl_UtfToUniChar(src, &uniChar);
if ((uniChar & 0xFC00) == 0xD800) {
Tcl_UniChar low = uniChar;
/* This can only happen if sizeof(Tcl_UniChar)== 2 and src points
@@ -1253,7 +1259,7 @@ TkUtfToUniChar(
*---------------------------------------------------------------------------
*/
-int TkUniCharToUtf(int ch, char *buf)
+size_t TkUniCharToUtf(int ch, char *buf)
{
if ((unsigned)(ch - 0x10000) <= 0xFFFFF) {
/* Spit out a 4-byte UTF-8 character or 2 x 3-byte UTF-8 characters, depending on Tcl
@@ -1263,74 +1269,6 @@ int TkUniCharToUtf(int ch, char *buf)
}
return Tcl_UniCharToUtf(ch, buf);
}
-/*
- *---------------------------------------------------------------------------
- *
- * TkUtfPrev --
- *
- * Almost the same as Tcl_UtfPrev.
- * This function is capable of jumping over a upper/lower surrogate pair.
- * So, might jump back up to 6 bytes.
- *
- * Results:
- * pointer to the first byte of the current UTF-8 character. A surrogate
- * pair is also handled as being a single entity.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-const char *
-TkUtfPrev(
- const char *src, /* The UTF-8 string. */
- const char *start) /* Start position of string */
-{
- const char *p = Tcl_UtfPrev(src, start);
- const char *first = Tcl_UtfPrev(p, start);
- int ch;
-
-#if TCL_UTF_MAX == 3
- if ((src - start > 3) && ((src[-1] & 0xC0) == 0x80) && ((src[-2] & 0xC0) == 0x80)
- && ((src[-3] & 0xC0) == 0x80) && (UCHAR(src[-4]) >= 0xF0)) {
- return src - 4;
- }
-#endif
-
- return (first + TkUtfToUniChar(first, &ch) >= src) ? first : p ;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * TkUtfAtIndex --
- *
- * Returns a pointer to the specified character (not byte) position in
- * a CESU-8 string. This will never point at a low surrogate.
- *
- * Results:
- * As above.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-const char *
-TkUtfAtIndex(
- const char *src, /* The UTF-8 string. */
- int index) /* The position of the desired character. */
-{
- int ch;
- const char *p = Tcl_UtfAtIndex(src, index);
- if ((p > src) && (UCHAR(p[-1]) >= 0xF0)) {
- --p;
- return p + TkUtfToUniChar(p, &ch);
- }
- return p;
-}
#endif
/*
* Local Variables:
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index 9324499..09d1fa1 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -5,8 +5,8 @@
* visuals and colormaps. This code is based on a prototype
* implementation by Paul Mackerras.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -20,10 +20,10 @@
*/
typedef struct VisualDictionary {
- const char *name; /* Textual name of class. */
- int minLength; /* Minimum # characters that must be specified
+ char name[12]; /* Textual name of class. */
+ unsigned short minLength; /* Minimum # characters that must be specified
* for an unambiguous match. */
- int c_class; /* X symbol for class. */
+ short c_class; /* X symbol for class. */
} VisualDictionary;
static const VisualDictionary visualNames[] = {
{"best", 1, 0},
@@ -35,7 +35,7 @@ static const VisualDictionary visualNames[] = {
{"staticgray", 7, StaticGray},
{"staticgrey", 7, StaticGray},
{"truecolor", 1, TrueColor},
- {NULL, 0, 0},
+ {"", 0, 0},
};
/*
@@ -46,7 +46,7 @@ static const VisualDictionary visualNames[] = {
struct TkColormap {
Colormap colormap; /* X's identifier for the colormap. */
Visual *visual; /* Visual for which colormap was allocated. */
- int refCount; /* How many uses of the colormap are still
+ size_t refCount; /* How many uses of the colormap are still
* outstanding (calls to Tk_GetColormap minus
* calls to Tk_FreeColormap). */
int shareable; /* 0 means this colormap was allocated by a
@@ -193,8 +193,8 @@ Tk_GetVisual(
}
length = p - string;
templ.c_class = -1;
- for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) {
- if ((dictPtr->name[0] == c) && (length >= (size_t)dictPtr->minLength)
+ for (dictPtr = visualNames; dictPtr->minLength; dictPtr++) {
+ if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength)
&& (strncmp(string, dictPtr->name, length) == 0)) {
templ.c_class = dictPtr->c_class;
break;
@@ -205,7 +205,7 @@ Tk_GetVisual(
"unknown or ambiguous visual name \"%s\": class must be ",
string);
- for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) {
+ for (dictPtr = visualNames; dictPtr->minLength; dictPtr++) {
Tcl_AppendPrintfToObj(msgObj, "%s, ", dictPtr->name);
}
Tcl_AppendToObj(msgObj, "or default", -1);
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index f48e469..dcaaf69 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -5,8 +5,8 @@
* equivalent to functions in Xlib (and even invoke them) but also
* maintain the local Tk_Window structure.
*
- * Copyright (c) 1989-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1989-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -240,8 +240,6 @@ TkCloseDisplay(
{
TkClipCleanup(dispPtr);
- TkpCancelWarp(dispPtr);
-
if (dispPtr->name != NULL) {
ckfree(dispPtr->name);
}
@@ -320,7 +318,7 @@ CreateTopLevelWindow(
TkWindow *winPtr;
TkDisplay *dispPtr;
int screenId;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
@@ -337,9 +335,11 @@ CreateTopLevelWindow(
* Create built-in photo image formats.
*/
- Tk_CreatePhotoImageFormat(&tkImgFmtGIF);
- Tk_CreatePhotoImageFormat(&tkImgFmtPNG);
+ Tk_CreatePhotoImageFormat(&tkImgFmtDefault);
+ Tk_CreatePhotoImageFormatVersion3(&tkImgFmtGIF);
+ Tk_CreatePhotoImageFormatVersion3(&tkImgFmtPNG);
Tk_CreatePhotoImageFormat(&tkImgFmtPPM);
+ Tk_CreatePhotoImageFormat(&tkImgFmtSVGnano);
}
if ((parent != NULL) && (screenName != NULL) && (screenName[0] == '\0')) {
@@ -358,9 +358,7 @@ CreateTopLevelWindow(
* Set the flags specified in the call.
*/
-#ifdef TK_USE_INPUT_METHODS
winPtr->ximGeneration = 0;
-#endif /*TK_USE_INPUT_METHODS*/
winPtr->flags |= flags;
/*
@@ -424,7 +422,7 @@ GetScreen(
const char *p;
int screenId;
size_t length;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -488,7 +486,7 @@ GetScreen(
Tcl_InitHashTable(&dispPtr->winTable, TCL_ONE_WORD_KEYS);
- dispPtr->name = ckalloc(length + 1);
+ dispPtr->name = (char *)ckalloc(length + 1);
strncpy(dispPtr->name, screenName, length);
dispPtr->name[length] = '\0';
break;
@@ -531,7 +529,7 @@ TkGetDisplay(
Display *display) /* X's display pointer */
{
TkDisplay *dispPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (dispPtr = tsdPtr->displayList; dispPtr != NULL;
@@ -564,7 +562,7 @@ TkGetDisplay(
TkDisplay *
TkGetDisplayList(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->displayList;
@@ -591,7 +589,7 @@ TkGetDisplayList(void)
TkMainInfo *
TkGetMainInfoList(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->mainWindowList;
@@ -621,7 +619,7 @@ TkAllocWindow(
* inherit visual information. NULL means use
* screen defaults instead of inheriting. */
{
- TkWindow *winPtr = ckalloc(sizeof(TkWindow));
+ TkWindow *winPtr = (TkWindow *)ckalloc(sizeof(TkWindow));
winPtr->display = dispPtr->display;
winPtr->dispPtr = dispPtr;
@@ -655,10 +653,8 @@ TkAllocWindow(
winPtr->dirtyAtts = CWEventMask|CWColormap|CWBitGravity;
winPtr->flags = 0;
winPtr->handlerList = NULL;
-#ifdef TK_USE_INPUT_METHODS
winPtr->ximGeneration = 0;
winPtr->inputContext = NULL;
-#endif /* TK_USE_INPUT_METHODS */
winPtr->tagPtr = NULL;
winPtr->numTags = 0;
winPtr->optionLevel = -1;
@@ -772,7 +768,7 @@ NameWindow(
if ((length1 + length2 + 2) <= FIXED_SIZE) {
pathName = staticSpace;
} else {
- pathName = ckalloc(length1 + length2 + 2);
+ pathName = (char *)ckalloc(length1 + length2 + 2);
}
if (length1 == 1) {
pathName[0] = '.';
@@ -794,7 +790,7 @@ NameWindow(
return TCL_ERROR;
}
Tcl_SetHashValue(hPtr, winPtr);
- winPtr->pathName = Tcl_GetHashKey(&parentPtr->mainPtr->nameTable, hPtr);
+ winPtr->pathName = (char *)Tcl_GetHashKey(&parentPtr->mainPtr->nameTable, hPtr);
return TCL_OK;
}
@@ -837,7 +833,7 @@ TkCreateMainWindow(
TkWindow *winPtr;
const TkCmd *cmdPtr;
ClientData clientData;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -865,7 +861,7 @@ TkCreateMainWindow(
*/
winPtr = (TkWindow *) tkwin;
- mainPtr = ckalloc(sizeof(TkMainInfo));
+ mainPtr = (TkMainInfo *)ckalloc(sizeof(TkMainInfo));
mainPtr->winPtr = winPtr;
mainPtr->refCount = 1;
mainPtr->interp = interp;
@@ -899,7 +895,7 @@ TkCreateMainWindow(
winPtr->mainPtr = mainPtr;
hPtr = Tcl_CreateHashEntry(&mainPtr->nameTable, ".", &dummy);
Tcl_SetHashValue(hPtr, winPtr);
- winPtr->pathName = Tcl_GetHashKey(&mainPtr->nameTable, hPtr);
+ winPtr->pathName = (char *)Tcl_GetHashKey(&mainPtr->nameTable, hPtr);
Tcl_InitHashTable(&mainPtr->busyTable, TCL_ONE_WORD_KEYS);
/*
@@ -928,7 +924,7 @@ TkCreateMainWindow(
}
#if defined(_WIN32) && !defined(STATIC_BUILD)
- if ((cmdPtr->flags & WINMACONLY) && tclStubsPtr->reserved9) {
+ if ((cmdPtr->flags & WINMACONLY) && tclStubsPtr->tcl_CreateFileHandler) {
/*
* We are running on Cygwin, so don't use the win32 dialogs.
*/
@@ -959,7 +955,7 @@ TkCreateMainWindow(
}
/*
- * Set variables for the intepreter.
+ * Set variables for the interpreter.
*/
Tcl_SetVar2(interp, "tk_patchLevel", NULL, TK_PATCH_LEVEL, TCL_GLOBAL_ONLY);
@@ -1145,7 +1141,7 @@ Tk_CreateWindowFromPath(
char fixedSpace[FIXED_SPACE+1];
char *p;
Tk_Window parent;
- int numChars;
+ size_t numChars;
/*
* Strip the parent's name out of pathName (it's everything up to the last
@@ -1155,16 +1151,16 @@ Tk_CreateWindowFromPath(
* the situation where the parent is ".".
*/
- p = strrchr(pathName, '.');
+ p = (char *)strrchr(pathName, '.');
if (p == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad window path name \"%s\"", pathName));
Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL);
return NULL;
}
- numChars = (int) (p-pathName);
+ numChars = p-pathName;
if (numChars > FIXED_SPACE) {
- p = ckalloc(numChars + 1);
+ p = (char *)ckalloc(numChars + 1);
} else {
p = fixedSpace;
}
@@ -1172,7 +1168,7 @@ Tk_CreateWindowFromPath(
*p = '.';
p[1] = '\0';
} else {
- strncpy(p, pathName, (size_t) numChars);
+ strncpy(p, pathName, numChars);
p[numChars] = '\0';
}
@@ -1249,7 +1245,7 @@ Tk_DestroyWindow(
TkDisplay *dispPtr = winPtr->dispPtr;
XEvent event;
TkHalfdeadWindow *halfdeadPtr, *prev_halfdeadPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_ALREADY_DEAD) {
@@ -1272,7 +1268,7 @@ Tk_DestroyWindow(
(tsdPtr->halfdeadWindowList->winPtr == winPtr)) {
halfdeadPtr = tsdPtr->halfdeadWindowList;
} else {
- halfdeadPtr = ckalloc(sizeof(TkHalfdeadWindow));
+ halfdeadPtr = (TkHalfdeadWindow *)ckalloc(sizeof(TkHalfdeadWindow));
halfdeadPtr->flags = 0;
halfdeadPtr->winPtr = winPtr;
halfdeadPtr->nextPtr = tsdPtr->halfdeadWindowList;
@@ -1452,18 +1448,16 @@ Tk_DestroyWindow(
}
#endif
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->winTable,
- (char *) winPtr->window));
+ winPtr->window));
winPtr->window = None;
}
UnlinkWindow(winPtr);
TkEventDeadWindow(winPtr);
-#ifdef TK_USE_INPUT_METHODS
if (winPtr->inputContext != NULL &&
- winPtr->ximGeneration == winPtr->dispPtr->ximGeneration) {
+ winPtr->ximGeneration == winPtr->dispPtr->ximGeneration) {
XDestroyIC(winPtr->inputContext);
}
winPtr->inputContext = NULL;
-#endif /* TK_USE_INPUT_METHODS */
if (winPtr->tagPtr != NULL) {
TkFreeBindingTags(winPtr);
}
@@ -2091,11 +2085,7 @@ Tk_DefineCursor(
{
TkWindow *winPtr = (TkWindow *) tkwin;
-#if defined(MAC_OSX_TK)
- winPtr->atts.cursor = (XCursor) cursor;
-#else
winPtr->atts.cursor = (Cursor) cursor;
-#endif
if (winPtr->window != None) {
XDefineCursor(winPtr->display, winPtr->window, winPtr->atts.cursor);
@@ -2339,7 +2329,7 @@ Tk_NameToWindow(
}
return NULL;
}
- return Tcl_GetHashValue(hPtr);
+ return (Tk_Window)Tcl_GetHashValue(hPtr);
}
/*
@@ -2381,11 +2371,11 @@ Tk_IdToWindow(
return NULL;
}
- hPtr = Tcl_FindHashEntry(&dispPtr->winTable, (char *) window);
+ hPtr = Tcl_FindHashEntry(&dispPtr->winTable, window);
if (hPtr == NULL) {
return NULL;
}
- return Tcl_GetHashValue(hPtr);
+ return (Tk_Window)Tcl_GetHashValue(hPtr);
}
/*
@@ -2643,7 +2633,7 @@ Tk_MainWindow(
return NULL;
}
#endif
- tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (mainPtr = tsdPtr->mainWindowList; mainPtr != NULL;
mainPtr = mainPtr->nextPtr) {
@@ -2713,7 +2703,7 @@ Tk_GetNumMainWindows(void)
}
#endif
- tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->numMainWindows;
}
@@ -2721,7 +2711,7 @@ Tk_GetNumMainWindows(void)
/*
*----------------------------------------------------------------------
*
- * TkpAlwaysShowSelection --
+ * Tk_AlwaysShowSelection --
*
* Indicates whether text/entry widgets should always display
* their selection, regardless of window focus.
@@ -2739,7 +2729,7 @@ Tk_GetNumMainWindows(void)
*/
int
-TkpAlwaysShowSelection(
+Tk_AlwaysShowSelection(
Tk_Window tkwin) /* Window whose application is to be
* checked. */
{
@@ -2771,7 +2761,7 @@ DeleteWindowsExitProc(
{
TkDisplay *dispPtr, *nextPtr;
Tcl_Interp *interp;
- ThreadSpecificData *tsdPtr = clientData;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)clientData;
if (tsdPtr == NULL) {
return;
@@ -2853,7 +2843,7 @@ static HMODULE tkcygwindll = NULL;
/*
* Run Tk_MainEx from libtk8.?.dll
*
- * This function is only ever called from wish8.4.exe, the cygwin port of Tcl.
+ * This function is only ever called from wish8.?.exe, the cygwin port of Tcl.
* This means that the system encoding is utf-8, so we don't have to do any
* encoding conversions.
*/
@@ -2869,7 +2859,7 @@ TkCygwinMainEx(
Tcl_Interp *interp)
{
WCHAR name[MAX_PATH];
- int len;
+ size_t len;
void (*tkmainex)(int, char **, Tcl_AppInitProc *, Tcl_Interp *);
/* construct "<path>/libtk8.?.dll", from "<path>/tk8?.dll" */
@@ -3034,6 +3024,8 @@ CopyValue(
Tcl_Obj *objPtr,
void *dstPtr)
{
+ (void)dummy;
+
*(Tcl_Obj **)dstPtr = objPtr;
return 1;
}
@@ -3060,17 +3052,17 @@ Initialize(
const Tcl_ArgvInfo table[] = {
{TCL_ARGV_CONSTANT, "-sync", INT2PTR(1), &sync,
"Use synchronous mode for display server", NULL},
- {TCL_ARGV_FUNC, "-colormap", CopyValue, &colorMapObj,
+ {TCL_ARGV_FUNC, "-colormap", (void *)CopyValue, &colorMapObj,
"Colormap for main window", NULL},
- {TCL_ARGV_FUNC, "-display", CopyValue, &displayObj,
+ {TCL_ARGV_FUNC, "-display", (void *)CopyValue, &displayObj,
"Display to use", NULL},
- {TCL_ARGV_FUNC, "-geometry", CopyValue, &geometryObj,
+ {TCL_ARGV_FUNC, "-geometry", (void *)CopyValue, &geometryObj,
"Initial geometry for window", NULL},
- {TCL_ARGV_FUNC, "-name", CopyValue, &nameObj,
+ {TCL_ARGV_FUNC, "-name", (void *)CopyValue, &nameObj,
"Name to use for application", NULL},
- {TCL_ARGV_FUNC, "-visual", CopyValue, &visualObj,
+ {TCL_ARGV_FUNC, "-visual", (void *)CopyValue, &visualObj,
"Visual for main window", NULL},
- {TCL_ARGV_FUNC, "-use", CopyValue, &useObj,
+ {TCL_ARGV_FUNC, "-use", (void *)CopyValue, &useObj,
"Id of window in which to embed application", NULL},
TCL_ARGV_AUTO_REST, TCL_ARGV_AUTO_HELP, TCL_ARGV_TABLE_END
};
@@ -3079,17 +3071,23 @@ Initialize(
* Ensure that we are getting a compatible version of Tcl.
*/
- if (Tcl_InitStubs(interp, "8.6", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
return TCL_ERROR;
}
/*
+ * TIP #59: Make embedded configuration information available.
+ */
+
+ TkInitEmbeddedConfigurationInformation(interp);
+
+ /*
* Ensure that our obj-types are registered with the Tcl runtime.
*/
TkRegisterObjTypes();
- tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* We start by resetting the result because it might not be clean.
@@ -3117,7 +3115,7 @@ Initialize(
if (parent == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"no controlling parent interpreter", -1));
- Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_MASTER", NULL);
+ Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_PARENT", NULL);
return TCL_ERROR;
}
}
@@ -3189,7 +3187,7 @@ Initialize(
Tcl_SetVar2Ex(interp, "argv", NULL,
Tcl_NewListObj(objc-1, rest+1), TCL_GLOBAL_ONLY);
Tcl_SetVar2Ex(interp, "argc", NULL,
- Tcl_NewIntObj(objc-1), TCL_GLOBAL_ONLY);
+ Tcl_NewWideIntObj(objc-1), TCL_GLOBAL_ONLY);
ckfree(rest);
}
Tcl_DecrRefCount(parseList);
@@ -3221,7 +3219,7 @@ Initialize(
*/
{
- int numBytes;
+ TkSizeT numBytes;
const char *bytes = Tcl_GetStringFromObj(nameObj, &numBytes);
classObj = Tcl_NewStringObj(bytes, numBytes);
@@ -3304,10 +3302,14 @@ Initialize(
}
/*
- * Provide Tk and its stub table.
+ * Provide "tk" and its stub table.
*/
- code = Tcl_PkgProvideEx(interp, "Tk", TK_PATCH_LEVEL,
+#ifndef TK_NO_DEPRECATED
+ Tcl_PkgProvideEx(interp, "Tk", TK_PATCH_LEVEL,
+ (ClientData) &tkStubs);
+#endif
+ code = Tcl_PkgProvideEx(interp, "tk", TK_PATCH_LEVEL,
(ClientData) &tkStubs);
if (code != TCL_OK) {
goto done;
@@ -3402,7 +3404,7 @@ Tk_PkgInitStubsCheck(
const char * version,
int exact)
{
- const char *actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 0, NULL);
+ const char *actualVersion = Tcl_PkgRequireEx(interp, "tk", version, 0, NULL);
if (exact && actualVersion) {
const char *p = version;
@@ -3414,11 +3416,11 @@ Tk_PkgInitStubsCheck(
if (count == 1) {
if (0 != strncmp(version, actualVersion, strlen(version))) {
/* Construct error message */
- Tcl_PkgPresentEx(interp, "Tk", version, 1, NULL);
+ Tcl_PkgPresentEx(interp, "tk", version, 1, NULL);
return NULL;
}
} else {
- return Tcl_PkgPresentEx(interp, "Tk", version, 1, NULL);
+ return Tcl_PkgPresentEx(interp, "tk", version, 1, NULL);
}
}
return actualVersion;
diff --git a/generic/ttk/ttk.decls b/generic/ttk/ttk.decls
index e668a2a..1c98b23 100644
--- a/generic/ttk/ttk.decls
+++ b/generic/ttk/ttk.decls
@@ -25,7 +25,7 @@ declare 5 {
int Ttk_RegisterElementSpec(
Ttk_Theme theme,
const char *elementName,
- Ttk_ElementSpec *elementSpec,
+ const Ttk_ElementSpec *elementSpec,
void *clientData)
}
@@ -34,7 +34,7 @@ declare 6 {
Tcl_Interp *interp,
Ttk_Theme theme,
const char *elementName,
- Ttk_ElementSpec *elementSpec,
+ const Ttk_ElementSpec *elementSpec,
void *clientData)
}
@@ -72,7 +72,7 @@ declare 13 {
}
declare 14 {
int Ttk_StateTableLookup(
- Ttk_StateTable map[], Ttk_State state)
+ const Ttk_StateTable *map, Ttk_State state)
}
@@ -143,7 +143,7 @@ declare 35 {
#
# Utilities.
#
-declare 40 {
+declare 40 {deprecated {}} {
int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient)
}
diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c
index a7d4a9a..fc48af9 100644
--- a/generic/ttk/ttkBlink.c
+++ b/generic/ttk/ttkBlink.c
@@ -34,9 +34,11 @@ typedef struct
/* CursorManagerDeleteProc --
* InterpDeleteProc for cursor manager.
*/
-static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp)
+static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *dummy)
{
CursorManager *cm = (CursorManager*)clientData;
+ (void)dummy;
+
if (cm->timer) {
Tcl_DeleteTimerHandler(cm->timer);
}
@@ -49,10 +51,10 @@ static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp)
static CursorManager *GetCursorManager(Tcl_Interp *interp)
{
static const char *cm_key = "ttk::CursorManager";
- CursorManager *cm = Tcl_GetAssocData(interp, cm_key,0);
+ CursorManager *cm = (CursorManager *)Tcl_GetAssocData(interp, cm_key,0);
if (!cm) {
- cm = ckalloc(sizeof(*cm));
+ cm = (CursorManager *)ckalloc(sizeof(*cm));
cm->timer = 0;
cm->owner = 0;
cm->onTime = DEF_CURSOR_ON_TIME;
@@ -68,7 +70,7 @@ static CursorManager *GetCursorManager(Tcl_Interp *interp)
static void
CursorBlinkProc(ClientData clientData)
{
- CursorManager *cm = (CursorManager*)clientData;
+ CursorManager *cm = (CursorManager *)clientData;
int blinkTime;
if (cm->owner->flags & CURSOR_ON) {
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index f4ef7bc..5c5e353 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003, Joe English
*
* label, button, checkbutton, radiobutton, and menubutton widgets.
*/
@@ -22,6 +22,7 @@ typedef struct
* Text element resources:
*/
Tcl_Obj *textObj;
+ Tcl_Obj *justifyObj;
Tcl_Obj *textVariableObj;
Tcl_Obj *underlineObj;
Tcl_Obj *widthObj;
@@ -53,45 +54,48 @@ typedef struct
BasePart base;
} Base;
-static Tk_OptionSpec BaseOptionSpecs[] =
+static const Tk_OptionSpec BaseOptionSpecs[] =
{
+ {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
+ "left", offsetof(Base,base.justifyObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-text", "text", "Text", "",
- Tk_Offset(Base,base.textObj), -1,
+ offsetof(Base,base.textObj), TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", "",
- Tk_Offset(Base,base.textVariableObj), -1,
+ offsetof(Base,base.textVariableObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_INT, "-underline", "underline", "Underline",
- "-1", Tk_Offset(Base,base.underlineObj), -1,
+ "-1", offsetof(Base,base.underlineObj), TCL_INDEX_NONE,
0,0,0 },
/* SB: OPTION_INT, see <<NOTE-NULLOPTIONS>> */
{TK_OPTION_STRING, "-width", "width", "Width",
- NULL, Tk_Offset(Base,base.widthObj), -1,
+ NULL, offsetof(Base,base.widthObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
/*
* Image options
*/
{TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/,
- Tk_Offset(Base,base.imageObj), -1,
+ offsetof(Base,base.imageObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
/*
* Compound base/image options
*/
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- NULL, Tk_Offset(Base,base.compoundObj), -1,
- TK_OPTION_NULL_OK, (void *)ttkCompoundStrings,
- GEOMETRY_CHANGED },
+ NULL, offsetof(Base,base.compoundObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK, (void *)ttkCompoundStrings,
+ GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-padding", "padding", "Pad",
- NULL, Tk_Offset(Base,base.paddingObj), -1,
+ NULL, offsetof(Base,base.paddingObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED},
/*
* Compatibility/legacy options
*/
{TK_OPTION_STRING, "-state", "state", "State",
- "normal", Tk_Offset(Base,base.stateObj), -1,
+ "normal", offsetof(Base,base.stateObj), TCL_INDEX_NONE,
0,0,STATE_CHANGED },
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -237,31 +241,31 @@ typedef struct
LabelPart label;
} Label;
-static Tk_OptionSpec LabelOptionSpecs[] =
+static const Tk_OptionSpec LabelOptionSpecs[] =
{
{TK_OPTION_BORDER, "-background", "frameColor", "FrameColor",
- NULL, Tk_Offset(Label,label.backgroundObj), -1,
+ NULL, offsetof(Label,label.backgroundObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
- NULL, Tk_Offset(Label,label.foregroundObj), -1,
+ NULL, offsetof(Label,label.foregroundObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_FONT, "-font", "font", "Font",
- NULL, Tk_Offset(Label,label.fontObj), -1,
+ NULL, offsetof(Label,label.fontObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- NULL, Tk_Offset(Label,label.borderWidthObj), -1,
+ NULL, offsetof(Label,label.borderWidthObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- NULL, Tk_Offset(Label,label.reliefObj), -1,
+ NULL, offsetof(Label,label.reliefObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- NULL, Tk_Offset(Label,label.anchorObj), -1,
+ NULL, offsetof(Label,label.anchorObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- NULL, Tk_Offset(Label, label.justifyObj), -1,
+ NULL, offsetof(Label, label.justifyObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
- NULL, Tk_Offset(Label, label.wrapLengthObj), -1,
+ NULL, offsetof(Label, label.wrapLengthObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED /*SB: SIZE_CHANGED*/ },
WIDGET_TAKEFOCUS_FALSE,
@@ -269,15 +273,16 @@ static Tk_OptionSpec LabelOptionSpecs[] =
};
static const Ttk_Ensemble LabelCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
-static WidgetSpec LabelWidgetSpec =
+static const WidgetSpec LabelWidgetSpec =
{
"TLabel", /* className */
sizeof(Label), /* recordSize */
@@ -320,12 +325,12 @@ typedef struct
/*
* Option specifications:
*/
-static Tk_OptionSpec ButtonOptionSpecs[] =
+static const Tk_OptionSpec ButtonOptionSpecs[] =
{
{TK_OPTION_STRING, "-command", "command", "Command",
- "", Tk_Offset(Button, button.commandObj), -1, 0,0,0},
+ "", offsetof(Button, button.commandObj), TCL_INDEX_NONE, 0,0,0},
{TK_OPTION_STRING_TABLE, "-default", "default", "Default",
- "normal", Tk_Offset(Button, button.defaultStateObj), -1,
+ "normal", offsetof(Button, button.defaultStateObj), TCL_INDEX_NONE,
0, (void *)ttkDefaultStrings, DEFAULTSTATE_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
@@ -343,7 +348,7 @@ static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
/* Handle "-default" option:
*/
if (mask & DEFAULTSTATE_CHANGED) {
- int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED;
Ttk_GetButtonDefaultStateFromObj(
NULL, buttonPtr->button.defaultStateObj, &defaultState);
if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) {
@@ -374,16 +379,17 @@ ButtonInvokeCommand(
}
static const Ttk_Ensemble ButtonCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "invoke", ButtonInvokeCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
+ { "invoke", ButtonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
-static WidgetSpec ButtonWidgetSpec =
+static const WidgetSpec ButtonWidgetSpec =
{
"TButton", /* className */
sizeof(Button), /* recordSize */
@@ -430,19 +436,19 @@ typedef struct
/*
* Option specifications:
*/
-static Tk_OptionSpec CheckbuttonOptionSpecs[] =
+static const Tk_OptionSpec CheckbuttonOptionSpecs[] =
{
{TK_OPTION_STRING, "-variable", "variable", "Variable",
- NULL, Tk_Offset(Checkbutton, checkbutton.variableObj), -1,
+ NULL, offsetof(Checkbutton, checkbutton.variableObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-onvalue", "onValue", "OnValue",
- "1", Tk_Offset(Checkbutton, checkbutton.onValueObj), -1,
+ "1", offsetof(Checkbutton, checkbutton.onValueObj), TCL_INDEX_NONE,
0,0,0},
{TK_OPTION_STRING, "-offvalue", "offValue", "OffValue",
- "0", Tk_Offset(Checkbutton, checkbutton.offValueObj), -1,
+ "0", offsetof(Checkbutton, checkbutton.offValueObj), TCL_INDEX_NONE,
0,0,0},
{TK_OPTION_STRING, "-command", "command", "Command",
- "", Tk_Offset(Checkbutton, checkbutton.commandObj), -1,
+ "", offsetof(Checkbutton, checkbutton.commandObj), TCL_INDEX_NONE,
0,0,0},
WIDGET_TAKEFOCUS_TRUE,
@@ -581,17 +587,18 @@ CheckbuttonInvokeCommand(
}
static const Ttk_Ensemble CheckbuttonCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "invoke", CheckbuttonInvokeCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
+ { "invoke", CheckbuttonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
/* MISSING: select, deselect, toggle */
{ 0,0,0 }
};
-static WidgetSpec CheckbuttonWidgetSpec =
+static const WidgetSpec CheckbuttonWidgetSpec =
{
"TCheckbutton", /* className */
sizeof(Checkbutton), /* recordSize */
@@ -638,16 +645,16 @@ typedef struct
/*
* Option specifications:
*/
-static Tk_OptionSpec RadiobuttonOptionSpecs[] =
+static const Tk_OptionSpec RadiobuttonOptionSpecs[] =
{
{TK_OPTION_STRING, "-variable", "variable", "Variable",
- "::selectedButton", Tk_Offset(Radiobutton, radiobutton.variableObj),-1,
+ "::selectedButton", offsetof(Radiobutton, radiobutton.variableObj),TCL_INDEX_NONE,
0,0,0},
{TK_OPTION_STRING, "-value", "Value", "Value",
- "1", Tk_Offset(Radiobutton, radiobutton.valueObj), -1,
+ "1", offsetof(Radiobutton, radiobutton.valueObj), TCL_INDEX_NONE,
0,0,0},
{TK_OPTION_STRING, "-command", "command", "Command",
- "", Tk_Offset(Radiobutton, radiobutton.commandObj), -1,
+ "", offsetof(Radiobutton, radiobutton.commandObj), TCL_INDEX_NONE,
0,0,0},
WIDGET_TAKEFOCUS_TRUE,
@@ -757,17 +764,18 @@ RadiobuttonInvokeCommand(
}
static const Ttk_Ensemble RadiobuttonCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "invoke", RadiobuttonInvokeCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
+ { "invoke", RadiobuttonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
/* MISSING: select, deselect */
{ 0,0,0 }
};
-static WidgetSpec RadiobuttonWidgetSpec =
+static const WidgetSpec RadiobuttonWidgetSpec =
{
"TRadiobutton", /* className */
sizeof(Radiobutton), /* recordSize */
@@ -813,12 +821,12 @@ typedef struct
static const char *const directionStrings[] = {
"above", "below", "left", "right", "flush", NULL
};
-static Tk_OptionSpec MenubuttonOptionSpecs[] =
+static const Tk_OptionSpec MenubuttonOptionSpecs[] =
{
{TK_OPTION_STRING, "-menu", "menu", "Menu",
- "", Tk_Offset(Menubutton, menubutton.menuObj), -1, 0,0,0},
+ "", offsetof(Menubutton, menubutton.menuObj), TCL_INDEX_NONE, 0,0,0},
{TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction",
- "below", Tk_Offset(Menubutton, menubutton.directionObj), -1,
+ "below", offsetof(Menubutton, menubutton.directionObj), TCL_INDEX_NONE,
0, (void *)directionStrings, GEOMETRY_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
@@ -831,10 +839,11 @@ static const Ttk_Ensemble MenubuttonCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
-static WidgetSpec MenubuttonWidgetSpec =
+static const WidgetSpec MenubuttonWidgetSpec =
{
"TMenubutton", /* className */
sizeof(Menubutton), /* recordSize */
diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c
index c29007c..412a1a1 100644
--- a/generic/ttk/ttkCache.c
+++ b/generic/ttk/ttkCache.c
@@ -1,7 +1,7 @@
/*
* Theme engine resource cache.
*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004, Joe English
*
* The problem:
*
@@ -48,7 +48,7 @@ struct Ttk_ResourceCache_ {
*/
Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *interp)
{
- Ttk_ResourceCache cache = ckalloc(sizeof(*cache));
+ Ttk_ResourceCache cache = (Ttk_ResourceCache)ckalloc(sizeof(*cache));
cache->tkwin = NULL; /* initialized later */
cache->interp = interp;
@@ -75,7 +75,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->fontTable, &search);
while (entryPtr != NULL) {
- Tcl_Obj *fontObj = Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *fontObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
if (fontObj) {
Tk_FreeFontFromObj(cache->tkwin, fontObj);
Tcl_DecrRefCount(fontObj);
@@ -90,7 +90,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->colorTable, &search);
while (entryPtr != NULL) {
- Tcl_Obj *colorObj = Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *colorObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
if (colorObj) {
Tk_FreeColorFromObj(cache->tkwin, colorObj);
Tcl_DecrRefCount(colorObj);
@@ -105,7 +105,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->borderTable, &search);
while (entryPtr != NULL) {
- Tcl_Obj *borderObj = Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *borderObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
if (borderObj) {
Tk_Free3DBorderFromObj(cache->tkwin, borderObj);
Tcl_DecrRefCount(borderObj);
@@ -120,7 +120,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->imageTable, &search);
while (entryPtr != NULL) {
- Tk_Image image = Tcl_GetHashValue(entryPtr);
+ Tk_Image image = (Tk_Image)Tcl_GetHashValue(entryPtr);
if (image) {
Tk_FreeImage(image);
}
@@ -153,7 +153,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->namedColors, &search);
while (entryPtr != NULL) {
- Tcl_Obj *colorNameObj = Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *colorNameObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
Tcl_DecrRefCount(colorNameObj);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -168,7 +168,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache)
*/
static void CacheWinEventHandler(ClientData clientData, XEvent *eventPtr)
{
- Ttk_ResourceCache cache = clientData;
+ Ttk_ResourceCache cache = (Ttk_ResourceCache)clientData;
if (eventPtr->type != DestroyNotify) {
return;
@@ -216,7 +216,7 @@ void Ttk_RegisterNamedColor(
entryPtr = Tcl_CreateHashEntry(&cache->namedColors, colorName, &newEntry);
if (!newEntry) {
- Tcl_Obj *oldColor = Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *oldColor = (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
Tcl_DecrRefCount(oldColor);
}
@@ -234,7 +234,7 @@ static Tcl_Obj *CheckNamedColor(Ttk_ResourceCache cache, Tcl_Obj *objPtr)
Tcl_HashEntry *entryPtr =
Tcl_FindHashEntry(&cache->namedColors, Tcl_GetString(objPtr));
if (entryPtr) { /* Use named color instead */
- objPtr = Tcl_GetHashValue(entryPtr);
+ objPtr = (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
}
return objPtr;
}
@@ -257,7 +257,7 @@ static Tcl_Obj *Ttk_Use(
Tcl_Obj *cacheObj;
if (!newEntry) {
- return Tcl_GetHashValue(entryPtr);
+ return (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
}
cacheObj = Tcl_DuplicateObj(objPtr);
@@ -314,9 +314,17 @@ Tcl_Obj *Ttk_UseBorder(
* Tk_ImageChangedProc for Ttk_UseImage
*/
-static void NullImageChanged(ClientData clientData,
+static void NullImageChanged(ClientData dummy,
int x, int y, int width, int height, int imageWidth, int imageHeight)
-{ /* No-op */ }
+{ /* No-op */
+ (void)dummy;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imageWidth;
+ (void)imageHeight;
+}
/*
* Ttk_UseImage --
@@ -333,7 +341,7 @@ Tk_Image Ttk_UseImage(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr)
InitCacheWindow(cache, tkwin);
if (!newEntry) {
- return Tcl_GetHashValue(entryPtr);
+ return (Tk_Image)Tcl_GetHashValue(entryPtr);
}
image = Tk_GetImage(cache->interp, tkwin, imageName, NullImageChanged,0);
diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c
index 733a391..60e9df3 100644
--- a/generic/ttk/ttkClamTheme.c
+++ b/generic/ttk/ttkClamTheme.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 Joe English
+ * Copyright © 2004 Joe English
*
* "clam" theme; inspired by the XFCE family of Gnome themes.
*/
@@ -106,17 +106,17 @@ typedef struct {
Tcl_Obj *borderWidthObj; /* See <<NOTE-BORDERWIDTH>> */
} BorderElement;
-static Ttk_ElementOptionSpec BorderElementOptions[] = {
+static const Ttk_ElementOptionSpec BorderElementOptions[] = {
{ "-bordercolor", TK_OPTION_COLOR,
- Tk_Offset(BorderElement,borderColorObj), DARKEST_COLOR },
+ offsetof(BorderElement,borderColorObj), DARKEST_COLOR },
{ "-lightcolor", TK_OPTION_COLOR,
- Tk_Offset(BorderElement,lightColorObj), LIGHT_COLOR },
+ offsetof(BorderElement,lightColorObj), LIGHT_COLOR },
{ "-darkcolor", TK_OPTION_COLOR,
- Tk_Offset(BorderElement,darkColorObj), DARK_COLOR },
+ offsetof(BorderElement,darkColorObj), DARK_COLOR },
{ "-relief", TK_OPTION_RELIEF,
- Tk_Offset(BorderElement,reliefObj), "flat" },
+ offsetof(BorderElement,reliefObj), "flat" },
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(BorderElement,borderWidthObj), "2" },
+ offsetof(BorderElement,borderWidthObj), "2" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -183,7 +183,7 @@ static void BorderElementDraw(
DrawSmoothBorder(tkwin, d, b, outer, upper, lower);
}
-static Ttk_ElementSpec BorderElementSpec = {
+static const Ttk_ElementSpec BorderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(BorderElement),
BorderElementOptions,
@@ -202,15 +202,15 @@ typedef struct {
Tcl_Obj *backgroundObj;
} FieldElement;
-static Ttk_ElementOptionSpec FieldElementOptions[] = {
+static const Ttk_ElementOptionSpec FieldElementOptions[] = {
{ "-bordercolor", TK_OPTION_COLOR,
- Tk_Offset(FieldElement,borderColorObj), DARKEST_COLOR },
+ offsetof(FieldElement,borderColorObj), DARKEST_COLOR },
{ "-lightcolor", TK_OPTION_COLOR,
- Tk_Offset(FieldElement,lightColorObj), LIGHT_COLOR },
+ offsetof(FieldElement,lightColorObj), LIGHT_COLOR },
{ "-darkcolor", TK_OPTION_COLOR,
- Tk_Offset(FieldElement,darkColorObj), DARK_COLOR },
+ offsetof(FieldElement,darkColorObj), DARK_COLOR },
{ "-fieldbackground", TK_OPTION_BORDER,
- Tk_Offset(FieldElement,backgroundObj), "white" },
+ offsetof(FieldElement,backgroundObj), "white" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -244,7 +244,7 @@ static void FieldElementDraw(
tkwin, d, bg, f.x, f.y, f.width, f.height, 0, TK_RELIEF_SUNKEN);
}
-static Ttk_ElementSpec FieldElementSpec = {
+static const Ttk_ElementSpec FieldElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FieldElement),
FieldElementOptions,
@@ -271,7 +271,7 @@ static void ComboboxFieldElementDraw(
b.x + b.width - 1, b.y + b.height - 1 + WIN32_XDRAWLINE_HACK);
}
-static Ttk_ElementSpec ComboboxFieldElementSpec = {
+static const Ttk_ElementSpec ComboboxFieldElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FieldElement),
FieldElementOptions,
@@ -292,19 +292,19 @@ typedef struct {
Tcl_Obj *lowerColorObj;
} IndicatorElement;
-static Ttk_ElementOptionSpec IndicatorElementOptions[] = {
+static const Ttk_ElementOptionSpec IndicatorElementOptions[] = {
{ "-indicatorsize", TK_OPTION_PIXELS,
- Tk_Offset(IndicatorElement,sizeObj), "10" },
+ offsetof(IndicatorElement,sizeObj), "10" },
{ "-indicatormargin", TK_OPTION_STRING,
- Tk_Offset(IndicatorElement,marginObj), "1" },
+ offsetof(IndicatorElement,marginObj), "1" },
{ "-indicatorbackground", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,backgroundObj), "white" },
+ offsetof(IndicatorElement,backgroundObj), "white" },
{ "-indicatorforeground", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,foregroundObj), "black" },
+ offsetof(IndicatorElement,foregroundObj), "black" },
{ "-upperbordercolor", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,upperColorObj), DARKEST_COLOR },
+ offsetof(IndicatorElement,upperColorObj), DARKEST_COLOR },
{ "-lowerbordercolor", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,lowerColorObj), DARK_COLOR },
+ offsetof(IndicatorElement,lowerColorObj), DARK_COLOR },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -395,7 +395,7 @@ static void CheckIndicatorElementDraw(
}
}
-static Ttk_ElementSpec RadioIndicatorElementSpec = {
+static const Ttk_ElementSpec RadioIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(IndicatorElement),
IndicatorElementOptions,
@@ -403,7 +403,7 @@ static Ttk_ElementSpec RadioIndicatorElementSpec = {
RadioIndicatorElementDraw
};
-static Ttk_ElementSpec CheckIndicatorElementSpec = {
+static const Ttk_ElementSpec CheckIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(IndicatorElement),
IndicatorElementOptions,
@@ -419,16 +419,16 @@ typedef struct {
Tcl_Obj *paddingObj;
} MenuIndicatorElement;
-static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] =
+static const Ttk_ElementOptionSpec MenuIndicatorElementOptions[] =
{
{ "-arrowsize", TK_OPTION_PIXELS,
- Tk_Offset(MenuIndicatorElement,sizeObj),
+ offsetof(MenuIndicatorElement,sizeObj),
STR(MENUBUTTON_ARROW_SIZE)},
{ "-arrowcolor",TK_OPTION_COLOR,
- Tk_Offset(MenuIndicatorElement,colorObj),
+ offsetof(MenuIndicatorElement,colorObj),
"black" },
{ "-arrowpadding",TK_OPTION_STRING,
- Tk_Offset(MenuIndicatorElement,paddingObj),
+ offsetof(MenuIndicatorElement,paddingObj),
"3" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -469,7 +469,7 @@ static void MenuIndicatorElementDraw(
TtkFillArrow(Tk_Display(tkwin), d, gc, b, ARROW_DOWN);
}
-static Ttk_ElementSpec MenuIndicatorElementSpec =
+static const Ttk_ElementSpec MenuIndicatorElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(MenuIndicatorElement),
@@ -484,23 +484,19 @@ static Ttk_ElementSpec MenuIndicatorElementSpec =
* TODO: factor this with ThumbElementDraw
*/
-static Ttk_Orient GripClientData[] = {
- TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL
-};
-
typedef struct {
Tcl_Obj *lightColorObj;
Tcl_Obj *borderColorObj;
Tcl_Obj *gripCountObj;
} GripElement;
-static Ttk_ElementOptionSpec GripElementOptions[] = {
+static const Ttk_ElementOptionSpec GripElementOptions[] = {
{ "-lightcolor", TK_OPTION_COLOR,
- Tk_Offset(GripElement,lightColorObj), LIGHT_COLOR },
+ offsetof(GripElement,lightColorObj), LIGHT_COLOR },
{ "-bordercolor", TK_OPTION_COLOR,
- Tk_Offset(GripElement,borderColorObj), DARKEST_COLOR },
+ offsetof(GripElement,borderColorObj), DARKEST_COLOR },
{ "-gripcount", TK_OPTION_INT,
- Tk_Offset(GripElement,gripCountObj), "5" },
+ offsetof(GripElement,gripCountObj), "5" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -508,14 +504,14 @@ static void GripElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orient = (Ttk_Orient)PTR2INT(clientData);
GripElement *grip = (GripElement *)elementRecord;
int gripCount = 0;
(void)tkwin;
(void)paddingPtr;
Tcl_GetIntFromObj(NULL, grip->gripCountObj, &gripCount);
- if (horizontal) {
+ if (orient == TTK_ORIENT_HORIZONTAL) {
*widthPtr = 2*gripCount;
} else {
*heightPtr = 2*gripCount;
@@ -527,16 +523,17 @@ static void GripElementDraw(
Drawable d, Ttk_Box b, unsigned state)
{
const int w = WIN32_XDRAWLINE_HACK;
- int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orient = (Ttk_Orient)PTR2INT(clientData);
GripElement *grip = (GripElement *)elementRecord;
GC lightGC = Ttk_GCForColor(tkwin,grip->lightColorObj,d);
GC darkGC = Ttk_GCForColor(tkwin,grip->borderColorObj,d);
int gripPad = 1, gripCount = 0;
int i;
+ (void)state;
Tcl_GetIntFromObj(NULL, grip->gripCountObj, &gripCount);
- if (horizontal) {
+ if (orient == TTK_ORIENT_HORIZONTAL) {
int x = b.x + b.width / 2 - gripCount;
int y1 = b.y + gripPad, y2 = b.y + b.height - gripPad - 1 + w;
for (i=0; i<gripCount; ++i) {
@@ -553,7 +550,7 @@ static void GripElementDraw(
}
}
-static Ttk_ElementSpec GripElementSpec = {
+static const Ttk_ElementSpec GripElementSpec = {
TK_STYLE_VERSION_2,
sizeof(GripElement),
GripElementOptions,
@@ -581,27 +578,27 @@ typedef struct { /* Common element record for scrollbar elements */
Tcl_Obj *sliderlengthObj;
} ScrollbarElement;
-static Ttk_ElementOptionSpec ScrollbarElementOptions[] = {
+static const Ttk_ElementOptionSpec ScrollbarElementOptions[] = {
{ "-orient", TK_OPTION_ANY,
- Tk_Offset(ScrollbarElement, orientObj), "horizontal" },
+ offsetof(ScrollbarElement, orientObj), "horizontal" },
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(ScrollbarElement,backgroundObj), FRAME_COLOR },
+ offsetof(ScrollbarElement,backgroundObj), FRAME_COLOR },
{ "-bordercolor", TK_OPTION_COLOR,
- Tk_Offset(ScrollbarElement,borderColorObj), DARKEST_COLOR },
+ offsetof(ScrollbarElement,borderColorObj), DARKEST_COLOR },
{ "-troughcolor", TK_OPTION_COLOR,
- Tk_Offset(ScrollbarElement,troughColorObj), DARKER_COLOR },
+ offsetof(ScrollbarElement,troughColorObj), DARKER_COLOR },
{ "-lightcolor", TK_OPTION_COLOR,
- Tk_Offset(ScrollbarElement,lightColorObj), LIGHT_COLOR },
+ offsetof(ScrollbarElement,lightColorObj), LIGHT_COLOR },
{ "-darkcolor", TK_OPTION_COLOR,
- Tk_Offset(ScrollbarElement,darkColorObj), DARK_COLOR },
+ offsetof(ScrollbarElement,darkColorObj), DARK_COLOR },
{ "-arrowcolor", TK_OPTION_COLOR,
- Tk_Offset(ScrollbarElement,arrowColorObj), "#000000" },
+ offsetof(ScrollbarElement,arrowColorObj), "#000000" },
{ "-arrowsize", TK_OPTION_PIXELS,
- Tk_Offset(ScrollbarElement,arrowSizeObj), STR(SCROLLBAR_THICKNESS) },
+ offsetof(ScrollbarElement,arrowSizeObj), STR(SCROLLBAR_THICKNESS) },
{ "-gripcount", TK_OPTION_INT,
- Tk_Offset(ScrollbarElement,gripCountObj), "5" },
+ offsetof(ScrollbarElement,gripCountObj), "5" },
{ "-sliderlength", TK_OPTION_INT,
- Tk_Offset(ScrollbarElement,sliderlengthObj), "30" },
+ offsetof(ScrollbarElement,sliderlengthObj), "30" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -619,7 +616,7 @@ static void TroughElementDraw(
XDrawRectangle(Tk_Display(tkwin), d, gcb, b.x, b.y, b.width-1, b.height-1);
}
-static Ttk_ElementSpec TroughElementSpec = {
+static const Ttk_ElementSpec TroughElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ScrollbarElement),
ScrollbarElementOptions,
@@ -647,7 +644,7 @@ static void ThumbElementDraw(
{
ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
int gripCount = 0;
- int orient = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orient = TTK_ORIENT_HORIZONTAL;
GC lightGC, darkGC;
int x1, y1, x2, y2, dx, dy, i;
const int w = WIN32_XDRAWLINE_HACK;
@@ -663,7 +660,7 @@ static void ThumbElementDraw(
/*
* Draw grip:
*/
- Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, sb->orientObj, &orient);
Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount);
lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d);
darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d);
@@ -688,7 +685,7 @@ static void ThumbElementDraw(
}
}
-static Ttk_ElementSpec ThumbElementSpec = {
+static const Ttk_ElementSpec ThumbElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ScrollbarElement),
ScrollbarElementOptions,
@@ -705,12 +702,12 @@ static void SliderElementSize(
{
ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
int length, thickness;
- int orient;
+ Ttk_Orient orient;
(void)dummy;
(void)paddingPtr;
length = thickness = SCROLLBAR_THICKNESS;
- Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, sb->orientObj, &orient);
Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &thickness);
Tk_GetPixelsFromObj(NULL, tkwin, sb->sliderlengthObj, &length);
if (orient == TTK_ORIENT_VERTICAL) {
@@ -723,7 +720,7 @@ static void SliderElementSize(
}
-static Ttk_ElementSpec SliderElementSpec = {
+static const Ttk_ElementSpec SliderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ScrollbarElement),
ScrollbarElementOptions,
@@ -763,7 +760,7 @@ static void PbarElementDraw(
}
}
-static Ttk_ElementSpec PbarElementSpec = {
+static const Ttk_ElementSpec PbarElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ScrollbarElement),
ScrollbarElementOptions,
@@ -775,8 +772,6 @@ static Ttk_ElementSpec PbarElementSpec = {
/*------------------------------------------------------------------------
* +++ Scrollbar arrows.
*/
-static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
-
static void ArrowElementSize(
void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
@@ -795,10 +790,11 @@ static void ArrowElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
- ArrowDirection direction = *(ArrowDirection*)clientData;
+ ArrowDirection direction = (ArrowDirection)PTR2INT(clientData);
ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
GC gc = Ttk_GCForColor(tkwin,sb->arrowColorObj, d);
int h, cx, cy;
+ (void)state;
DrawSmoothBorder(tkwin, d, b,
sb->borderColorObj, sb->lightColorObj, sb->darkColorObj);
@@ -815,7 +811,7 @@ static void ArrowElementDraw(
TtkFillArrow(Tk_Display(tkwin), d, gc, b, direction);
}
-static Ttk_ElementSpec ArrowElementSpec = {
+static const Ttk_ElementSpec ArrowElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ScrollbarElement),
ScrollbarElementOptions,
@@ -838,15 +834,15 @@ typedef struct {
Tcl_Obj *darkColorObj;
} NotebookElement;
-static Ttk_ElementOptionSpec NotebookElementOptions[] = {
+static const Ttk_ElementOptionSpec NotebookElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(NotebookElement,backgroundObj), FRAME_COLOR },
+ offsetof(NotebookElement,backgroundObj), FRAME_COLOR },
{ "-bordercolor", TK_OPTION_COLOR,
- Tk_Offset(NotebookElement,borderColorObj), DARKEST_COLOR },
+ offsetof(NotebookElement,borderColorObj), DARKEST_COLOR },
{ "-lightcolor", TK_OPTION_COLOR,
- Tk_Offset(NotebookElement,lightColorObj), LIGHT_COLOR },
+ offsetof(NotebookElement,lightColorObj), LIGHT_COLOR },
{ "-darkcolor", TK_OPTION_COLOR,
- Tk_Offset(NotebookElement,darkColorObj), DARK_COLOR },
+ offsetof(NotebookElement,darkColorObj), DARK_COLOR },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -903,7 +899,7 @@ static void TabElementDraw(
XDrawLine(display,d,gc, x1+1,y1+1, x2-1+w,y1+1);
}
-static Ttk_ElementSpec TabElementSpec =
+static const Ttk_ElementSpec TabElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NotebookElement),
@@ -942,7 +938,7 @@ static void ClientElementDraw(
ce->borderColorObj, ce->lightColorObj, ce->darkColorObj);
}
-static Ttk_ElementSpec ClientElementSpec =
+static const Ttk_ElementSpec ClientElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NotebookElement),
@@ -997,13 +993,13 @@ TtkClamTheme_Init(Tcl_Interp *interp)
Ttk_RegisterElement(interp,
theme, "thumb", &ThumbElementSpec, NULL);
Ttk_RegisterElement(interp,
- theme, "uparrow", &ArrowElementSpec, &ArrowElements[0]);
+ theme, "uparrow", &ArrowElementSpec, INT2PTR(ARROW_UP));
Ttk_RegisterElement(interp,
- theme, "downarrow", &ArrowElementSpec, &ArrowElements[1]);
+ theme, "downarrow", &ArrowElementSpec, INT2PTR(ARROW_DOWN));
Ttk_RegisterElement(interp,
- theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]);
+ theme, "leftarrow", &ArrowElementSpec, INT2PTR(ARROW_LEFT));
Ttk_RegisterElement(interp,
- theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]);
+ theme, "rightarrow", &ArrowElementSpec, INT2PTR(ARROW_RIGHT));
Ttk_RegisterElement(interp,
theme, "Radiobutton.indicator", &RadioIndicatorElementSpec, NULL);
@@ -1020,9 +1016,9 @@ TtkClamTheme_Init(Tcl_Interp *interp)
Ttk_RegisterElement(interp, theme, "pbar", &PbarElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "hgrip",
- &GripElementSpec, &GripClientData[0]);
+ &GripElementSpec, INT2PTR(TTK_ORIENT_HORIZONTAL));
Ttk_RegisterElement(interp, theme, "vgrip",
- &GripElementSpec, &GripClientData[1]);
+ &GripElementSpec, INT2PTR(TTK_ORIENT_VERTICAL));
Ttk_RegisterLayouts(theme, LayoutTable);
diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c
index 8436aec..c3aaee8 100644
--- a/generic/ttk/ttkClassicTheme.c
+++ b/generic/ttk/ttkClassicTheme.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004, Joe English
*
* "classic" theme; implements the classic Motif-like Tk look.
*
@@ -21,11 +21,11 @@ typedef struct {
Tcl_Obj *highlightThicknessObj;
} HighlightElement;
-static Ttk_ElementOptionSpec HighlightElementOptions[] = {
+static const Ttk_ElementOptionSpec HighlightElementOptions[] = {
{ "-highlightcolor",TK_OPTION_COLOR,
- Tk_Offset(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND },
+ offsetof(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND },
{ "-highlightthickness",TK_OPTION_PIXELS,
- Tk_Offset(HighlightElement,highlightThicknessObj), "0" },
+ offsetof(HighlightElement,highlightThicknessObj), "0" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -62,7 +62,7 @@ static void HighlightElementDraw(
}
}
-static Ttk_ElementSpec HighlightElementSpec =
+static const Ttk_ElementSpec HighlightElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(HighlightElement),
@@ -88,16 +88,16 @@ typedef struct {
Tcl_Obj *defaultStateObj;
} ButtonBorderElement;
-static Ttk_ElementOptionSpec ButtonBorderElementOptions[] =
+static const Ttk_ElementOptionSpec ButtonBorderElementOptions[] =
{
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND },
+ offsetof(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND },
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ offsetof(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH },
{ "-relief", TK_OPTION_RELIEF,
- Tk_Offset(ButtonBorderElement,reliefObj), "flat" },
+ offsetof(ButtonBorderElement,reliefObj), "flat" },
{ "-default", TK_OPTION_ANY,
- Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" },
+ offsetof(ButtonBorderElement,defaultStateObj), "disabled" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -106,7 +106,7 @@ static void ButtonBorderElementSize(
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord;
- int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED;
int borderWidth = 0;
(void)dummy;
(void)tkwin;
@@ -134,7 +134,7 @@ static void ButtonBorderElementDraw(
ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord;
Tk_3DBorder border = NULL;
int borderWidth = 1, relief = TK_RELIEF_FLAT;
- int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED;
int inset = 0;
(void)dummy;
(void)state;
@@ -183,7 +183,7 @@ static void ButtonBorderElementDraw(
}
}
-static Ttk_ElementSpec ButtonBorderElementSpec =
+static const Ttk_ElementSpec ButtonBorderElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(ButtonBorderElement),
@@ -199,7 +199,6 @@ static Ttk_ElementSpec ButtonBorderElementSpec =
* clientData is an enum ArrowDirection pointer.
*/
-static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
typedef struct
{
Tcl_Obj *sizeObj;
@@ -208,15 +207,15 @@ typedef struct
Tcl_Obj *reliefObj;
} ArrowElement;
-static Ttk_ElementOptionSpec ArrowElementOptions[] =
+static const Ttk_ElementOptionSpec ArrowElementOptions[] =
{
- { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,sizeObj),
+ { "-arrowsize", TK_OPTION_PIXELS, offsetof(ArrowElement,sizeObj),
DEFAULT_ARROW_SIZE },
- { "-background", TK_OPTION_BORDER, Tk_Offset(ArrowElement,borderObj),
+ { "-background", TK_OPTION_BORDER, offsetof(ArrowElement,borderObj),
DEFAULT_BACKGROUND },
- { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,borderWidthObj),
+ { "-borderwidth", TK_OPTION_PIXELS, offsetof(ArrowElement,borderWidthObj),
DEFAULT_BORDERWIDTH },
- { "-relief", TK_OPTION_RELIEF, Tk_Offset(ArrowElement,reliefObj),"raised" },
+ { "-relief", TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj),"raised" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -237,7 +236,7 @@ static void ArrowElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- int direction = *(int *)clientData;
+ ArrowDirection direction = (ArrowDirection)PTR2INT(clientData);
ArrowElement *arrow = (ArrowElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj);
int borderWidth = 2;
@@ -282,7 +281,7 @@ static void ArrowElementDraw(
Tk_Fill3DPolygon(tkwin, d, border, points, 3, borderWidth, relief);
}
-static Ttk_ElementSpec ArrowElementSpec =
+static const Ttk_ElementSpec ArrowElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(ArrowElement),
@@ -306,10 +305,6 @@ static Ttk_ElementSpec ArrowElementSpec =
* -sashrelief raised, but that looks wrong to me.
*/
-static Ttk_Orient SashClientData[] = {
- TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL
-};
-
typedef struct {
Tcl_Obj *borderObj; /* background color */
Tcl_Obj *sashReliefObj; /* sash relief */
@@ -319,19 +314,19 @@ typedef struct {
Tcl_Obj *handlePadObj; /* handle's distance from edge */
} SashElement;
-static Ttk_ElementOptionSpec SashOptions[] = {
+static const Ttk_ElementOptionSpec SashOptions[] = {
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(SashElement,borderObj), DEFAULT_BACKGROUND },
+ offsetof(SashElement,borderObj), DEFAULT_BACKGROUND },
{ "-sashrelief", TK_OPTION_RELIEF,
- Tk_Offset(SashElement,sashReliefObj), "sunken" },
+ offsetof(SashElement,sashReliefObj), "sunken" },
{ "-sashthickness", TK_OPTION_PIXELS,
- Tk_Offset(SashElement,sashThicknessObj), "6" },
+ offsetof(SashElement,sashThicknessObj), "6" },
{ "-sashpad", TK_OPTION_PIXELS,
- Tk_Offset(SashElement,sashPadObj), "2" },
+ offsetof(SashElement,sashPadObj), "2" },
{ "-handlesize", TK_OPTION_PIXELS,
- Tk_Offset(SashElement,handleSizeObj), "8" },
+ offsetof(SashElement,handleSizeObj), "8" },
{ "-handlepad", TK_OPTION_PIXELS,
- Tk_Offset(SashElement,handlePadObj), "8" },
+ offsetof(SashElement,handlePadObj), "8" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -341,7 +336,8 @@ static void SashElementSize(
{
SashElement *sash = (SashElement *)elementRecord;
int sashPad = 2, sashThickness = 6, handleSize = 8;
- int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orient = (Ttk_Orient)PTR2INT(clientData);
+ (void)paddingPtr;
(void)paddingPtr;
Tk_GetPixelsFromObj(NULL, tkwin, sash->sashThicknessObj, &sashThickness);
@@ -351,7 +347,7 @@ static void SashElementSize(
if (sashThickness < handleSize + 2*sashPad)
sashThickness = handleSize + 2*sashPad;
- if (horizontal)
+ if (orient == TTK_ORIENT_HORIZONTAL)
*heightPtr = sashThickness;
else
*widthPtr = sashThickness;
@@ -366,7 +362,7 @@ static void SashElementDraw(
GC gc1,gc2;
int relief = TK_RELIEF_RAISED;
int handleSize = 8, handlePad = 8;
- int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orient = (Ttk_Orient)PTR2INT(clientData);
Ttk_Box hb;
(void)state;
@@ -394,7 +390,7 @@ static void SashElementDraw(
/* Draw sash line:
*/
- if (horizontal) {
+ if (orient == TTK_ORIENT_HORIZONTAL) {
int y = b.y + b.height/2 - 1;
XDrawLine(Tk_Display(tkwin), d, gc1, b.x, y, b.x+b.width, y); ++y;
XDrawLine(Tk_Display(tkwin), d, gc2, b.x, y, b.x+b.width, y);
@@ -407,7 +403,7 @@ static void SashElementDraw(
/* Draw handle:
*/
if (handleSize >= 0) {
- if (horizontal) {
+ if (orient == TTK_ORIENT_HORIZONTAL) {
hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_W);
hb.x += handlePad;
} else {
@@ -419,7 +415,7 @@ static void SashElementDraw(
}
}
-static Ttk_ElementSpec SashElementSpec = {
+static const Ttk_ElementSpec SashElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SashElement),
SashOptions,
@@ -501,20 +497,20 @@ MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *interp)
&ButtonBorderElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "uparrow",
- &ArrowElementSpec, &ArrowElements[0]);
+ &ArrowElementSpec, INT2PTR(ARROW_UP));
Ttk_RegisterElement(interp, theme, "downarrow",
- &ArrowElementSpec, &ArrowElements[1]);
+ &ArrowElementSpec, INT2PTR(ARROW_DOWN));
Ttk_RegisterElement(interp, theme, "leftarrow",
- &ArrowElementSpec, &ArrowElements[2]);
+ &ArrowElementSpec, INT2PTR(ARROW_LEFT));
Ttk_RegisterElement(interp, theme, "rightarrow",
- &ArrowElementSpec, &ArrowElements[3]);
+ &ArrowElementSpec, INT2PTR(ARROW_RIGHT));
Ttk_RegisterElement(interp, theme, "arrow",
- &ArrowElementSpec, &ArrowElements[0]);
+ &ArrowElementSpec, INT2PTR(ARROW_UP));
Ttk_RegisterElement(interp, theme, "hsash",
- &SashElementSpec, &SashClientData[0]);
+ &SashElementSpec, INT2PTR(TTK_ORIENT_HORIZONTAL));
Ttk_RegisterElement(interp, theme, "vsash",
- &SashElementSpec, &SashClientData[1]);
+ &SashElementSpec, INT2PTR(TTK_ORIENT_VERTICAL));
/*
* Register layouts:
diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h
index 6701724..2b074ac 100644
--- a/generic/ttk/ttkDecls.h
+++ b/generic/ttk/ttkDecls.h
@@ -13,11 +13,24 @@ extern const char *TtkInitializeStubs(
interp, TTK_VERSION, TTK_STUBS_EPOCH, TTK_STUBS_REVISION)
#else
-#define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "Ttk", TTK_VERSION, 0, NULL)
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
+# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "Ttk", TTK_VERSION, 0, NULL)
+#else
+# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "ttk", TTK_VERSION, 0, NULL)
+#endif
+
+#endif
+#if !defined(BUILD_tk)
+# define TTK_DEPRECATED(msg) TTKAPI TCL_DEPRECATED_API(msg)
+#elif defined(TK_NO_DEPRECATED)
+# define TTK_DEPRECATED(msg) MODULE_SCOPE
+#else
+# define TTK_DEPRECATED(msg) TTKAPI
#endif
+
/* !BEGIN!: Do not edit below this line. */
#define TTK_STUBS_EPOCH 0
@@ -47,12 +60,12 @@ TTKAPI void Ttk_RegisterCleanup(Tcl_Interp *interp,
/* 5 */
TTKAPI int Ttk_RegisterElementSpec(Ttk_Theme theme,
const char *elementName,
- Ttk_ElementSpec *elementSpec,
+ const Ttk_ElementSpec *elementSpec,
void *clientData);
/* 6 */
TTKAPI Ttk_ElementClass * Ttk_RegisterElement(Tcl_Interp *interp,
Ttk_Theme theme, const char *elementName,
- Ttk_ElementSpec *elementSpec,
+ const Ttk_ElementSpec *elementSpec,
void *clientData);
/* 7 */
TTKAPI int Ttk_RegisterElementFactory(Tcl_Interp *interp,
@@ -77,7 +90,7 @@ TTKAPI Ttk_StateMap Ttk_GetStateMapFromObj(Tcl_Interp *interp,
TTKAPI Tcl_Obj * Ttk_StateMapLookup(Tcl_Interp *interp,
Ttk_StateMap map, Ttk_State state);
/* 14 */
-TTKAPI int Ttk_StateTableLookup(Ttk_StateTable map[],
+TTKAPI int Ttk_StateTableLookup(const Ttk_StateTable *map,
Ttk_State state);
/* Slot 15 is reserved */
/* Slot 16 is reserved */
@@ -130,7 +143,8 @@ TTKAPI Tcl_Obj * Ttk_NewBoxObj(Ttk_Box box);
/* Slot 38 is reserved */
/* Slot 39 is reserved */
/* 40 */
-TTKAPI int Ttk_GetOrientFromObj(Tcl_Interp *interp,
+TTK_DEPRECATED("")
+int Ttk_GetOrientFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, int *orient);
typedef struct TtkStubs {
@@ -144,8 +158,8 @@ typedef struct TtkStubs {
Ttk_Theme (*ttk_GetCurrentTheme) (Tcl_Interp *interp); /* 2 */
Ttk_Theme (*ttk_CreateTheme) (Tcl_Interp *interp, const char *name, Ttk_Theme parent); /* 3 */
void (*ttk_RegisterCleanup) (Tcl_Interp *interp, void *deleteData, Ttk_CleanupProc *cleanupProc); /* 4 */
- int (*ttk_RegisterElementSpec) (Ttk_Theme theme, const char *elementName, Ttk_ElementSpec *elementSpec, void *clientData); /* 5 */
- Ttk_ElementClass * (*ttk_RegisterElement) (Tcl_Interp *interp, Ttk_Theme theme, const char *elementName, Ttk_ElementSpec *elementSpec, void *clientData); /* 6 */
+ int (*ttk_RegisterElementSpec) (Ttk_Theme theme, const char *elementName, const Ttk_ElementSpec *elementSpec, void *clientData); /* 5 */
+ Ttk_ElementClass * (*ttk_RegisterElement) (Tcl_Interp *interp, Ttk_Theme theme, const char *elementName, const Ttk_ElementSpec *elementSpec, void *clientData); /* 6 */
int (*ttk_RegisterElementFactory) (Tcl_Interp *interp, const char *name, Ttk_ElementFactory factoryProc, void *clientData); /* 7 */
void (*ttk_RegisterLayout) (Ttk_Theme theme, const char *className, Ttk_LayoutSpec layoutSpec); /* 8 */
void (*reserved9)(void);
@@ -153,7 +167,7 @@ typedef struct TtkStubs {
Tcl_Obj * (*ttk_NewStateSpecObj) (unsigned int onbits, unsigned int offbits); /* 11 */
Ttk_StateMap (*ttk_GetStateMapFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 12 */
Tcl_Obj * (*ttk_StateMapLookup) (Tcl_Interp *interp, Ttk_StateMap map, Ttk_State state); /* 13 */
- int (*ttk_StateTableLookup) (Ttk_StateTable map[], Ttk_State state); /* 14 */
+ int (*ttk_StateTableLookup) (const Ttk_StateTable *map, Ttk_State state); /* 14 */
void (*reserved15)(void);
void (*reserved16)(void);
void (*reserved17)(void);
@@ -179,7 +193,7 @@ typedef struct TtkStubs {
void (*reserved37)(void);
void (*reserved38)(void);
void (*reserved39)(void);
- int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); /* 40 */
+ TCL_DEPRECATED_API("") int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); /* 40 */
} TtkStubs;
extern const TtkStubs *ttkStubsPtr;
diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c
index 89bf028..1acdcbc 100644
--- a/generic/ttk/ttkDefaultTheme.c
+++ b/generic/ttk/ttkDefaultTheme.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003 Joe English
*
* Tk alternate theme, intended to match the MSUE and Gtk's (old) default theme
*/
@@ -37,7 +37,7 @@ static const int WIN32_XDRAWLINE_HACK = 0;
enum BorderColor { FLAT = 1, LITE = 2, DARK = 3, BRDR = 4 };
/* top-left outer, top-left inner, bottom-right inner, bottom-right outer */
-static int const shadowColors[6][4] = {
+static const enum BorderColor shadowColors[6][4] = {
{ FLAT, FLAT, FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/
{ DARK, LITE, DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/
{ LITE, FLAT, DARK, BRDR }, /* TK_RELIEF_RAISED = 2*/
@@ -47,7 +47,7 @@ static int const shadowColors[6][4] = {
};
/* top-left, bottom-right */
-static int const thinShadowColors[6][4] = {
+static const enum BorderColor thinShadowColors[6][4] = {
{ FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/
{ DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/
{ LITE, DARK }, /* TK_RELIEF_RAISED = 2*/
@@ -116,21 +116,19 @@ static void DrawBorder(
/* Alternate shadow colors for entry fields:
* NOTE: FLAT color is normally white, and the LITE color is a darker shade.
*/
-static int fieldShadowColors[4] = { DARK, BRDR, LITE, FLAT };
-
static void DrawFieldBorder(
Tk_Window tkwin, Drawable d, Tk_3DBorder border, XColor *borderColor,
Ttk_Box b)
{
GC borderGC = Tk_GCForColor(borderColor, d);
DrawCorner(tkwin, d, border, borderGC,
- b.x, b.y, b.width, b.height, 0,fieldShadowColors[0]);
+ b.x, b.y, b.width, b.height, 0, DARK);
DrawCorner(tkwin, d, border, borderGC,
- b.x+1, b.y+1, b.width-2, b.height-2, 0,fieldShadowColors[1]);
+ b.x+1, b.y+1, b.width-2, b.height-2, 0, BRDR);
DrawCorner(tkwin, d, border, borderGC,
- b.x+1, b.y+1, b.width-2, b.height-2, 1,fieldShadowColors[2]);
+ b.x+1, b.y+1, b.width-2, b.height-2, 1, LITE);
DrawCorner(tkwin, d, border, borderGC,
- b.x, b.y, b.width, b.height, 1,fieldShadowColors[3]);
+ b.x, b.y, b.width, b.height, 1, FLAT);
return;
}
@@ -138,11 +136,11 @@ static void DrawFieldBorder(
* ArrowPoints --
* Compute points of arrow polygon.
*/
-static void ArrowPoints(Ttk_Box b, ArrowDirection dir, XPoint points[4])
+static void ArrowPoints(Ttk_Box b, ArrowDirection direction, XPoint points[4])
{
int cx, cy, h;
- switch (dir) {
+ switch (direction) {
case ARROW_UP:
h = (b.width - 1)/2;
cx = b.x + h;
@@ -186,9 +184,9 @@ static void ArrowPoints(Ttk_Box b, ArrowDirection dir, XPoint points[4])
}
/*public*/
-void TtkArrowSize(int h, ArrowDirection dir, int *widthPtr, int *heightPtr)
+void TtkArrowSize(int h, ArrowDirection direction, int *widthPtr, int *heightPtr)
{
- switch (dir) {
+ switch (direction) {
case ARROW_UP:
case ARROW_DOWN: *widthPtr = 2*h+1; *heightPtr = h+1; break;
case ARROW_LEFT:
@@ -202,10 +200,10 @@ void TtkArrowSize(int h, ArrowDirection dir, int *widthPtr, int *heightPtr)
*/
/*public*/
void TtkFillArrow(
- Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir)
+ Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection direction)
{
XPoint points[4];
- ArrowPoints(b, dir, points);
+ ArrowPoints(b, direction, points);
XFillPolygon(display, d, gc, points, 3, Convex, CoordModeOrigin);
XDrawLines(display, d, gc, points, 4, CoordModeOrigin);
@@ -215,10 +213,10 @@ void TtkFillArrow(
/*public*/
void TtkDrawArrow(
- Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir)
+ Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection direction)
{
XPoint points[4];
- ArrowPoints(b, dir, points);
+ ArrowPoints(b, direction, points);
XDrawLines(display, d, gc, points, 4, CoordModeOrigin);
/* Work around bug [77527326e5] - ttk artifacts on Ubuntu */
@@ -244,27 +242,31 @@ typedef struct {
Tcl_Obj *defaultStateObj; /* for buttons */
} BorderElement;
-static Ttk_ElementOptionSpec BorderElementOptions[] = {
- { "-background", TK_OPTION_BORDER, Tk_Offset(BorderElement,borderObj),
+static const Ttk_ElementOptionSpec BorderElementOptions[] = {
+ { "-background", TK_OPTION_BORDER, offsetof(BorderElement,borderObj),
DEFAULT_BACKGROUND },
{ "-bordercolor",TK_OPTION_COLOR,
- Tk_Offset(BorderElement,borderColorObj), "black" },
- { "-default", TK_OPTION_ANY, Tk_Offset(BorderElement,defaultStateObj),
+ offsetof(BorderElement,borderColorObj), "black" },
+ { "-default", TK_OPTION_ANY, offsetof(BorderElement,defaultStateObj),
"disabled" },
- { "-borderwidth",TK_OPTION_PIXELS,Tk_Offset(BorderElement,borderWidthObj),
+ { "-borderwidth",TK_OPTION_PIXELS, offsetof(BorderElement,borderWidthObj),
STRINGIFY(BORDERWIDTH) },
- { "-relief", TK_OPTION_RELIEF, Tk_Offset(BorderElement,reliefObj),
+ { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj),
"flat" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void BorderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- BorderElement *bd = elementRecord;
+ BorderElement *bd = (BorderElement *)elementRecord;
int borderWidth = 0;
- int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ (void)dummy;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
@@ -277,15 +279,17 @@ static void BorderElementSize(
}
static void BorderElementDraw(
- void *clientData, void *elementRecord,
+ void *dummy, void *elementRecord,
Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state)
{
- BorderElement *bd = elementRecord;
+ BorderElement *bd = (BorderElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj);
XColor *borderColor = Tk_GetColorFromObj(tkwin, bd->borderColorObj);
int borderWidth = 2;
int relief = TK_RELIEF_FLAT;
- int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ (void)dummy;
+ (void)state;
/*
* Get option values.
@@ -307,7 +311,7 @@ static void BorderElementDraw(
DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief);
}
-static Ttk_ElementSpec BorderElementSpec = {
+static const Ttk_ElementSpec BorderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(BorderElement),
BorderElementOptions,
@@ -324,35 +328,43 @@ typedef struct {
Tcl_Obj *borderColorObj; /* Extra border color */
} FieldElement;
-static Ttk_ElementOptionSpec FieldElementOptions[] = {
- { "-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement,borderObj),
+static const Ttk_ElementOptionSpec FieldElementOptions[] = {
+ { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,borderObj),
"white" },
- { "-bordercolor",TK_OPTION_COLOR, Tk_Offset(FieldElement,borderColorObj),
+ { "-bordercolor",TK_OPTION_COLOR, offsetof(FieldElement,borderColorObj),
"black" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void FieldElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+
*paddingPtr = Ttk_UniformPadding(2);
}
static void FieldElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- FieldElement *field = elementRecord;
+ FieldElement *field = (FieldElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj);
XColor *borderColor = Tk_GetColorFromObj(tkwin, field->borderColorObj);
+ (void)dummy;
+ (void)state;
Tk_Fill3DRectangle(
tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_SUNKEN);
DrawFieldBorder(tkwin, d, border, borderColor, b);
}
-static Ttk_ElementSpec FieldElementSpec = {
+static const Ttk_ElementSpec FieldElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FieldElement),
FieldElementOptions,
@@ -375,7 +387,7 @@ typedef struct {
int height; /* Height of each image */
int nimages; /* #images / row */
const char *const *pixels; /* array[height] of char[width*nimage] */
- Ttk_StateTable *map;/* used to look up image index by state */
+ const Ttk_StateTable *map;/* used to look up image index by state */
} IndicatorSpec;
#if 0
@@ -395,7 +407,7 @@ static const char *const button_images[] = {
};
#endif
-static Ttk_StateTable checkbutton_states[] = {
+static const Ttk_StateTable checkbutton_states[] = {
{ 0, 0, TTK_STATE_SELECTED|TTK_STATE_DISABLED },
{ 1, TTK_STATE_SELECTED, TTK_STATE_DISABLED },
{ 2, TTK_STATE_DISABLED, TTK_STATE_SELECTED },
@@ -425,7 +437,7 @@ static IndicatorSpec checkbutton_spec = {
checkbutton_states
};
-static Ttk_StateTable radiobutton_states[] = {
+static const Ttk_StateTable radiobutton_states[] = {
{ 0, 0, TTK_STATE_SELECTED|TTK_STATE_DISABLED },
{ 1, TTK_STATE_SELECTED, TTK_STATE_DISABLED },
{ 2, TTK_STATE_DISABLED, TTK_STATE_SELECTED },
@@ -465,31 +477,33 @@ typedef struct {
Tcl_Obj *marginObj;
} IndicatorElement;
-static Ttk_ElementOptionSpec IndicatorElementOptions[] = {
+static const Ttk_ElementOptionSpec IndicatorElementOptions[] = {
{ "-background", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
+ offsetof(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
{ "-foreground", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,foregroundObj), DEFAULT_FOREGROUND },
+ offsetof(IndicatorElement,foregroundObj), DEFAULT_FOREGROUND },
{ "-indicatorcolor", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,colorObj), "#FFFFFF" },
+ offsetof(IndicatorElement,colorObj), "#FFFFFF" },
{ "-lightcolor", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,lightColorObj), "#DDDDDD" },
+ offsetof(IndicatorElement,lightColorObj), "#DDDDDD" },
{ "-shadecolor", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,shadeColorObj), "#888888" },
+ offsetof(IndicatorElement,shadeColorObj), "#888888" },
{ "-bordercolor", TK_OPTION_COLOR,
- Tk_Offset(IndicatorElement,borderColorObj), "black" },
+ offsetof(IndicatorElement,borderColorObj), "black" },
{ "-indicatormargin", TK_OPTION_STRING,
- Tk_Offset(IndicatorElement,marginObj), "0 2 4 2" },
- { NULL, 0, 0, NULL }
+ offsetof(IndicatorElement,marginObj), "0 2 4 2" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void IndicatorElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- IndicatorSpec *spec = clientData;
- IndicatorElement *indicator = elementRecord;
+ IndicatorSpec *spec = (IndicatorSpec *)clientData;
+ IndicatorElement *indicator = (IndicatorElement *)elementRecord;
Ttk_Padding margins;
+ (void)paddingPtr;
+
Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
*widthPtr = spec->width + Ttk_PaddingWidth(margins);
*heightPtr = spec->height + Ttk_PaddingHeight(margins);
@@ -499,8 +513,8 @@ static void IndicatorElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- IndicatorSpec *spec = clientData;
- IndicatorElement *indicator = elementRecord;
+ IndicatorSpec *spec = (IndicatorSpec *)clientData;
+ IndicatorElement *indicator = (IndicatorElement *)elementRecord;
Display *display = Tk_Display(tkwin);
Ttk_Padding padding;
XColor *fgColor, *frameColor, *shadeColor, *indicatorColor, *borderColor;
@@ -579,7 +593,7 @@ static void IndicatorElementDraw(
#if defined(IGNORES_VISUAL)
- img->data = ckalloc(img->bytes_per_line * img->height);
+ img->data = (char *)ckalloc(img->bytes_per_line * img->height);
if (img->data == NULL) {
XDestroyImage(img);
return;
@@ -628,7 +642,7 @@ static void IndicatorElementDraw(
XDestroyImage(img);
}
-static Ttk_ElementSpec IndicatorElementSpec = {
+static const Ttk_ElementSpec IndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(IndicatorElement),
IndicatorElementOptions,
@@ -643,7 +657,6 @@ static Ttk_ElementSpec IndicatorElementSpec = {
* clientData is an enum ArrowDirection pointer.
*/
-static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
typedef struct {
Tcl_Obj *sizeObj;
Tcl_Obj *borderObj;
@@ -652,18 +665,18 @@ typedef struct {
Tcl_Obj *colorObj; /* Arrow color */
} ArrowElement;
-static Ttk_ElementOptionSpec ArrowElementOptions[] = {
+static const Ttk_ElementOptionSpec ArrowElementOptions[] = {
{ "-arrowsize", TK_OPTION_PIXELS,
- Tk_Offset(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) },
+ offsetof(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) },
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND },
+ offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND },
{ "-bordercolor", TK_OPTION_COLOR,
- Tk_Offset(ArrowElement,borderColorObj), "black" },
+ offsetof(ArrowElement,borderColorObj), "black" },
{ "-relief", TK_OPTION_RELIEF,
- Tk_Offset(ArrowElement,reliefObj),"raised"},
+ offsetof(ArrowElement,reliefObj),"raised"},
{ "-arrowcolor", TK_OPTION_COLOR,
- Tk_Offset(ArrowElement,colorObj),"black"},
- { NULL, 0, 0, NULL }
+ offsetof(ArrowElement,colorObj),"black"},
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
/*
@@ -671,15 +684,16 @@ static Ttk_ElementOptionSpec ArrowElementOptions[] = {
* top/left padding is 1 less than bottom/right,
* since in this theme 2-pixel borders are asymmetric.
*/
-static Ttk_Padding ArrowPadding = { 3,3,4,4 };
+static const Ttk_Padding ArrowPadding = { 3,3,4,4 };
static void ArrowElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ArrowElement *arrow = elementRecord;
- int direction = *(int *)clientData;
+ ArrowElement *arrow = (ArrowElement *)elementRecord;
+ ArrowDirection direction = (ArrowDirection)PTR2INT(clientData);
int width = SCROLLBAR_WIDTH;
+ (void)paddingPtr;
Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width);
width -= Ttk_PaddingWidth(ArrowPadding);
@@ -692,13 +706,14 @@ static void ArrowElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- int direction = *(int *)clientData;
- ArrowElement *arrow = elementRecord;
+ ArrowDirection direction = (ArrowDirection)PTR2INT(clientData);
+ ArrowElement *arrow = (ArrowElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj);
XColor *borderColor = Tk_GetColorFromObj(tkwin, arrow->borderColorObj);
XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj);
int relief = TK_RELIEF_RAISED;
int borderWidth = 2;
+ (void)state;
Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief);
@@ -710,7 +725,7 @@ static void ArrowElementDraw(
Ttk_PadBox(b, ArrowPadding), direction);
}
-static Ttk_ElementSpec ArrowElementSpec = {
+static const Ttk_ElementSpec ArrowElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ArrowElement),
ArrowElementOptions,
@@ -731,29 +746,32 @@ typedef struct {
Tcl_Obj *colorObj;
} MenubuttonArrowElement;
-static const char *directionStrings[] = { /* See also: button.c */
+static const char *const directionStrings[] = { /* See also: button.c */
"above", "below", "left", "right", "flush", NULL
};
enum { POST_ABOVE, POST_BELOW, POST_LEFT, POST_RIGHT, POST_FLUSH };
-static Ttk_ElementOptionSpec MenubuttonArrowElementOptions[] = {
+static const Ttk_ElementOptionSpec MenubuttonArrowElementOptions[] = {
{ "-direction", TK_OPTION_STRING,
- Tk_Offset(MenubuttonArrowElement,directionObj), "below" },
+ offsetof(MenubuttonArrowElement,directionObj), "below" },
{ "-arrowsize", TK_OPTION_PIXELS,
- Tk_Offset(MenubuttonArrowElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)},
+ offsetof(MenubuttonArrowElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)},
{ "-arrowcolor",TK_OPTION_COLOR,
- Tk_Offset(MenubuttonArrowElement,colorObj), "black"},
- { NULL, 0, 0, NULL }
+ offsetof(MenubuttonArrowElement,colorObj), "black"},
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
-static Ttk_Padding MenubuttonArrowPadding = { 3, 0, 3, 0 };
+static const Ttk_Padding MenubuttonArrowPadding = { 3, 0, 3, 0 };
static void MenubuttonArrowElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- MenubuttonArrowElement *arrow = elementRecord;
+ MenubuttonArrowElement *arrow = (MenubuttonArrowElement *)elementRecord;
int size = MENUBUTTON_ARROW_SIZE;
+ (void)dummy;
+ (void)paddingPtr;
+
Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size);
*widthPtr = *heightPtr = 2 * size + 1;
*widthPtr += Ttk_PaddingWidth(MenubuttonArrowPadding);
@@ -761,16 +779,18 @@ static void MenubuttonArrowElementSize(
}
static void MenubuttonArrowElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- MenubuttonArrowElement *arrow = elementRecord;
+ MenubuttonArrowElement *arrow = (MenubuttonArrowElement *)elementRecord;
XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj);
GC gc = Tk_GCForColor(arrowColor, d);
int size = MENUBUTTON_ARROW_SIZE;
int postDirection = POST_BELOW;
ArrowDirection arrowDirection = ARROW_DOWN;
int width = 0, height = 0;
+ (void)dummy;
+ (void)state;
Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size);
Tcl_GetIndexFromObjStruct(NULL, arrow->directionObj, directionStrings,
@@ -791,7 +811,7 @@ static void MenubuttonArrowElementDraw(
TtkFillArrow(Tk_Display(tkwin), d, gc, b, arrowDirection);
}
-static Ttk_ElementSpec MenubuttonArrowElementSpec = {
+static const Ttk_ElementSpec MenubuttonArrowElementSpec = {
TK_STYLE_VERSION_2,
sizeof(MenubuttonArrowElement),
MenubuttonArrowElementOptions,
@@ -820,26 +840,29 @@ typedef struct {
Tcl_Obj *orientObj;
} TroughElement;
-static Ttk_ElementOptionSpec TroughElementOptions[] = {
+static const Ttk_ElementOptionSpec TroughElementOptions[] = {
{ "-orient", TK_OPTION_ANY,
- Tk_Offset(TroughElement, orientObj), "horizontal" },
+ offsetof(TroughElement, orientObj), "horizontal" },
{ "-troughborderwidth", TK_OPTION_PIXELS,
- Tk_Offset(TroughElement,borderWidthObj), "1" },
+ offsetof(TroughElement,borderWidthObj), "1" },
{ "-troughcolor", TK_OPTION_BORDER,
- Tk_Offset(TroughElement,colorObj), DEFAULT_BACKGROUND },
+ offsetof(TroughElement,colorObj), DEFAULT_BACKGROUND },
{ "-troughrelief",TK_OPTION_RELIEF,
- Tk_Offset(TroughElement,reliefObj), "sunken" },
+ offsetof(TroughElement,reliefObj), "sunken" },
{ "-groovewidth", TK_OPTION_PIXELS,
- Tk_Offset(TroughElement,grooveWidthObj), "-1" },
- { NULL, 0, 0, NULL }
+ offsetof(TroughElement,grooveWidthObj), "-1" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void TroughElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- TroughElement *troughPtr = elementRecord;
+ TroughElement *troughPtr = (TroughElement *)elementRecord;
int borderWidth = 2, grooveWidth = 0;
+ (void)dummy;
+ (void)widthPtr;
+ (void)heightPtr;
Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth);
Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &grooveWidth);
@@ -850,15 +873,18 @@ static void TroughElementSize(
}
static void TroughElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- TroughElement *troughPtr = elementRecord;
+ TroughElement *troughPtr = (TroughElement *)elementRecord;
Tk_3DBorder border = NULL;
- int borderWidth = 2, relief = TK_RELIEF_SUNKEN, groove = -1, orient;
+ int borderWidth = 2, relief = TK_RELIEF_SUNKEN, groove = -1;
+ Ttk_Orient orient;
+ (void)dummy;
+ (void)state;
border = Tk_Get3DBorderFromObj(tkwin, troughPtr->colorObj);
- Ttk_GetOrientFromObj(NULL, troughPtr->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, troughPtr->orientObj, &orient);
Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief);
Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth);
Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &groove);
@@ -877,7 +903,7 @@ static void TroughElementDraw(
borderWidth, relief);
}
-static Ttk_ElementSpec TroughElementSpec = {
+static const Ttk_ElementSpec TroughElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TroughElement),
TroughElementOptions,
@@ -900,26 +926,30 @@ typedef struct {
Tcl_Obj *orientObj;
} ThumbElement;
-static Ttk_ElementOptionSpec ThumbElementOptions[] = {
- { "-width", TK_OPTION_PIXELS, Tk_Offset(ThumbElement,sizeObj),
+static const Ttk_ElementOptionSpec ThumbElementOptions[] = {
+ { "-width", TK_OPTION_PIXELS, offsetof(ThumbElement,sizeObj),
STRINGIFY(SCROLLBAR_WIDTH) },
- { "-background", TK_OPTION_BORDER, Tk_Offset(ThumbElement,borderObj),
+ { "-background", TK_OPTION_BORDER, offsetof(ThumbElement,borderObj),
DEFAULT_BACKGROUND },
- { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ThumbElement,borderColorObj),
+ { "-bordercolor", TK_OPTION_COLOR, offsetof(ThumbElement,borderColorObj),
"black" },
- { "-relief", TK_OPTION_RELIEF,Tk_Offset(ThumbElement,reliefObj),"raised" },
- { "-orient", TK_OPTION_ANY,Tk_Offset(ThumbElement,orientObj),"horizontal"},
- { NULL, 0, 0, NULL }
+ { "-relief", TK_OPTION_RELIEF, offsetof(ThumbElement,reliefObj),"raised" },
+ { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"},
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void ThumbElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ThumbElement *thumb = elementRecord;
- int orient, size;
+ ThumbElement *thumb = (ThumbElement *)elementRecord;
+ Ttk_Orient orient;
+ int size;
+ (void)dummy;
+ (void)paddingPtr;
+
Tk_GetPixelsFromObj(NULL, tkwin, thumb->sizeObj, &size);
- Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, thumb->orientObj, &orient);
if (orient == TTK_ORIENT_VERTICAL) {
*widthPtr = size;
@@ -931,14 +961,16 @@ static void ThumbElementSize(
}
static void ThumbElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- ThumbElement *thumb = elementRecord;
+ ThumbElement *thumb = (ThumbElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj);
XColor *borderColor = Tk_GetColorFromObj(tkwin, thumb->borderColorObj);
int relief = TK_RELIEF_RAISED;
int borderWidth = 2;
+ (void)dummy;
+ (void)state;
/*
* Don't draw the thumb if we are disabled.
@@ -954,7 +986,7 @@ static void ThumbElementDraw(
DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief);
}
-static Ttk_ElementSpec ThumbElementSpec = {
+static const Ttk_ElementSpec ThumbElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ThumbElement),
ThumbElementOptions,
@@ -983,32 +1015,35 @@ typedef struct {
Tcl_Obj *orientObj; /* Orientation of overall slider */
} SliderElement;
-static Ttk_ElementOptionSpec SliderElementOptions[] = {
- { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj),
+static const Ttk_ElementOptionSpec SliderElementOptions[] = {
+ { "-sliderlength", TK_OPTION_PIXELS, offsetof(SliderElement,lengthObj),
"15" },
- { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj),
+ { "-sliderthickness",TK_OPTION_PIXELS, offsetof(SliderElement,thicknessObj),
"15" },
- { "-sliderrelief", TK_OPTION_RELIEF, Tk_Offset(SliderElement,reliefObj),
+ { "-sliderrelief", TK_OPTION_RELIEF, offsetof(SliderElement,reliefObj),
"raised" },
- { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SliderElement,borderWidthObj),
+ { "-borderwidth", TK_OPTION_PIXELS, offsetof(SliderElement,borderWidthObj),
STRINGIFY(BORDERWIDTH) },
- { "-background", TK_OPTION_BORDER, Tk_Offset(SliderElement,borderObj),
+ { "-background", TK_OPTION_BORDER, offsetof(SliderElement,borderObj),
DEFAULT_BACKGROUND },
- { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ThumbElement,borderColorObj),
+ { "-bordercolor", TK_OPTION_COLOR, offsetof(ThumbElement,borderColorObj),
"black" },
- { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj),
+ { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj),
"horizontal" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void SliderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- SliderElement *slider = elementRecord;
- int orient, length, thickness, borderWidth;
+ SliderElement *slider = (SliderElement *)elementRecord;
+ Ttk_Orient orient;
+ int length, thickness, borderWidth;
+ (void)dummy;
+ (void)paddingPtr;
- Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, slider->orientObj, &orient);
Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth);
Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length);
Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness);
@@ -1027,13 +1062,15 @@ static void SliderElementSize(
}
static void SliderElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- SliderElement *slider = elementRecord;
+ SliderElement *slider = (SliderElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj);
XColor *borderColor = Tk_GetColorFromObj(tkwin, slider->borderColorObj);
int relief = TK_RELIEF_RAISED, borderWidth = 2;
+ (void)dummy;
+ (void)state;
Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth);
Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief);
@@ -1044,7 +1081,7 @@ static void SliderElementDraw(
DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief);
}
-static Ttk_ElementSpec SliderElementSpec = {
+static const Ttk_ElementSpec SliderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SliderElement),
SliderElementOptions,
@@ -1065,23 +1102,25 @@ typedef struct {
Tcl_Obj *diameterObj;
} TreeitemIndicator;
-static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = {
+static const Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = {
{ "-foreground", TK_OPTION_COLOR,
- Tk_Offset(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND },
+ offsetof(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND },
{ "-diameter", TK_OPTION_PIXELS,
- Tk_Offset(TreeitemIndicator,diameterObj), "9" },
+ offsetof(TreeitemIndicator,diameterObj), "9" },
{ "-indicatormargins", TK_OPTION_STRING,
- Tk_Offset(TreeitemIndicator,marginObj), "2 2 4 2" },
- { NULL, 0, 0, NULL }
+ offsetof(TreeitemIndicator,marginObj), "2 2 4 2" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void TreeitemIndicatorSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- TreeitemIndicator *indicator = elementRecord;
+ TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord;
int diameter = 0;
Ttk_Padding margins;
+ (void)dummy;
+ (void)paddingPtr;
Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter);
@@ -1090,15 +1129,16 @@ static void TreeitemIndicatorSize(
}
static void TreeitemIndicatorDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- TreeitemIndicator *indicator = elementRecord;
+ TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord;
XColor *color = Tk_GetColorFromObj(tkwin, indicator->colorObj);
GC gc = Tk_GCForColor(color, d);
Ttk_Padding padding = Ttk_UniformPadding(0);
int w = WIN32_XDRAWLINE_HACK;
int cx, cy;
+ (void)dummy;
if (state & TTK_STATE_LEAF) {
/* don't draw anything ... */
@@ -1121,7 +1161,7 @@ static void TreeitemIndicatorDraw(
}
}
-static Ttk_ElementSpec TreeitemIndicatorElementSpec = {
+static const Ttk_ElementSpec TreeitemIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TreeitemIndicator),
TreeitemIndicatorOptions,
@@ -1157,18 +1197,15 @@ MODULE_SCOPE int TtkAltTheme_Init(Tcl_Interp *interp)
Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "uparrow",
- &ArrowElementSpec, &ArrowElements[0]);
+ &ArrowElementSpec, INT2PTR(ARROW_UP));
Ttk_RegisterElement(interp, theme, "downarrow",
- &ArrowElementSpec, &ArrowElements[1]);
+ &ArrowElementSpec, INT2PTR(ARROW_DOWN));
Ttk_RegisterElement(interp, theme, "leftarrow",
- &ArrowElementSpec, &ArrowElements[2]);
+ &ArrowElementSpec, INT2PTR(ARROW_LEFT));
Ttk_RegisterElement(interp, theme, "rightarrow",
- &ArrowElementSpec, &ArrowElements[3]);
- Ttk_RegisterElement(interp, theme, "arrow",
- &ArrowElementSpec, &ArrowElements[0]);
-
+ &ArrowElementSpec, INT2PTR(ARROW_RIGHT));
Ttk_RegisterElement(interp, theme, "arrow",
- &ArrowElementSpec, &ArrowElements[0]);
+ &ArrowElementSpec, INT2PTR(ARROW_UP));
Ttk_RegisterElement(interp, theme, "Treeitem.indicator",
&TreeitemIndicatorElementSpec, 0);
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c
index 4dd2adb..e2626e5 100644
--- a/generic/ttk/ttkElements.c
+++ b/generic/ttk/ttkElements.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003 Joe English
*
* Default implementation for themed elements.
*
@@ -19,20 +19,32 @@
* and may be used in other engines.
*/
-/* public */ Ttk_ElementOptionSpec TtkNullElementOptions[] = { { NULL, 0, 0, NULL } };
+/* public */ const Ttk_ElementOptionSpec TtkNullElementOptions[] = { { NULL, TK_OPTION_BOOLEAN, 0, NULL } };
/* public */ void
TtkNullElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+ (void)paddingPtr;
}
/* public */ void
TtkNullElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)d;
+ (void)b;
+ (void)state;
}
/* public */ Ttk_ElementSpec ttkNullElementSpec = {
@@ -56,18 +68,20 @@ typedef struct {
Tcl_Obj *backgroundObj;
} BackgroundElement;
-static Ttk_ElementOptionSpec BackgroundElementOptions[] = {
+static const Ttk_ElementOptionSpec BackgroundElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND },
- { NULL, 0, 0, NULL }
+ offsetof(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void FillElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- BackgroundElement *bg = elementRecord;
+ BackgroundElement *bg = (BackgroundElement *)elementRecord;
Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,bg->backgroundObj);
+ (void)dummy;
+ (void)state;
XFillRectangle(Tk_Display(tkwin), d,
Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),
@@ -78,12 +92,14 @@ static void BackgroundElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
+ (void)b;
+
FillElementDraw(
clientData, elementRecord, tkwin,
d, Ttk_WinBox(tkwin), state);
}
-static Ttk_ElementSpec FillElementSpec = {
+static const Ttk_ElementSpec FillElementSpec = {
TK_STYLE_VERSION_2,
sizeof(BackgroundElement),
BackgroundElementOptions,
@@ -91,7 +107,7 @@ static Ttk_ElementSpec FillElementSpec = {
FillElementDraw
};
-static Ttk_ElementSpec BackgroundElementSpec = {
+static const Ttk_ElementSpec BackgroundElementSpec = {
TK_STYLE_VERSION_2,
sizeof(BackgroundElement),
BackgroundElementOptions,
@@ -109,33 +125,40 @@ typedef struct {
Tcl_Obj *reliefObj;
} BorderElement;
-static Ttk_ElementOptionSpec BorderElementOptions[] = {
+static const Ttk_ElementOptionSpec BorderElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(BorderElement,borderObj), DEFAULT_BACKGROUND },
+ offsetof(BorderElement,borderObj), DEFAULT_BACKGROUND },
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ offsetof(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH },
{ "-relief", TK_OPTION_RELIEF,
- Tk_Offset(BorderElement,reliefObj), "flat" },
- { NULL, 0, 0, NULL }
+ offsetof(BorderElement,reliefObj), "flat" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void BorderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- BorderElement *bd = elementRecord;
+ BorderElement *bd = (BorderElement *)elementRecord;
int borderWidth = 0;
+ (void)dummy;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+
Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
}
static void BorderElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- BorderElement *bd = elementRecord;
+ BorderElement *bd = (BorderElement *)elementRecord;
Tk_3DBorder border = NULL;
int borderWidth = 1, relief = TK_RELIEF_FLAT;
+ (void)dummy;
+ (void)state;
border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj);
Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
@@ -147,7 +170,7 @@ static void BorderElementDraw(
}
}
-static Ttk_ElementSpec BorderElementSpec = {
+static const Ttk_ElementSpec BorderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(BorderElement),
BorderElementOptions,
@@ -164,38 +187,44 @@ typedef struct {
Tcl_Obj *borderWidthObj;
} FieldElement;
-static Ttk_ElementOptionSpec FieldElementOptions[] = {
+static const Ttk_ElementOptionSpec FieldElementOptions[] = {
{ "-fieldbackground", TK_OPTION_BORDER,
- Tk_Offset(FieldElement,borderObj), "white" },
+ offsetof(FieldElement,borderObj), "white" },
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(FieldElement,borderWidthObj), "2" },
- { NULL, 0, 0, NULL }
+ offsetof(FieldElement,borderWidthObj), "2" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void FieldElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- FieldElement *field = elementRecord;
+ FieldElement *field = (FieldElement *)elementRecord;
int borderWidth = 2;
+ (void)dummy;
+ (void)widthPtr;
+ (void)heightPtr;
+
Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
}
static void FieldElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- FieldElement *field = elementRecord;
+ FieldElement *field = (FieldElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj);
int borderWidth = 2;
+ (void)dummy;
+ (void)state;
Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth);
Tk_Fill3DRectangle(tkwin, d, border,
b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_SUNKEN);
}
-static Ttk_ElementSpec FieldElementSpec = {
+static const Ttk_ElementSpec FieldElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FieldElement),
FieldElementOptions,
@@ -220,24 +249,27 @@ typedef struct {
Tcl_Obj *shiftreliefObj;
} PaddingElement;
-static Ttk_ElementOptionSpec PaddingElementOptions[] = {
+static const Ttk_ElementOptionSpec PaddingElementOptions[] = {
{ "-padding", TK_OPTION_STRING,
- Tk_Offset(PaddingElement,paddingObj), "0" },
+ offsetof(PaddingElement,paddingObj), "0" },
{ "-relief", TK_OPTION_RELIEF,
- Tk_Offset(PaddingElement,reliefObj), "flat" },
+ offsetof(PaddingElement,reliefObj), "flat" },
{ "-shiftrelief", TK_OPTION_INT,
- Tk_Offset(PaddingElement,shiftreliefObj), "0" },
- { NULL, 0, 0, NULL }
+ offsetof(PaddingElement,shiftreliefObj), "0" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void PaddingElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- PaddingElement *padding = elementRecord;
+ PaddingElement *padding = (PaddingElement *)elementRecord;
int shiftRelief = 0;
int relief = TK_RELIEF_FLAT;
Ttk_Padding pad;
+ (void)dummy;
+ (void)widthPtr;
+ (void)heightPtr;
Tk_GetReliefFromObj(NULL, padding->reliefObj, &relief);
Tcl_GetIntFromObj(NULL, padding->shiftreliefObj, &shiftRelief);
@@ -245,7 +277,7 @@ static void PaddingElementSize(
*paddingPtr = Ttk_RelievePadding(pad, relief, shiftRelief);
}
-static Ttk_ElementSpec PaddingElementSpec = {
+static const Ttk_ElementSpec PaddingElementSpec = {
TK_STYLE_VERSION_2,
sizeof(PaddingElement),
PaddingElementOptions,
@@ -286,31 +318,36 @@ static void DrawFocusRing(
Tk_FreeGC(Tk_Display(tkwin), gc);
}
-static Ttk_ElementOptionSpec FocusElementOptions[] = {
+static const Ttk_ElementOptionSpec FocusElementOptions[] = {
{ "-focuscolor",TK_OPTION_COLOR,
- Tk_Offset(FocusElement,focusColorObj), "black" },
+ offsetof(FocusElement,focusColorObj), "black" },
{ "-focusthickness",TK_OPTION_PIXELS,
- Tk_Offset(FocusElement,focusThicknessObj), "1" },
- { NULL, 0, 0, NULL }
+ offsetof(FocusElement,focusThicknessObj), "1" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void FocusElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- FocusElement *focus = elementRecord;
+ FocusElement *focus = (FocusElement *)elementRecord;
int focusThickness = 0;
+ (void)dummy;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
Tcl_GetIntFromObj(NULL, focus->focusThicknessObj, &focusThickness);
*paddingPtr = Ttk_UniformPadding((short)focusThickness);
}
static void FocusElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- FocusElement *focus = elementRecord;
+ FocusElement *focus = (FocusElement *)elementRecord;
int focusThickness = 0;
+ (void)dummy;
if (state & TTK_STATE_FOCUS) {
Tcl_GetIntFromObj(NULL,focus->focusThicknessObj,&focusThickness);
@@ -318,7 +355,7 @@ static void FocusElementDraw(
}
}
-static Ttk_ElementSpec FocusElementSpec = {
+static const Ttk_ElementSpec FocusElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FocusElement),
FocusElementOptions,
@@ -338,42 +375,51 @@ typedef struct {
Tcl_Obj *borderObj;
} SeparatorElement;
-static Ttk_ElementOptionSpec SeparatorElementOptions[] = {
+static const Ttk_ElementOptionSpec SeparatorElementOptions[] = {
{ "-orient", TK_OPTION_ANY,
- Tk_Offset(SeparatorElement, orientObj), "horizontal" },
+ offsetof(SeparatorElement, orientObj), "horizontal" },
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(SeparatorElement,borderObj), DEFAULT_BACKGROUND },
- { NULL, 0, 0, NULL }
+ offsetof(SeparatorElement,borderObj), DEFAULT_BACKGROUND },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void SeparatorElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)paddingPtr;
+
*widthPtr = *heightPtr = 2;
}
static void HorizontalSeparatorElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- SeparatorElement *separator = elementRecord;
+ SeparatorElement *separator = (SeparatorElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj);
GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC);
GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
+ (void)dummy;
+ (void)state;
XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x + b.width, b.y);
XDrawLine(Tk_Display(tkwin), d, lightGC, b.x, b.y+1, b.x + b.width, b.y+1);
}
static void VerticalSeparatorElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- SeparatorElement *separator = elementRecord;
+ SeparatorElement *separator = (SeparatorElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj);
GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC);
GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
+ (void)dummy;
+ (void)state;
XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x, b.y + b.height);
XDrawLine(Tk_Display(tkwin), d, lightGC, b.x+1, b.y, b.x+1, b.y+b.height);
@@ -383,9 +429,10 @@ static void GeneralSeparatorElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- SeparatorElement *separator = elementRecord;
- int orient;
- Ttk_GetOrientFromObj(NULL, separator->orientObj, &orient);
+ SeparatorElement *separator = (SeparatorElement *)elementRecord;
+ Ttk_Orient orient;
+
+ TtkGetOrientFromObj(NULL, separator->orientObj, &orient);
switch (orient) {
case TTK_ORIENT_HORIZONTAL:
HorizontalSeparatorElementDraw(
@@ -398,7 +445,7 @@ static void GeneralSeparatorElementDraw(
}
}
-static Ttk_ElementSpec HorizontalSeparatorElementSpec = {
+static const Ttk_ElementSpec HorizontalSeparatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SeparatorElement),
SeparatorElementOptions,
@@ -406,7 +453,7 @@ static Ttk_ElementSpec HorizontalSeparatorElementSpec = {
HorizontalSeparatorElementDraw
};
-static Ttk_ElementSpec VerticalSeparatorElementSpec = {
+static const Ttk_ElementSpec VerticalSeparatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SeparatorElement),
SeparatorElementOptions,
@@ -414,7 +461,7 @@ static Ttk_ElementSpec VerticalSeparatorElementSpec = {
HorizontalSeparatorElementDraw
};
-static Ttk_ElementSpec SeparatorElementSpec = {
+static const Ttk_ElementSpec SeparatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SeparatorElement),
SeparatorElementOptions,
@@ -430,30 +477,37 @@ typedef struct {
Tcl_Obj *backgroundObj;
} SizegripElement;
-static Ttk_ElementOptionSpec SizegripOptions[] = {
+static const Ttk_ElementOptionSpec SizegripOptions[] = {
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(SizegripElement,backgroundObj), DEFAULT_BACKGROUND },
- {0,0,0,0}
+ offsetof(SizegripElement,backgroundObj), DEFAULT_BACKGROUND },
+ {0,TK_OPTION_BOOLEAN,0,0}
};
static void SizegripSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
int gripCount = 3, gripSpace = 2, gripThickness = 3;
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)paddingPtr;
+
*widthPtr = *heightPtr = gripCount * (gripSpace + gripThickness);
}
static void SizegripDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- SizegripElement *grip = elementRecord;
+ SizegripElement *grip = (SizegripElement *)elementRecord;
int gripCount = 3, gripSpace = 2;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, grip->backgroundObj);
GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC);
GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
int x1 = b.x + b.width-1, y1 = b.y + b.height-1, x2 = x1, y2 = y1;
+ (void)dummy;
+ (void)state;
while (gripCount--) {
x1 -= gripSpace; y2 -= gripSpace;
@@ -463,7 +517,7 @@ static void SizegripDraw(
}
}
-static Ttk_ElementSpec SizegripElementSpec = {
+static const Ttk_ElementSpec SizegripElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SizegripElement),
SizegripOptions,
@@ -491,32 +545,35 @@ typedef struct {
Tcl_Obj *borderWidthObj;
} IndicatorElement;
-static Ttk_ElementOptionSpec IndicatorElementOptions[] = {
+static const Ttk_ElementOptionSpec IndicatorElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
+ offsetof(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
{ "-indicatorcolor", TK_OPTION_BORDER,
- Tk_Offset(IndicatorElement,colorObj), DEFAULT_BACKGROUND },
+ offsetof(IndicatorElement,colorObj), DEFAULT_BACKGROUND },
{ "-indicatorrelief", TK_OPTION_RELIEF,
- Tk_Offset(IndicatorElement,reliefObj), "raised" },
+ offsetof(IndicatorElement,reliefObj), "raised" },
{ "-indicatordiameter", TK_OPTION_PIXELS,
- Tk_Offset(IndicatorElement,diameterObj), "12" },
+ offsetof(IndicatorElement,diameterObj), "12" },
{ "-indicatormargin", TK_OPTION_STRING,
- Tk_Offset(IndicatorElement,marginObj), "0 2 4 2" },
+ offsetof(IndicatorElement,marginObj), "0 2 4 2" },
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(IndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH },
- { NULL, 0, 0, NULL }
+ offsetof(IndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
/*
* Checkbutton indicators (default): 3-D square.
*/
static void SquareIndicatorElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- IndicatorElement *indicator = elementRecord;
+ IndicatorElement *indicator = (IndicatorElement *)elementRecord;
Ttk_Padding margins;
int diameter = 0;
+ (void)dummy;
+ (void)paddingPtr;
+
Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter);
*widthPtr = diameter + Ttk_PaddingWidth(margins);
@@ -524,15 +581,17 @@ static void SquareIndicatorElementSize(
}
static void SquareIndicatorElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- IndicatorElement *indicator = elementRecord;
+ IndicatorElement *indicator = (IndicatorElement *)elementRecord;
Tk_3DBorder border = 0, interior = 0;
int relief = TK_RELIEF_RAISED;
Ttk_Padding padding;
int borderWidth = 2;
int diameter;
+ (void)dummy;
+ (void)state;
interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj);
border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj);
@@ -553,12 +612,15 @@ static void SquareIndicatorElementDraw(
* Radiobutton indicators: 3-D diamond.
*/
static void DiamondIndicatorElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- IndicatorElement *indicator = elementRecord;
+ IndicatorElement *indicator = (IndicatorElement *)elementRecord;
Ttk_Padding margins;
int diameter = 0;
+ (void)dummy;
+ (void)paddingPtr;
+
Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter);
*widthPtr = diameter + 3 + Ttk_PaddingWidth(margins);
@@ -566,16 +628,18 @@ static void DiamondIndicatorElementSize(
}
static void DiamondIndicatorElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- IndicatorElement *indicator = elementRecord;
+ IndicatorElement *indicator = (IndicatorElement *)elementRecord;
Tk_3DBorder border = 0, interior = 0;
int borderWidth = 2;
int relief = TK_RELIEF_RAISED;
int diameter, radius;
XPoint points[4];
Ttk_Padding padding;
+ (void)dummy;
+ (void)state;
interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj);
border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj);
@@ -601,7 +665,7 @@ static void DiamondIndicatorElementDraw(
Tk_Draw3DPolygon(tkwin,d,border,points,4,borderWidth,relief);
}
-static Ttk_ElementSpec CheckbuttonIndicatorElementSpec = {
+static const Ttk_ElementSpec CheckbuttonIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(IndicatorElement),
IndicatorElementOptions,
@@ -609,7 +673,7 @@ static Ttk_ElementSpec CheckbuttonIndicatorElementSpec = {
SquareIndicatorElementDraw
};
-static Ttk_ElementSpec RadiobuttonIndicatorElementSpec = {
+static const Ttk_ElementSpec RadiobuttonIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(IndicatorElement),
IndicatorElementOptions,
@@ -637,28 +701,31 @@ typedef struct {
Tcl_Obj *marginObj;
} MenuIndicatorElement;
-static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = {
+static const Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
+ offsetof(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
{ "-indicatorwidth", TK_OPTION_PIXELS,
- Tk_Offset(MenuIndicatorElement,widthObj), "4.0m" },
+ offsetof(MenuIndicatorElement,widthObj), "4.0m" },
{ "-indicatorheight", TK_OPTION_PIXELS,
- Tk_Offset(MenuIndicatorElement,heightObj), "1.7m" },
+ offsetof(MenuIndicatorElement,heightObj), "1.7m" },
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(MenuIndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ offsetof(MenuIndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH },
{ "-indicatorrelief", TK_OPTION_RELIEF,
- Tk_Offset(MenuIndicatorElement,reliefObj),"raised" },
+ offsetof(MenuIndicatorElement,reliefObj),"raised" },
{ "-indicatormargin", TK_OPTION_STRING,
- Tk_Offset(MenuIndicatorElement,marginObj), "5 0" },
- { NULL, 0, 0, NULL }
+ offsetof(MenuIndicatorElement,marginObj), "5 0" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void MenuIndicatorElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- MenuIndicatorElement *mi = elementRecord;
+ MenuIndicatorElement *mi = (MenuIndicatorElement *)elementRecord;
Ttk_Padding margins;
+ (void)dummy;
+ (void)paddingPtr;
+
Tk_GetPixelsFromObj(NULL, tkwin, mi->widthObj, widthPtr);
Tk_GetPixelsFromObj(NULL, tkwin, mi->heightObj, heightPtr);
Ttk_GetPaddingFromObj(NULL,tkwin,mi->marginObj, &margins);
@@ -667,13 +734,15 @@ static void MenuIndicatorElementSize(
}
static void MenuIndicatorElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- MenuIndicatorElement *mi = elementRecord;
+ MenuIndicatorElement *mi = (MenuIndicatorElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, mi->backgroundObj);
Ttk_Padding margins;
int borderWidth = 2;
+ (void)dummy;
+ (void)state;
Ttk_GetPaddingFromObj(NULL,tkwin,mi->marginObj,&margins);
b = Ttk_PadBox(b, margins);
@@ -682,7 +751,7 @@ static void MenuIndicatorElementDraw(
borderWidth, TK_RELIEF_RAISED);
}
-static Ttk_ElementSpec MenuIndicatorElementSpec = {
+static const Ttk_ElementSpec MenuIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(MenuIndicatorElement),
MenuIndicatorElementOptions,
@@ -697,7 +766,6 @@ static Ttk_ElementSpec MenuIndicatorElementSpec = {
* clientData is an enum ArrowDirection pointer.
*/
-static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
typedef struct {
Tcl_Obj *borderObj;
Tcl_Obj *borderWidthObj;
@@ -706,29 +774,30 @@ typedef struct {
Tcl_Obj *colorObj;
} ArrowElement;
-static Ttk_ElementOptionSpec ArrowElementOptions[] = {
+static const Ttk_ElementOptionSpec ArrowElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND },
+ offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND },
{ "-relief",TK_OPTION_RELIEF,
- Tk_Offset(ArrowElement,reliefObj),"raised"},
+ offsetof(ArrowElement,reliefObj),"raised"},
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(ArrowElement,borderWidthObj), "1" },
+ offsetof(ArrowElement,borderWidthObj), "1" },
{ "-arrowcolor",TK_OPTION_COLOR,
- Tk_Offset(ArrowElement,colorObj),"black"},
+ offsetof(ArrowElement,colorObj),"black"},
{ "-arrowsize", TK_OPTION_PIXELS,
- Tk_Offset(ArrowElement,sizeObj), "14" },
- { NULL, 0, 0, NULL }
+ offsetof(ArrowElement,sizeObj), "14" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
-static Ttk_Padding ArrowMargins = { 3,3,3,3 };
+static const Ttk_Padding ArrowMargins = { 3,3,3,3 };
static void ArrowElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ArrowElement *arrow = elementRecord;
- int direction = *(int *)clientData;
+ ArrowElement *arrow = (ArrowElement *)elementRecord;
+ ArrowDirection direction = (ArrowDirection)PTR2INT(clientData);
int width = 14;
+ (void)paddingPtr;
Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width);
width -= Ttk_PaddingWidth(ArrowMargins);
@@ -741,23 +810,24 @@ static void ArrowElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- int direction = *(int *)clientData;
- ArrowElement *arrow = elementRecord;
+ ArrowDirection direction = (ArrowDirection)PTR2INT(clientData);
+ ArrowElement *arrow = (ArrowElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj);
XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj);
int relief = TK_RELIEF_RAISED;
int borderWidth = 1;
+ (void)state;
Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief);
- Tk_Fill3DRectangle(
- tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief);
+ Tk_Fill3DRectangle( tkwin, d, border, b.x, b.y, b.width, b.height,
+ borderWidth, relief);
TtkFillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d),
- Ttk_PadBox(b, ArrowMargins), direction);
+ Ttk_PadBox(b, ArrowMargins), direction);
}
-static Ttk_ElementSpec ArrowElementSpec = {
+static const Ttk_ElementSpec ArrowElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ArrowElement),
ArrowElementOptions,
@@ -777,34 +847,39 @@ typedef struct {
Tcl_Obj *reliefObj;
} TroughElement;
-static Ttk_ElementOptionSpec TroughElementOptions[] = {
+static const Ttk_ElementOptionSpec TroughElementOptions[] = {
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(TroughElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ offsetof(TroughElement,borderWidthObj), DEFAULT_BORDERWIDTH },
{ "-troughcolor", TK_OPTION_BORDER,
- Tk_Offset(TroughElement,colorObj), DEFAULT_BACKGROUND },
+ offsetof(TroughElement,colorObj), DEFAULT_BACKGROUND },
{ "-troughrelief",TK_OPTION_RELIEF,
- Tk_Offset(TroughElement,reliefObj), "sunken" },
- { NULL, 0, 0, NULL }
+ offsetof(TroughElement,reliefObj), "sunken" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void TroughElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- TroughElement *troughPtr = elementRecord;
+ TroughElement *troughPtr = (TroughElement *)elementRecord;
int borderWidth = 2;
+ (void)dummy;
+ (void)widthPtr;
+ (void)heightPtr;
Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
}
static void TroughElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- TroughElement *troughPtr = elementRecord;
+ TroughElement *troughPtr = (TroughElement *)elementRecord;
Tk_3DBorder border = NULL;
int borderWidth = 2, relief = TK_RELIEF_SUNKEN;
+ (void)dummy;
+ (void)state;
border = Tk_Get3DBorderFromObj(tkwin, troughPtr->colorObj);
Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief);
@@ -814,7 +889,7 @@ static void TroughElementDraw(
borderWidth, relief);
}
-static Ttk_ElementSpec TroughElementSpec = {
+static const Ttk_ElementSpec TroughElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TroughElement),
TroughElementOptions,
@@ -837,29 +912,32 @@ typedef struct {
Tcl_Obj *borderWidthObj;
} ThumbElement;
-static Ttk_ElementOptionSpec ThumbElementOptions[] = {
+static const Ttk_ElementOptionSpec ThumbElementOptions[] = {
{ "-orient", TK_OPTION_ANY,
- Tk_Offset(ThumbElement, orientObj), "horizontal" },
+ offsetof(ThumbElement, orientObj), "horizontal" },
{ "-width", TK_OPTION_PIXELS,
- Tk_Offset(ThumbElement,thicknessObj), DEFAULT_ARROW_SIZE },
+ offsetof(ThumbElement,thicknessObj), DEFAULT_ARROW_SIZE },
{ "-relief", TK_OPTION_RELIEF,
- Tk_Offset(ThumbElement,reliefObj), "raised" },
+ offsetof(ThumbElement,reliefObj), "raised" },
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(ThumbElement,borderObj), DEFAULT_BACKGROUND },
+ offsetof(ThumbElement,borderObj), DEFAULT_BACKGROUND },
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH },
- { NULL, 0, 0, NULL }
+ offsetof(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void ThumbElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ThumbElement *thumb = elementRecord;
- int orient, thickness;
+ ThumbElement *thumb = (ThumbElement *)elementRecord;
+ Ttk_Orient orient;
+ int thickness;
+ (void)dummy;
+ (void)paddingPtr;
Tk_GetPixelsFromObj(NULL, tkwin, thumb->thicknessObj, &thickness);
- Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, thumb->orientObj, &orient);
if (orient == TTK_ORIENT_VERTICAL) {
*widthPtr = thickness;
@@ -871,12 +949,14 @@ static void ThumbElementSize(
}
static void ThumbElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- ThumbElement *thumb = elementRecord;
+ ThumbElement *thumb = (ThumbElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj);
int borderWidth = 2, relief = TK_RELIEF_RAISED;
+ (void)dummy;
+ (void)state;
Tk_GetPixelsFromObj(NULL, tkwin, thumb->borderWidthObj, &borderWidth);
Tk_GetReliefFromObj(NULL, thumb->reliefObj, &relief);
@@ -884,7 +964,7 @@ static void ThumbElementDraw(
borderWidth, relief);
}
-static Ttk_ElementSpec ThumbElementSpec = {
+static const Ttk_ElementSpec ThumbElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ThumbElement),
ThumbElementOptions,
@@ -908,30 +988,33 @@ typedef struct {
Tcl_Obj *borderWidthObj; /* the size of the border */
} SliderElement;
-static Ttk_ElementOptionSpec SliderElementOptions[] = {
- { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj),
+static const Ttk_ElementOptionSpec SliderElementOptions[] = {
+ { "-sliderlength", TK_OPTION_PIXELS, offsetof(SliderElement,lengthObj),
"30" },
- { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj),
+ { "-sliderthickness",TK_OPTION_PIXELS, offsetof(SliderElement,thicknessObj),
"15" },
- { "-sliderrelief", TK_OPTION_RELIEF, Tk_Offset(SliderElement,reliefObj),
+ { "-sliderrelief", TK_OPTION_RELIEF, offsetof(SliderElement,reliefObj),
"raised" },
- { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SliderElement,borderWidthObj),
+ { "-borderwidth", TK_OPTION_PIXELS, offsetof(SliderElement,borderWidthObj),
DEFAULT_BORDERWIDTH },
- { "-background", TK_OPTION_BORDER, Tk_Offset(SliderElement,borderObj),
+ { "-background", TK_OPTION_BORDER, offsetof(SliderElement,borderObj),
DEFAULT_BACKGROUND },
- { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj),
+ { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj),
"horizontal" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void SliderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- SliderElement *slider = elementRecord;
- int orient, length, thickness;
+ SliderElement *slider = (SliderElement *)elementRecord;
+ Ttk_Orient orient;
+ int length, thickness;
+ (void)dummy;
+ (void)paddingPtr;
- Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, slider->orientObj, &orient);
Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length);
Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness);
@@ -949,15 +1032,18 @@ static void SliderElementSize(
}
static void SliderElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- SliderElement *slider = elementRecord;
+ SliderElement *slider = (SliderElement *)elementRecord;
Tk_3DBorder border = NULL;
- int relief = TK_RELIEF_RAISED, borderWidth = 2, orient;
+ int relief = TK_RELIEF_RAISED, borderWidth = 2;
+ Ttk_Orient orient;
+ (void)dummy;
+ (void)state;
border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj);
- Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, slider->orientObj, &orient);
Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth);
Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief);
@@ -990,7 +1076,7 @@ static void SliderElementDraw(
}
}
-static Ttk_ElementSpec SliderElementSpec = {
+static const Ttk_ElementSpec SliderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SliderElement),
SliderElementOptions,
@@ -1019,30 +1105,33 @@ typedef struct {
Tcl_Obj *borderWidthObj; /* thickness of the border */
} PbarElement;
-static Ttk_ElementOptionSpec PbarElementOptions[] = {
- { "-orient", TK_OPTION_ANY, Tk_Offset(PbarElement,orientObj),
+static const Ttk_ElementOptionSpec PbarElementOptions[] = {
+ { "-orient", TK_OPTION_ANY, offsetof(PbarElement,orientObj),
"horizontal" },
- { "-thickness", TK_OPTION_PIXELS, Tk_Offset(PbarElement,thicknessObj),
+ { "-thickness", TK_OPTION_PIXELS, offsetof(PbarElement,thicknessObj),
DEFAULT_PBAR_THICKNESS },
- { "-barsize", TK_OPTION_PIXELS, Tk_Offset(PbarElement,lengthObj),
+ { "-barsize", TK_OPTION_PIXELS, offsetof(PbarElement,lengthObj),
DEFAULT_PBAR_LENGTH },
- { "-pbarrelief", TK_OPTION_RELIEF, Tk_Offset(PbarElement,reliefObj),
+ { "-pbarrelief", TK_OPTION_RELIEF, offsetof(PbarElement,reliefObj),
"raised" },
- { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(PbarElement,borderWidthObj),
+ { "-borderwidth", TK_OPTION_PIXELS, offsetof(PbarElement,borderWidthObj),
DEFAULT_BORDERWIDTH },
- { "-background", TK_OPTION_BORDER, Tk_Offset(PbarElement,borderObj),
+ { "-background", TK_OPTION_BORDER, offsetof(PbarElement,borderObj),
DEFAULT_BACKGROUND },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void PbarElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- PbarElement *pbar = elementRecord;
- int orient, thickness = 15, length = 30, borderWidth = 2;
+ PbarElement *pbar = (PbarElement *)elementRecord;
+ Ttk_Orient orient;
+ int thickness = 15, length = 30, borderWidth = 2;
+ (void)dummy;
+ (void)paddingPtr;
- Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, pbar->orientObj, &orient);
Tk_GetPixelsFromObj(NULL, tkwin, pbar->thicknessObj, &thickness);
Tk_GetPixelsFromObj(NULL, tkwin, pbar->lengthObj, &length);
Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth);
@@ -1060,12 +1149,14 @@ static void PbarElementSize(
}
static void PbarElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- PbarElement *pbar = elementRecord;
+ PbarElement *pbar = (PbarElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, pbar->borderObj);
int relief = TK_RELIEF_RAISED, borderWidth = 2;
+ (void)dummy;
+ (void)state;
Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth);
Tk_GetReliefFromObj(NULL, pbar->reliefObj, &relief);
@@ -1075,7 +1166,7 @@ static void PbarElementDraw(
borderWidth, relief);
}
-static Ttk_ElementSpec PbarElementSpec = {
+static const Ttk_ElementSpec PbarElementSpec = {
TK_STYLE_VERSION_2,
sizeof(PbarElement),
PbarElementOptions,
@@ -1092,35 +1183,40 @@ typedef struct {
Tcl_Obj *backgroundObj;
} TabElement;
-static Ttk_ElementOptionSpec TabElementOptions[] = {
+static const Ttk_ElementOptionSpec TabElementOptions[] = {
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(TabElement,borderWidthObj),"1" },
+ offsetof(TabElement,borderWidthObj),"1" },
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(TabElement,backgroundObj), DEFAULT_BACKGROUND },
- {0,0,0,0}
+ offsetof(TabElement,backgroundObj), DEFAULT_BACKGROUND },
+ {0,TK_OPTION_BOOLEAN,0,0}
};
static void TabElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- TabElement *tab = elementRecord;
+ TabElement *tab = (TabElement *)elementRecord;
int borderWidth = 1;
+ (void)dummy;
+ (void)widthPtr;
+ (void)heightPtr;
+
Tk_GetPixelsFromObj(0, tkwin, tab->borderWidthObj, &borderWidth);
paddingPtr->top = paddingPtr->left = paddingPtr->right = borderWidth;
paddingPtr->bottom = 0;
}
static void TabElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- TabElement *tab = elementRecord;
+ TabElement *tab = (TabElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj);
int borderWidth = 1;
int cut = 2;
XPoint pts[6];
int n = 0;
+ (void)dummy;
Tcl_GetIntFromObj(NULL, tab->borderWidthObj, &borderWidth);
@@ -1163,7 +1259,7 @@ static void TabElementDraw(
}
-static Ttk_ElementSpec TabElementSpec = {
+static const Ttk_ElementSpec TabElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TabElement),
TabElementOptions,
@@ -1179,12 +1275,14 @@ typedef TabElement ClientElement;
#define ClientElementOptions TabElementOptions
static void ClientElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- ClientElement *ce = elementRecord;
+ ClientElement *ce = (ClientElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj);
int borderWidth = 1;
+ (void)dummy;
+ (void)state;
Tcl_GetIntFromObj(NULL, ce->borderWidthObj, &borderWidth);
@@ -1193,16 +1291,20 @@ static void ClientElementDraw(
}
static void ClientElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ClientElement *ce = elementRecord;
+ ClientElement *ce = (ClientElement *)elementRecord;
int borderWidth = 1;
+ (void)dummy;
+ (void)widthPtr;
+ (void)heightPtr;
+
Tk_GetPixelsFromObj(0, tkwin, ce->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
}
-static Ttk_ElementSpec ClientElementSpec = {
+static const Ttk_ElementSpec ClientElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ClientElement),
ClientElementOptions,
@@ -1243,15 +1345,15 @@ void TtkElements_Init(Tcl_Interp *interp)
Ttk_RegisterElement(interp, theme, "indicator", &ttkNullElementSpec,NULL);
Ttk_RegisterElement(interp, theme, "uparrow",
- &ArrowElementSpec, &ArrowElements[0]);
+ &ArrowElementSpec, INT2PTR(ARROW_UP));
Ttk_RegisterElement(interp, theme, "downarrow",
- &ArrowElementSpec, &ArrowElements[1]);
+ &ArrowElementSpec, INT2PTR(ARROW_DOWN));
Ttk_RegisterElement(interp, theme, "leftarrow",
- &ArrowElementSpec, &ArrowElements[2]);
+ &ArrowElementSpec, INT2PTR(ARROW_LEFT));
Ttk_RegisterElement(interp, theme, "rightarrow",
- &ArrowElementSpec, &ArrowElements[3]);
+ &ArrowElementSpec, INT2PTR(ARROW_RIGHT));
Ttk_RegisterElement(interp, theme, "arrow",
- &ArrowElementSpec, &ArrowElements[0]);
+ &ArrowElementSpec, INT2PTR(ARROW_UP));
Ttk_RegisterElement(interp, theme, "trough", &TroughElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "thumb", &ThumbElementSpec, NULL);
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 1d8137b..36e613e 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -1,11 +1,11 @@
/*
* DERIVED FROM: tk/generic/tkEntry.c r1.35.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2000 Ajuba Solutions.
- * Copyright (c) 2002 ActiveState Corporation.
- * Copyright (c) 2004 Joe English
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Ajuba Solutions.
+ * Copyright © 2002 ActiveState Corporation.
+ * Copyright © 2004 Joe English
*/
#include "tkInt.h"
@@ -69,6 +69,7 @@ static const char *const validateReasonStrings[] = {
/* Style parameters:
*/
typedef struct {
+ Tcl_Obj *placeholderForegroundObj;/* Foreground color for placeholder text */
Tcl_Obj *foregroundObj; /* Foreground color for normal text */
Tcl_Obj *backgroundObj; /* Entry widget background color */
Tcl_Obj *selBorderObj; /* Border and background for selection */
@@ -83,12 +84,12 @@ typedef struct {
* Internal state:
*/
char *string; /* Storage for string (malloced) */
- int numBytes; /* Length of string in bytes. */
- int numChars; /* Length of string in characters. */
+ TkSizeT numBytes; /* Length of string in bytes. */
+ TkSizeT numChars; /* Length of string in characters. */
- int insertPos; /* Insert index */
- int selectFirst; /* Index of start of selection, or -1 */
- int selectLast; /* Index of end of selection, or -1 */
+ TkSizeT insertPos; /* Insert index */
+ TkSizeT selectFirst; /* Index of start of selection, or TCL_INDEX_NONE */
+ TkSizeT selectLast; /* Index of end of selection, or TCL_INDEX_NONE */
Scrollable xscroll; /* Current scroll position */
ScrollHandle xscrollHandle;
@@ -114,6 +115,8 @@ typedef struct {
Tcl_Obj *stateObj; /* Compatibility option -- see CheckStateObj */
+ Tcl_Obj *placeholderObj; /* Text to display for placeholder text */
+
/*
* Derived resources:
*/
@@ -143,55 +146,63 @@ typedef struct {
/*
* Default option values:
*/
-#define DEF_SELECT_BG "#000000"
-#define DEF_SELECT_FG "#ffffff"
-#define DEF_INSERT_BG "black"
-#define DEF_ENTRY_WIDTH "20"
-#define DEF_ENTRY_FONT "TkTextFont"
-#define DEF_LIST_HEIGHT "10"
+#define DEF_SELECT_BG "#000000"
+#define DEF_SELECT_FG "#ffffff"
+#define DEF_PLACEHOLDER_FG "#b3b3b3"
+#define DEF_INSERT_BG "black"
+#define DEF_ENTRY_WIDTH "20"
+#define DEF_ENTRY_FONT "TkTextFont"
+#define DEF_LIST_HEIGHT "10"
-static Tk_OptionSpec EntryOptionSpecs[] = {
+static const Tk_OptionSpec EntryOptionSpecs[] = {
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
- "ExportSelection", "1", -1, Tk_Offset(Entry, entry.exportSelection),
+ "ExportSelection", "1", TCL_INDEX_NONE, offsetof(Entry, entry.exportSelection),
0,0,0 },
{TK_OPTION_FONT, "-font", "font", "Font",
- DEF_ENTRY_FONT, Tk_Offset(Entry, entry.fontObj),-1,
+ DEF_ENTRY_FONT, offsetof(Entry, entry.fontObj),TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand",
- NULL, -1, Tk_Offset(Entry, entry.invalidCmd),
+ NULL, TCL_INDEX_NONE, offsetof(Entry, entry.invalidCmd),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- "left", -1, Tk_Offset(Entry, entry.justify),
+ "left", TCL_INDEX_NONE, offsetof(Entry, entry.justify),
0, 0, GEOMETRY_CHANGED},
+ {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder",
+ NULL, offsetof(Entry, entry.placeholderObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-show", "show", "Show",
- NULL, -1, Tk_Offset(Entry, entry.showChar),
+ NULL, TCL_INDEX_NONE, offsetof(Entry, entry.showChar),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-state", "state", "State",
- "normal", Tk_Offset(Entry, entry.stateObj), -1,
+ "normal", offsetof(Entry, entry.stateObj), TCL_INDEX_NONE,
0,0,STATE_CHANGED},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- NULL, Tk_Offset(Entry, entry.textVariableObj), -1,
+ NULL, offsetof(Entry, entry.textVariableObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED},
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
- "none", -1, Tk_Offset(Entry, entry.validate),
- 0, (ClientData) validateStrings, 0},
+ "none", TCL_INDEX_NONE, offsetof(Entry, entry.validate),
+ 0, (void *) validateStrings, 0},
{TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand",
- NULL, -1, Tk_Offset(Entry, entry.validateCmd),
+ NULL, TCL_INDEX_NONE, offsetof(Entry, entry.validateCmd),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-width", "width", "Width",
- DEF_ENTRY_WIDTH, Tk_Offset(Entry, entry.widthObj), -1,
+ DEF_ENTRY_WIDTH, offsetof(Entry, entry.widthObj), TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
- NULL, -1, Tk_Offset(Entry, entry.xscroll.scrollCmd),
+ NULL, TCL_INDEX_NONE, offsetof(Entry, entry.xscroll.scrollCmd),
TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED},
/* EntryStyleData options:
*/
+ {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor",
+ NULL, offsetof(Entry, entry.styleData.backgroundObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK,0,0},
{TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
- NULL, Tk_Offset(Entry, entry.styleData.foregroundObj), -1,
+ NULL, offsetof(Entry, entry.styleData.foregroundObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0},
- {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor",
- NULL, Tk_Offset(Entry, entry.styleData.backgroundObj), -1,
+ {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground",
+ "PlaceholderForeground", NULL,
+ offsetof(Entry, entry.styleData.placeholderForegroundObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0},
WIDGET_TAKEFOCUS_TRUE,
@@ -212,6 +223,7 @@ static void EntryInitStyleDefaults(EntryStyleData *es)
#define INIT(member, value) \
es->member = Tcl_NewStringObj(value, -1); \
Tcl_IncrRefCount(es->member);
+ INIT(placeholderForegroundObj, DEF_PLACEHOLDER_FG)
INIT(foregroundObj, DEFAULT_FOREGROUND)
INIT(selBorderObj, DEF_SELECT_BG)
INIT(selForegroundObj, DEF_SELECT_FG)
@@ -223,6 +235,7 @@ static void EntryInitStyleDefaults(EntryStyleData *es)
static void EntryFreeStyleDefaults(EntryStyleData *es)
{
+ Tcl_DecrRefCount(es->placeholderForegroundObj);
Tcl_DecrRefCount(es->foregroundObj);
Tcl_DecrRefCount(es->selBorderObj);
Tcl_DecrRefCount(es->selForegroundObj);
@@ -249,6 +262,7 @@ static void EntryInitStyleData(Entry *entryPtr, EntryStyleData *es)
# define INIT(member, name) \
if ((tmp=Ttk_QueryOption(entryPtr->core.layout,name,state))) \
es->member=tmp;
+ INIT(placeholderForegroundObj, "-placeholderforeground");
INIT(foregroundObj, "-foreground");
INIT(selBorderObj, "-selectbackground")
INIT(selBorderWidthObj, "-selectborderwidth")
@@ -259,6 +273,7 @@ static void EntryInitStyleData(Entry *entryPtr, EntryStyleData *es)
/* Reacquire color & border resources from resource cache.
*/
+ es->placeholderForegroundObj = Ttk_UseColor(cache, tkwin, es->placeholderForegroundObj);
es->foregroundObj = Ttk_UseColor(cache, tkwin, es->foregroundObj);
es->selForegroundObj = Ttk_UseColor(cache, tkwin, es->selForegroundObj);
es->insertColorObj = Ttk_UseColor(cache, tkwin, es->insertColorObj);
@@ -283,7 +298,7 @@ static char *EntryDisplayString(const char *showChar, int numChars)
TkUtfToUniChar(showChar, &ch);
size = TkUniCharToUtf(ch, buf);
- p = displayString = ckalloc(numChars * size + 1);
+ p = displayString = (char *)ckalloc(numChars * size + 1);
while (numChars--) {
memcpy(p, buf, size);
@@ -300,12 +315,23 @@ static char *EntryDisplayString(const char *showChar, int numChars)
*/
static void EntryUpdateTextLayout(Entry *entryPtr)
{
+ TkSizeT length;
+ char *text;
Tk_FreeTextLayout(entryPtr->entry.textLayout);
- entryPtr->entry.textLayout = Tk_ComputeTextLayout(
+ if ((entryPtr->entry.numChars != 0) || (entryPtr->entry.placeholderObj == NULL)) {
+ entryPtr->entry.textLayout = Tk_ComputeTextLayout(
Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj),
entryPtr->entry.displayString, entryPtr->entry.numChars,
0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES,
&entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight);
+ } else {
+ text = Tcl_GetStringFromObj(entryPtr->entry.placeholderObj, &length);
+ entryPtr->entry.textLayout = Tk_ComputeTextLayout(
+ Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj),
+ text, length,
+ 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES,
+ &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight);
+ }
}
/* EntryEditable --
@@ -324,32 +350,32 @@ EntryEditable(Entry *entryPtr)
/* EntryFetchSelection --
* Selection handler for entry widgets.
*/
-static int
+static TkSizeT
EntryFetchSelection(
- ClientData clientData, int offset, char *buffer, int maxBytes)
+ ClientData clientData, TkSizeT offset, char *buffer, TkSizeT maxBytes)
{
- Entry *entryPtr = (Entry *) clientData;
- int byteCount;
+ Entry *entryPtr = (Entry *)clientData;
+ TkSizeT byteCount;
const char *string;
const char *selStart, *selEnd;
- if (entryPtr->entry.selectFirst < 0 || (!entryPtr->entry.exportSelection)
+ if (entryPtr->entry.selectFirst == TCL_INDEX_NONE || (!entryPtr->entry.exportSelection)
|| Tcl_IsSafe(entryPtr->core.interp)) {
- return -1;
+ return TCL_INDEX_NONE;
}
string = entryPtr->entry.displayString;
- selStart = TkUtfAtIndex(string, entryPtr->entry.selectFirst);
- selEnd = TkUtfAtIndex(selStart,
+ selStart = Tcl_UtfAtIndex(string, entryPtr->entry.selectFirst);
+ selEnd = Tcl_UtfAtIndex(selStart,
entryPtr->entry.selectLast - entryPtr->entry.selectFirst);
+ if (selEnd <= selStart + offset) {
+ return 0;
+ }
byteCount = selEnd - selStart - offset;
if (byteCount > maxBytes) {
/* @@@POSSIBLE BUG: Can transfer partial UTF-8 sequences. Is this OK? */
byteCount = maxBytes;
}
- if (byteCount <= 0) {
- return 0;
- }
memcpy(buffer, selStart + offset, byteCount);
buffer[byteCount] = '\0';
return byteCount;
@@ -361,9 +387,9 @@ EntryFetchSelection(
*/
static void EntryLostSelection(ClientData clientData)
{
- Entry *entryPtr = (Entry *) clientData;
+ Entry *entryPtr = (Entry *)clientData;
entryPtr->core.flags &= ~GOT_SELECTION;
- entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1;
+ entryPtr->entry.selectFirst = entryPtr->entry.selectLast = TCL_INDEX_NONE;
TtkRedisplayWidget(&entryPtr->core);
}
@@ -377,7 +403,7 @@ static void EntryOwnSelection(Entry *entryPtr)
&& (!Tcl_IsSafe(entryPtr->core.interp))
&& !(entryPtr->core.flags & GOT_SELECTION)) {
Tk_OwnSelection(entryPtr->core.tkwin, XA_PRIMARY, EntryLostSelection,
- (ClientData) entryPtr);
+ entryPtr);
entryPtr->core.flags |= GOT_SELECTION;
}
}
@@ -393,9 +419,9 @@ static void EntryOwnSelection(Entry *entryPtr)
static void
ExpandPercents(
Entry *entryPtr, /* Entry that needs validation. */
- const char *template, /* Script template */
- const char *new, /* Potential new value of entry string */
- int index, /* index of insert/delete */
+ const char *templ, /* Script template */
+ const char *newValue, /* Potential new value of entry string */
+ TkSizeT index, /* index of insert/delete */
int count, /* #changed characters */
VREASON reason, /* Reason for change */
Tcl_DString *dsPtr) /* Result of %-substitutions */
@@ -407,28 +433,28 @@ ExpandPercents(
int ch;
char numStorage[2*TCL_INTEGER_SPACE];
- while (*template) {
+ while (*templ) {
/* Find everything up to the next % character and append it
* to the result string.
*/
- string = Tcl_UtfFindFirst(template, '%');
+ string = Tcl_UtfFindFirst(templ, '%');
if (string == NULL) {
/* No more %-sequences to expand.
* Copy the rest of the template.
*/
- Tcl_DStringAppend(dsPtr, template, -1);
+ Tcl_DStringAppend(dsPtr, templ, -1);
return;
}
- if (string != template) {
- Tcl_DStringAppend(dsPtr, template, string - template);
- template = string;
+ if (string != templ) {
+ Tcl_DStringAppend(dsPtr, templ, string - templ);
+ templ = string;
}
/* There's a percent sequence here. Process it.
*/
- ++template; /* skip over % */
- if (*template != '\0') {
- template += TkUtfToUniChar(template, &ch);
+ ++templ; /* skip over % */
+ if (*templ != '\0') {
+ templ += TkUtfToUniChar(templ, &ch);
} else {
ch = '%';
}
@@ -447,22 +473,22 @@ ExpandPercents(
string = numStorage;
break;
case 'i': /* index of insert/delete */
- sprintf(numStorage, "%d", index);
+ sprintf(numStorage, "%d", (int)index);
string = numStorage;
break;
case 'P': /* 'Peeked' new value of the string */
- string = new;
+ string = newValue;
break;
case 's': /* Current string value */
string = entryPtr->entry.string;
break;
case 'S': /* string to be inserted/deleted, if any */
if (reason == VALIDATE_INSERT) {
- string = TkUtfAtIndex(new, index);
- stringLength = TkUtfAtIndex(string, count) - string;
+ string = Tcl_UtfAtIndex(newValue, index);
+ stringLength = Tcl_UtfAtIndex(string, count) - string;
} else if (reason == VALIDATE_DELETE) {
- string = TkUtfAtIndex(entryPtr->entry.string, index);
- stringLength = TkUtfAtIndex(string, count) - string;
+ string = Tcl_UtfAtIndex(entryPtr->entry.string, index);
+ stringLength = Tcl_UtfAtIndex(string, count) - string;
} else {
string = "";
stringLength = 0;
@@ -502,18 +528,18 @@ ExpandPercents(
static int RunValidationScript(
Tcl_Interp *interp, /* Interpreter to use */
Entry *entryPtr, /* Entry being validated */
- const char *template, /* Script template */
+ const char *templ, /* Script template */
const char *optionName, /* "-validatecommand", "-invalidcommand" */
- const char *new, /* Potential new value of entry string */
- int index, /* index of insert/delete */
- int count, /* #changed characters */
+ const char *newValue, /* Potential new value of entry string */
+ TkSizeT index, /* index of insert/delete */
+ TkSizeT count, /* #changed characters */
VREASON reason) /* Reason for change */
{
Tcl_DString script;
int code;
Tcl_DStringInit(&script);
- ExpandPercents(entryPtr, template, new, index, count, reason, &script);
+ ExpandPercents(entryPtr, templ, newValue, index, count, reason, &script);
code = Tcl_EvalEx(interp,
Tcl_DStringValue(&script), Tcl_DStringLength(&script),
TCL_EVAL_GLOBAL);
@@ -557,7 +583,7 @@ static int EntryNeedsValidation(VMODE vmode, VREASON reason)
* Returns:
* TCL_OK if the change is accepted
* TCL_BREAK if the change is rejected
- * TCL_ERROR if any errors occurred
+ * TCL_ERROR if any errors occurred
*
* The change will be rejected if -validatecommand returns 0,
* or if -validatecommand or -invalidcommand modifies the value.
@@ -566,17 +592,17 @@ static int
EntryValidateChange(
Entry *entryPtr, /* Entry that needs validation. */
const char *newValue, /* Potential new value of entry string */
- int index, /* index of insert/delete, -1 otherwise */
- int count, /* #changed characters */
+ TkSizeT index, /* index of insert/delete, TCL_INDEX_NONE otherwise */
+ TkSizeT count, /* #changed characters */
VREASON reason) /* Reason for change */
{
Tcl_Interp *interp = entryPtr->core.interp;
VMODE vmode = entryPtr->entry.validate;
int code, change_ok;
- if ( (entryPtr->entry.validateCmd == NULL)
+ if ((entryPtr->entry.validateCmd == NULL)
|| (entryPtr->core.flags & VALIDATING)
- || !EntryNeedsValidation(vmode, reason) )
+ || !EntryNeedsValidation(vmode, reason))
{
return TCL_OK;
}
@@ -630,10 +656,11 @@ done:
* Returns:
* TCL_OK if valid, TCL_BREAK if invalid, TCL_ERROR on error.
*/
-static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason)
+static int EntryRevalidate(Tcl_Interp *dummy, Entry *entryPtr, VREASON reason)
{
int code = EntryValidateChange(
entryPtr, entryPtr->entry.string, -1,0, reason);
+ (void)dummy;
if (code == TCL_BREAK) {
TtkWidgetChangeState(&entryPtr->core, TTK_STATE_INVALID, 0);
@@ -693,8 +720,8 @@ static void AdjustIndices(Entry *entryPtr, int index, int nChars)
e->selectLast = AdjustIndex(e->selectLast, index+g, nChars);
e->xscroll.first= AdjustIndex(e->xscroll.first, index+g, nChars);
- if (e->selectLast <= e->selectFirst)
- e->selectFirst = e->selectLast = -1;
+ if (e->selectLast + 1 <= e->selectFirst + 1)
+ e->selectFirst = e->selectLast = TCL_INDEX_NONE;
}
/* EntryStoreValue --
@@ -707,7 +734,7 @@ static void
EntryStoreValue(Entry *entryPtr, const char *value)
{
size_t numBytes = strlen(value);
- int numChars = Tcl_NumUtfChars(value, numBytes);
+ TkSizeT numChars = Tcl_NumUtfChars(value, numBytes);
if (entryPtr->core.flags & VALIDATING)
entryPtr->core.flags |= VALIDATION_SET_VALUE;
@@ -725,7 +752,7 @@ EntryStoreValue(Entry *entryPtr, const char *value)
/* Store new value:
*/
- entryPtr->entry.string = ckalloc(numBytes + 1);
+ entryPtr->entry.string = (char *)ckalloc(numBytes + 1);
strcpy(entryPtr->entry.string, value);
entryPtr->entry.numBytes = numBytes;
entryPtr->entry.numChars = numChars;
@@ -782,7 +809,7 @@ static int EntrySetValue(Entry *entryPtr, const char *value)
*/
static void EntryTextVariableTrace(void *recordPtr, const char *value)
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
if (WidgetDestroyed(&entryPtr->core)) {
return;
@@ -808,37 +835,37 @@ static void EntryTextVariableTrace(void *recordPtr, const char *value)
static int
InsertChars(
Entry *entryPtr, /* Entry that is to get the new elements. */
- int index, /* Insert before this index */
+ TkSizeT index, /* Insert before this index */
const char *value) /* New characters to add */
{
char *string = entryPtr->entry.string;
- size_t byteIndex = TkUtfAtIndex(string, index) - string;
+ size_t byteIndex = Tcl_UtfAtIndex(string, index) - string;
size_t byteCount = strlen(value);
int charsAdded = Tcl_NumUtfChars(value, byteCount);
size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1;
- char *new;
+ char *newBytes;
int code;
if (byteCount == 0) {
return TCL_OK;
}
- new = ckalloc(newByteCount);
- memcpy(new, string, byteIndex);
- strcpy(new + byteIndex, value);
- strcpy(new + byteIndex + byteCount, string + byteIndex);
+ newBytes = (char *)ckalloc(newByteCount);
+ memcpy(newBytes, string, byteIndex);
+ strcpy(newBytes + byteIndex, value);
+ strcpy(newBytes + byteIndex + byteCount, string + byteIndex);
code = EntryValidateChange(
- entryPtr, new, index, charsAdded, VALIDATE_INSERT);
+ entryPtr, newBytes, index, charsAdded, VALIDATE_INSERT);
if (code == TCL_OK) {
AdjustIndices(entryPtr, index, charsAdded);
- code = EntrySetValue(entryPtr, new);
+ code = EntrySetValue(entryPtr, newBytes);
} else if (code == TCL_BREAK) {
code = TCL_OK;
}
- ckfree(new);
+ ckfree(newBytes);
return code;
}
@@ -848,42 +875,42 @@ InsertChars(
static int
DeleteChars(
Entry *entryPtr, /* Entry widget to modify. */
- int index, /* Index of first character to delete. */
- int count) /* How many characters to delete. */
+ TkSizeT index, /* Index of first character to delete. */
+ TkSizeT count) /* How many characters to delete. */
{
char *string = entryPtr->entry.string;
size_t byteIndex, byteCount, newByteCount;
- char *new;
+ char *newBytes;
int code;
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
index = 0;
}
- if (count > entryPtr->entry.numChars - index) {
+ if (count + index + 1 > entryPtr->entry.numChars + 1) {
count = entryPtr->entry.numChars - index;
}
- if (count <= 0) {
+ if (count + 1 <= 1) {
return TCL_OK;
}
- byteIndex = TkUtfAtIndex(string, index) - string;
- byteCount = TkUtfAtIndex(string+byteIndex, count) - (string+byteIndex);
+ byteIndex = Tcl_UtfAtIndex(string, index) - string;
+ byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex);
newByteCount = entryPtr->entry.numBytes + 1 - byteCount;
- new = ckalloc(newByteCount);
- memcpy(new, string, byteIndex);
- strcpy(new + byteIndex, string + byteIndex + byteCount);
+ newBytes = (char *)ckalloc(newByteCount);
+ memcpy(newBytes, string, byteIndex);
+ strcpy(newBytes + byteIndex, string + byteIndex + byteCount);
code = EntryValidateChange(
- entryPtr, new, index, count, VALIDATE_DELETE);
+ entryPtr, newBytes, index, count, VALIDATE_DELETE);
if (code == TCL_OK) {
AdjustIndices(entryPtr, index, -count);
- code = EntrySetValue(entryPtr, new);
+ code = EntrySetValue(entryPtr, newBytes);
} else if (code == TCL_BREAK) {
code = TCL_OK;
}
- ckfree(new);
+ ckfree(newBytes);
return code;
}
@@ -900,7 +927,7 @@ DeleteChars(
static void
EntryEventProc(ClientData clientData, XEvent *eventPtr)
{
- Entry *entryPtr = (Entry *) clientData;
+ Entry *entryPtr = (Entry *)clientData;
Tcl_Preserve(clientData);
switch (eventPtr->type) {
@@ -923,17 +950,18 @@ EntryEventProc(ClientData clientData, XEvent *eventPtr)
*/
static void
-EntryInitialize(Tcl_Interp *interp, void *recordPtr)
+EntryInitialize(Tcl_Interp *dummy, void *recordPtr)
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
+ (void)dummy;
Tk_CreateEventHandler(
entryPtr->core.tkwin, EntryEventMask, EntryEventProc, entryPtr);
Tk_CreateSelHandler(entryPtr->core.tkwin, XA_PRIMARY, XA_STRING,
- EntryFetchSelection, (ClientData) entryPtr, XA_STRING);
+ EntryFetchSelection, entryPtr, XA_STRING);
TtkBlinkCursor(&entryPtr->core);
- entryPtr->entry.string = ckalloc(1);
+ entryPtr->entry.string = (char *)ckalloc(1);
*entryPtr->entry.string = '\0';
entryPtr->entry.displayString = entryPtr->entry.string;
entryPtr->entry.textVariableTrace = 0;
@@ -945,14 +973,14 @@ EntryInitialize(Tcl_Interp *interp, void *recordPtr)
TtkCreateScrollHandle(&entryPtr->core, &entryPtr->entry.xscroll);
entryPtr->entry.insertPos = 0;
- entryPtr->entry.selectFirst = -1;
- entryPtr->entry.selectLast = -1;
+ entryPtr->entry.selectFirst = TCL_INDEX_NONE;
+ entryPtr->entry.selectLast = TCL_INDEX_NONE;
}
static void
EntryCleanup(void *recordPtr)
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
if (entryPtr->entry.textVariableTrace)
Ttk_UntraceVariable(entryPtr->entry.textVariableTrace);
@@ -974,7 +1002,7 @@ EntryCleanup(void *recordPtr)
*/
static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
Tcl_Obj *textVarName = entryPtr->entry.textVariableObj;
Ttk_TraceHandle *vt = 0;
@@ -1001,7 +1029,7 @@ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
/* Claim the selection, in case we've suddenly started exporting it.
*/
- if (entryPtr->entry.exportSelection && (entryPtr->entry.selectFirst != -1)
+ if (entryPtr->entry.exportSelection && (entryPtr->entry.selectFirst != TCL_INDEX_NONE)
&& (!Tcl_IsSafe(entryPtr->core.interp))) {
EntryOwnSelection(entryPtr);
}
@@ -1038,10 +1066,11 @@ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
/* EntryPostConfigure --
* Post-configuration hook for entry widgets.
*/
-static int EntryPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+static int EntryPostConfigure(Tcl_Interp *dummy, void *recordPtr, int mask)
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
int status = TCL_OK;
+ (void)dummy;
if ((mask & TEXTVAR_CHANGED) && entryPtr->entry.textVariableTrace != NULL) {
status = Ttk_FireTrace(entryPtr->entry.textVariableTrace);
@@ -1059,7 +1088,7 @@ static int EntryPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Precondition: textLayout and layoutX up-to-date.
*/
static int
-EntryCharPosition(Entry *entryPtr, int index)
+EntryCharPosition(Entry *entryPtr, TkSizeT index)
{
int xPos;
Tk_CharBbox(entryPtr->entry.textLayout, index, &xPos, NULL, NULL, NULL);
@@ -1079,7 +1108,7 @@ EntryCharPosition(Entry *entryPtr, int index)
static void
EntryDoLayout(void *recordPtr)
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
WidgetCore *corePtr = &entryPtr->core;
Tk_TextLayout textLayout = entryPtr->entry.textLayout;
int leftIndex = entryPtr->entry.xscroll.first;
@@ -1166,9 +1195,9 @@ static GC EntryGetGC(Entry *entryPtr, Tcl_Obj *colorObj, TkRegion clip)
*/
static void EntryDisplay(void *clientData, Drawable d)
{
- Entry *entryPtr = clientData;
+ Entry *entryPtr = (Entry *)clientData;
Tk_Window tkwin = entryPtr->core.tkwin;
- int leftIndex = entryPtr->entry.xscroll.first,
+ TkSizeT leftIndex = entryPtr->entry.xscroll.first,
rightIndex = entryPtr->entry.xscroll.last + 1,
selFirst = entryPtr->entry.selectFirst,
selLast = entryPtr->entry.selectLast;
@@ -1178,6 +1207,7 @@ static void EntryDisplay(void *clientData, Drawable d)
Ttk_Box textarea;
TkRegion clipRegion;
XRectangle rect;
+ Tcl_Obj *foregroundObj;
EntryInitStyleData(entryPtr, &es);
@@ -1185,22 +1215,21 @@ static void EntryDisplay(void *clientData, Drawable d)
showCursor =
(entryPtr->core.flags & CURSOR_ON)
&& EntryEditable(entryPtr)
- && entryPtr->entry.insertPos >= leftIndex
- && entryPtr->entry.insertPos <= rightIndex
+ && entryPtr->entry.insertPos + 1 >= leftIndex + 1
+ && entryPtr->entry.insertPos + 1 <= rightIndex + 1
;
showSelection =
!(entryPtr->core.state & TTK_STATE_DISABLED)
- && selFirst > -1
- && selLast > leftIndex
- && selFirst <= rightIndex
- ;
+ && selFirst != TCL_INDEX_NONE
+ && selLast + 1 > leftIndex + 1
+ && selFirst + 1 <= rightIndex + 1;
/* Adjust selection range to keep in display bounds.
*/
if (showSelection) {
- if (selFirst < leftIndex)
+ if (selFirst + 1 < leftIndex + 1)
selFirst = leftIndex;
- if (selLast > rightIndex)
+ if (selLast + 1 > rightIndex + 1)
selLast = rightIndex;
}
@@ -1273,7 +1302,21 @@ static void EntryDisplay(void *clientData, Drawable d)
/* Draw the text:
*/
- gc = EntryGetGC(entryPtr, es.foregroundObj, clipRegion);
+ if ((*(entryPtr->entry.displayString) == '\0')
+ && (entryPtr->entry.placeholderObj != NULL)) {
+ /* No text displayed, but -placeholder is given */
+ if (Tcl_GetCharLength(es.placeholderForegroundObj) > 0) {
+ foregroundObj = es.placeholderForegroundObj;
+ } else {
+ foregroundObj = es.foregroundObj;
+ }
+ /* Use placeholder text width */
+ leftIndex = 0;
+ (void)Tcl_GetStringFromObj(entryPtr->entry.placeholderObj, &rightIndex);
+ } else {
+ foregroundObj = es.foregroundObj;
+ }
+ gc = EntryGetGC(entryPtr, foregroundObj, clipRegion);
if (showSelection) {
/* Draw the selected and unselected portions separately.
@@ -1343,22 +1386,32 @@ EntryIndex(
Tcl_Interp *interp, /* For error messages. */
Entry *entryPtr, /* Entry widget to query */
Tcl_Obj *indexObj, /* Symbolic index name */
- int *indexPtr) /* Return value */
+ TkSizeT *indexPtr) /* Return value */
{
# define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */
- const char *string = Tcl_GetString(indexObj);
- size_t length = indexObj->length;
+ TkSizeT length, idx;
+ const char *string;
+
+ if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->entry.numChars - 1, 1, &idx)) {
+ if (idx == TCL_INDEX_NONE) {
+ idx = 0;
+ } else if (idx > entryPtr->entry.numChars) {
+ idx = entryPtr->entry.numChars;
+ }
+ *indexPtr = idx;
+ return TCL_OK;
+ }
+
+ string = Tcl_GetStringFromObj(indexObj, &length);
- if (strncmp(string, "end", length) == 0) {
- *indexPtr = entryPtr->entry.numChars;
- } else if (strncmp(string, "insert", length) == 0) {
+ if (strncmp(string, "insert", length) == 0) {
*indexPtr = entryPtr->entry.insertPos;
} else if (strncmp(string, "left", length) == 0) { /* for debugging */
*indexPtr = entryPtr->entry.xscroll.first;
} else if (strncmp(string, "right", length) == 0) { /* for debugging */
*indexPtr = entryPtr->entry.xscroll.last;
} else if (strncmp(string, "sel.", 4) == 0) {
- if (entryPtr->entry.selectFirst < 0) {
+ if (entryPtr->entry.selectFirst == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"selection isn't in widget %s",
Tk_PathName(entryPtr->core.tkwin)));
@@ -1388,7 +1441,7 @@ EntryIndex(
x - entryPtr->entry.layoutX, 0);
TtkUpdateScrollInfo(entryPtr->entry.xscrollHandle);
- if (*indexPtr < entryPtr->entry.xscroll.first) {
+ if (*indexPtr + 1 < (TkSizeT)entryPtr->entry.xscroll.first + 1) {
*indexPtr = entryPtr->entry.xscroll.first;
}
@@ -1399,18 +1452,11 @@ EntryIndex(
* last character to be selected, for example.
*/
- if (roundUp && (*indexPtr < entryPtr->entry.numChars)) {
+ if (roundUp && ((TkSizeT)*indexPtr + 1 < entryPtr->entry.numChars + 1 )) {
*indexPtr += 1;
}
} else {
- if (Tcl_GetIntFromObj(interp, indexObj, indexPtr) != TCL_OK) {
- goto badIndex;
- }
- if (*indexPtr < 0) {
- *indexPtr = 0;
- } else if (*indexPtr > entryPtr->entry.numChars) {
- *indexPtr = entryPtr->entry.numChars;
- }
+ goto badIndex;
}
return TCL_OK;
@@ -1428,9 +1474,9 @@ static int
EntryBBoxCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
Ttk_Box b;
- int index;
+ TkSizeT index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "index");
@@ -1439,7 +1485,7 @@ EntryBBoxCommand(
if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) {
return TCL_ERROR;
}
- if ((index == entryPtr->entry.numChars) && (index > 0)) {
+ if ((index == entryPtr->entry.numChars) && (index + 1 > 1)) {
index--;
}
Tk_CharBbox(entryPtr->entry.textLayout, index,
@@ -1458,8 +1504,8 @@ static int
EntryDeleteCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
- int first, last;
+ Entry *entryPtr = (Entry *)recordPtr;
+ TkSizeT first, last;
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
@@ -1474,7 +1520,7 @@ EntryDeleteCommand(
return TCL_ERROR;
}
- if (last >= first && EntryEditable(entryPtr)) {
+ if (last + 1 >= first + 1 && EntryEditable(entryPtr)) {
return DeleteChars(entryPtr, first, last - first);
}
return TCL_OK;
@@ -1487,7 +1533,7 @@ static int
EntryGetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
@@ -1503,7 +1549,7 @@ static int
EntryICursorCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "pos");
return TCL_ERROR;
@@ -1523,8 +1569,8 @@ static int
EntryIndexCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
- int index;
+ Entry *entryPtr = (Entry *)recordPtr;
+ TkSizeT index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "string");
@@ -1533,7 +1579,7 @@ EntryIndexCommand(
if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
return TCL_OK;
}
@@ -1545,8 +1591,8 @@ static int
EntryInsertCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
- int index;
+ Entry *entryPtr = (Entry *)recordPtr;
+ TkSizeT index;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "index text");
@@ -1567,13 +1613,13 @@ EntryInsertCommand(
static int EntrySelectionClearCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1;
+ entryPtr->entry.selectFirst = entryPtr->entry.selectLast = TCL_INDEX_NONE;
TtkRedisplayWidget(&entryPtr->core);
return TCL_OK;
}
@@ -1584,13 +1630,13 @@ static int EntrySelectionClearCommand(
static int EntrySelectionPresentCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(entryPtr->entry.selectFirst >= 0));
+ Tcl_NewWideIntObj(entryPtr->entry.selectFirst != TCL_INDEX_NONE));
return TCL_OK;
}
@@ -1600,13 +1646,13 @@ static int EntrySelectionPresentCommand(
static int EntrySelectionRangeCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
- int start, end;
+ Entry *entryPtr = (Entry *)recordPtr;
+ TkSizeT start, end;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 3, objv, "start end");
return TCL_ERROR;
}
- if ( EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK
+ if (EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK
|| EntryIndex(interp, entryPtr, objv[4], &end) != TCL_OK) {
return TCL_ERROR;
}
@@ -1614,8 +1660,8 @@ static int EntrySelectionRangeCommand(
return TCL_OK;
}
- if (start >= end) {
- entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1;
+ if (start + 1 >= end + 1 ) {
+ entryPtr->entry.selectFirst = entryPtr->entry.selectLast = TCL_INDEX_NONE;
} else {
entryPtr->entry.selectFirst = start;
entryPtr->entry.selectLast = end;
@@ -1638,7 +1684,7 @@ static const Ttk_Ensemble EntrySelectionCommands[] = {
static int EntrySetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "value");
return TCL_ERROR;
@@ -1654,7 +1700,7 @@ static int EntrySetCommand(
static int EntryValidateCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
int code;
if (objc != 2) {
@@ -1676,9 +1722,9 @@ static int EntryValidateCommand(
static int EntryXViewCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Entry *entryPtr = recordPtr;
+ Entry *entryPtr = (Entry *)recordPtr;
if (objc == 3) {
- int newFirst;
+ TkSizeT newFirst;
if (EntryIndex(interp, entryPtr, objv[2], &newFirst) != TCL_OK) {
return TCL_ERROR;
}
@@ -1701,6 +1747,7 @@ static const Ttk_Ensemble EntryCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "selection", 0,EntrySelectionCommands },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "validate", EntryValidateCommand,0 },
{ "xview", EntryXViewCommand,0 },
{ 0,0,0 }
@@ -1710,7 +1757,7 @@ static const Ttk_Ensemble EntryCommands[] = {
* +++ Entry widget definition.
*/
-static WidgetSpec EntryWidgetSpec = {
+static const WidgetSpec EntryWidgetSpec = {
"TEntry", /* className */
sizeof(Entry), /* recordSize */
EntryOptionSpecs, /* optionSpecs */
@@ -1726,16 +1773,6 @@ static WidgetSpec EntryWidgetSpec = {
};
/*------------------------------------------------------------------------
- * Named indices for the combobox "current" command
- */
-static const char *const comboboxCurrentIndexNames[] = {
- "end", NULL
-};
-enum comboboxCurrentIndices {
- INDEX_END
-};
-
-/*------------------------------------------------------------------------
* +++ Combobox widget record.
*/
@@ -1743,7 +1780,7 @@ typedef struct {
Tcl_Obj *postCommandObj;
Tcl_Obj *valuesObj;
Tcl_Obj *heightObj;
- int currentIndex;
+ TkSizeT currentIndex;
} ComboboxPart;
typedef struct {
@@ -1752,15 +1789,15 @@ typedef struct {
ComboboxPart combobox;
} Combobox;
-static Tk_OptionSpec ComboboxOptionSpecs[] = {
+static const Tk_OptionSpec ComboboxOptionSpecs[] = {
{TK_OPTION_STRING, "-height", "height", "Height",
- DEF_LIST_HEIGHT, Tk_Offset(Combobox, combobox.heightObj), -1,
+ DEF_LIST_HEIGHT, offsetof(Combobox, combobox.heightObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_STRING, "-postcommand", "postCommand", "PostCommand",
- "", Tk_Offset(Combobox, combobox.postCommandObj), -1,
+ "", offsetof(Combobox, combobox.postCommandObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_STRING, "-values", "values", "Values",
- "", Tk_Offset(Combobox, combobox.valuesObj), -1,
+ "", offsetof(Combobox, combobox.valuesObj), TCL_INDEX_NONE,
0,0,0 },
WIDGET_INHERIT_OPTIONS(EntryOptionSpecs)
};
@@ -1771,9 +1808,9 @@ static Tk_OptionSpec ComboboxOptionSpecs[] = {
static void
ComboboxInitialize(Tcl_Interp *interp, void *recordPtr)
{
- Combobox *cb = recordPtr;
+ Combobox *cb = (Combobox *)recordPtr;
- cb->combobox.currentIndex = -1;
+ cb->combobox.currentIndex = TCL_INDEX_NONE;
TtkTrackElementState(&cb->core);
EntryInitialize(interp, recordPtr);
}
@@ -1784,7 +1821,7 @@ ComboboxInitialize(Tcl_Interp *interp, void *recordPtr)
static int
ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Combobox *cbPtr = recordPtr;
+ Combobox *cbPtr = (Combobox *)recordPtr;
int unused;
/* Make sure -values is a valid list:
@@ -1804,78 +1841,58 @@ ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
static int ComboboxCurrentCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Combobox *cbPtr = recordPtr;
- int currentIndex = cbPtr->combobox.currentIndex;
+ Combobox *cbPtr = (Combobox *)recordPtr;
+ TkSizeT currentIndex = cbPtr->combobox.currentIndex;
const char *currentValue = cbPtr->entry.string;
int nValues;
Tcl_Obj **values;
- Tcl_ListObjGetElements(interp,cbPtr->combobox.valuesObj,&nValues,&values);
+ Tcl_ListObjGetElements(interp, cbPtr->combobox.valuesObj, &nValues, &values);
if (objc == 2) {
/* Check if currentIndex still valid:
*/
- if ( currentIndex < 0
- || currentIndex >= nValues
+ if (currentIndex == TCL_INDEX_NONE
+ || currentIndex >= (TkSizeT)nValues
|| strcmp(currentValue,Tcl_GetString(values[currentIndex]))
)
{
/* Not valid. Check current value against each element in -values:
*/
- for (currentIndex = 0; currentIndex < nValues; ++currentIndex) {
+ for (currentIndex = 0; currentIndex < (TkSizeT)nValues; ++currentIndex) {
if (!strcmp(currentValue,Tcl_GetString(values[currentIndex]))) {
break;
}
}
- if (currentIndex >= nValues) {
+ if (currentIndex >= (TkSizeT)nValues) {
/* Not found */
- currentIndex = -1;
+ currentIndex = TCL_INDEX_NONE;
}
}
cbPtr->combobox.currentIndex = currentIndex;
- Tcl_SetObjResult(interp, Tcl_NewIntObj(currentIndex));
+ Tcl_SetObjResult(interp, TkNewIndexObj(currentIndex));
return TCL_OK;
} else if (objc == 3) {
- int result, index;
-
- result = Tcl_GetIndexFromObj(NULL, objv[2], comboboxCurrentIndexNames,
- "", 0, &index);
- if (result == TCL_OK) {
-
- /*
- * The index is one of the named indices.
- */
-
- switch (index) {
- case INDEX_END:
- /* "end" index */
- currentIndex = nValues - 1;
- break;
- }
- } else {
-
- /*
- * The index should be just an integer.
- */
+ TkSizeT idx;
- if (Tcl_GetIntFromObj(NULL, objv[2], &currentIndex) != TCL_OK) {
+ if (TCL_OK == TkGetIntForIndex(objv[2], nValues - 1, 0, &idx)) {
+ if (idx == TCL_INDEX_NONE || idx > (TkSizeT)nValues) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Incorrect index %s", Tcl_GetString(objv[2])));
- Tcl_SetErrorCode(interp, "TTK", "COMBOBOX", "IDX_VALUE", NULL);
- return TCL_ERROR;
- }
-
- if (currentIndex < 0 || currentIndex >= nValues) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Index %s out of range", Tcl_GetString(objv[2])));
+ "index \"%s\" out of range", Tcl_GetString(objv[2])));
Tcl_SetErrorCode(interp, "TTK", "COMBOBOX", "IDX_RANGE", NULL);
return TCL_ERROR;
}
- }
+ currentIndex = idx;
+ } else {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Incorrect index %s", Tcl_GetString(objv[2])));
+ Tcl_SetErrorCode(interp, "TTK", "COMBOBOX", "IDX_VALUE", NULL);
+ return TCL_ERROR;
+ }
cbPtr->combobox.currentIndex = currentIndex;
- return EntrySetValue(recordPtr, Tcl_GetString(values[currentIndex]));
+ return EntrySetValue((Entry *)recordPtr, Tcl_GetString(values[currentIndex]));
} else {
Tcl_WrongNumArgs(interp, 2, objv, "?newIndex?");
return TCL_ERROR;
@@ -1899,14 +1916,15 @@ static const Ttk_Ensemble ComboboxCommands[] = {
{ "insert", EntryInsertCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "selection", 0,EntrySelectionCommands },
- { "state", TtkWidgetStateCommand,0 },
{ "set", EntrySetCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "validate", EntryValidateCommand,0 },
{ "xview", EntryXViewCommand,0 },
{ 0,0,0 }
};
-static WidgetSpec ComboboxWidgetSpec = {
+static const WidgetSpec ComboboxWidgetSpec = {
"TCombobox", /* className */
sizeof(Combobox), /* recordSize */
ComboboxOptionSpecs, /* optionSpecs */
@@ -1943,29 +1961,29 @@ typedef struct {
SpinboxPart spinbox;
} Spinbox;
-static Tk_OptionSpec SpinboxOptionSpecs[] = {
+static const Tk_OptionSpec SpinboxOptionSpecs[] = {
{TK_OPTION_STRING, "-values", "values", "Values",
- "", Tk_Offset(Spinbox, spinbox.valuesObj), -1,
+ "", offsetof(Spinbox, spinbox.valuesObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_DOUBLE, "-from", "from", "From",
- "0", Tk_Offset(Spinbox,spinbox.fromObj), -1,
+ "0", offsetof(Spinbox,spinbox.fromObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_DOUBLE, "-to", "to", "To",
- "0", Tk_Offset(Spinbox,spinbox.toObj), -1,
+ "0", offsetof(Spinbox,spinbox.toObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_DOUBLE, "-increment", "increment", "Increment",
- "1", Tk_Offset(Spinbox,spinbox.incrementObj), -1,
+ "1", offsetof(Spinbox,spinbox.incrementObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_STRING, "-format", "format", "Format",
- "", Tk_Offset(Spinbox, spinbox.formatObj), -1,
+ "", offsetof(Spinbox, spinbox.formatObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_STRING, "-command", "command", "Command",
- "", Tk_Offset(Spinbox, spinbox.commandObj), -1,
+ "", offsetof(Spinbox, spinbox.commandObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap",
- "0", Tk_Offset(Spinbox,spinbox.wrapObj), -1,
+ "0", offsetof(Spinbox,spinbox.wrapObj), TCL_INDEX_NONE,
0,0,0 },
WIDGET_INHERIT_OPTIONS(EntryOptionSpecs)
@@ -1977,7 +1995,7 @@ static Tk_OptionSpec SpinboxOptionSpecs[] = {
static void
SpinboxInitialize(Tcl_Interp *interp, void *recordPtr)
{
- Spinbox *sb = recordPtr;
+ Spinbox *sb = (Spinbox *)recordPtr;
TtkTrackElementState(&sb->core);
EntryInitialize(interp, recordPtr);
}
@@ -1988,7 +2006,7 @@ SpinboxInitialize(Tcl_Interp *interp, void *recordPtr)
static int
SpinboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Spinbox *sb = recordPtr;
+ Spinbox *sb = (Spinbox *)recordPtr;
int unused;
/* Make sure -values is a valid list:
@@ -2011,14 +2029,15 @@ static const Ttk_Ensemble SpinboxCommands[] = {
{ "insert", EntryInsertCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "selection", 0,EntrySelectionCommands },
- { "state", TtkWidgetStateCommand,0 },
{ "set", EntrySetCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "validate", EntryValidateCommand,0 },
{ "xview", EntryXViewCommand,0 },
{ 0,0,0 }
};
-static WidgetSpec SpinboxWidgetSpec = {
+static const WidgetSpec SpinboxWidgetSpec = {
"TSpinbox", /* className */
sizeof(Spinbox), /* recordSize */
SpinboxOptionSpecs, /* optionSpecs */
@@ -2045,23 +2064,25 @@ typedef struct {
Tcl_Obj *widthObj;
} TextareaElement;
-static Ttk_ElementOptionSpec TextareaElementOptions[] = {
+static const Ttk_ElementOptionSpec TextareaElementOptions[] = {
{ "-font", TK_OPTION_FONT,
- Tk_Offset(TextareaElement,fontObj), DEF_ENTRY_FONT },
+ offsetof(TextareaElement,fontObj), DEF_ENTRY_FONT },
{ "-width", TK_OPTION_INT,
- Tk_Offset(TextareaElement,widthObj), "20" },
- { NULL, 0, 0, NULL }
+ offsetof(TextareaElement,widthObj), "20" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void TextareaElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- TextareaElement *textarea = elementRecord;
+ TextareaElement *textarea = (TextareaElement *)elementRecord;
Tk_Font font = Tk_GetFontFromObj(tkwin, textarea->fontObj);
int avgWidth = Tk_TextWidth(font, "0", 1);
Tk_FontMetrics fm;
int prefWidth = 1;
+ (void)dummy;
+ (void)paddingPtr;
Tk_GetFontMetrics(font, &fm);
Tcl_GetIntFromObj(NULL, textarea->widthObj, &prefWidth);
@@ -2072,7 +2093,7 @@ static void TextareaElementSize(
*widthPtr = prefWidth * avgWidth;
}
-static Ttk_ElementSpec TextareaElementSpec = {
+static const Ttk_ElementSpec TextareaElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TextareaElement),
TextareaElementOptions,
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c
index b8b3477..59a576e 100644
--- a/generic/ttk/ttkFrame.c
+++ b/generic/ttk/ttkFrame.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004 Joe English
*
* ttk::frame and ttk::labelframe widgets.
*/
@@ -26,21 +26,21 @@ typedef struct {
FramePart frame;
} Frame;
-static Tk_OptionSpec FrameOptionSpecs[] = {
+static const Tk_OptionSpec FrameOptionSpecs[] = {
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL,
- Tk_Offset(Frame,frame.borderWidthObj), -1,
+ offsetof(Frame,frame.borderWidthObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-padding", "padding", "Pad", NULL,
- Tk_Offset(Frame,frame.paddingObj), -1,
+ offsetof(Frame,frame.paddingObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL,
- Tk_Offset(Frame,frame.reliefObj), -1,
+ offsetof(Frame,frame.reliefObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_PIXELS, "-width", "width", "Width", "0",
- Tk_Offset(Frame,frame.widthObj), -1,
+ offsetof(Frame,frame.widthObj), TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED },
{TK_OPTION_PIXELS, "-height", "height", "Height", "0",
- Tk_Offset(Frame,frame.heightObj), -1,
+ offsetof(Frame,frame.heightObj), TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
@@ -48,11 +48,12 @@ static Tk_OptionSpec FrameOptionSpecs[] = {
};
static const Ttk_Ensemble FrameCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -148,7 +149,7 @@ static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
return TtkCoreConfigure(interp, recordPtr, mask);
}
-static WidgetSpec FrameWidgetSpec = {
+static const WidgetSpec FrameWidgetSpec = {
"TFrame", /* className */
sizeof(Frame), /* recordSize */
FrameOptionSpecs, /* optionSpecs */
@@ -250,18 +251,18 @@ typedef struct {
#define LABELWIDGET_CHANGED 0x100
-static Tk_OptionSpec LabelframeOptionSpecs[] = {
+static const Tk_OptionSpec LabelframeOptionSpecs[] = {
{TK_OPTION_STRING, "-labelanchor", "labelAnchor", "LabelAnchor",
- "nw", Tk_Offset(Labelframe, label.labelAnchorObj),-1,
+ "nw", offsetof(Labelframe, label.labelAnchorObj),TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-text", "text", "Text", "",
- Tk_Offset(Labelframe,label.textObj), -1,
+ offsetof(Labelframe,label.textObj), TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED },
{TK_OPTION_INT, "-underline", "underline", "Underline",
- "-1", Tk_Offset(Labelframe,label.underlineObj), -1,
+ "-1", offsetof(Labelframe,label.underlineObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL,
- -1, Tk_Offset(Labelframe,label.labelWidget),
+ TCL_INDEX_NONE, offsetof(Labelframe,label.labelWidget),
TK_OPTION_NULL_OK,0,LABELWIDGET_CHANGED|GEOMETRY_CHANGED },
WIDGET_INHERIT_OPTIONS(FrameOptionSpecs)
@@ -495,7 +496,7 @@ static void LabelframePlaceContent(void *recordPtr)
static int LabelRequest(
TCL_UNUSED(void *),
- TCL_UNUSED(int),
+ TCL_UNUSED(TkSizeT),
TCL_UNUSED(int),
TCL_UNUSED(int))
{
@@ -511,7 +512,7 @@ static int LabelRequest(
*/
static void LabelRemoved(
void *managerData,
- TCL_UNUSED(int))
+ TCL_UNUSED(TkSizeT))
{
Labelframe *lframe = (Labelframe *)managerData;
@@ -626,7 +627,7 @@ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask)
return TCL_OK;
}
-static WidgetSpec LabelframeWidgetSpec = {
+static const WidgetSpec LabelframeWidgetSpec = {
"TLabelframe", /* className */
sizeof(Labelframe), /* recordSize */
LabelframeOptionSpecs, /* optionSpecs */
diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl
deleted file mode 100644
index af8a2a5..0000000
--- a/generic/ttk/ttkGenStubs.tcl
+++ /dev/null
@@ -1,1009 +0,0 @@
-# ttkGenStubs.tcl --
-#
-# This script generates a set of stub files for a given
-# interface.
-#
-#
-# Copyright (c) 1998-1999 Scriptics Corporation.
-# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# SOURCE: tcl/tools/genStubs.tcl, revision 1.44
-#
-# CHANGES:
-# + Second argument to "declare" is used as a status guard
-# instead of a platform guard.
-# + Allow trailing semicolon in function declarations
-#
-
-namespace eval genStubs {
- # libraryName --
- #
- # The name of the entire library. This value is used to compute
- # the USE_*_STUBS macro and the name of the init file.
-
- variable libraryName "UNKNOWN"
-
- # interfaces --
- #
- # An array indexed by interface name that is used to maintain
- # the set of valid interfaces. The value is empty.
-
- array set interfaces {}
-
- # curName --
- #
- # The name of the interface currently being defined.
-
- variable curName "UNKNOWN"
-
- # scspec --
- #
- # Storage class specifier for external function declarations.
- # Normally "EXTERN", may be set to something like XYZAPI
- #
- variable scspec "EXTERN"
-
- # epoch, revision --
- #
- # The epoch and revision numbers of the interface currently being defined.
- # (@@@TODO: should be an array mapping interface names -> numbers)
- #
-
- variable epoch {}
- variable revision 0
-
- # hooks --
- #
- # An array indexed by interface name that contains the set of
- # subinterfaces that should be defined for a given interface.
-
- array set hooks {}
-
- # stubs --
- #
- # This three dimensional array is indexed first by interface name,
- # second by field name, and third by a numeric offset or the
- # constant "lastNum". The lastNum entry contains the largest
- # numeric offset used for a given interface.
- #
- # Field "decl,$i" contains the C function specification that
- # should be used for the given entry in the stub table. The spec
- # consists of a list in the form returned by parseDecl.
- # Other fields TBD later.
-
- array set stubs {}
-
- # outDir --
- #
- # The directory where the generated files should be placed.
-
- variable outDir .
-}
-
-# genStubs::library --
-#
-# This function is used in the declarations file to set the name
-# of the library that the interfaces are associated with (e.g. "tcl").
-# This value will be used to define the inline conditional macro.
-#
-# Arguments:
-# name The library name.
-#
-# Results:
-# None.
-
-proc genStubs::library {name} {
- variable libraryName $name
-}
-
-# genStubs::interface --
-#
-# This function is used in the declarations file to set the name
-# of the interface currently being defined.
-#
-# Arguments:
-# name The name of the interface.
-#
-# Results:
-# None.
-
-proc genStubs::interface {name} {
- variable curName $name
- variable interfaces
- variable stubs
-
- set interfaces($name) {}
- set stubs($name,lastNum) 0
- return
-}
-
-# genStubs::scspec --
-#
-# Define the storage class macro used for external function declarations.
-# Typically, this will be a macro like XYZAPI or EXTERN that
-# expands to either DLLIMPORT or DLLEXPORT, depending on whether
-# -DBUILD_XYZ has been set.
-#
-proc genStubs::scspec {value} {
- variable scspec $value
-}
-
-# genStubs::epoch --
-#
-# Define the epoch number for this library. The epoch
-# should be incrememented when a release is made that
-# contains incompatible changes to the public API.
-#
-proc genStubs::epoch {value} {
- variable epoch $value
-}
-
-# genStubs::hooks --
-#
-# This function defines the subinterface hooks for the current
-# interface.
-#
-# Arguments:
-# names The ordered list of interfaces that are reachable through the
-# hook vector.
-#
-# Results:
-# None.
-
-proc genStubs::hooks {names} {
- variable curName
- variable hooks
-
- set hooks($curName) $names
- return
-}
-
-# genStubs::declare --
-#
-# This function is used in the declarations file to declare a new
-# interface entry.
-#
-# Arguments:
-# index The index number of the interface.
-# status Status of the interface: one of "current",
-# "deprecated", or "obsolete".
-# decl The C function declaration, or {} for an undefined
-# entry.
-#
-# Results:
-# None.
-
-proc genStubs::declare {args} {
- variable stubs
- variable curName
- variable revision
-
- incr revision
- if {[llength $args] == 2} {
- lassign $args index decl
- set status current
- } elseif {[llength $args] == 3} {
- lassign $args index status decl
- } else {
- puts stderr "wrong # args: declare $args"
- return
- }
-
- # Check for duplicate declarations, then add the declaration and
- # bump the lastNum counter if necessary.
-
- if {[info exists stubs($curName,decl,$index)]} {
- puts stderr "Duplicate entry: $index"
- }
- regsub -all "\[ \t\n\]+" [string trim $decl] " " decl
- set decl [parseDecl $decl]
-
- set stubs($curName,status,$index) $status
- set stubs($curName,decl,$index) $decl
-
- if {$index > $stubs($curName,lastNum)} {
- set stubs($curName,lastNum) $index
- }
- return
-}
-
-# genStubs::export --
-#
-# This function is used in the declarations file to declare a symbol
-# that is exported from the library but is not in the stubs table.
-#
-# Arguments:
-# decl The C function declaration, or {} for an undefined
-# entry.
-#
-# Results:
-# None.
-
-proc genStubs::export {args} {
- if {[llength $args] != 1} {
- puts stderr "wrong # args: export $args"
- }
- return
-}
-
-# genStubs::rewriteFile --
-#
-# This function replaces the machine generated portion of the
-# specified file with new contents. It looks for the !BEGIN! and
-# !END! comments to determine where to place the new text.
-#
-# Arguments:
-# file The name of the file to modify.
-# text The new text to place in the file.
-#
-# Results:
-# None.
-
-proc genStubs::rewriteFile {file text} {
- if {![file exists $file]} {
- puts stderr "Cannot find file: $file"
- return
- }
- set in [open ${file} r]
- fconfigure $in -eofchar "\032 {}" -encoding utf-8
- set out [open ${file}.new w]
- fconfigure $out -translation lf -encoding utf-8
-
- while {![eof $in]} {
- set line [gets $in]
- if {[string match "*!BEGIN!*" $line]} {
- break
- }
- puts $out $line
- }
- puts $out "/* !BEGIN!: Do not edit below this line. */"
- puts $out $text
- while {![eof $in]} {
- set line [gets $in]
- if {[string match "*!END!*" $line]} {
- break
- }
- }
- puts $out "/* !END!: Do not edit above this line. */"
- puts -nonewline $out [read $in]
- close $in
- close $out
- file rename -force ${file}.new ${file}
- return
-}
-
-# genStubs::addPlatformGuard --
-#
-# Wrap a string inside a platform #ifdef.
-#
-# Arguments:
-# plat Platform to test.
-#
-# Results:
-# Returns the original text inside an appropriate #ifdef.
-
-proc genStubs::addPlatformGuard {plat iftxt {eltxt {}} {withCygwin 0}} {
- set text ""
- switch $plat {
- win {
- append text "#if defined(_WIN32)"
- if {$withCygwin} {
- append text " || defined(__CYGWIN__)"
- }
- append text " /* WIN */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* WIN */\n${eltxt}"
- }
- append text "#endif /* WIN */\n"
- }
- unix {
- append text "#if !defined(_WIN32)"
- if {$withCygwin} {
- append text " && !defined(__CYGWIN__)"
- }
- append text " && !defined(MAC_OSX_TCL)\
- /* UNIX */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* UNIX */\n${eltxt}"
- }
- append text "#endif /* UNIX */\n"
- }
- macosx {
- append text "#ifdef MAC_OSX_TCL /* MACOSX */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* MACOSX */\n${eltxt}"
- }
- append text "#endif /* MACOSX */\n"
- }
- aqua {
- append text "#ifdef MAC_OSX_TK /* AQUA */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* AQUA */\n${eltxt}"
- }
- append text "#endif /* AQUA */\n"
- }
- x11 {
- append text "#if !(defined(_WIN32)"
- if {$withCygwin} {
- append text " || defined(__CYGWIN__)"
- }
- append text " || defined(MAC_OSX_TK))\
- /* X11 */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* X11 */\n${eltxt}"
- }
- append text "#endif /* X11 */\n"
- }
- default {
- append text "${iftxt}${eltxt}"
- }
- }
- return $text
-}
-
-# genStubs::emitSlots --
-#
-# Generate the stub table slots for the given interface. If there
-# are no generic slots, then one table is generated for each
-# platform, otherwise one table is generated for all platforms.
-#
-# Arguments:
-# name The name of the interface being emitted.
-# textVar The variable to use for output.
-#
-# Results:
-# None.
-
-proc genStubs::emitSlots {name textVar} {
- upvar $textVar text
-
- forAllStubs $name makeSlot noGuard text {" void (*reserved$i)(void);\n"}
- return
-}
-
-# genStubs::parseDecl --
-#
-# Parse a C function declaration into its component parts.
-#
-# Arguments:
-# decl The function declaration.
-#
-# Results:
-# Returns a list of the form {returnType name args}. The args
-# element consists of a list of type/name pairs, or a single
-# element "void". If the function declaration is malformed
-# then an error is displayed and the return value is {}.
-
-proc genStubs::parseDecl {decl} {
- if {![regexp {^(.*)\((.*)\);?$} $decl all prefix args]} {
- set prefix $decl
- set args {}
- }
- set prefix [string trim $prefix]
- if {![regexp {^(.+[ ][*]*)([^ *]+)$} $prefix all rtype fname]} {
- puts stderr "Bad return type: $decl"
- return
- }
- set rtype [string trim $rtype]
- if {$args eq ""} {
- return [list $rtype $fname {}]
- }
- foreach arg [split $args ,] {
- lappend argList [string trim $arg]
- }
- if {![string compare [lindex $argList end] "..."]} {
- set args TCL_VARARGS
- foreach arg [lrange $argList 0 end-1] {
- set argInfo [parseArg $arg]
- if {[llength $argInfo] == 2 || [llength $argInfo] == 3} {
- lappend args $argInfo
- } else {
- puts stderr "Bad argument: '$arg' in '$decl'"
- return
- }
- }
- } else {
- set args {}
- foreach arg $argList {
- set argInfo [parseArg $arg]
- if {![string compare $argInfo "void"]} {
- lappend args "void"
- break
- } elseif {[llength $argInfo] == 2 || [llength $argInfo] == 3} {
- lappend args $argInfo
- } else {
- puts stderr "Bad argument: '$arg' in '$decl'"
- return
- }
- }
- }
- return [list $rtype $fname $args]
-}
-
-# genStubs::parseArg --
-#
-# This function parses a function argument into a type and name.
-#
-# Arguments:
-# arg The argument to parse.
-#
-# Results:
-# Returns a list of type and name with an optional third array
-# indicator. If the argument is malformed, returns "".
-
-proc genStubs::parseArg {arg} {
- if {![regexp {^(.+[ ][*]*)([^][ *]+)(\[\])?$} $arg all type name array]} {
- if {$arg eq "void"} {
- return $arg
- } else {
- return
- }
- }
- set result [list [string trim $type] $name]
- if {$array ne ""} {
- lappend result $array
- }
- return $result
-}
-
-# genStubs::makeDecl --
-#
-# Generate the prototype for a function.
-#
-# Arguments:
-# name The interface name.
-# decl The function declaration.
-# index The slot index for this function.
-#
-# Results:
-# Returns the formatted declaration string.
-
-proc genStubs::makeDecl {name decl index} {
- variable scspec
- variable stubs
- variable libraryName
- lassign $decl rtype fname args
-
- append text "/* $index */\n"
- if {[info exists stubs($name,deprecated,$index)]} {
- append text "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n"
- set line "$rtype"
- } elseif {[string range $rtype end-5 end] eq "MP_WUR"} {
- set line "$scspec [string trim [string range $rtype 0 end-6]]"
- } else {
- set line "$scspec $rtype"
- }
- set count [expr {2 - ([string length $line] / 8)}]
- if {$count >= 0} {
- append line [string range "\t\t\t" 0 $count]
- }
- set pad [expr {24 - [string length $line]}]
- if {$pad <= 0} {
- append line " "
- set pad 0
- }
- if {$args eq ""} {
- append line $fname
- append text $line
- append text ";\n"
- return $text
- }
- append line $fname
-
- set arg1 [lindex $args 0]
- switch -exact $arg1 {
- void {
- append line "(void)"
- }
- TCL_VARARGS {
- set sep "("
- foreach arg [lrange $args 1 end] {
- append line $sep
- set next {}
- append next [lindex $arg 0]
- if {[string index $next end] ne "*"} {
- append next " "
- }
- append next [lindex $arg 1] [lindex $arg 2]
- if {[string length $line] + [string length $next] \
- + $pad > 76} {
- append text [string trimright $line] \n
- set line "\t\t\t\t"
- set pad 28
- }
- append line $next
- set sep ", "
- }
- append line ", ...)"
- if {[lindex $args end] eq "{const char *} format"} {
- append line " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")"
- }
- }
- default {
- set sep "("
- foreach arg $args {
- append line $sep
- set next {}
- append next [lindex $arg 0]
- if {[string index $next end] ne "*"} {
- append next " "
- }
- append next [lindex $arg 1] [lindex $arg 2]
- if {[string length $line] + [string length $next] \
- + $pad > 76} {
- append text [string trimright $line] \n
- set line "\t\t\t\t"
- set pad 28
- }
- append line $next
- set sep ", "
- }
- append line ")"
- }
- }
- if {[string range $rtype end-5 end] eq "MP_WUR"} {
- append line " MP_WUR"
- }
- return "$text$line;\n"
-}
-
-# genStubs::makeMacro --
-#
-# Generate the inline macro for a function.
-#
-# Arguments:
-# name The interface name.
-# decl The function declaration.
-# index The slot index for this function.
-#
-# Results:
-# Returns the formatted macro definition.
-
-proc genStubs::makeMacro {name decl index} {
- lassign $decl rtype fname args
-
- set lfname [string tolower [string index $fname 0]]
- append lfname [string range $fname 1 end]
-
- set text "#define $fname \\\n\t("
- if {$args eq ""} {
- append text "*"
- }
- append text "${name}StubsPtr->$lfname)"
- append text " /* $index */\n"
- return $text
-}
-
-# genStubs::makeSlot --
-#
-# Generate the stub table entry for a function.
-#
-# Arguments:
-# name The interface name.
-# decl The function declaration.
-# index The slot index for this function.
-#
-# Results:
-# Returns the formatted table entry.
-
-proc genStubs::makeSlot {name decl index} {
- lassign $decl rtype fname args
- variable stubs
-
- set lfname [string tolower [string index $fname 0]]
- append lfname [string range $fname 1 end]
-
- set text " "
- if {[info exists stubs($name,deprecated,$index)]} {
- append text "TCL_DEPRECATED_API(\"$stubs($name,deprecated,$index)\") "
- } elseif {[info exists stubs($name,nostub,$index)]} {
- append text "TCL_DEPRECATED_API(\"$stubs($name,nostub,$index)\") "
- }
- if {$args eq ""} {
- append text $rtype " *" $lfname "; /* $index */\n"
- return $text
- }
- if {[string range $rtype end-8 end] eq "__stdcall"} {
- append text [string trim [string range $rtype 0 end-9]] " (__stdcall *" $lfname ") "
- } elseif {[string range $rtype 0 11] eq "TCL_NORETURN"} {
- append text "TCL_NORETURN1 " [string trim [string range $rtype 12 end]] " (*" $lfname ") "
- } elseif {[string range $rtype end-5 end] eq "MP_WUR"} {
- append text [string trim [string range $rtype 0 end-6]] " (*" $lfname ") "
- } else {
- append text $rtype " (*" $lfname ") "
- }
- set arg1 [lindex $args 0]
- switch -exact $arg1 {
- void {
- append text "(void)"
- }
- TCL_VARARGS {
- set sep "("
- foreach arg [lrange $args 1 end] {
- append text $sep [lindex $arg 0]
- if {[string index $text end] ne "*"} {
- append text " "
- }
- append text [lindex $arg 1] [lindex $arg 2]
- set sep ", "
- }
- append text ", ...)"
- if {[lindex $args end] eq "{const char *} format"} {
- append text " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")"
- }
- }
- default {
- set sep "("
- foreach arg $args {
- append text $sep [lindex $arg 0]
- if {[string index $text end] ne "*"} {
- append text " "
- }
- append text [lindex $arg 1] [lindex $arg 2]
- set sep ", "
- }
- append text ")"
- }
- }
-
- if {[string range $rtype end-5 end] eq "MP_WUR"} {
- append text " MP_WUR"
- }
- append text "; /* $index */\n"
- return $text
-}
-
-# genStubs::makeInit --
-#
-# Generate the prototype for a function.
-#
-# Arguments:
-# name The interface name.
-# decl The function declaration.
-# index The slot index for this function.
-#
-# Results:
-# Returns the formatted declaration string.
-
-proc genStubs::makeInit {name decl index} {
- if {[lindex $decl 2] eq ""} {
- append text " &" [lindex $decl 1] ", /* " $index " */\n"
- } else {
- append text " " [lindex $decl 1] ", /* " $index " */\n"
- }
- return $text
-}
-
-# genStubs::forAllStubs --
-#
-# This function iterates over all of the slots and invokes
-# a callback for each slot. The result of the callback is then
-# placed inside appropriate guards.
-#
-# Arguments:
-# name The interface name.
-# slotProc The proc to invoke to handle the slot. It will
-# have the interface name, the declaration, and
-# the index appended.
-# guardProc The proc to invoke to add guards. It will have
-# the slot status and text appended.
-# textVar The variable to use for output.
-# skipString The string to emit if a slot is skipped. This
-# string will be subst'ed in the loop so "$i" can
-# be used to substitute the index value.
-#
-# Results:
-# None.
-
-proc genStubs::forAllStubs {name slotProc guardProc textVar
- {skipString {"/* Slot $i is reserved */\n"}}} {
- variable stubs
- upvar $textVar text
-
- set lastNum $stubs($name,lastNum)
-
- for {set i 0} {$i <= $lastNum} {incr i} {
- if {[info exists stubs($name,decl,$i)]} {
- append text [$guardProc $stubs($name,status,$i) \
- [$slotProc $name $stubs($name,decl,$i) $i]]
- } else {
- eval {append text} $skipString
- }
- }
-}
-
-proc genStubs::noGuard {status text} { return $text }
-
-proc genStubs::addGuard {status text} {
- variable libraryName
- set upName [string toupper $libraryName]
-
- switch -- $status {
- current {
- # No change
- }
- deprecated {
- set text [ifdeffed "${upName}_DEPRECATED" $text]
- }
- obsolete {
- set text ""
- }
- default {
- puts stderr "Unrecognized status code $status"
- }
- }
- return $text
-}
-
-proc genStubs::ifdeffed {macro text} {
- join [list "#ifdef $macro" $text "#endif" ""] \n
-}
-
-# genStubs::emitDeclarations --
-#
-# This function emits the function declarations for this interface.
-#
-# Arguments:
-# name The interface name.
-# textVar The variable to use for output.
-#
-# Results:
-# None.
-
-proc genStubs::emitDeclarations {name textVar} {
- upvar $textVar text
-
- append text "\n/*\n * Exported function declarations:\n */\n\n"
- forAllStubs $name makeDecl noGuard text
- return
-}
-
-# genStubs::emitMacros --
-#
-# This function emits the inline macros for an interface.
-#
-# Arguments:
-# name The name of the interface being emitted.
-# textVar The variable to use for output.
-#
-# Results:
-# None.
-
-proc genStubs::emitMacros {name textVar} {
- variable libraryName
- upvar $textVar text
-
- set upName [string toupper $libraryName]
- append text "\n#if defined(USE_${upName}_STUBS)\n"
- append text "\n/*\n * Inline function declarations:\n */\n\n"
-
- forAllStubs $name makeMacro addGuard text
-
- append text "\n#endif /* defined(USE_${upName}_STUBS) */\n"
- return
-}
-
-# genStubs::emitHeader --
-#
-# This function emits the body of the <name>Decls.h file for
-# the specified interface.
-#
-# Arguments:
-# name The name of the interface being emitted.
-#
-# Results:
-# None.
-
-proc genStubs::emitHeader {name} {
- variable outDir
- variable hooks
- variable epoch
- variable revision
-
- set capName [string toupper [string index $name 0]]
- append capName [string range $name 1 end]
-
- if {$epoch ne ""} {
- set CAPName [string toupper $name]
- append text "\n"
- append text "#define ${CAPName}_STUBS_EPOCH $epoch\n"
- append text "#define ${CAPName}_STUBS_REVISION $revision\n"
- }
-
- append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
-
- emitDeclarations $name text
-
- if {[info exists hooks($name)]} {
- append text "\ntypedef struct {\n"
- foreach hook $hooks($name) {
- set capHook [string toupper [string index $hook 0]]
- append capHook [string range $hook 1 end]
- append text " const struct ${capHook}Stubs *${hook}Stubs;\n"
- }
- append text "} ${capName}StubHooks;\n"
- }
- append text "\ntypedef struct ${capName}Stubs {\n"
- append text " int magic;\n"
- if {$epoch ne ""} {
- append text " int epoch;\n"
- append text " int revision;\n"
- }
- if {[info exists hooks($name)]} {
- append text " const ${capName}StubHooks *hooks;\n\n"
- } else {
- append text " void *hooks;\n\n"
- }
-
- emitSlots $name text
-
- append text "} ${capName}Stubs;\n\n"
-
- append text "extern const ${capName}Stubs *${name}StubsPtr;\n\n"
- append text "#ifdef __cplusplus\n}\n#endif\n"
-
- emitMacros $name text
-
- rewriteFile [file join $outDir ${name}Decls.h] $text
- return
-}
-
-# genStubs::emitInit --
-#
-# Generate the table initializers for an interface.
-#
-# Arguments:
-# name The name of the interface to initialize.
-# textVar The variable to use for output.
-#
-# Results:
-# Returns the formatted output.
-
-proc genStubs::emitInit {name textVar} {
- variable hooks
- variable interfaces
- variable epoch
- upvar $textVar text
- set root 1
-
- set capName [string toupper [string index $name 0]]
- append capName [string range $name 1 end]
-
- if {[info exists hooks($name)]} {
- append text "\nstatic const ${capName}StubHooks ${name}StubHooks = \{\n"
- set sep " "
- foreach sub $hooks($name) {
- append text $sep "&${sub}Stubs"
- set sep ",\n "
- }
- append text "\n\};\n"
- }
- foreach intf [array names interfaces] {
- if {[info exists hooks($intf)]} {
- if {$name in $hooks($intf)} {
- set root 0
- break
- }
- }
- }
-
- append text "\n"
- if {!$root} {
- append text "static "
- }
- append text "const ${capName}Stubs ${name}Stubs = \{\n TCL_STUB_MAGIC,\n"
- if {$epoch ne ""} {
- set CAPName [string toupper $name]
- append text " ${CAPName}_STUBS_EPOCH,\n"
- append text " ${CAPName}_STUBS_REVISION,\n"
- }
- if {[info exists hooks($name)]} {
- append text " &${name}StubHooks,\n"
- } else {
- append text " 0,\n"
- }
-
- forAllStubs $name makeInit noGuard text {" 0, /* $i */\n"}
-
- append text "\};\n"
- return
-}
-
-# genStubs::emitInits --
-#
-# This function emits the body of the <name>StubInit.c file for
-# the specified interface.
-#
-# Arguments:
-# name The name of the interface being emitted.
-#
-# Results:
-# None.
-
-proc genStubs::emitInits {} {
- variable hooks
- variable outDir
- variable libraryName
- variable interfaces
-
- # Assuming that dependencies only go one level deep, we need to emit
- # all of the leaves first to avoid needing forward declarations.
-
- set leaves {}
- set roots {}
- foreach name [lsort [array names interfaces]] {
- if {[info exists hooks($name)]} {
- lappend roots $name
- } else {
- lappend leaves $name
- }
- }
- foreach name $leaves {
- emitInit $name text
- }
- foreach name $roots {
- emitInit $name text
- }
-
- rewriteFile [file join $outDir ${libraryName}StubInit.c] $text
-}
-
-# genStubs::init --
-#
-# This is the main entry point.
-#
-# Arguments:
-# None.
-#
-# Results:
-# None.
-
-proc genStubs::init {} {
- global argv argv0
- variable outDir
- variable interfaces
-
- if {[llength $argv] < 2} {
- puts stderr "usage: $argv0 outDir declFile ?declFile...?"
- exit 1
- }
-
- set outDir [lindex $argv 0]
-
- foreach file [lrange $argv 1 end] {
- source -encoding utf-8 $file
- }
-
- foreach name [lsort [array names interfaces]] {
- puts "Emitting $name"
- emitHeader $name
- }
-
- emitInits
-}
-
-# lassign --
-#
-# This function emulates the TclX lassign command.
-#
-# Arguments:
-# valueList A list containing the values to be assigned.
-# args The list of variables to be assigned.
-#
-# Results:
-# Returns any values that were not assigned to variables.
-
-if {[string length [namespace which lassign]] == 0} {
- proc lassign {valueList args} {
- if {[llength $args] == 0} {
- error "wrong # args: should be \"lassign list varName ?varName ...?\""
- }
- uplevel [list foreach $args $valueList {break}]
- return [lrange $valueList [llength $args] end]
- }
-}
-
-genStubs::init
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index 2ef30e0..6609651 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -1,8 +1,8 @@
/*
* Image specifications and image element factory.
*
- * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
- * Copyright (C) 2004 Joe English
+ * Copyright © 2004 Pat Thoyts <patthoyts@users.sf.net>
+ * Copyright © 2004 Joe English
*
* An imageSpec is a multi-element list; the first element
* is the name of the default image to use, the remainder of the
@@ -31,9 +31,17 @@ struct TtkImageSpec {
/* NullImageChanged --
* Do-nothing Tk_ImageChangedProc.
*/
-static void NullImageChanged(ClientData clientData,
+static void NullImageChanged(ClientData dummy,
int x, int y, int width, int height, int imageWidth, int imageHeight)
-{ /* No-op */ }
+{ /* No-op */
+ (void)dummy;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imageWidth;
+ (void)imageHeight;
+}
/* ImageSpecImageChanged --
* Image changes should trigger a repaint.
@@ -74,7 +82,7 @@ TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr,
int i = 0, n = 0, objc;
Tcl_Obj **objv;
- imageSpec = ckalloc(sizeof(*imageSpec));
+ imageSpec = (Ttk_ImageSpec *)ckalloc(sizeof(*imageSpec));
imageSpec->baseImage = 0;
imageSpec->mapCount = 0;
imageSpec->states = 0;
@@ -97,8 +105,8 @@ TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr,
}
n = (objc - 1) / 2;
- imageSpec->states = ckalloc(n * sizeof(Ttk_StateSpec));
- imageSpec->images = ckalloc(n * sizeof(Tk_Image *));
+ imageSpec->states = (Ttk_StateSpec *)ckalloc(n * sizeof(Ttk_StateSpec));
+ imageSpec->images = (Tk_Image *)ckalloc(n * sizeof(Tk_Image));
/* Get base image:
*/
@@ -205,6 +213,7 @@ static void Ttk_Fill(
int dr = dst.x + dst.width;
int db = dst.y + dst.height;
int x,y;
+ (void)tkwin;
if (!(src.width && src.height && dst.width && dst.height))
return;
@@ -254,7 +263,7 @@ typedef struct { /* ClientData for image elements */
Ttk_Padding border; /* Fixed border region */
Ttk_Padding padding; /* Internal padding */
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
Ttk_ResourceCache cache; /* Resource cache for images */
Ttk_StateMap imageMap; /* State-based lookup table for images */
#endif
@@ -262,9 +271,9 @@ typedef struct { /* ClientData for image elements */
static void FreeImageData(void *clientData)
{
- ImageData *imageData = clientData;
+ ImageData *imageData = (ImageData *)clientData;
if (imageData->imageSpec) { TtkFreeImageSpec(imageData->imageSpec); }
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); }
#endif
ckfree(clientData);
@@ -274,8 +283,10 @@ static void ImageElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ImageData *imageData = clientData;
+ ImageData *imageData = (ImageData *)clientData;
Tk_Image image = imageData->imageSpec->baseImage;
+ (void)elementRecord;
+ (void)tkwin;
if (image) {
Tk_SizeOfImage(image, widthPtr, heightPtr);
@@ -294,12 +305,13 @@ static void ImageElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- ImageData *imageData = clientData;
+ ImageData *imageData = (ImageData *)clientData;
Tk_Image image = 0;
int imgWidth, imgHeight;
Ttk_Box src, dst;
+ (void)elementRecord;
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (imageData->imageMap) {
Tcl_Obj *imageObj = Ttk_StateMapLookup(NULL,imageData->imageMap,state);
if (imageObj) {
@@ -324,7 +336,7 @@ static void ImageElementDraw(
Ttk_Tile(tkwin, d, image, src, dst, imageData->border);
}
-static Ttk_ElementSpec ImageElementSpec =
+static const Ttk_ElementSpec ImageElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -339,12 +351,12 @@ static Ttk_ElementSpec ImageElementSpec =
static int
Ttk_CreateImageElement(
Tcl_Interp *interp,
- void *clientData,
+ void *dummy,
Ttk_Theme theme,
const char *elementName,
int objc, Tcl_Obj *const objv[])
{
- static const char *optionStrings[] =
+ static const char *const optionStrings[] =
{ "-border","-height","-padding","-sticky","-width",NULL };
enum { O_BORDER, O_HEIGHT, O_PADDING, O_STICKY, O_WIDTH };
@@ -352,6 +364,7 @@ Ttk_CreateImageElement(
ImageData *imageData = 0;
int padding_specified = 0;
int i;
+ (void)dummy;
if (objc <= 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -365,12 +378,12 @@ Ttk_CreateImageElement(
return TCL_ERROR;
}
- imageData = ckalloc(sizeof(*imageData));
+ imageData = (ImageData *)ckalloc(sizeof(*imageData));
imageData->imageSpec = imageSpec;
imageData->minWidth = imageData->minHeight = -1;
imageData->sticky = TTK_FILL_BOTH;
imageData->border = imageData->padding = Ttk_UniformPadding(0);
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
imageData->cache = Ttk_GetResourceCache(interp);
imageData->imageMap = 0;
#endif
@@ -385,7 +398,7 @@ Ttk_CreateImageElement(
goto error;
}
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (!strcmp("-map", Tcl_GetString(objv[i]))) {
imageData->imageMap = objv[i+1];
Tcl_IncrRefCount(imageData->imageMap);
diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c
index 0bda18b..2672a0b 100644
--- a/generic/ttk/ttkInit.c
+++ b/generic/ttk/ttkInit.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003 Joe English
*
* Ttk package: initialization routine and miscellaneous utilities.
*/
@@ -12,43 +12,50 @@
* Legal values for the button -default option.
* See also: enum Ttk_ButtonDefaultState.
*/
-const char *ttkDefaultStrings[] = {
+const char *const ttkDefaultStrings[] = {
"normal", "active", "disabled", NULL
};
int Ttk_GetButtonDefaultStateFromObj(
- Tcl_Interp *interp, Tcl_Obj *objPtr, int *statePtr)
+ Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_ButtonDefaultState *statePtr)
{
- *statePtr = TTK_BUTTON_DEFAULT_DISABLED;
- return Tcl_GetIndexFromObjStruct(interp, objPtr, ttkDefaultStrings,
- sizeof(char *), "default state", 0, statePtr);
+ int state = (int)TTK_BUTTON_DEFAULT_DISABLED;
+ int result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkDefaultStrings,
+ sizeof(char *), "default state", 0, &state);
+
+ *statePtr = (Ttk_ButtonDefaultState)state;
+ return result;
}
/*
* Legal values for the -compound option.
* See also: enum Ttk_Compound.
*/
-const char *ttkCompoundStrings[] = {
+const char *const ttkCompoundStrings[] = {
"none", "text", "image", "center",
"top", "bottom", "left", "right", NULL
};
int Ttk_GetCompoundFromObj(
- Tcl_Interp *interp, Tcl_Obj *objPtr, int *statePtr)
+ Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Compound *compoundPtr)
{
- *statePtr = TTK_COMPOUND_NONE;
- return Tcl_GetIndexFromObjStruct(interp, objPtr, ttkCompoundStrings,
- sizeof(char *), "compound layout", 0, statePtr);
+ int compound = (int)TTK_COMPOUND_NONE;
+ int result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkCompoundStrings,
+ sizeof(char *), "compound layout", 0, &compound);
+
+ *compoundPtr = (Ttk_Compound)compound;
+ return result;
}
/*
* Legal values for the -orient option.
* See also: enum Ttk_Orient.
*/
-const char *ttkOrientStrings[] = {
+const char *const ttkOrientStrings[] = {
"horizontal", "vertical", NULL
};
+#if !defined(TK_NO_DEPRECATED) && TK_MAJOR_VERSION < 9
int Ttk_GetOrientFromObj(
Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr)
{
@@ -56,12 +63,24 @@ int Ttk_GetOrientFromObj(
return Tcl_GetIndexFromObjStruct(interp, objPtr, ttkOrientStrings,
sizeof(char *), "orientation", 0, resultPtr);
}
+#endif
+
+int TtkGetOrientFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *resultPtr)
+{
+ int orient = (int)TTK_ORIENT_HORIZONTAL;
+ int result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkOrientStrings,
+ sizeof(char *), "orientation", 0, &orient);
+
+ *resultPtr = (Ttk_Orient)orient;
+ return result;
+}
/*
* Recognized values for the -state compatibility option.
* Other options are accepted and interpreted as synonyms for "normal".
*/
-static const char *ttkStateStrings[] = {
+static const char *const ttkStateStrings[] = {
"normal", "readonly", "disabled", "active", NULL
};
enum {
@@ -105,28 +124,6 @@ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr)
# undef SETFLAGS
}
-/* TtkSendVirtualEvent --
- * Send a virtual event notification to the specified target window.
- * Equivalent to "event generate $tgtWindow <<$eventName>>"
- *
- * Note that we use Tk_QueueWindowEvent, not Tk_HandleEvent,
- * so this routine does not reenter the interpreter.
- */
-void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName)
-{
- union {XEvent general; XVirtualEvent virt;} event;
-
- memset(&event, 0, sizeof(event));
- event.general.xany.type = VirtualEvent;
- event.general.xany.serial = NextRequest(Tk_Display(tgtWin));
- event.general.xany.send_event = False;
- event.general.xany.window = Tk_WindowId(tgtWin);
- event.general.xany.display = Tk_Display(tgtWin);
- event.virt.name = Tk_GetUid(eventName);
-
- Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
-}
-
/* TtkEnumerateOptions, TtkGetOptionValue --
* Common factors for data accessor commands.
*/
@@ -148,7 +145,7 @@ int TtkEnumerateOptions(
if (specPtr->type == TK_OPTION_END && specPtr->clientData != NULL) {
/* Chain to next option spec array: */
- specPtr = specPtr->clientData;
+ specPtr = (const Tk_OptionSpec *)specPtr->clientData;
}
}
Tcl_SetObjResult(interp, result);
@@ -175,14 +172,14 @@ int TtkGetOptionValue(
*/
/* public */
-Tk_OptionSpec ttkCoreOptionSpecs[] =
+const Tk_OptionSpec ttkCoreOptionSpecs[] =
{
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", NULL,
- Tk_Offset(WidgetCore, cursorObj), -1, TK_OPTION_NULL_OK,0,0 },
+ offsetof(WidgetCore, cursorObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_STRING, "-style", "style", "Style", "",
- Tk_Offset(WidgetCore,styleObj), -1, 0,0,STYLE_CHANGED},
+ offsetof(WidgetCore,styleObj), TCL_INDEX_NONE, 0,0,STYLE_CHANGED},
{TK_OPTION_STRING, "-class", "", "", NULL,
- Tk_Offset(WidgetCore,classObj), -1, 0,0,READONLY_OPTION},
+ offsetof(WidgetCore,classObj), TCL_INDEX_NONE, 0,0,READONLY_OPTION},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -274,7 +271,10 @@ Ttk_Init(Tcl_Interp *interp)
Ttk_PlatformInit(interp);
+#ifndef TK_NO_DEPRECATED
Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs);
+#endif
+ Tcl_PkgProvideEx(interp, "ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs);
return TCL_OK;
}
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c
index 6f32299..6d254e8 100644
--- a/generic/ttk/ttkLabel.c
+++ b/generic/ttk/ttkLabel.c
@@ -46,25 +46,25 @@ typedef struct {
/* Text element options table.
* NB: Keep in sync with label element option table.
*/
-static Ttk_ElementOptionSpec TextElementOptions[] = {
+static const Ttk_ElementOptionSpec TextElementOptions[] = {
{ "-text", TK_OPTION_STRING,
- Tk_Offset(TextElement,textObj), "" },
+ offsetof(TextElement,textObj), "" },
{ "-font", TK_OPTION_FONT,
- Tk_Offset(TextElement,fontObj), DEFAULT_FONT },
+ offsetof(TextElement,fontObj), DEFAULT_FONT },
{ "-foreground", TK_OPTION_COLOR,
- Tk_Offset(TextElement,foregroundObj), "black" },
+ offsetof(TextElement,foregroundObj), "black" },
{ "-underline", TK_OPTION_INT,
- Tk_Offset(TextElement,underlineObj), "-1"},
+ offsetof(TextElement,underlineObj), "-1"},
{ "-width", TK_OPTION_INT,
- Tk_Offset(TextElement,widthObj), "-1"},
+ offsetof(TextElement,widthObj), "-1"},
{ "-anchor", TK_OPTION_ANCHOR,
- Tk_Offset(TextElement,anchorObj), "w"},
+ offsetof(TextElement,anchorObj), "w"},
{ "-justify", TK_OPTION_JUSTIFY,
- Tk_Offset(TextElement,justifyObj), "left" },
+ offsetof(TextElement,justifyObj), "left" },
{ "-wraplength", TK_OPTION_PIXELS,
- Tk_Offset(TextElement,wrapLengthObj), "0" },
+ offsetof(TextElement,wrapLengthObj), "0" },
{ "-embossed", TK_OPTION_INT,
- Tk_Offset(TextElement,embossedObj), "0"},
+ offsetof(TextElement,embossedObj), "0"},
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -225,7 +225,7 @@ static void TextElementDraw(
}
}
-static Ttk_ElementSpec TextElementSpec = {
+static const Ttk_ElementSpec TextElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TextElement),
TextElementOptions,
@@ -251,13 +251,13 @@ typedef struct {
/* ===> NB: Keep in sync with label element option table. <===
*/
-static Ttk_ElementOptionSpec ImageElementOptions[] = {
+static const Ttk_ElementOptionSpec ImageElementOptions[] = {
{ "-image", TK_OPTION_STRING,
- Tk_Offset(ImageElement,imageObj), "" },
+ offsetof(ImageElement,imageObj), "" },
{ "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */
- Tk_Offset(ImageElement,stippleObj), "gray50" },
+ offsetof(ImageElement,stippleObj), "gray50" },
{ "-background", TK_OPTION_COLOR,
- Tk_Offset(ImageElement,backgroundObj), DEFAULT_BACKGROUND },
+ offsetof(ImageElement,backgroundObj), DEFAULT_BACKGROUND },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -392,7 +392,7 @@ static void ImageElementDraw(
}
}
-static Ttk_ElementSpec ImageElementSpec = {
+static const Ttk_ElementSpec ImageElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ImageElement),
ImageElementOptions,
@@ -448,43 +448,43 @@ typedef struct {
int totalWidth, totalHeight;
} LabelElement;
-static Ttk_ElementOptionSpec LabelElementOptions[] = {
+static const Ttk_ElementOptionSpec LabelElementOptions[] = {
{ "-compound", TK_OPTION_ANY,
- Tk_Offset(LabelElement,compoundObj), "none" },
+ offsetof(LabelElement,compoundObj), "none" },
{ "-space", TK_OPTION_PIXELS,
- Tk_Offset(LabelElement,spaceObj), "4" },
+ offsetof(LabelElement,spaceObj), "4" },
/* Text element part:
* NB: Keep in sync with TextElementOptions.
*/
{ "-text", TK_OPTION_STRING,
- Tk_Offset(LabelElement,text.textObj), "" },
+ offsetof(LabelElement,text.textObj), "" },
{ "-font", TK_OPTION_FONT,
- Tk_Offset(LabelElement,text.fontObj), DEFAULT_FONT },
+ offsetof(LabelElement,text.fontObj), DEFAULT_FONT },
{ "-foreground", TK_OPTION_COLOR,
- Tk_Offset(LabelElement,text.foregroundObj), "black" },
+ offsetof(LabelElement,text.foregroundObj), "black" },
{ "-underline", TK_OPTION_INT,
- Tk_Offset(LabelElement,text.underlineObj), "-1"},
+ offsetof(LabelElement,text.underlineObj), "-1"},
{ "-width", TK_OPTION_INT,
- Tk_Offset(LabelElement,text.widthObj), ""},
+ offsetof(LabelElement,text.widthObj), ""},
{ "-anchor", TK_OPTION_ANCHOR,
- Tk_Offset(LabelElement,text.anchorObj), "w"},
+ offsetof(LabelElement,text.anchorObj), "w"},
{ "-justify", TK_OPTION_JUSTIFY,
- Tk_Offset(LabelElement,text.justifyObj), "left" },
+ offsetof(LabelElement,text.justifyObj), "left" },
{ "-wraplength", TK_OPTION_PIXELS,
- Tk_Offset(LabelElement,text.wrapLengthObj), "0" },
+ offsetof(LabelElement,text.wrapLengthObj), "0" },
{ "-embossed", TK_OPTION_INT,
- Tk_Offset(LabelElement,text.embossedObj), "0"},
+ offsetof(LabelElement,text.embossedObj), "0"},
/* Image element part:
* NB: Keep in sync with ImageElementOptions.
*/
{ "-image", TK_OPTION_STRING,
- Tk_Offset(LabelElement,image.imageObj), "" },
+ offsetof(LabelElement,image.imageObj), "" },
{ "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */
- Tk_Offset(LabelElement,image.stippleObj), "gray50" },
+ offsetof(LabelElement,image.stippleObj), "gray50" },
{ "-background", TK_OPTION_COLOR,
- Tk_Offset(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND },
+ offsetof(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -503,7 +503,7 @@ static void LabelSetup(
Ttk_Compound *compoundPtr = &c->compound;
Tk_GetPixelsFromObj(NULL, tkwin, c->spaceObj, &c->space);
- Ttk_GetCompoundFromObj(NULL, c->compoundObj, (int *)compoundPtr);
+ Ttk_GetCompoundFromObj(NULL, c->compoundObj, compoundPtr);
/*
* Deal with TTK_COMPOUND_NONE.
@@ -569,13 +569,15 @@ static void LabelCleanup(LabelElement *c)
}
static void LabelElementSize(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ int *widthPtr,
+ int *heightPtr,
+ TCL_UNUSED(Ttk_Padding *))
{
LabelElement *label = (LabelElement *)elementRecord;
int textReqWidth = 0;
- (void)dummy;
- (void)paddingPtr;
LabelSetup(label, tkwin, 0);
@@ -617,7 +619,7 @@ static void LabelElementSize(
*/
static void DrawCompound(
LabelElement *l, Ttk_Box b, Tk_Window tkwin, Drawable d, Ttk_State state,
- int imageSide, int textSide)
+ Ttk_Side imageSide, Ttk_Side textSide)
{
Ttk_Box imageBox =
Ttk_PlaceBox(&b, l->image.width, l->image.height, imageSide, 0);
@@ -628,12 +630,15 @@ static void DrawCompound(
}
static void LabelElementDraw(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, Ttk_State state)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ Drawable d,
+ Ttk_Box b,
+ Ttk_State state)
{
LabelElement *l = (LabelElement *)elementRecord;
Tk_Anchor anchor = TK_ANCHOR_CENTER;
- (void)dummy;
LabelSetup(l, tkwin, state);
@@ -684,7 +689,7 @@ static void LabelElementDraw(
LabelCleanup(l);
}
-static Ttk_ElementSpec LabelElementSpec = {
+static const Ttk_ElementSpec LabelElementSpec = {
TK_STYLE_VERSION_2,
sizeof(LabelElement),
LabelElementOptions,
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index ed61a1c..b91c24d 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -3,7 +3,7 @@
*
* Generic layout processing.
*
- * Copyright (c) 2003 Joe English. Freely redistributable.
+ * Copyright © 2003 Joe English. Freely redistributable.
*/
#include "tkInt.h"
@@ -36,10 +36,10 @@ Ttk_NewBoxObj(Ttk_Box box)
{
Tcl_Obj *result[4];
- result[0] = Tcl_NewIntObj(box.x);
- result[1] = Tcl_NewIntObj(box.y);
- result[2] = Tcl_NewIntObj(box.width);
- result[3] = Tcl_NewIntObj(box.height);
+ result[0] = Tcl_NewWideIntObj(box.x);
+ result[1] = Tcl_NewWideIntObj(box.y);
+ result[2] = Tcl_NewWideIntObj(box.width);
+ result[3] = Tcl_NewWideIntObj(box.height);
return Tcl_NewListObj(4, result);
}
@@ -524,7 +524,7 @@ struct Ttk_LayoutNode_
static Ttk_LayoutNode *Ttk_NewLayoutNode(
unsigned flags, Ttk_ElementClass *elementClass)
{
- Ttk_LayoutNode *node = ckalloc(sizeof(*node));
+ Ttk_LayoutNode *node = (Ttk_LayoutNode *)ckalloc(sizeof(*node));
node->flags = flags;
node->eclass = elementClass;
@@ -557,8 +557,8 @@ struct Ttk_TemplateNode_ {
static Ttk_TemplateNode *Ttk_NewTemplateNode(const char *name, unsigned flags)
{
- Ttk_TemplateNode *op = ckalloc(sizeof(*op));
- op->name = ckalloc(strlen(name) + 1); strcpy(op->name, name);
+ Ttk_TemplateNode *op = (Ttk_TemplateNode *)ckalloc(sizeof(*op));
+ op->name = (char *)ckalloc(strlen(name) + 1); strcpy(op->name, name);
op->flags = flags;
op->next = op->child = 0;
return op;
@@ -603,13 +603,13 @@ Ttk_InstantiateLayout(Ttk_Theme theme, Ttk_TemplateNode *op)
*/
/* NB: This must match bit definitions TTK_PACK_LEFT etc. */
-static const char *packSideStrings[] =
+static const char *const packSideStrings[] =
{ "left", "right", "top", "bottom", NULL };
Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr)
{
enum { OP_SIDE, OP_STICKY, OP_EXPAND, OP_BORDER, OP_UNIT, OP_CHILDREN };
- static const char *optStrings[] = {
+ static const char *const optStrings[] = {
"-side", "-sticky", "-expand", "-border", "-unit", "-children", 0 };
int i = 0, objc;
@@ -843,7 +843,7 @@ static Ttk_Layout TTKNewLayout(
void *recordPtr,Tk_OptionTable optionTable, Tk_Window tkwin,
Ttk_LayoutNode *root)
{
- Ttk_Layout layout = ckalloc(sizeof(*layout));
+ Ttk_Layout layout = (Ttk_Layout)ckalloc(sizeof(*layout));
layout->style = style;
layout->recordPtr = recordPtr;
layout->optionTable = optionTable;
diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c
index a47d8dc..c3257c3 100644
--- a/generic/ttk/ttkManager.c
+++ b/generic/ttk/ttkManager.c
@@ -34,9 +34,9 @@
* (2) Manager voluntarily relinquishes control
* (3) Content window is destroyed
*
- * In case (1), Tk calls the manager's lostSlaveProc.
+ * In case (1), Tk calls the manager's lostContentProc.
* Case (2) is performed by calling Tk_ManageGeometry(window,NULL,0);
- * in this case Tk does _not_ call the lostSlaveProc (documented behavior).
+ * in this case Tk does _not_ call the lostContentProc (documented behavior).
* Tk doesn't handle case (3) either; to account for that we
* register an event handler on the content window to track <Destroy> events.
*/
@@ -61,7 +61,7 @@ struct TtkManager_
void *managerData;
Tk_Window window;
unsigned flags;
- int nContent;
+ TkSizeT nContent;
Ttk_Content **content;
};
@@ -106,7 +106,7 @@ static void RecomputeSize(Ttk_Manager *mgr)
*/
static void RecomputeLayout(Ttk_Manager *mgr)
{
- mgr->managerSpec->PlaceSlaves(mgr->managerData);
+ mgr->managerSpec->PlaceContent(mgr->managerData);
mgr->flags &= ~MGR_RELAYOUT_REQUIRED;
}
@@ -142,7 +142,7 @@ static const int ManagerEventMask = StructureNotifyMask;
static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr)
{
Ttk_Manager *mgr = (Ttk_Manager *)clientData;
- int i;
+ TkSizeT i;
switch (eventPtr->type)
{
@@ -174,7 +174,7 @@ static void ContentLostEventHandler(void *clientData, XEvent *eventPtr)
{
Ttk_Content *content = (Ttk_Content *)clientData;
if (eventPtr->type == DestroyNotify) {
- content->manager->managerSpec->tkGeomMgr.lostSlaveProc(
+ content->manager->managerSpec->tkGeomMgr.lostContentProc(
content->manager, content->window);
}
}
@@ -247,9 +247,9 @@ void Ttk_DeleteManager(Ttk_Manager *mgr)
/* ++ InsertContent --
* Adds content to the list of managed windows.
*/
-static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, int index)
+static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, TkSizeT index)
{
- int endIndex = mgr->nContent++;
+ TkSizeT endIndex = mgr->nContent++;
mgr->content = (Ttk_Content **)ckrealloc(mgr->content, mgr->nContent * sizeof(Ttk_Content *));
while (endIndex > index) {
@@ -276,14 +276,14 @@ static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, int index)
* [1] It's safe to call Tk_UnmapWindow / Tk_UnmaintainGeometry even if this
* routine is called from the content window's DestroyNotify event handler.
*/
-static void RemoveContent(Ttk_Manager *mgr, int index)
+static void RemoveContent(Ttk_Manager *mgr, TkSizeT index)
{
Ttk_Content *content = mgr->content[index];
- int i;
+ TkSizeT i;
/* Notify manager:
*/
- mgr->managerSpec->SlaveRemoved(mgr->managerData, index);
+ mgr->managerSpec->ContentRemoved(mgr->managerData, index);
/* Remove from array:
*/
@@ -313,11 +313,11 @@ static void RemoveContent(Ttk_Manager *mgr, int index)
void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window)
{
Ttk_Manager *mgr = (Ttk_Manager *)clientData;
- int index = Ttk_ContentIndex(mgr, window);
+ TkSizeT index = Ttk_ContentIndex(mgr, window);
int reqWidth = Tk_ReqWidth(window);
int reqHeight= Tk_ReqHeight(window);
- if (mgr->managerSpec->SlaveRequest(
+ if (mgr->managerSpec->ContentRequest(
mgr->managerData, index, reqWidth, reqHeight))
{
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
@@ -327,7 +327,7 @@ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window)
void Ttk_LostContentProc(ClientData clientData, Tk_Window window)
{
Ttk_Manager *mgr = (Ttk_Manager *)clientData;
- int index = Ttk_ContentIndex(mgr, window);
+ TkSizeT index = Ttk_ContentIndex(mgr, window);
/* ASSERT: index >= 0 */
RemoveContent(mgr, index);
@@ -341,7 +341,7 @@ void Ttk_LostContentProc(ClientData clientData, Tk_Window window)
* Add a new content window at the specified index.
*/
void Ttk_InsertContent(
- Ttk_Manager *mgr, int index, Tk_Window tkwin, void *data)
+ Ttk_Manager *mgr, TkSizeT index, Tk_Window tkwin, void *data)
{
Ttk_Content *content = NewContent(mgr, tkwin, data);
InsertContent(mgr, content, index);
@@ -350,7 +350,7 @@ void Ttk_InsertContent(
/* ++ Ttk_ForgetContent --
* Unmanage the specified content window.
*/
-void Ttk_ForgetContent(Ttk_Manager *mgr, int index)
+void Ttk_ForgetContent(Ttk_Manager *mgr, TkSizeT index)
{
Tk_Window window = mgr->content[index]->window;
RemoveContent(mgr, index);
@@ -365,7 +365,7 @@ void Ttk_ForgetContent(Ttk_Manager *mgr, int index)
* map the content window.
*/
void Ttk_PlaceContent(
- Ttk_Manager *mgr, int index, int x, int y, int width, int height)
+ Ttk_Manager *mgr, TkSizeT index, int x, int y, int width, int height)
{
Ttk_Content *content = mgr->content[index];
Tk_MaintainGeometry(content->window,mgr->window,x,y,width,height);
@@ -378,7 +378,7 @@ void Ttk_PlaceContent(
/* ++ Ttk_UnmapContent --
* Unmap the specified content window, but leave it managed.
*/
-void Ttk_UnmapContent(Ttk_Manager *mgr, int index)
+void Ttk_UnmapContent(Ttk_Manager *mgr, TkSizeT index)
{
Ttk_Content *content = mgr->content[index];
Tk_UnmaintainGeometry(content->window, mgr->window);
@@ -404,15 +404,15 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr)
/* +++ Accessors.
*/
-int Ttk_NumberContent(Ttk_Manager *mgr)
+TkSizeT Ttk_NumberContent(Ttk_Manager *mgr)
{
return mgr->nContent;
}
-void *Ttk_ContentData(Ttk_Manager *mgr, int index)
+void *Ttk_ContentData(Ttk_Manager *mgr, TkSizeT index)
{
return mgr->content[index]->data;
}
-Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, int index)
+Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, TkSizeT index)
{
return mgr->content[index]->window;
}
@@ -424,13 +424,13 @@ Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, int index)
/* ++ Ttk_ContentIndex --
* Returns the index of specified content window, -1 if not found.
*/
-int Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window)
+TkSizeT Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window)
{
- int index;
+ TkSizeT index;
for (index = 0; index < mgr->nContent; ++index)
if (mgr->content[index]->window == window)
return index;
- return -1;
+ return TCL_INDEX_NONE;
}
/* ++ Ttk_GetContentIndexFromObj(interp, mgr, objPtr, indexPtr) --
@@ -443,19 +443,19 @@ int Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window)
*/
int Ttk_GetContentIndexFromObj(
- Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, int *indexPtr)
+ Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, TkSizeT *indexPtr)
{
const char *string = Tcl_GetString(objPtr);
- int index = 0;
+ TkSizeT index = 0;
Tk_Window tkwin;
/* Try interpreting as an integer first:
*/
- if (Tcl_GetIntFromObj(NULL, objPtr, &index) == TCL_OK) {
- if (index < 0 || index >= mgr->nContent) {
+ if (TkGetIntForIndex(objPtr, mgr->nContent - 1, 1, &index) == TCL_OK) {
+ if (index == TCL_INDEX_NONE || index > mgr->nContent) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Slave index %d out of bounds", index));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "INDEX", NULL);
+ "Managed window index %d out of bounds", (int)index));
+ Tcl_SetErrorCode(interp, "TTK", "MANAGED", "INDEX", NULL);
return TCL_ERROR;
}
*indexPtr = index;
@@ -467,11 +467,11 @@ int Ttk_GetContentIndexFromObj(
if ((*string == '.') &&
(tkwin = Tk_NameToWindow(interp, string, mgr->window))) {
index = Ttk_ContentIndex(mgr, tkwin);
- if (index < 0) {
+ if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s is not managed by %s", string,
Tk_PathName(mgr->window)));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "MANAGER", NULL);
+ Tcl_SetErrorCode(interp, "TTK", "MANAGED", "MANAGER", NULL);
return TCL_ERROR;
}
*indexPtr = index;
@@ -479,15 +479,15 @@ int Ttk_GetContentIndexFromObj(
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Invalid slave specification %s", string));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "SPEC", NULL);
+ "Invalid managed window specification %s", string));
+ Tcl_SetErrorCode(interp, "TTK", "MANAGED", "SPEC", NULL);
return TCL_ERROR;
}
/* ++ Ttk_ReorderContent(mgr, fromIndex, toIndex) --
* Change content window order.
*/
-void Ttk_ReorderContent(Ttk_Manager *mgr, int fromIndex, int toIndex)
+void Ttk_ReorderContent(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT toIndex)
{
Ttk_Content *moved = mgr->content[fromIndex];
@@ -539,7 +539,7 @@ int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window window, Tk_Window container)
return 1;
badWindow:
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as slave of %s",
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as content of %s",
Tk_PathName(window), Tk_PathName(container)));
Tcl_SetErrorCode(interp, "TTK", "GEOMETRY", "MAINTAINABLE", NULL);
return 0;
diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h
index d487dea..cf07dfc 100644
--- a/generic/ttk/ttkManager.h
+++ b/generic/ttk/ttkManager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Joe English. Freely redistributable.
+ * Copyright © 2005 Joe English. Freely redistributable.
*
* Geometry manager utilities.
*/
@@ -16,29 +16,29 @@ typedef struct TtkManager_ Ttk_Manager;
*
* RequestedSize computes the requested size of the container window.
*
- * PlaceSlaves sets the position and size of all managed content windows
+ * PlaceContent sets the position and size of all managed content windows
* by calling Ttk_PlaceContent().
*
- * SlaveRemoved() is called immediately before a content window is removed.
+ * ContentRemoved() is called immediately before a content window is removed.
* NB: the associated content window may have been destroyed when this
* routine is called.
*
- * SlaveRequest() is called when a content window requests a size change.
+ * ContentRequest() is called when a content window requests a size change.
* It should return 1 if the request should propagate, 0 otherwise.
*/
typedef struct { /* Manager hooks */
Tk_GeomMgr tkGeomMgr; /* "real" Tk Geometry Manager */
int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr);
- void (*PlaceSlaves)(void *managerData);
- int (*SlaveRequest)(void *managerData, int index, int w, int h);
- void (*SlaveRemoved)(void *managerData, int index);
+ void (*PlaceContent)(void *managerData);
+ int (*ContentRequest)(void *managerData, TkSizeT index, int w, int h);
+ void (*ContentRemoved)(void *managerData, TkSizeT index);
} Ttk_ManagerSpec;
/*
* Default implementations for Tk_GeomMgr hooks:
*/
-#define Ttk_LostContentProc Ttk_LostSlaveProc
+#define Ttk_LostSlaveProc Ttk_LostContentProc
MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window window);
MODULE_SCOPE void Ttk_LostContentProc(ClientData, Tk_Window window);
@@ -49,24 +49,24 @@ MODULE_SCOPE Ttk_Manager *Ttk_CreateManager(
Ttk_ManagerSpec *, void *managerData, Tk_Window window);
MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *);
-#define Ttk_InsertContent Ttk_InsertSlave
+#define Ttk_InsertSlave Ttk_InsertContent
MODULE_SCOPE void Ttk_InsertContent(
- Ttk_Manager *, int position, Tk_Window, void *data);
+ Ttk_Manager *, TkSizeT position, Tk_Window, void *clientData);
-#define Ttk_ForgetContent Ttk_ForgetSlave
-MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, int index);
+#define Ttk_ForgetSlave Ttk_ForgetContent
+MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, TkSizeT index);
-#define Ttk_ReorderContent Ttk_ReorderSlave
-MODULE_SCOPE void Ttk_ReorderContent(Ttk_Manager *, int fromIndex, int toIndex);
+#define Ttk_ReorderSlave Ttk_ReorderContent
+MODULE_SCOPE void Ttk_ReorderContent(Ttk_Manager *, TkSizeT fromIndex, TkSizeT toIndex);
/* Rearrange content window positions */
-#define Ttk_PlaceContent Ttk_PlaceSlave
+#define Ttk_PlaceSlave Ttk_PlaceContent
MODULE_SCOPE void Ttk_PlaceContent(
- Ttk_Manager *, int index, int x, int y, int width, int height);
+ Ttk_Manager *, TkSizeT index, int x, int y, int width, int height);
/* Position and map the content window */
-#define Ttk_UnmapContent Ttk_UnmapSlave
-MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, int index);
+#define Ttk_UnmapSlave Ttk_UnmapContent
+MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, TkSizeT index);
/* Unmap the content window */
MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *);
@@ -75,26 +75,26 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *);
/* Utilities:
*/
-#define Ttk_ContentIndex Ttk_SlaveIndex
-MODULE_SCOPE int Ttk_ContentIndex(Ttk_Manager *, Tk_Window);
- /* Returns: index in content array of specified window, -1 if not found */
+#define Ttk_SlaveIndex Ttk_ContentIndex
+MODULE_SCOPE TkSizeT Ttk_ContentIndex(Ttk_Manager *, Tk_Window);
+ /* Returns: index in content array of specified window, TCL_INDEX_NONE if not found */
-#define Ttk_GetContentIndexFromObj Ttk_GetSlaveIndexFromObj
+#define Ttk_GetSlaveIndexFromObj Ttk_GetContentIndexFromObj
MODULE_SCOPE int Ttk_GetContentIndexFromObj(
- Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, int *indexPtr);
+ Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, TkSizeT *indexPtr);
/* Accessor functions:
*/
-#define Ttk_NumberContent Ttk_NumberSlaves
-MODULE_SCOPE int Ttk_NumberContent(Ttk_Manager *);
+#define Ttk_NumberSlaves Ttk_NumberContent
+MODULE_SCOPE TkSizeT Ttk_NumberContent(Ttk_Manager *);
/* Returns: number of managed content windows */
-#define Ttk_ContentData Ttk_SlaveData
-MODULE_SCOPE void *Ttk_ContentData(Ttk_Manager *, int index);
+#define Ttk_SlaveData Ttk_ContentData
+MODULE_SCOPE void *Ttk_ContentData(Ttk_Manager *, TkSizeT index);
/* Returns: client data associated with content window */
-#define Ttk_ContentWindow Ttk_SlaveWindow
-MODULE_SCOPE Tk_Window Ttk_ContentWindow(Ttk_Manager *, int index);
+#define Ttk_SlaveWindow Ttk_ContentWindow
+MODULE_SCOPE Tk_Window Ttk_ContentWindow(Ttk_Manager *, TkSizeT index);
/* Returns: content window */
MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window content, Tk_Window container);
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index ea82ef1..5664be5 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -1,9 +1,8 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004 Joe English
*/
#include "tkInt.h"
-
#include "ttkTheme.h"
#include "ttkWidget.h"
#include "ttkManager.h"
@@ -54,31 +53,31 @@ typedef struct
* relevant to the tab.
*
* PaneOptionSpecs includes additional options for child window placement
- * and is used to configure the content window.
+ * and is used to configure the pane.
*/
-static Tk_OptionSpec TabOptionSpecs[] =
+static const Tk_OptionSpec TabOptionSpecs[] =
{
{TK_OPTION_STRING_TABLE, "-state", "", "",
- "normal", -1,Tk_Offset(Tab,state),
+ "normal", TCL_INDEX_NONE, offsetof(Tab,state),
0, (void *)TabStateStrings, 0 },
{TK_OPTION_STRING, "-text", "text", "Text", "",
- Tk_Offset(Tab,textObj), -1, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,textObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/,
- Tk_Offset(Tab,imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ offsetof(Tab,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- NULL, Tk_Offset(Tab,compoundObj), -1,
- TK_OPTION_NULL_OK, (void *)ttkCompoundStrings, GEOMETRY_CHANGED },
+ NULL, offsetof(Tab,compoundObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK,(void *)ttkCompoundStrings,GEOMETRY_CHANGED },
{TK_OPTION_INT, "-underline", "underline", "Underline", "-1",
- Tk_Offset(Tab,underlineObj), -1, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,underlineObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 }
};
-static Tk_OptionSpec PaneOptionSpecs[] =
+static const Tk_OptionSpec PaneOptionSpecs[] =
{
{TK_OPTION_STRING, "-padding", "padding", "Padding", "0",
- Tk_Offset(Tab,paddingObj), -1, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,paddingObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-sticky", "sticky", "Sticky", "nsew",
- Tk_Offset(Tab,stickyObj), -1, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,stickyObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
WIDGET_INHERIT_OPTIONS(TabOptionSpecs)
};
@@ -95,11 +94,11 @@ typedef struct
Ttk_Manager *mgr; /* Geometry manager */
Tk_OptionTable tabOptionTable; /* Tab options */
Tk_OptionTable paneOptionTable; /* Tab+pane options */
- int currentIndex; /* index of currently selected tab */
- int activeIndex; /* index of currently active tab */
+ TkSizeT currentIndex; /* index of currently selected tab */
+ TkSizeT activeIndex; /* index of currently active tab */
Ttk_Layout tabLayout; /* Sublayout for tabs */
- Ttk_Box clientArea; /* Where to pack content widgets */
+ Ttk_Box clientArea; /* Where to pack content windows */
} NotebookPart;
typedef struct
@@ -108,16 +107,16 @@ typedef struct
NotebookPart notebook;
} Notebook;
-static Tk_OptionSpec NotebookOptionSpecs[] =
+static const Tk_OptionSpec NotebookOptionSpecs[] =
{
{TK_OPTION_INT, "-width", "width", "Width", "0",
- Tk_Offset(Notebook,notebook.widthObj),-1,
+ offsetof(Notebook,notebook.widthObj),TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED },
{TK_OPTION_INT, "-height", "height", "Height", "0",
- Tk_Offset(Notebook,notebook.heightObj),-1,
+ offsetof(Notebook,notebook.heightObj),TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-padding", "padding", "Padding", NULL,
- Tk_Offset(Notebook,notebook.paddingObj),-1,
+ offsetof(Notebook,notebook.paddingObj),TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
WIDGET_TAKEFOCUS_TRUE,
@@ -194,7 +193,7 @@ static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window window)
Tab *record = (Tab *)ckalloc(sizeof(Tab));
memset(record, 0, sizeof(Tab));
- if (Tk_InitOptions(interp, (char *)record, optionTable, window) != TCL_OK) {
+ if (Tk_InitOptions(interp, record, optionTable, window) != TCL_OK) {
ckfree(record);
return NULL;
}
@@ -218,7 +217,7 @@ static int ConfigureTab(
Tk_SavedOptions savedOptions;
int mask = 0;
- if (Tk_SetOptions(interp, (void *)tab, nb->notebook.paneOptionTable,
+ if (Tk_SetOptions(interp, tab, nb->notebook.paneOptionTable,
objc, objv, window, &savedOptions, &mask) != TCL_OK)
{
return TCL_ERROR;
@@ -255,9 +254,9 @@ error:
* Return the index of the tab at point x,y,
* or -1 if no tab at that point.
*/
-static int IdentifyTab(Notebook *nb, int x, int y)
+static TkSizeT IdentifyTab(Notebook *nb, int x, int y)
{
- int index;
+ TkSizeT index;
for (index = 0; index < Ttk_NumberContent(nb->notebook.mgr); ++index) {
Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,index);
if ( tab->state != TAB_STATE_HIDDEN
@@ -266,14 +265,14 @@ static int IdentifyTab(Notebook *nb, int x, int y)
return index;
}
}
- return -1;
+ return TCL_INDEX_NONE;
}
/*
* ActivateTab --
* Set the active tab index, redisplay if necessary.
*/
-static void ActivateTab(Notebook *nb, int index)
+static void ActivateTab(Notebook *nb, TkSizeT index)
{
if (index != nb->notebook.activeIndex) {
nb->notebook.activeIndex = index;
@@ -288,11 +287,11 @@ static void ActivateTab(Notebook *nb, int index)
* The USER1 bit is set for the leftmost visible tab, and USER2
* is set for the rightmost visible tab.
*/
-static Ttk_State TabState(Notebook *nb, int index)
+static Ttk_State TabState(Notebook *nb, TkSizeT index)
{
Ttk_State state = nb->core.state;
Tab *itab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
- int i = 0;
+ TkSizeT i = 0;
if (index == nb->notebook.currentIndex) {
state |= TTK_STATE_SELECTED;
@@ -313,7 +312,7 @@ static Ttk_State TabState(Notebook *nb, int index)
}
break;
}
- for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i != -1; --i) {
+ for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i != TCL_INDEX_NONE; --i) {
Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
if (tab->state == TAB_STATE_HIDDEN) {
continue;
@@ -352,7 +351,7 @@ static void TabrowSize(
{
Ttk_Layout tabLayout = nb->notebook.tabLayout;
int tabrowWidth = 0, tabrowHeight = 0;
- int i;
+ TkSizeT i;
for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
@@ -392,7 +391,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
int clientWidth = 0, clientHeight = 0,
reqWidth = 0, reqHeight = 0,
tabrowWidth = 0, tabrowHeight = 0;
- int i;
+ TkSizeT i;
NotebookStyleOptions(nb, &nbstyle);
@@ -572,7 +571,7 @@ static void NotebookDoLayout(void *recordPtr)
* Set the position and size of a child widget
* based on the current client area and content window options:
*/
-static void NotebookPlaceContent(Notebook *nb, int index)
+static void NotebookPlaceContent(Notebook *nb, TkSizeT index)
{
Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, index);
@@ -590,8 +589,8 @@ static void NotebookPlaceContent(Notebook *nb, int index)
static void NotebookPlaceContents(void *recordPtr)
{
Notebook *nb = (Notebook *)recordPtr;
- int currentIndex = nb->notebook.currentIndex;
- if (currentIndex >= 0) {
+ TkSizeT currentIndex = nb->notebook.currentIndex;
+ if (currentIndex != TCL_INDEX_NONE) {
NotebookDoLayout(nb);
NotebookPlaceContent(nb, currentIndex);
}
@@ -601,10 +600,10 @@ static void NotebookPlaceContents(void *recordPtr)
* SelectTab(nb, index) --
* Change the currently-selected tab.
*/
-static void SelectTab(Notebook *nb, int index)
+static void SelectTab(Notebook *nb, TkSizeT index)
{
Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
- int currentIndex = nb->notebook.currentIndex;
+ TkSizeT currentIndex = nb->notebook.currentIndex;
if (index == currentIndex) {
return;
@@ -620,7 +619,7 @@ static void SelectTab(Notebook *nb, int index)
tab->state = TAB_STATE_NORMAL;
}
- if (currentIndex >= 0) {
+ if (currentIndex != TCL_INDEX_NONE) {
Ttk_UnmapContent(nb->notebook.mgr, currentIndex);
}
@@ -632,7 +631,7 @@ static void SelectTab(Notebook *nb, int index)
NotebookPlaceContent(nb, index);
TtkRedisplayWidget(&nb->core);
- TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
+ Tk_SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged", NULL);
}
/* NextTab --
@@ -642,12 +641,12 @@ static void SelectTab(Notebook *nb, int index)
*/
static int NextTab(Notebook *nb, int index)
{
- int nTabs = Ttk_NumberContent(nb->notebook.mgr);
- int nextIndex;
+ TkSizeT nTabs = Ttk_NumberContent(nb->notebook.mgr);
+ TkSizeT nextIndex;
/* Scan forward for following usable tab:
*/
- for (nextIndex = index + 1; nextIndex < nTabs; ++nextIndex) {
+ for (nextIndex = index + 1; nextIndex + 1 < nTabs + 1; ++nextIndex) {
Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex);
if (tab->state == TAB_STATE_NORMAL) {
return nextIndex;
@@ -656,7 +655,7 @@ static int NextTab(Notebook *nb, int index)
/* Not found -- scan backwards.
*/
- for (nextIndex = index - 1; nextIndex >= 0; --nextIndex) {
+ for (nextIndex = index - 1; nextIndex != TCL_INDEX_NONE; --nextIndex) {
Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex);
if (tab->state == TAB_STATE_NORMAL) {
return nextIndex;
@@ -677,14 +676,14 @@ static int NextTab(Notebook *nb, int index)
*/
static void SelectNearestTab(Notebook *nb)
{
- int currentIndex = nb->notebook.currentIndex;
- int nextIndex = NextTab(nb, currentIndex);
+ TkSizeT currentIndex = nb->notebook.currentIndex;
+ TkSizeT nextIndex = NextTab(nb, currentIndex);
- if (currentIndex >= 0) {
+ if (currentIndex != TCL_INDEX_NONE) {
Ttk_UnmapContent(nb->notebook.mgr, currentIndex);
}
if (currentIndex != nextIndex) {
- TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
+ Tk_SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged", NULL);
}
nb->notebook.currentIndex = nextIndex;
@@ -696,7 +695,7 @@ static void SelectNearestTab(Notebook *nb)
* Select the next tab if the current one is being removed.
* Adjust currentIndex to account for removed content window.
*/
-static void TabRemoved(void *managerData, int index)
+static void TabRemoved(void *managerData, TkSizeT index)
{
Notebook *nb = (Notebook *)managerData;
Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
@@ -705,7 +704,7 @@ static void TabRemoved(void *managerData, int index)
SelectNearestTab(nb);
}
- if (index < nb->notebook.currentIndex) {
+ if (index + 1 < nb->notebook.currentIndex + 1) {
--nb->notebook.currentIndex;
}
@@ -716,7 +715,7 @@ static void TabRemoved(void *managerData, int index)
static int TabRequest(
TCL_UNUSED(void *),
- TCL_UNUSED(int),
+ TCL_UNUSED(TkSizeT),
TCL_UNUSED(int),
TCL_UNUSED(int))
{
@@ -728,7 +727,7 @@ static int TabRequest(
*/
static int AddTab(
Tcl_Interp *interp, Notebook *nb,
- int destIndex, Tk_Window window,
+ TkSizeT destIndex, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Tab *tab;
@@ -736,7 +735,7 @@ static int AddTab(
return TCL_ERROR;
}
#if 0 /* can't happen */
- if (Ttk_ContentIndex(nb->notebook.mgr, window) >= 0) {
+ if (Ttk_ContentIndex(nb->notebook.mgr, window) != TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added",
Tk_PathName(window)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL);
@@ -759,9 +758,9 @@ static int AddTab(
/* Adjust indices and/or autoselect first tab:
*/
- if (nb->notebook.currentIndex < 0) {
+ if (nb->notebook.currentIndex == TCL_INDEX_NONE) {
SelectTab(nb, destIndex);
- } else if (nb->notebook.currentIndex >= destIndex) {
+ } else if (nb->notebook.currentIndex + 1 >= destIndex + 1) {
++nb->notebook.currentIndex;
}
@@ -796,7 +795,7 @@ static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr)
Tk_DeleteEventHandler(nb->core.tkwin,
NotebookEventMask, NotebookEventHandler, clientData);
} else if (eventPtr->type == MotionNotify) {
- int index = IdentifyTab(nb, eventPtr->xmotion.x, eventPtr->xmotion.y);
+ TkSizeT index = IdentifyTab(nb, eventPtr->xmotion.x, eventPtr->xmotion.y);
ActivateTab(nb, index);
} else if (eventPtr->type == LeaveNotify) {
ActivateTab(nb, -1);
@@ -824,12 +823,12 @@ static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr)
* See also: GetTabIndex.
*/
static int FindTabIndex(
- Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, int *index_rtn)
+ Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, TkSizeT *index_rtn)
{
const char *string = Tcl_GetString(objPtr);
int x, y;
- *index_rtn = -1;
+ *index_rtn = TCL_INDEX_NONE;
/* Check for @x,y ...
*/
@@ -852,6 +851,12 @@ static int FindTabIndex(
{
return TCL_OK;
}
+ if (*index_rtn == Ttk_NumberContent(nb->notebook.mgr)) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Invalid tab specification %s", string));
+ Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "SPEC", NULL);
+ return TCL_ERROR;
+ }
/* Nothing matched; Ttk_GetContentIndexFromObj will have left error message.
*/
@@ -864,11 +869,17 @@ static int FindTabIndex(
* Returns TCL_ERROR if the tab does not exist.
*/
static int GetTabIndex(
- Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, int *index_rtn)
+ Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, TkSizeT *index_rtn)
{
int status = FindTabIndex(interp, nb, objPtr, index_rtn);
+ if (status == TCL_OK && *index_rtn + 1 >= Ttk_NumberContent(nb->notebook.mgr) + 1) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "tab index %s out of bounds", Tcl_GetString(objPtr)));
+ Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "INDEX", NULL);
+ return TCL_ERROR;
+ }
- if (status == TCL_OK && *index_rtn < 0) {
+ if (status == TCL_OK && *index_rtn == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"tab '%s' not found", Tcl_GetString(objPtr)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "TAB", NULL);
@@ -926,18 +937,16 @@ static int NotebookInsertCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Notebook *nb = (Notebook *)recordPtr;
- int current = nb->notebook.currentIndex;
- int nContent = Ttk_NumberContent(nb->notebook.mgr);
- int srcIndex, destIndex;
+ TkSizeT current = nb->notebook.currentIndex;
+ TkSizeT nContent = Ttk_NumberContent(nb->notebook.mgr);
+ TkSizeT srcIndex, destIndex;
if (objc < 4) {
- Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?");
+ Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?");
return TCL_ERROR;
}
- if (!strcmp(Tcl_GetString(objv[2]), "end")) {
- destIndex = Ttk_NumberContent(nb->notebook.mgr);
- } else if (TCL_OK != Ttk_GetContentIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objv[2], &destIndex)) {
return TCL_ERROR;
}
@@ -953,13 +962,15 @@ static int NotebookInsertCommand(
}
srcIndex = Ttk_ContentIndex(nb->notebook.mgr, window);
- if (srcIndex < 0) { /* New content window */
+ if (srcIndex == TCL_INDEX_NONE) { /* New content window */
return AddTab(interp, nb, destIndex, window, objc-4,objv+4);
}
} else if (Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK)
{
return TCL_ERROR;
+ } else if (srcIndex + 1 >= Ttk_NumberContent(nb->notebook.mgr) + 1) {
+ srcIndex = Ttk_NumberContent(nb->notebook.mgr) - 1;
}
/* Move existing content window:
@@ -972,19 +983,19 @@ static int NotebookInsertCommand(
return TCL_ERROR;
}
- if (destIndex >= nContent) {
+ if (destIndex + 1 >= nContent + 1) {
destIndex = nContent - 1;
}
Ttk_ReorderContent(nb->notebook.mgr, srcIndex, destIndex);
/* Adjust internal indexes:
*/
- nb->notebook.activeIndex = -1;
+ nb->notebook.activeIndex = TCL_INDEX_NONE;
if (current == srcIndex) {
nb->notebook.currentIndex = destIndex;
- } else if (destIndex <= current && current < srcIndex) {
+ } else if (destIndex + 1 <= current + 1 && current + 1 < srcIndex + 1) {
++nb->notebook.currentIndex;
- } else if (srcIndex < current && current <= destIndex) {
+ } else if (srcIndex + 1 < current + 1 && current + 1 <= destIndex + 1) {
--nb->notebook.currentIndex;
}
@@ -1000,7 +1011,7 @@ static int NotebookForgetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Notebook *nb = (Notebook *)recordPtr;
- int index;
+ TkSizeT index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "tab");
@@ -1024,7 +1035,7 @@ static int NotebookHideCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Notebook *nb = (Notebook *)recordPtr;
- int index;
+ TkSizeT index;
Tab *tab;
if (objc != 3) {
@@ -1053,13 +1064,13 @@ static int NotebookHideCommand(
static int NotebookIdentifyCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- static const char *whatTable[] = { "element", "tab", NULL };
+ static const char *const whatTable[] = { "element", "tab", NULL };
enum { IDENTIFY_ELEMENT, IDENTIFY_TAB };
int what = IDENTIFY_ELEMENT;
Notebook *nb = (Notebook *)recordPtr;
Ttk_Element element = NULL;
int x, y;
- int tabIndex;
+ TkSizeT tabIndex;
if (objc < 4 || objc > 5) {
Tcl_WrongNumArgs(interp, 2,objv, "?what? x y");
@@ -1075,7 +1086,7 @@ static int NotebookIdentifyCommand(
}
tabIndex = IdentifyTab(nb, x, y);
- if (tabIndex >= 0) {
+ if (tabIndex != TCL_INDEX_NONE) {
Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, tabIndex);
Ttk_State state = TabState(nb, tabIndex);
Ttk_Layout tabLayout = nb->notebook.tabLayout;
@@ -1095,9 +1106,8 @@ static int NotebookIdentifyCommand(
}
break;
case IDENTIFY_TAB:
- if (tabIndex >= 0) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(tabIndex));
- }
+ if (tabIndex != TCL_INDEX_NONE)
+ Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex));
break;
}
return TCL_OK;
@@ -1112,7 +1122,7 @@ static int NotebookIndexCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Notebook *nb = (Notebook *)recordPtr;
- int index;
+ TkSizeT index;
int status;
if (objc != 3) {
@@ -1120,18 +1130,10 @@ static int NotebookIndexCommand(
return TCL_ERROR;
}
- /*
- * Special-case for "end":
- */
- if (!strcmp("end", Tcl_GetString(objv[2]))) {
- int nContent = Ttk_NumberContent(nb->notebook.mgr);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(nContent));
- return TCL_OK;
- }
-
status = FindTabIndex(interp, nb, objv[2], &index);
- if (status == TCL_OK && index >= 0) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ if (status == TCL_OK) {
+ if (index != TCL_INDEX_NONE)
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
}
return status;
@@ -1147,14 +1149,15 @@ static int NotebookSelectCommand(
Notebook *nb = (Notebook *)recordPtr;
if (objc == 2) {
- if (nb->notebook.currentIndex >= 0) {
+ if (nb->notebook.currentIndex != TCL_INDEX_NONE) {
Tk_Window pane = Ttk_ContentWindow(
nb->notebook.mgr, nb->notebook.currentIndex);
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(pane), -1));
}
return TCL_OK;
} else if (objc == 3) {
- int index, status = GetTabIndex(interp, nb, objv[2], &index);
+ TkSizeT index;
+ int status = GetTabIndex(interp, nb, objv[2], &index);
if (status == TCL_OK) {
SelectTab(nb, index);
}
@@ -1173,7 +1176,7 @@ static int NotebookTabsCommand(
Notebook *nb = (Notebook *)recordPtr;
Ttk_Manager *mgr = nb->notebook.mgr;
Tcl_Obj *result;
- int i;
+ TkSizeT i;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, "");
@@ -1197,7 +1200,7 @@ static int NotebookTabCommand(
{
Notebook *nb = (Notebook *)recordPtr;
Ttk_Manager *mgr = nb->notebook.mgr;
- int index;
+ TkSizeT index;
Tk_Window window;
Tab *tab;
@@ -1239,8 +1242,8 @@ static int NotebookTabCommand(
*/
static const Ttk_Ensemble NotebookCommands[] = {
{ "add", NotebookAddCommand,0 },
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "forget", NotebookForgetCommand,0 },
{ "hide", NotebookHideCommand,0 },
{ "identify", NotebookIdentifyCommand,0 },
@@ -1249,6 +1252,7 @@ static const Ttk_Ensemble NotebookCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "select", NotebookSelectCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "tab", NotebookTabCommand,0 },
{ "tabs", NotebookTabsCommand,0 },
{ 0,0,0 }
@@ -1268,8 +1272,8 @@ static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr)
nb->notebook.tabOptionTable = Tk_CreateOptionTable(interp,TabOptionSpecs);
nb->notebook.paneOptionTable = Tk_CreateOptionTable(interp,PaneOptionSpecs);
- nb->notebook.currentIndex = -1;
- nb->notebook.activeIndex = -1;
+ nb->notebook.currentIndex = TCL_INDEX_NONE;
+ nb->notebook.activeIndex = TCL_INDEX_NONE;
nb->notebook.tabLayout = 0;
nb->notebook.clientArea = Ttk_MakeBox(0,0,1,1);
@@ -1354,8 +1358,8 @@ static void DisplayTab(Notebook *nb, int index, Drawable d)
static void NotebookDisplay(void *clientData, Drawable d)
{
Notebook *nb = (Notebook *)clientData;
- int nContent = Ttk_NumberContent(nb->notebook.mgr);
- int index;
+ TkSizeT nContent = Ttk_NumberContent(nb->notebook.mgr);
+ TkSizeT index;
/* Draw notebook background (base layout):
*/
@@ -1369,7 +1373,7 @@ static void NotebookDisplay(void *clientData, Drawable d)
DisplayTab(nb, index, d);
}
}
- if (nb->notebook.currentIndex >= 0) {
+ if (nb->notebook.currentIndex != TCL_INDEX_NONE) {
DisplayTab(nb, nb->notebook.currentIndex, d);
}
}
@@ -1378,7 +1382,7 @@ static void NotebookDisplay(void *clientData, Drawable d)
* +++ Widget specification and layout definitions.
*/
-static WidgetSpec NotebookWidgetSpec =
+static const WidgetSpec NotebookWidgetSpec =
{
"TNotebook", /* className */
sizeof(Notebook), /* recordSize */
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index 4fbbf94..c072f97 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Joe English. Freely redistributable.
+ * Copyright © 2005 Joe English. Freely redistributable.
*
* ttk::panedwindow widget implementation.
*
@@ -74,15 +74,15 @@ typedef struct {
/* @@@ NOTE: -orient is readonly 'cause dynamic oriention changes NYI
*/
-static Tk_OptionSpec PanedOptionSpecs[] = {
+static const Tk_OptionSpec PanedOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
- Tk_Offset(Paned,paned.orientObj), Tk_Offset(Paned,paned.orient),
+ offsetof(Paned,paned.orientObj), offsetof(Paned,paned.orient),
0, (void *)ttkOrientStrings, READONLY_OPTION|STYLE_CHANGED },
{TK_OPTION_INT, "-width", "width", "Width", "0",
- -1,Tk_Offset(Paned,paned.width),
+ TCL_INDEX_NONE, offsetof(Paned, paned.width),
0, 0, GEOMETRY_CHANGED },
{TK_OPTION_INT, "-height", "height", "Height", "0",
- -1,Tk_Offset(Paned,paned.height),
+ TCL_INDEX_NONE, offsetof(Paned, paned.height),
0, 0, GEOMETRY_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
@@ -98,10 +98,10 @@ typedef struct {
int weight; /* Pane -weight, for resizing */
} Pane;
-static Tk_OptionSpec PaneOptionSpecs[] = {
+static const Tk_OptionSpec PaneOptionSpecs[] = {
{TK_OPTION_INT, "-weight", "weight", "Weight", "0",
- -1,Tk_Offset(Pane,weight), 0,0,GEOMETRY_CHANGED },
- {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+ TCL_INDEX_NONE, offsetof(Pane,weight), 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_END, 0,0,0, NULL, TCL_INDEX_NONE,TCL_INDEX_NONE, 0,0,0}
};
/* CreatePane --
@@ -147,7 +147,7 @@ static int ConfigurePane(
Tk_SavedOptions savedOptions;
int mask = 0;
- if (Tk_SetOptions(interp, (void*)pane, pw->paned.paneOptionTable,
+ if (Tk_SetOptions(interp, pane, pw->paned.paneOptionTable,
objc, objv, window, &savedOptions, &mask) != TCL_OK)
{
return TCL_ERROR;
@@ -206,7 +206,7 @@ static int ShoveUp(Paned *pw, int i, int pos)
* Same as ShoveUp, but going in the opposite direction
* and stopping at the sentinel sash.
*/
-static int ShoveDown(Paned *pw, int i, int pos)
+static int ShoveDown(Paned *pw, TkSizeT i, int pos)
{
Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr,i);
int sashThickness = pw->paned.sashThickness;
@@ -275,7 +275,7 @@ static void AdjustPanes(Paned *pw)
{
int sashThickness = pw->paned.sashThickness;
int pos = 0;
- int index;
+ TkSizeT index;
for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) {
Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
@@ -372,7 +372,7 @@ static void PlacePanes(Paned *pw)
int width = Tk_Width(pw->core.tkwin), height = Tk_Height(pw->core.tkwin);
int sashThickness = pw->paned.sashThickness;
int pos = 0;
- int index;
+ TkSizeT index;
for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) {
Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
@@ -403,7 +403,7 @@ static void PanedPlaceContent(void *managerData)
PlacePanes(pw);
}
-static void PaneRemoved(void *managerData, int index)
+static void PaneRemoved(void *managerData, TkSizeT index)
{
Paned *pw = (Paned *)managerData;
Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
@@ -419,7 +419,7 @@ static int AddPane(
if (!Ttk_Maintainable(interp, window, pw->core.tkwin)) {
return TCL_ERROR;
}
- if (Ttk_ContentIndex(pw->paned.mgr, window) >= 0) {
+ if (Ttk_ContentIndex(pw->paned.mgr, window) != TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s already added", Tk_PathName(window)));
Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL);
@@ -445,7 +445,7 @@ static int AddPane(
* in order to avoid unexpected pane resizes (esp. while the
* user is dragging a sash [#1325286]).
*/
-static int PaneRequest(void *managerData, int index, int width, int height)
+static int PaneRequest(void *managerData, TkSizeT index, int width, int height)
{
Paned *pw = (Paned *)managerData;
Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
@@ -486,7 +486,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr)
if ( eventPtr->type == LeaveNotify
&& eventPtr->xcrossing.detail == NotifyInferior)
{
- TtkSendVirtualEvent(corePtr->tkwin, "EnteredChild");
+ Tk_SendVirtualEvent(corePtr->tkwin, "EnteredChild", NULL);
}
}
@@ -606,11 +606,11 @@ static void DrawSash(Paned *pw, int index, Drawable d)
static void PanedDisplay(void *recordPtr, Drawable d)
{
Paned *pw = (Paned *)recordPtr;
- int i, nSashes = Ttk_NumberContent(pw->paned.mgr) - 1;
+ TkSizeT i, nContent = Ttk_NumberContent(pw->paned.mgr);
TtkWidgetDisplay(recordPtr, d);
- for (i = 0; i < nSashes; ++i) {
- DrawSash(pw, i, d);
+ for (i = 1; i < nContent; ++i) {
+ DrawSash(pw, i - 1, d);
}
}
@@ -649,12 +649,12 @@ static int PanedInsertCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Paned *pw = (Paned *)recordPtr;
- int nContent = Ttk_NumberContent(pw->paned.mgr);
- int srcIndex, destIndex;
+ TkSizeT nContent = Ttk_NumberContent(pw->paned.mgr);
+ TkSizeT srcIndex, destIndex;
Tk_Window window;
if (objc < 4) {
- Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?");
+ Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?");
return TCL_ERROR;
}
@@ -664,20 +664,18 @@ static int PanedInsertCommand(
return TCL_ERROR;
}
- if (!strcmp(Tcl_GetString(objv[2]), "end")) {
- destIndex = Ttk_NumberContent(pw->paned.mgr);
- } else if (TCL_OK != Ttk_GetContentIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp,pw->paned.mgr, objv[2], &destIndex))
{
return TCL_ERROR;
}
srcIndex = Ttk_ContentIndex(pw->paned.mgr, window);
- if (srcIndex < 0) { /* New content: */
+ if (srcIndex == TCL_INDEX_NONE) { /* New content: */
return AddPane(interp, pw, destIndex, window, objc-4, objv+4);
} /* else -- move existing content: */
- if (destIndex >= nContent)
+ if (destIndex + 1 >= nContent + 1)
destIndex = nContent - 1;
Ttk_ReorderContent(pw->paned.mgr, srcIndex, destIndex);
@@ -694,7 +692,7 @@ static int PanedForgetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Paned *pw = (Paned *)recordPtr;
- int paneIndex;
+ TkSizeT paneIndex;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2,objv, "pane");
@@ -705,6 +703,8 @@ static int PanedForgetCommand(
interp, pw->paned.mgr, objv[2], &paneIndex))
{
return TCL_ERROR;
+ } else if (paneIndex + 1 >= Ttk_NumberContent(pw->paned.mgr) + 1) {
+ paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1;
}
Ttk_ForgetContent(pw->paned.mgr, paneIndex);
@@ -717,7 +717,7 @@ static int PanedForgetCommand(
static int PanedIdentifyCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- static const char *whatTable[] = { "element", "sash", NULL };
+ static const char *const whatTable[] = { "element", "sash", NULL };
enum { IDENTIFY_ELEMENT, IDENTIFY_SASH };
int what = IDENTIFY_SASH;
Paned *pw = (Paned *)recordPtr;
@@ -746,7 +746,7 @@ static int PanedIdentifyCommand(
/* Found it. */
switch (what) {
case IDENTIFY_SASH:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
return TCL_OK;
case IDENTIFY_ELEMENT:
{
@@ -772,7 +772,7 @@ static int PanedPaneCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Paned *pw = (Paned *)recordPtr;
- int paneIndex;
+ TkSizeT paneIndex;
Tk_Window window;
Pane *pane;
@@ -785,6 +785,8 @@ static int PanedPaneCommand(
interp,pw->paned.mgr, objv[2], &paneIndex))
{
return TCL_ERROR;
+ } else if (paneIndex + 1 >= Ttk_NumberContent(pw->paned.mgr) + 1) {
+ paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1;
}
pane = (Pane *)Ttk_ContentData(pw->paned.mgr, paneIndex);
@@ -811,7 +813,7 @@ static int PanedPanesCommand(
Paned *pw = (Paned *)recordPtr;
Ttk_Manager *mgr = pw->paned.mgr;
Tcl_Obj *panes;
- int i;
+ TkSizeT i;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, "");
@@ -846,7 +848,7 @@ static int PanedSashposCommand(
if (Tcl_GetIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) {
return TCL_ERROR;
}
- if (sashIndex < 0 || sashIndex >= Ttk_NumberContent(pw->paned.mgr) - 1) {
+ if (sashIndex < 0 || (TkSizeT)sashIndex + 1 >= Ttk_NumberContent(pw->paned.mgr)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"sash index %d out of range", sashIndex));
Tcl_SetErrorCode(interp, "TTK", "PANE", "SASH_INDEX", NULL);
@@ -856,7 +858,7 @@ static int PanedSashposCommand(
pane = (Pane *)Ttk_ContentData(pw->paned.mgr, sashIndex);
if (objc == 3) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos));
return TCL_OK;
}
/* else -- set new sash position */
@@ -874,14 +876,14 @@ static int PanedSashposCommand(
AdjustPanes(pw);
Ttk_ManagerLayoutChanged(pw->paned.mgr);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos));
return TCL_OK;
}
static const Ttk_Ensemble PanedCommands[] = {
{ "add", PanedAddCommand,0 },
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "forget", PanedForgetCommand,0 },
{ "identify", PanedIdentifyCommand,0 },
{ "insert", PanedInsertCommand,0 },
@@ -890,6 +892,7 @@ static const Ttk_Ensemble PanedCommands[] = {
{ "panes", PanedPanesCommand,0 },
{ "sashpos", PanedSashposCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -897,7 +900,7 @@ static const Ttk_Ensemble PanedCommands[] = {
* +++ Widget specification.
*/
-static WidgetSpec PanedWidgetSpec =
+static const WidgetSpec PanedWidgetSpec =
{
"TPanedwindow", /* className */
sizeof(Paned), /* recordSize */
@@ -923,9 +926,9 @@ typedef struct {
Tcl_Obj *thicknessObj;
} SashElement;
-static Ttk_ElementOptionSpec SashElementOptions[] = {
+static const Ttk_ElementOptionSpec SashElementOptions[] = {
{ "-sashthickness", TK_OPTION_INT,
- Tk_Offset(SashElement,thicknessObj), "5" },
+ offsetof(SashElement,thicknessObj), "5" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -944,7 +947,7 @@ static void SashElementSize(
*widthPtr = *heightPtr = thickness;
}
-static Ttk_ElementSpec SashElementSpec = {
+static const Ttk_ElementSpec SashElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SashElement),
SashElementOptions,
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index f65cb08..608b226 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham
+ * Copyright © Joe English, Pat Thoyts, Michael Kirkham
*
* ttk::progressbar widget.
*/
@@ -21,13 +21,19 @@ static const char *const ProgressbarModeStrings[] = {
};
typedef struct {
- Tcl_Obj *orientObj;
+ Tcl_Obj *anchorObj;
+ Tcl_Obj *fontObj;
+ Tcl_Obj *foregroundObj;
+ Tcl_Obj *justifyObj;
Tcl_Obj *lengthObj;
- Tcl_Obj *modeObj;
- Tcl_Obj *variableObj;
Tcl_Obj *maximumObj;
- Tcl_Obj *valueObj;
+ Tcl_Obj *modeObj;
+ Tcl_Obj *orientObj;
Tcl_Obj *phaseObj;
+ Tcl_Obj *textObj;
+ Tcl_Obj *valueObj;
+ Tcl_Obj *variableObj;
+ Tcl_Obj *wrapLengthObj;
int mode;
Ttk_TraceHandle *variableTrace; /* Trace handle for -variable option */
@@ -42,30 +48,48 @@ typedef struct {
ProgressbarPart progress;
} Progressbar;
-static Tk_OptionSpec ProgressbarOptionSpecs[] =
+static const Tk_OptionSpec ProgressbarOptionSpecs[] =
{
- {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
- "horizontal", Tk_Offset(Progressbar,progress.orientObj), -1,
- 0, (void *)ttkOrientStrings, STYLE_CHANGED },
+ {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
+ "w", offsetof(Progressbar,progress.anchorObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED},
+ {TK_OPTION_FONT, "-font", "font", "Font",
+ DEFAULT_FONT, offsetof(Progressbar,progress.fontObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
+ "black", offsetof(Progressbar,progress.foregroundObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
+ "left", offsetof(Progressbar,progress.justifyObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_PIXELS, "-length", "length", "Length",
- DEF_PROGRESSBAR_LENGTH, Tk_Offset(Progressbar,progress.lengthObj), -1,
+ DEF_PROGRESSBAR_LENGTH, offsetof(Progressbar,progress.lengthObj), TCL_INDEX_NONE,
0, 0, GEOMETRY_CHANGED },
+ {TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum",
+ "100", offsetof(Progressbar,progress.maximumObj), TCL_INDEX_NONE,
+ 0, 0, 0 },
{TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate",
- Tk_Offset(Progressbar,progress.modeObj),
- Tk_Offset(Progressbar,progress.mode),
+ offsetof(Progressbar,progress.modeObj),
+ offsetof(Progressbar,progress.mode),
0, (void *)ProgressbarModeStrings, 0 },
- {TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum",
- "100", Tk_Offset(Progressbar,progress.maximumObj), -1,
+ {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
+ "horizontal", offsetof(Progressbar,progress.orientObj), TCL_INDEX_NONE,
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
+ {TK_OPTION_INT, "-phase", "phase", "Phase",
+ "0", offsetof(Progressbar,progress.phaseObj), TCL_INDEX_NONE,
0, 0, 0 },
- {TK_OPTION_STRING, "-variable", "variable", "Variable",
- NULL, Tk_Offset(Progressbar,progress.variableObj), -1,
- TK_OPTION_NULL_OK, 0, 0 },
+ {TK_OPTION_STRING, "-text", "text", "Text", "",
+ offsetof(Progressbar,progress.textObj), TCL_INDEX_NONE,
+ 0,0,GEOMETRY_CHANGED },
{TK_OPTION_DOUBLE, "-value", "value", "Value",
- "0.0", Tk_Offset(Progressbar,progress.valueObj), -1,
- 0, 0, 0 },
- {TK_OPTION_INT, "-phase", "phase", "Phase",
- "0", Tk_Offset(Progressbar,progress.phaseObj), -1,
+ "0.0", offsetof(Progressbar,progress.valueObj), TCL_INDEX_NONE,
0, 0, 0 },
+ {TK_OPTION_STRING, "-variable", "variable", "Variable",
+ NULL, offsetof(Progressbar,progress.variableObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK, 0, 0 },
+ {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
+ "0", offsetof(Progressbar, progress.wrapLengthObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED},
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -114,7 +138,7 @@ static void AnimateProgressProc(ClientData clientData)
phase = 0;
}
Tcl_DecrRefCount(pb->progress.phaseObj);
- pb->progress.phaseObj = Tcl_NewIntObj(phase);
+ pb->progress.phaseObj = Tcl_NewWideIntObj(phase);
Tcl_IncrRefCount(pb->progress.phaseObj);
/*
@@ -185,10 +209,11 @@ static void VariableChanged(void *recordPtr, const char *value)
* +++ Widget class methods:
*/
-static void ProgressbarInitialize(Tcl_Interp *dummy, void *recordPtr)
+static void ProgressbarInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Progressbar *pb = (Progressbar *)recordPtr;
- (void)dummy;
pb->progress.variableTrace = 0;
pb->progress.timer = 0;
@@ -236,12 +261,12 @@ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Post-configuration hook:
*/
static int ProgressbarPostConfigure(
- Tcl_Interp *dummy, void *recordPtr, int mask)
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr,
+ TCL_UNUSED(int))
{
Progressbar *pb = (Progressbar *)recordPtr;
int status = TCL_OK;
- (void)dummy;
- (void)mask;
if (pb->progress.variableTrace) {
status = Ttk_FireTrace(pb->progress.variableTrace);
@@ -271,14 +296,14 @@ static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr)
{
Progressbar *pb = (Progressbar *)recordPtr;
int length = 100;
- int orient = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orient = TTK_ORIENT_HORIZONTAL;
TtkWidgetSize(recordPtr, widthPtr, heightPtr);
/* Override requested width (height) based on -length and -orient
*/
Tk_GetPixelsFromObj(NULL, pb->core.tkwin, pb->progress.lengthObj, &length);
- Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient);
+ TtkGetOrientFromObj(NULL, pb->progress.orientObj, &orient);
if (orient == TTK_ORIENT_HORIZONTAL) {
*widthPtr = length;
@@ -342,7 +367,7 @@ static void ProgressbarDoLayout(void *recordPtr)
WidgetCore *corePtr = &pb->core;
Ttk_Element pbar = Ttk_FindElement(corePtr->layout, "pbar");
double value = 0.0, maximum = 100.0;
- int orient = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orient = TTK_ORIENT_HORIZONTAL;
Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
@@ -351,7 +376,7 @@ static void ProgressbarDoLayout(void *recordPtr)
Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value);
Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum);
- Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient);
+ TtkGetOrientFromObj(NULL, pb->progress.orientObj, &orient);
if (pbar) {
double fraction = value / maximum;
@@ -474,39 +499,42 @@ static int ProgressbarStartStopCommand(
}
static int ProgressbarStartCommand(
- void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
{
- (void)recordPtr;
-
return ProgressbarStartStopCommand(
- interp, "::ttk::progressbar::start", objc, objv);
+ interp, "::ttk::progressbar::start", objc, objv);
}
static int ProgressbarStopCommand(
- void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
{
- (void)recordPtr;
-
return ProgressbarStartStopCommand(
- interp, "::ttk::progressbar::stop", objc, objv);
+ interp, "::ttk::progressbar::stop", objc, objv);
}
static const Ttk_Ensemble ProgressbarCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "start", ProgressbarStartCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "step", ProgressbarStepCommand,0 },
{ "stop", ProgressbarStopCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
/*
* Widget specification:
*/
-static WidgetSpec ProgressbarWidgetSpec =
+static const WidgetSpec ProgressbarWidgetSpec =
{
"TProgressbar", /* className */
sizeof(Progressbar), /* recordSize */
@@ -532,7 +560,8 @@ TTK_END_LAYOUT
TTK_BEGIN_LAYOUT(HorizontalProgressbarLayout)
TTK_GROUP("Horizontal.Progressbar.trough", TTK_FILL_BOTH,
- TTK_NODE("Horizontal.Progressbar.pbar", TTK_PACK_LEFT|TTK_FILL_Y))
+ TTK_NODE("Horizontal.Progressbar.pbar", TTK_PACK_LEFT|TTK_FILL_Y)
+ TTK_NODE("Horizontal.Progressbar.text", TTK_PACK_LEFT))
TTK_END_LAYOUT
/*
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index a4b2a4e..7e8fdc9 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * Copyright © 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* ttk::scale widget.
*/
@@ -50,32 +50,32 @@ typedef struct
ScalePart scale;
} Scale;
-static Tk_OptionSpec ScaleOptionSpecs[] =
+static const Tk_OptionSpec ScaleOptionSpecs[] =
{
{TK_OPTION_STRING, "-command", "command", "Command", "",
- Tk_Offset(Scale,scale.commandObj), -1,
+ offsetof(Scale,scale.commandObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-variable", "variable", "Variable", "",
- Tk_Offset(Scale,scale.variableObj), -1,
- 0,0,0},
+ offsetof(Scale,scale.variableObj), TCL_INDEX_NONE,
+ 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
- Tk_Offset(Scale,scale.orientObj),
- Tk_Offset(Scale,scale.orient), 0,
+ offsetof(Scale,scale.orientObj),
+ offsetof(Scale,scale.orient), 0,
(void *)ttkOrientStrings, STYLE_CHANGED },
{TK_OPTION_DOUBLE, "-from", "from", "From", "0",
- Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0},
+ offsetof(Scale,scale.fromObj), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_DOUBLE, "-to", "to", "To", "1.0",
- Tk_Offset(Scale,scale.toObj), -1, 0, 0, 0},
+ offsetof(Scale,scale.toObj), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_DOUBLE, "-value", "value", "Value", "0",
- Tk_Offset(Scale,scale.valueObj), -1, 0, 0, 0},
+ offsetof(Scale,scale.valueObj), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-length", "length", "Length",
- DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0,
+ DEF_SCALE_LENGTH, offsetof(Scale,scale.lengthObj), TCL_INDEX_NONE, 0, 0,
GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-state", "state", "State",
- "normal", Tk_Offset(Scale,scale.stateObj), -1,
- 0,0,STATE_CHANGED},
+ "normal", offsetof(Scale,scale.stateObj), TCL_INDEX_NONE,
+ 0, 0, STATE_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -110,10 +110,11 @@ static void ScaleVariableChanged(void *recordPtr, const char *value)
/* ScaleInitialize --
* Scale widget initialization hook.
*/
-static void ScaleInitialize(Tcl_Interp *dummy, void *recordPtr)
+static void ScaleInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Scale *scalePtr = (Scale *)recordPtr;
- (void)dummy;
TtkTrackElementState(&scalePtr->core);
}
@@ -163,12 +164,12 @@ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Post-configuration hook.
*/
static int ScalePostConfigure(
- Tcl_Interp *dummy, void *recordPtr, int mask)
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr,
+ TCL_UNUSED(int))
{
Scale *scale = (Scale *)recordPtr;
int status = TCL_OK;
- (void)dummy;
- (void)mask;
if (scale->scale.variableTrace) {
status = Ttk_FireTrace(scale->scale.variableTrace);
@@ -376,8 +377,8 @@ ScaleCoordsCommand(
if (r == TCL_OK) {
Tcl_Obj *point[2];
XPoint pt = ValueToPoint(scalePtr, value);
- point[0] = Tcl_NewIntObj(pt.x);
- point[1] = Tcl_NewIntObj(pt.y);
+ point[0] = Tcl_NewWideIntObj(pt.x);
+ point[1] = Tcl_NewWideIntObj(pt.y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, point));
}
return r;
@@ -481,18 +482,19 @@ ValueToPoint(Scale *scalePtr, double value)
}
static const Ttk_Ensemble ScaleCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "state", TtkWidgetStateCommand,0 },
- { "instate", TtkWidgetInstateCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "coords", ScaleCoordsCommand,0 },
+ { "get", ScaleGetCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
{ "set", ScaleSetCommand,0 },
- { "get", ScaleGetCommand,0 },
- { "coords", ScaleCoordsCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
-static WidgetSpec ScaleWidgetSpec =
+static const WidgetSpec ScaleWidgetSpec =
{
"TScale", /* Class name */
sizeof(Scale), /* record size */
diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c
index 9cf8eae..69370c9 100644
--- a/generic/ttk/ttkScroll.c
+++ b/generic/ttk/ttkScroll.c
@@ -55,7 +55,7 @@ struct ScrollHandleRec
*/
ScrollHandle TtkCreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr)
{
- ScrollHandle h = ckalloc(sizeof(*h));
+ ScrollHandle h = (ScrollHandle)ckalloc(sizeof(*h));
h->flags = 0;
h->corePtr = corePtr;
@@ -130,12 +130,12 @@ static void UpdateScrollbarBG(ClientData clientData)
int code;
h->flags &= ~SCROLL_UPDATE_PENDING;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
code = UpdateScrollbar(interp, h);
if (code == TCL_ERROR && !Tcl_InterpDeleted(interp)) {
Tcl_BackgroundException(interp, code);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/* TtkScrolled --
@@ -167,7 +167,7 @@ void TtkScrolled(ScrollHandle h, int first, int last, int total)
s->total = total;
if (!(h->flags & SCROLL_UPDATE_PENDING)) {
- Tcl_DoWhenIdle(UpdateScrollbarBG, (ClientData)h);
+ Tcl_DoWhenIdle(UpdateScrollbarBG, h);
h->flags |= SCROLL_UPDATE_PENDING;
}
}
@@ -274,7 +274,7 @@ void TtkScrollTo(ScrollHandle h, int newFirst, int updateScrollInfo)
void TtkFreeScrollHandle(ScrollHandle h)
{
if (h->flags & SCROLL_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateScrollbarBG, (ClientData)h);
+ Tcl_CancelIdleCall(UpdateScrollbarBG, h);
}
ckfree(h);
}
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
index 5ffd671..a3f1594 100644
--- a/generic/ttk/ttkScrollbar.c
+++ b/generic/ttk/ttkScrollbar.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003 Joe English
*
* ttk::scrollbar widget.
*/
@@ -31,14 +31,14 @@ typedef struct
ScrollbarPart scrollbar;
} Scrollbar;
-static Tk_OptionSpec ScrollbarOptionSpecs[] =
+static const Tk_OptionSpec ScrollbarOptionSpecs[] =
{
{TK_OPTION_STRING, "-command", "command", "Command", "",
- Tk_Offset(Scrollbar,scrollbar.commandObj), -1, 0,0,0},
+ offsetof(Scrollbar, scrollbar.commandObj), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
- Tk_Offset(Scrollbar,scrollbar.orientObj),
- Tk_Offset(Scrollbar,scrollbar.orient),
+ offsetof(Scrollbar, scrollbar.orientObj),
+ offsetof(Scrollbar, scrollbar.orient),
0, (void *)ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
@@ -50,10 +50,11 @@ static Tk_OptionSpec ScrollbarOptionSpecs[] =
*/
static void
-ScrollbarInitialize(Tcl_Interp *dummy, void *recordPtr)
+ScrollbarInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Scrollbar *sb = (Scrollbar *)recordPtr;
- (void)dummy;
sb->scrollbar.first = 0.0;
sb->scrollbar.last = 1.0;
@@ -281,8 +282,8 @@ ScrollbarFractionCommand(
}
static const Ttk_Ensemble ScrollbarCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "delta", ScrollbarDeltaCommand,0 },
{ "fraction", ScrollbarFractionCommand,0 },
{ "get", ScrollbarGetCommand,0 },
@@ -290,13 +291,14 @@ static const Ttk_Ensemble ScrollbarCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "set", ScrollbarSetCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
/*------------------------------------------------------------------------
* +++ Widget specification.
*/
-static WidgetSpec ScrollbarWidgetSpec =
+static const WidgetSpec ScrollbarWidgetSpec =
{
"TScrollbar", /* className */
sizeof(Scrollbar), /* recordSize */
diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c
index a0ae596..9b712fd 100644
--- a/generic/ttk/ttkSeparator.c
+++ b/generic/ttk/ttkSeparator.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004 Joe English
*
* ttk::separator and ttk::sizegrip widgets.
*/
@@ -22,10 +22,10 @@ typedef struct
SeparatorPart separator;
} Separator;
-static Tk_OptionSpec SeparatorOptionSpecs[] = {
+static const Tk_OptionSpec SeparatorOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
- Tk_Offset(Separator,separator.orientObj),
- Tk_Offset(Separator,separator.orient),
+ offsetof(Separator,separator.orientObj),
+ offsetof(Separator,separator.orient),
0, (void *)ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
@@ -39,7 +39,7 @@ static Tk_OptionSpec SeparatorOptionSpecs[] = {
static Ttk_Layout SeparatorGetLayout(
Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
{
- Separator *sep = recordPtr;
+ Separator *sep = (Separator *)recordPtr;
return TtkWidgetGetOrientedLayout(
interp, theme, recordPtr, sep->separator.orientObj);
}
@@ -48,18 +48,19 @@ static Ttk_Layout SeparatorGetLayout(
* Widget commands:
*/
static const Ttk_Ensemble SeparatorCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
/*
* Widget specification:
*/
-static WidgetSpec SeparatorWidgetSpec =
+static const WidgetSpec SeparatorWidgetSpec =
{
"TSeparator", /* className */
sizeof(Separator), /* recordSize */
@@ -83,21 +84,22 @@ TTK_END_LAYOUT
* Has no options or methods other than the standard ones.
*/
-static Tk_OptionSpec SizegripOptionSpecs[] = {
+static const Tk_OptionSpec SizegripOptionSpecs[] = {
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
};
static const Ttk_Ensemble SizegripCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
-static WidgetSpec SizegripWidgetSpec =
+static const WidgetSpec SizegripWidgetSpec =
{
"TSizegrip", /* className */
sizeof(WidgetCore), /* recordSize */
diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c
index bd2a8c7..9250b4b 100644
--- a/generic/ttk/ttkSquare.c
+++ b/generic/ttk/ttkSquare.c
@@ -1,4 +1,4 @@
-/* square.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
+/* square.c - Copyright © 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* Minimal sample ttk widget.
*/
@@ -48,31 +48,31 @@ typedef struct
* defined for all widgets.
*/
-static Tk_OptionSpec SquareOptionSpecs[] =
+static const Tk_OptionSpec SquareOptionSpecs[] =
{
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEFAULT_BORDERWIDTH, Tk_Offset(Square,square.borderWidthObj), -1,
+ DEFAULT_BORDERWIDTH, offsetof(Square,square.borderWidthObj), TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED },
{TK_OPTION_BORDER, "-foreground", "foreground", "Foreground",
- DEFAULT_BACKGROUND, Tk_Offset(Square,square.foregroundObj),
- -1, 0, 0, 0},
+ DEFAULT_BACKGROUND, offsetof(Square,square.foregroundObj),
+ TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-width", "width", "Width",
- "50", Tk_Offset(Square,square.widthObj), -1, 0, 0,
+ "50", offsetof(Square,square.widthObj), TCL_INDEX_NONE, 0, 0,
GEOMETRY_CHANGED},
{TK_OPTION_PIXELS, "-height", "height", "Height",
- "50", Tk_Offset(Square,square.heightObj), -1, 0, 0,
+ "50", offsetof(Square,square.heightObj), TCL_INDEX_NONE, 0, 0,
GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-padding", "padding", "Pad", NULL,
- Tk_Offset(Square,square.paddingObj), -1,
+ offsetof(Square,square.paddingObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- NULL, Tk_Offset(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0},
+ NULL, offsetof(Square,square.reliefObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0},
+ NULL, offsetof(Square,square.anchorObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -129,11 +129,12 @@ SquareDoLayout(void *clientData)
*/
static const Ttk_Ensemble SquareCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -143,7 +144,7 @@ static const Ttk_Ensemble SquareCommands[] = {
* with Tk in the package initialization code (see bottom).
*/
-static WidgetSpec SquareWidgetSpec =
+static const WidgetSpec SquareWidgetSpec =
{
"TSquare", /* className */
sizeof(Square), /* recordSize */
@@ -176,18 +177,18 @@ typedef struct
Tcl_Obj *heightObj;
} SquareElement;
-static Ttk_ElementOptionSpec SquareElementOptions[] =
+static const Ttk_ElementOptionSpec SquareElementOptions[] =
{
- { "-background", TK_OPTION_BORDER, Tk_Offset(SquareElement,borderObj),
+ { "-background", TK_OPTION_BORDER, offsetof(SquareElement,borderObj),
DEFAULT_BACKGROUND },
- { "-foreground", TK_OPTION_BORDER, Tk_Offset(SquareElement,foregroundObj),
+ { "-foreground", TK_OPTION_BORDER, offsetof(SquareElement,foregroundObj),
DEFAULT_BACKGROUND },
- { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SquareElement,borderWidthObj),
+ { "-borderwidth", TK_OPTION_PIXELS, offsetof(SquareElement,borderWidthObj),
DEFAULT_BORDERWIDTH },
- { "-relief", TK_OPTION_RELIEF, Tk_Offset(SquareElement,reliefObj),
+ { "-relief", TK_OPTION_RELIEF, offsetof(SquareElement,reliefObj),
"raised" },
- { "-width", TK_OPTION_PIXELS, Tk_Offset(SquareElement,widthObj), "20"},
- { "-height", TK_OPTION_PIXELS, Tk_Offset(SquareElement,heightObj), "20"},
+ { "-width", TK_OPTION_PIXELS, offsetof(SquareElement,widthObj), "20"},
+ { "-height", TK_OPTION_PIXELS, offsetof(SquareElement,heightObj), "20"},
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -198,12 +199,15 @@ static Ttk_ElementOptionSpec SquareElementOptions[] =
*/
static void SquareElementSize(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ int *widthPtr,
+ int *heightPtr,
+ Ttk_Padding *paddingPtr)
{
SquareElement *square = (SquareElement *)elementRecord;
int borderWidth = 0;
- (void)dummy;
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
@@ -216,14 +220,16 @@ static void SquareElementSize(
*/
static void SquareElementDraw(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, unsigned int state)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ Drawable d,
+ Ttk_Box b,
+ TCL_UNUSED(unsigned int))
{
SquareElement *square = (SquareElement *)elementRecord;
Tk_3DBorder foreground = NULL;
int borderWidth = 1, relief = TK_RELIEF_FLAT;
- (void)dummy;
- (void)state;
foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj);
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
@@ -233,7 +239,7 @@ static void SquareElementDraw(
b.x, b.y, b.width, b.height, borderWidth, relief);
}
-static Ttk_ElementSpec SquareElementSpec =
+static const Ttk_ElementSpec SquareElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(SquareElement),
diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c
index 9e5cf4b..3da9531 100644
--- a/generic/ttk/ttkState.c
+++ b/generic/ttk/ttkState.c
@@ -1,7 +1,7 @@
/*
* Tk widget state utilities.
*
- * Copyright (c) 2003 Joe English. Freely redistributable.
+ * Copyright © 2003 Joe English. Freely redistributable.
*
*/
@@ -145,14 +145,14 @@ static void StateSpecUpdateString(Tcl_Obj *objPtr)
len = Tcl_DStringLength(&result);
if (len) {
/* 'len' includes extra trailing ' ' */
- objPtr->bytes = ckalloc(len);
+ objPtr->bytes = (char *)ckalloc(len);
objPtr->length = len-1;
strncpy(objPtr->bytes, Tcl_DStringValue(&result), len-1);
objPtr->bytes[len-1] = '\0';
} else {
/* empty string */
objPtr->length = 0;
- objPtr->bytes = ckalloc(1);
+ objPtr->bytes = (char *)ckalloc(1);
*objPtr->bytes = '\0';
}
@@ -261,7 +261,7 @@ Ttk_StateMap Ttk_GetStateMapFromObj(
* Ttk_StateTableLooup --
* Look up an index from a statically allocated state table.
*/
-int Ttk_StateTableLookup(Ttk_StateTable *map, unsigned int state)
+int Ttk_StateTableLookup(const Ttk_StateTable *map, unsigned int state)
{
while ((state & map->onBits) != map->onBits
|| (~state & map->offBits) != map->offBits)
diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c
index 0039585..dc11b4c 100644
--- a/generic/ttk/ttkStubInit.c
+++ b/generic/ttk/ttkStubInit.c
@@ -8,6 +8,18 @@
MODULE_SCOPE const TtkStubs ttkStubs;
+#if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
+#define Ttk_GetOrientFromObj 0
+#endif
+
+#ifdef __GNUC__
+/*
+ * The rest of this file shouldn't warn about deprecated functions; they're
+ * there because we intend them to be so and know that this file is OK to
+ * touch those fields.
+ */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
/* !BEGIN!: Do not edit below this line. */
const TtkStubs ttkStubs = {
diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c
index faeabe8..a3b3376 100644
--- a/generic/ttk/ttkStubLib.c
+++ b/generic/ttk/ttkStubLib.c
@@ -34,17 +34,23 @@ TtkInitializeStubs(
Tcl_Interp *interp, const char *version, int epoch, int revision)
{
int exact = 0;
- const char *packageName = "Ttk";
+ const char *packageName = "ttk";
const char *errMsg = NULL;
void *pkgClientData = NULL;
const char *actualVersion = Tcl_PkgRequireEx(
interp, packageName, version, exact, &pkgClientData);
- const TtkStubs *stubsPtr = (const TtkStubs *)pkgClientData;
+ const TtkStubs *stubsPtr;
if (!actualVersion) {
- return NULL;
+ packageName = "Ttk";
+ actualVersion = Tcl_PkgRequireEx(
+ interp, packageName, version, exact, &pkgClientData);
+ if (!actualVersion) {
+ return NULL;
+ }
}
+ stubsPtr = (const TtkStubs *)pkgClientData;
if (!stubsPtr) {
errMsg = "missing stub table pointer";
goto error;
diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c
index 0ce5cea..c1ec4c2 100644
--- a/generic/ttk/ttkTagSet.c
+++ b/generic/ttk/ttkTagSet.c
@@ -1,11 +1,10 @@
/*
* Tag tables. 3/4-baked, work in progress.
*
- * Copyright (C) 2005, Joe English. Freely redistributable.
+ * Copyright © 2005, Joe English. Freely redistributable.
*/
#include "tkInt.h"
-
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -20,7 +19,7 @@ struct TtkTag {
struct TtkTagTable {
Tk_Window tkwin; /* owner window */
- Tk_OptionSpec *optionSpecs; /* ... */
+ const Tk_OptionSpec *optionSpecs; /* ... */
Tk_OptionTable optionTable; /* ... */
int recordSize; /* size of tag record */
int nTags; /* #tags defined so far */
@@ -54,7 +53,7 @@ static void DeleteTag(Ttk_TagTable tagTable, Ttk_Tag tag)
Ttk_TagTable Ttk_CreateTagTable(
Tcl_Interp *interp, Tk_Window tkwin,
- Tk_OptionSpec optionSpecs[], int recordSize)
+ const Tk_OptionSpec *optionSpecs, int recordSize)
{
Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable));
tagTable->tkwin = tkwin;
@@ -81,6 +80,17 @@ void Ttk_DeleteTagTable(Ttk_TagTable tagTable)
ckfree(tagTable);
}
+void Ttk_DeleteTagFromTable(Ttk_TagTable tagTable, Ttk_Tag tag)
+{
+ Tcl_HashEntry *entryPtr;
+
+ entryPtr = Tcl_FindHashEntry(&tagTable->tags, tag->tagName);
+ if (entryPtr != NULL) {
+ DeleteTag(tagTable, tag);
+ Tcl_DeleteHashEntry(entryPtr);
+ }
+}
+
Ttk_Tag Ttk_GetTag(Ttk_TagTable tagTable, const char *tagName)
{
int isNew = 0;
@@ -270,8 +280,8 @@ void Ttk_TagSetValues(Ttk_TagTable tagTable, Ttk_TagSet tagSet, void *record)
memset(record, 0, tagTable->recordSize);
for (i = 0; tagTable->optionSpecs[i].type != TK_OPTION_END; ++i) {
- Tk_OptionSpec *optionSpec = tagTable->optionSpecs + i;
- int offset = optionSpec->objOffset;
+ const Tk_OptionSpec *optionSpec = tagTable->optionSpecs + i;
+ TkSizeT offset = optionSpec->objOffset;
int prio = LOWEST_PRIORITY;
for (j = 0; j < tagSet->nTags; ++j) {
@@ -287,10 +297,10 @@ void Ttk_TagSetValues(Ttk_TagTable tagTable, Ttk_TagSet tagSet, void *record)
void Ttk_TagSetApplyStyle(
Ttk_TagTable tagTable, Ttk_Style style, Ttk_State state, void *record)
{
- Tk_OptionSpec *optionSpec = tagTable->optionSpecs;
+ const Tk_OptionSpec *optionSpec = tagTable->optionSpecs;
while (optionSpec->type != TK_OPTION_END) {
- int offset = optionSpec->objOffset;
+ TkSizeT offset = optionSpec->objOffset;
const char *optionName = optionSpec->optionName;
Tcl_Obj *val = Ttk_StyleMap(style, optionName, state);
if (val) {
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index 00cb50b..a4ad79b 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -3,8 +3,8 @@
*
* This file implements the widget styles and themes support.
*
- * Copyright (c) 2002 Frederic Bonnet
- * Copyright (c) 2003 Joe English
+ * Copyright © 2002 Frederic Bonnet
+ * Copyright © 2003 Joe English
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -95,7 +95,7 @@ Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state)
/*
* Ttk_StyleDefault --
- * Look up default resource setting the in the specified style.
+ * Look up default resource setting in the specified style.
*/
Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName)
{
@@ -117,7 +117,7 @@ typedef const Tk_OptionSpec **OptionMap;
struct Ttk_ElementClass_ {
const char *name; /* Points to hash table key */
- Ttk_ElementSpec *specPtr; /* Template provided during registration. */
+ const Ttk_ElementSpec *specPtr; /* Template provided during registration. */
void *clientData; /* Client data passed in at registration time */
void *elementRecord; /* Scratch buffer for element record storage */
int nResources; /* #Element options */
@@ -142,7 +142,7 @@ static const Tk_OptionSpec *TTKGetOptionSpec(
/* Make sure widget option has a Tcl_Obj* entry:
*/
- if (optionSpec->objOffset < 0) {
+ if (optionSpec->objOffset == TCL_INDEX_NONE) {
return 0;
}
@@ -181,7 +181,7 @@ BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
int i;
for (i = 0; i < elementClass->nResources; ++i) {
- Ttk_ElementOptionSpec *e = elementClass->specPtr->options+i;
+ const Ttk_ElementOptionSpec *e = elementClass->specPtr->options+i;
optionMap[i] = TTKGetOptionSpec(e->optionName, optionTable, e->type);
}
@@ -216,7 +216,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
* from the specified element specification.
*/
static Ttk_ElementClass *
-NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData)
+NewElementClass(const char *name, const Ttk_ElementSpec *specPtr, void *clientData)
{
Ttk_ElementClass *elementClass = (Ttk_ElementClass *)ckalloc(sizeof(Ttk_ElementClass));
int i;
@@ -872,7 +872,7 @@ Ttk_ElementClass *Ttk_RegisterElement(
Tcl_Interp *interp, /* Where to leave error messages */
Ttk_Theme theme, /* Style engine providing the implementation. */
const char *name, /* Name of new element */
- Ttk_ElementSpec *specPtr, /* Static template information */
+ const Ttk_ElementSpec *specPtr, /* Static template information */
void *clientData) /* application-specific data */
{
Ttk_ElementClass *elementClass;
@@ -913,7 +913,7 @@ Ttk_ElementClass *Ttk_RegisterElement(
* Register a new element.
*/
int Ttk_RegisterElementSpec(Ttk_Theme theme,
- const char *name, Ttk_ElementSpec *specPtr, void *clientData)
+ const char *name, const Ttk_ElementSpec *specPtr, void *clientData)
{
return Ttk_RegisterElement(NULL, theme, name, specPtr, clientData)
? TCL_OK : TCL_ERROR;
@@ -977,16 +977,16 @@ static
int InitializeElementRecord(
Ttk_ElementClass *eclass, /* Element instance to initialize */
Ttk_Style style, /* Style table */
- char *widgetRecord, /* Source of widget option values */
+ void *widgetRecord, /* Source of widget option values */
Tk_OptionTable optionTable, /* Option table describing widget record */
Tk_Window tkwin, /* Corresponding window */
Ttk_State state) /* Widget or element state */
{
- char *elementRecord = eclass->elementRecord;
+ void *elementRecord = eclass->elementRecord;
OptionMap optionMap = GetOptionMap(eclass,optionTable);
int nResources = eclass->nResources;
Ttk_ResourceCache cache = style->cache;
- Ttk_ElementOptionSpec *elementOption = eclass->specPtr->options;
+ const Ttk_ElementOptionSpec *elementOption = eclass->specPtr->options;
int i;
for (i=0; i<nResources; ++i, ++elementOption) {
@@ -1071,7 +1071,7 @@ void
Ttk_ElementSize(
Ttk_ElementClass *eclass, /* Element to query */
Ttk_Style style, /* Style settings */
- char *recordPtr, /* The widget record. */
+ void *recordPtr, /* The widget record. */
Tk_OptionTable optionTable, /* Description of widget record */
Tk_Window tkwin, /* The widget window. */
Ttk_State state, /* Current widget state */
@@ -1101,7 +1101,7 @@ void
Ttk_DrawElement(
Ttk_ElementClass *eclass, /* Element instance */
Ttk_Style style, /* Style settings */
- char *recordPtr, /* The widget record. */
+ void *recordPtr, /* The widget record. */
Tk_OptionTable optionTable, /* Description of option table */
Tk_Window tkwin, /* The widget window. */
Drawable d, /* Where to draw element. */
@@ -1262,10 +1262,10 @@ usage:
styleName = Tcl_GetString(objv[2]);
stylePtr = Ttk_GetStyle(theme, styleName);
- if (objc == 3) { /* style default $styleName */
+ if (objc == 3) { /* style configure $styleName */
Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->defaultsTable));
return TCL_OK;
- } else if (objc == 4) { /* style default $styleName -option */
+ } else if (objc == 4) { /* style configure $styleName -option */
const char *optionName = Tcl_GetString(objv[3]);
Tcl_HashEntry *entryPtr =
Tcl_FindHashEntry(&stylePtr->defaultsTable, optionName);
@@ -1315,9 +1315,7 @@ static int StyleLookupCmd(
}
style = Ttk_GetStyle(theme, Tcl_GetString(objv[2]));
- if (!style) {
- return TCL_ERROR;
- }
+
optionName = Tcl_GetString(objv[3]);
if (objc >= 5) {
@@ -1381,7 +1379,7 @@ static int StyleThemeCreateCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
- static const char *optStrings[] =
+ static const char *const optStrings[] =
{ "-parent", "-settings", NULL };
enum { OP_PARENT, OP_SETTINGS };
Ttk_Theme parentTheme = pkgPtr->defaultTheme, newTheme;
@@ -1554,8 +1552,8 @@ static int StyleElementOptionsCmd(
elementName = Tcl_GetString(objv[3]);
elementClass = Ttk_GetElement(theme, elementName);
if (elementClass) {
- Ttk_ElementSpec *specPtr = elementClass->specPtr;
- Ttk_ElementOptionSpec *option = specPtr->options;
+ const Ttk_ElementSpec *specPtr = elementClass->specPtr;
+ const Ttk_ElementOptionSpec *option = specPtr->options;
Tcl_Obj *result = Tcl_NewListObj(0,0);
while (option->optionName) {
@@ -1612,6 +1610,31 @@ static int StyleLayoutCmd(
return TCL_OK;
}
+/* + style theme styles ?$theme? --
+ * Return list of styles available in $theme.
+ * Use the current theme if $theme is omitted.
+ */
+static int StyleThemeStylesCmd(
+ TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Ttk_Theme themePtr;
+
+ if (objc < 3 || objc > 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "?theme?");
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ themePtr = Ttk_GetCurrentTheme(interp);
+ } else {
+ themePtr = Ttk_GetTheme(interp, Tcl_GetString(objv[3]));
+ }
+ if (!themePtr)
+ return TCL_ERROR;
+
+ return TtkEnumerateHashTable(interp, &themePtr->styleTable);
+}
+
/* + style theme use $theme --
* Sets the current theme to $theme
*/
@@ -1651,6 +1674,7 @@ static const Ttk_Ensemble StyleThemeEnsemble[] = {
{ "create", StyleThemeCreateCmd, 0 },
{ "names", StyleThemeNamesCmd, 0 },
{ "settings", StyleThemeSettingsCmd, 0 },
+ { "styles", StyleThemeStylesCmd, 0 },
{ "use", StyleThemeUseCmd, 0 },
{ NULL, 0, 0 }
};
diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h
index cf0a07c..7f9f6e9 100644
--- a/generic/ttk/ttkTheme.h
+++ b/generic/ttk/ttkTheme.h
@@ -75,17 +75,11 @@ typedef struct
#define Ttk_ModifyState(state, spec) \
(((state) & ~(spec)->offbits) | (spec)->onbits)
-TTKAPI int Ttk_GetStateSpecFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_StateSpec *);
-TTKAPI Tcl_Obj *Ttk_NewStateSpecObj(unsigned int onbits,unsigned int offbits);
-
/*------------------------------------------------------------------------
* +++ State maps and state tables.
*/
typedef Tcl_Obj *Ttk_StateMap;
-TTKAPI Ttk_StateMap Ttk_GetStateMapFromObj(Tcl_Interp *, Tcl_Obj *);
-TTKAPI Tcl_Obj *Ttk_StateMapLookup(Tcl_Interp*, Ttk_StateMap, Ttk_State);
-
/*
* Table for looking up an integer index based on widget state:
*/
@@ -96,8 +90,6 @@ typedef struct
unsigned int offBits; /* Bits which must be cleared */
} Ttk_StateTable;
-TTKAPI int Ttk_StateTableLookup(Ttk_StateTable map[], Ttk_State);
-
/*------------------------------------------------------------------------
* +++ Padding.
* Used to represent internal padding and borders.
@@ -110,14 +102,6 @@ typedef struct
short bottom;
} Ttk_Padding;
-TTKAPI int Ttk_GetPaddingFromObj(Tcl_Interp*,Tk_Window,Tcl_Obj*,Ttk_Padding*);
-TTKAPI int Ttk_GetBorderFromObj(Tcl_Interp*,Tcl_Obj*,Ttk_Padding*);
-
-TTKAPI Ttk_Padding Ttk_MakePadding(short l, short t, short r, short b);
-TTKAPI Ttk_Padding Ttk_UniformPadding(short borderWidth);
-TTKAPI Ttk_Padding Ttk_AddPadding(Ttk_Padding, Ttk_Padding);
-TTKAPI Ttk_Padding Ttk_RelievePadding(Ttk_Padding, int relief, int n);
-
#define Ttk_PaddingWidth(p) ((p).left + (p).right)
#define Ttk_PaddingHeight(p) ((p).top + (p).bottom)
@@ -136,9 +120,6 @@ typedef struct /* Hey, this is an XRectangle! */
int height;
} Ttk_Box;
-TTKAPI Ttk_Box Ttk_MakeBox(int x, int y, int width, int height);
-TTKAPI int Ttk_BoxContains(Ttk_Box, int x, int y);
-
#define Ttk_WinBox(tkwin) Ttk_MakeBox(0,0,Tk_Width(tkwin),Tk_Height(tkwin))
/*------------------------------------------------------------------------
@@ -165,7 +146,6 @@ typedef unsigned int Ttk_Sticky;
#define TTK_FILL_Y (0xC) /* -sticky ns */
#define TTK_FILL_BOTH (0xF) /* -sticky nswe */
-TTKAPI int Ttk_GetStickyFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_Sticky *);
TTKAPI Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky);
/*
@@ -192,12 +172,6 @@ typedef unsigned int Ttk_PositionSpec; /* See below */
#define _TTK_MASK_STICK (0x0F) /* See Ttk_UnparseLayout() */
#define _TTK_MASK_PACK (0xF0) /* See Ttk_UnparseLayout(), packStrings */
-TTKAPI Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int w, int h, Ttk_Side side);
-TTKAPI Ttk_Box Ttk_StickBox(Ttk_Box parcel, int w, int h, Ttk_Sticky sticky);
-TTKAPI Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int w, int h, Tk_Anchor anchor);
-TTKAPI Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p);
-TTKAPI Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p);
-TTKAPI Ttk_Box Ttk_PlaceBox(Ttk_Box *cavity, int w,int h, Ttk_Side,Ttk_Sticky);
TTKAPI Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int w, int h, Ttk_PositionSpec);
/*------------------------------------------------------------------------
@@ -211,21 +185,12 @@ typedef struct Ttk_Layout_ *Ttk_Layout;
typedef struct Ttk_LayoutNode_ *Ttk_Element;
typedef struct Ttk_Style_ *Ttk_Style;
-TTKAPI Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, const char *name);
-TTKAPI Ttk_Theme Ttk_GetDefaultTheme(Tcl_Interp *interp);
-TTKAPI Ttk_Theme Ttk_GetCurrentTheme(Tcl_Interp *interp);
-
-TTKAPI Ttk_Theme Ttk_CreateTheme(
- Tcl_Interp *interp, const char *name, Ttk_Theme parent);
-
typedef int (Ttk_ThemeEnabledProc)(Ttk_Theme theme, void *clientData);
MODULE_SCOPE void Ttk_SetThemeEnabledProc(Ttk_Theme, Ttk_ThemeEnabledProc, void *);
MODULE_SCOPE int Ttk_UseTheme(Tcl_Interp *, Ttk_Theme);
typedef void (Ttk_CleanupProc)(void *clientData);
-TTKAPI void Ttk_RegisterCleanup(
- Tcl_Interp *interp, void *deleteData, Ttk_CleanupProc *cleanupProc);
/*------------------------------------------------------------------------
* +++ Elements.
@@ -238,11 +203,19 @@ typedef void (Ttk_ElementSizeProc)(void *clientData, void *elementRecord,
typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord,
Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state);
+#ifndef TkSizeT
+# if TCL_MAJOR_VERSION > 8
+# define TkSizeT size_t
+# else
+# define TkSizeT int
+# endif
+#endif
+
typedef struct Ttk_ElementOptionSpec
{
const char *optionName; /* Command-line name of the widget option */
Tk_OptionType type; /* Accepted option types */
- int offset; /* Offset of Tcl_Obj* field in element record */
+ TkSizeT offset; /* Offset of Tcl_Obj* field in element record */
const char *defaultValue; /* Default value to used if resource missing */
} Ttk_ElementOptionSpec;
@@ -251,22 +224,15 @@ typedef struct Ttk_ElementOptionSpec
typedef struct Ttk_ElementSpec {
enum TTKStyleVersion2 version; /* Version of the style support. */
size_t elementSize; /* Size of element record */
- Ttk_ElementOptionSpec *options; /* List of options, NULL-terminated */
+ const Ttk_ElementOptionSpec *options; /* List of options, NULL-terminated */
Ttk_ElementSizeProc *size; /* Compute min size and padding */
Ttk_ElementDrawProc *draw; /* Draw the element */
} Ttk_ElementSpec;
-TTKAPI Ttk_ElementClass *Ttk_RegisterElement(
- Tcl_Interp *interp, Ttk_Theme theme, const char *elementName,
- Ttk_ElementSpec *, void *clientData);
-
typedef int (*Ttk_ElementFactory)
(Tcl_Interp *, void *clientData,
Ttk_Theme, const char *elementName, int objc, Tcl_Obj *const objv[]);
-TTKAPI int Ttk_RegisterElementFactory(
- Tcl_Interp *, const char *name, Ttk_ElementFactory, void *clientData);
-
/*
* Null element implementation:
* has no geometry or layout; may be used as a stub or placeholder.
@@ -280,7 +246,7 @@ MODULE_SCOPE void TtkNullElementSize
(void *, void *, Tk_Window, int *, int *, Ttk_Padding *);
MODULE_SCOPE void TtkNullElementDraw
(void *, void *, Tk_Window, Drawable, Ttk_Box, Ttk_State);
-MODULE_SCOPE Ttk_ElementOptionSpec TtkNullElementOptions[];
+MODULE_SCOPE const Ttk_ElementOptionSpec TtkNullElementOptions[];
MODULE_SCOPE Ttk_ElementSpec ttkNullElementSpec;
/*------------------------------------------------------------------------
@@ -307,9 +273,6 @@ typedef struct {
#define TTK_BEGIN_LAYOUT(name) static TTKLayoutInstruction name[] = {
#define TTK_END_LAYOUT { 0, _TTK_LAYOUT_END } };
-TTKAPI void Ttk_RegisterLayout(
- Ttk_Theme theme, const char *className, Ttk_LayoutSpec layoutSpec);
-
TTKAPI void Ttk_RegisterLayouts(
Ttk_Theme theme, Ttk_LayoutSpec layoutTable);
@@ -392,7 +355,7 @@ typedef enum /* -default option values */
TTK_BUTTON_DEFAULT_DISABLED /* not defaultable */
} Ttk_ButtonDefaultState;
-TTKAPI int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, int *);
+TTKAPI int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_ButtonDefaultState *);
typedef enum /* -compound option values */
{
@@ -406,13 +369,16 @@ typedef enum /* -compound option values */
TTK_COMPOUND_RIGHT /* image to right of text */
} Ttk_Compound;
-TTKAPI int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, int *);
+TTKAPI int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_Compound *);
typedef enum { /* -orient option values */
TTK_ORIENT_HORIZONTAL,
TTK_ORIENT_VERTICAL
} Ttk_Orient;
+MODULE_SCOPE int TtkGetOrientFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, Ttk_Orient *orient);
+
/*------------------------------------------------------------------------
* +++ Utilities.
*/
diff --git a/generic/ttk/ttkThemeInt.h b/generic/ttk/ttkThemeInt.h
index 3aaada8..25a5fdf 100644
--- a/generic/ttk/ttkThemeInt.h
+++ b/generic/ttk/ttkThemeInt.h
@@ -15,11 +15,11 @@ MODULE_SCOPE Ttk_ElementClass *Ttk_GetElement(Ttk_Theme, const char *name);
MODULE_SCOPE const char *Ttk_ElementClassName(Ttk_ElementClass *);
MODULE_SCOPE void Ttk_ElementSize(
- Ttk_ElementClass *, Ttk_Style, char *recordPtr, Tk_OptionTable,
+ Ttk_ElementClass *, Ttk_Style, void *recordPtr, Tk_OptionTable,
Tk_Window tkwin, Ttk_State state,
int *widthPtr, int *heightPtr, Ttk_Padding*);
MODULE_SCOPE void Ttk_DrawElement(
- Ttk_ElementClass *, Ttk_Style, char *recordPtr, Tk_OptionTable,
+ Ttk_ElementClass *, Ttk_Style, void *recordPtr, Tk_OptionTable,
Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state);
MODULE_SCOPE Tcl_Obj *Ttk_QueryStyle(
diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c
index d086c02..1019ffa 100644
--- a/generic/ttk/ttkTrace.c
+++ b/generic/ttk/ttkTrace.c
@@ -26,15 +26,13 @@ static char *
VarTraceProc(
ClientData clientData, /* Widget record pointer */
Tcl_Interp *interp, /* Interpreter containing variable. */
- const char *name1, /* (unused) */
- const char *name2, /* (unused) */
+ TCL_UNUSED(const char *), /* name1 */
+ TCL_UNUSED(const char *), /* name2 */
int flags) /* Information about what happened. */
{
Ttk_TraceHandle *tracePtr = (Ttk_TraceHandle *)clientData;
const char *name, *value;
Tcl_Obj *valuePtr;
- (void)name1;
- (void)name2;
if (Tcl_InterpDeleted(interp)) {
return NULL;
diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c
index fa2a7e0..43a7644 100644
--- a/generic/ttk/ttkTrack.c
+++ b/generic/ttk/ttkTrack.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004, Joe English
*
* TtkTrackElementState() -- helper routine for widgets
* like scrollbars in which individual elements may
@@ -16,11 +16,11 @@
* and is normally set to the ACTIVE state unless another element
* is currently being pressed.
*
- * The active element becomes "pressed" on <ButtonPress> events,
+ * The active element becomes "pressed" on <Button> events,
* and remains "active" and "pressed" until the corresponding
* <ButtonRelease> event.
*
- * TODO: Handle "chords" properly (e.g., <B1-ButtonPress-2>)
+ * TODO: Handle "chords" properly (e.g., <B1-Button-2>)
*/
#include "tkInt.h"
@@ -118,7 +118,7 @@ static const unsigned ElementStateMask =
static void
ElementStateEventProc(ClientData clientData, XEvent *ev)
{
- ElementStateTracker *es = clientData;
+ ElementStateTracker *es = (ElementStateTracker *)clientData;
Ttk_Layout layout = es->corePtr->layout;
Ttk_Element element;
@@ -173,7 +173,7 @@ ElementStateEventProc(ClientData clientData, XEvent *ev)
void TtkTrackElementState(WidgetCore *corePtr)
{
- ElementStateTracker *es = ckalloc(sizeof(*es));
+ ElementStateTracker *es = (ElementStateTracker *)ckalloc(sizeof(*es));
es->corePtr = corePtr;
es->tracking = 0;
es->activeElement = es->pressedElement = 0;
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index 41b05e5..4e212d8 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004, Joe English
*
* ttk::treeview widget implementation.
*/
@@ -59,32 +59,35 @@ struct TreeItemRec {
#define ITEM_OPTION_TAGS_CHANGED 0x100
#define ITEM_OPTION_IMAGE_CHANGED 0x200
-static Tk_OptionSpec ItemOptionSpecs[] = {
+static const Tk_OptionSpec ItemOptionSpecs[] = {
{TK_OPTION_STRING, "-text", "text", "Text",
- "", Tk_Offset(TreeItem,textObj), -1,
+ "", offsetof(TreeItem,textObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_STRING, "-image", "image", "Image",
- NULL, Tk_Offset(TreeItem,imageObj), -1,
+ NULL, offsetof(TreeItem,imageObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,ITEM_OPTION_IMAGE_CHANGED },
{TK_OPTION_STRING, "-values", "values", "Values",
- NULL, Tk_Offset(TreeItem,valuesObj), -1,
+ NULL, offsetof(TreeItem,valuesObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_BOOLEAN, "-open", "open", "Open",
- "0", Tk_Offset(TreeItem,openObj), -1,
+ "0", offsetof(TreeItem,openObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_STRING, "-tags", "tags", "Tags",
- NULL, Tk_Offset(TreeItem,tagsObj), -1,
+ NULL, offsetof(TreeItem,tagsObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,ITEM_OPTION_TAGS_CHANGED },
- {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+ {TK_OPTION_END, 0,0,0, NULL, TCL_INDEX_NONE,TCL_INDEX_NONE, 0,0,0}
};
+/* Forward declaration */
+static void RemoveTag(TreeItem *, Ttk_Tag);
+
/* + NewItem --
* Allocate a new, uninitialized, unlinked item
*/
static TreeItem *NewItem(void)
{
- TreeItem *item = ckalloc(sizeof(*item));
+ TreeItem *item = (TreeItem *)ckalloc(sizeof(*item));
item->entryPtr = 0;
item->parent = item->children = item->next = item->prev = NULL;
@@ -119,7 +122,7 @@ static void FreeItem(TreeItem *item)
ckfree(item);
}
-static void FreeItemCB(void *clientData) { FreeItem(clientData); }
+static void FreeItemCB(void *clientData) { FreeItem((TreeItem *)clientData); }
/* + DetachItem --
* Unlink an item from the tree.
@@ -187,27 +190,27 @@ typedef struct {
Tcl_Obj *fontObj;
} DisplayItem;
-static Tk_OptionSpec TagOptionSpecs[] = {
+static const Tk_OptionSpec TagOptionSpecs[] = {
{TK_OPTION_STRING, "-text", "text", "Text",
- NULL, Tk_Offset(DisplayItem,textObj), -1,
+ NULL, offsetof(DisplayItem,textObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_STRING, "-image", "image", "Image",
- NULL, Tk_Offset(DisplayItem,imageObj), -1,
+ NULL, offsetof(DisplayItem,imageObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- NULL, Tk_Offset(DisplayItem,anchorObj), -1,
+ NULL, offsetof(DisplayItem,anchorObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, /* <<NOTE-ANCHOR>> */
{TK_OPTION_COLOR, "-background", "windowColor", "WindowColor",
- NULL, Tk_Offset(DisplayItem,backgroundObj), -1,
+ NULL, offsetof(DisplayItem,backgroundObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
- NULL, Tk_Offset(DisplayItem,foregroundObj), -1,
+ NULL, offsetof(DisplayItem,foregroundObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_FONT, "-font", "font", "Font",
- NULL, Tk_Offset(DisplayItem,fontObj), -1,
+ NULL, offsetof(DisplayItem,fontObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
- {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+ {TK_OPTION_END, 0,0,0, NULL, TCL_INDEX_NONE,TCL_INDEX_NONE, 0,0,0}
};
/*------------------------------------------------------------------------
@@ -271,42 +274,42 @@ static void FreeColumn(TreeColumn *column)
/* Don't touch column->data, it's scratch storage */
}
-static Tk_OptionSpec ColumnOptionSpecs[] = {
+static const Tk_OptionSpec ColumnOptionSpecs[] = {
{TK_OPTION_INT, "-width", "width", "Width",
- DEF_COLWIDTH, -1, Tk_Offset(TreeColumn,width),
+ DEF_COLWIDTH, TCL_INDEX_NONE, offsetof(TreeColumn,width),
0,0,GEOMETRY_CHANGED },
{TK_OPTION_INT, "-minwidth", "minWidth", "MinWidth",
- DEF_MINWIDTH, -1, Tk_Offset(TreeColumn,minWidth),
+ DEF_MINWIDTH, TCL_INDEX_NONE, offsetof(TreeColumn,minWidth),
0,0,0 },
{TK_OPTION_BOOLEAN, "-stretch", "stretch", "Stretch",
- "1", -1, Tk_Offset(TreeColumn,stretch),
+ "1", TCL_INDEX_NONE, offsetof(TreeColumn,stretch),
0,0,GEOMETRY_CHANGED },
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- "w", Tk_Offset(TreeColumn,anchorObj), -1, /* <<NOTE-ANCHOR>> */
+ "w", offsetof(TreeColumn,anchorObj), TCL_INDEX_NONE, /* <<NOTE-ANCHOR>> */
0,0,0 },
{TK_OPTION_STRING, "-id", "id", "ID",
- NULL, Tk_Offset(TreeColumn,idObj), -1,
+ NULL, offsetof(TreeColumn,idObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,READONLY_OPTION },
- {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+ {TK_OPTION_END, 0,0,0, NULL, TCL_INDEX_NONE,TCL_INDEX_NONE, 0,0,0}
};
-static Tk_OptionSpec HeadingOptionSpecs[] = {
+static const Tk_OptionSpec HeadingOptionSpecs[] = {
{TK_OPTION_STRING, "-text", "text", "Text",
- "", Tk_Offset(TreeColumn,headingObj), -1,
+ "", offsetof(TreeColumn,headingObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_STRING, "-image", "image", "Image",
- "", Tk_Offset(TreeColumn,headingImageObj), -1,
+ "", offsetof(TreeColumn,headingImageObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- "center", Tk_Offset(TreeColumn,headingAnchorObj), -1,
+ "center", offsetof(TreeColumn,headingAnchorObj), TCL_INDEX_NONE,
0,0,0 },
{TK_OPTION_STRING, "-command", "", "",
- "", Tk_Offset(TreeColumn,headingCommandObj), -1,
+ "", offsetof(TreeColumn,headingCommandObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,0 },
{TK_OPTION_STRING, "state", "", "",
- "", Tk_Offset(TreeColumn,headingStateObj), -1,
+ "", offsetof(TreeColumn,headingStateObj), TCL_INDEX_NONE,
0,0,STATE_CHANGED },
- {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+ {TK_OPTION_END, 0,0,0, NULL, TCL_INDEX_NONE,TCL_INDEX_NONE, 0,0,0}
};
/*------------------------------------------------------------------------
@@ -319,14 +322,14 @@ static Tk_OptionSpec HeadingOptionSpecs[] = {
#define DEFAULT_SHOW "tree headings"
-static const char *showStrings[] = {
+static const char *const showStrings[] = {
"tree", "headings", NULL
};
static int GetEnumSetFromObj(
Tcl_Interp *interp,
Tcl_Obj *objPtr,
- const char *table[],
+ const char *const table[],
unsigned *resultPtr)
{
unsigned result = 0;
@@ -433,35 +436,35 @@ typedef struct {
#define SCROLLCMD_CHANGED (USER_MASK<<2)
#define SHOW_CHANGED (USER_MASK<<3)
-static const char *SelectModeStrings[] = { "none", "browse", "extended", NULL };
+static const char *const SelectModeStrings[] = { "none", "browse", "extended", NULL };
-static Tk_OptionSpec TreeviewOptionSpecs[] = {
+static const Tk_OptionSpec TreeviewOptionSpecs[] = {
{TK_OPTION_STRING, "-columns", "columns", "Columns",
- "", Tk_Offset(Treeview,tree.columnsObj), -1,
- 0,0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ },
+ "", offsetof(Treeview,tree.columnsObj), TCL_INDEX_NONE,
+ 0, 0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ },
{TK_OPTION_STRING, "-displaycolumns","displayColumns","DisplayColumns",
- "#all", Tk_Offset(Treeview,tree.displayColumnsObj), -1,
- 0,0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED },
+ "#all", offsetof(Treeview,tree.displayColumnsObj), TCL_INDEX_NONE,
+ 0, 0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-show", "show", "Show",
- DEFAULT_SHOW, Tk_Offset(Treeview,tree.showObj), -1,
- 0,0,SHOW_CHANGED | GEOMETRY_CHANGED },
+ DEFAULT_SHOW, offsetof(Treeview,tree.showObj), TCL_INDEX_NONE,
+ 0, 0,SHOW_CHANGED | GEOMETRY_CHANGED },
{TK_OPTION_STRING_TABLE, "-selectmode", "selectMode", "SelectMode",
- "extended", Tk_Offset(Treeview,tree.selectModeObj), -1,
- 0,(ClientData)SelectModeStrings,0 },
+ "extended", offsetof(Treeview,tree.selectModeObj), TCL_INDEX_NONE,
+ 0, (void *)SelectModeStrings, 0 },
{TK_OPTION_PIXELS, "-height", "height", "Height",
- DEF_TREE_ROWS, Tk_Offset(Treeview,tree.heightObj), -1,
- 0,0,GEOMETRY_CHANGED},
+ DEF_TREE_ROWS, offsetof(Treeview,tree.heightObj), TCL_INDEX_NONE,
+ 0, 0,GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-padding", "padding", "Pad",
- NULL, Tk_Offset(Treeview,tree.paddingObj), -1,
+ NULL, offsetof(Treeview,tree.paddingObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
- NULL, -1, Tk_Offset(Treeview, tree.xscroll.scrollCmd),
+ NULL, TCL_INDEX_NONE, offsetof(Treeview, tree.xscroll.scrollCmd),
TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED},
{TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand",
- NULL, -1, Tk_Offset(Treeview, tree.yscroll.scrollCmd),
+ NULL, TCL_INDEX_NONE, offsetof(Treeview, tree.yscroll.scrollCmd),
TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
@@ -525,7 +528,7 @@ static TreeColumn *GetColumn(
entryPtr = Tcl_FindHashEntry(
&tv->tree.columnNames, Tcl_GetString(columnIDObj));
if (entryPtr) {
- return Tcl_GetHashValue(entryPtr);
+ return (TreeColumn *)Tcl_GetHashValue(entryPtr);
}
/* Check for number:
@@ -586,7 +589,7 @@ static TreeItem *FindItem(
Tcl_SetErrorCode(interp, "TTK", "TREE", "ITEM", NULL);
return 0;
}
- return Tcl_GetHashValue(entryPtr);
+ return (TreeItem *)Tcl_GetHashValue(entryPtr);
}
/* + GetItemListFromObj --
@@ -607,7 +610,7 @@ static TreeItem **GetItemListFromObj(
return NULL;
}
- items = ckalloc((nElements + 1)*sizeof(TreeItem*));
+ items = (TreeItem **)ckalloc((nElements + 1)*sizeof(TreeItem*));
for (i = 0; i < nElements; ++i) {
items[i] = FindItem(interp, tv, elements[i]);
if (!items[i]) {
@@ -624,7 +627,7 @@ static TreeItem **GetItemListFromObj(
*/
static const char *ItemName(Treeview *tv, TreeItem *item)
{
- return Tcl_GetHashKey(&tv->tree.items, item->entryPtr);
+ return (const char *)Tcl_GetHashKey(&tv->tree.items, item->entryPtr);
}
/* + ItemID --
@@ -682,7 +685,7 @@ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv)
* Initialize columns array and columnNames hash table:
*/
tv->tree.nColumns = ncols;
- tv->tree.columns = ckalloc(tv->tree.nColumns * sizeof(TreeColumn));
+ tv->tree.columns = (TreeColumn *)ckalloc(tv->tree.nColumns * sizeof(TreeColumn));
for (i = 0; i < ncols; ++i) {
int isNew;
@@ -727,12 +730,12 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv)
if (!strcmp(Tcl_GetString(tv->tree.displayColumnsObj), "#all")) {
ndcols = tv->tree.nColumns;
- displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*));
+ displayColumns = (TreeColumn **)ckalloc((ndcols+1) * sizeof(TreeColumn*));
for (index = 0; index < ndcols; ++index) {
displayColumns[index+1] = tv->tree.columns + index;
}
} else {
- displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*));
+ displayColumns = (TreeColumn **)ckalloc((ndcols+1) * sizeof(TreeColumn*));
for (index = 0; index < ndcols; ++index) {
displayColumns[index+1] = GetColumn(interp, tv, dcolumns[index]);
if (!displayColumns[index+1]) {
@@ -789,9 +792,8 @@ static int PickupSlack(Treeview *tv, int extra)
{
int newSlack = tv->tree.slack + extra;
- if ( (newSlack < 0 && 0 <= tv->tree.slack)
- || (newSlack > 0 && 0 >= tv->tree.slack))
- {
+ if ((newSlack < 0 && 0 <= tv->tree.slack)
+ || (newSlack > 0 && 0 >= tv->tree.slack)) {
tv->tree.slack = 0;
return newSlack;
} else {
@@ -930,7 +932,7 @@ static const unsigned long TreeviewBindEventMask =
static void TreeviewBindEventProc(void *clientData, XEvent *event)
{
- Treeview *tv = clientData;
+ Treeview *tv = (Treeview *)clientData;
TreeItem *item = NULL;
Ttk_TagSet tagset;
@@ -982,7 +984,7 @@ static void TreeviewBindEventProc(void *clientData, XEvent *event)
static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr)
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
int unused;
tv->tree.itemOptionTable =
@@ -1049,7 +1051,7 @@ static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr)
static void TreeviewCleanup(void *recordPtr)
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
Tk_DeleteEventHandler(tv->core.tkwin,
TreeviewBindEventMask, TreeviewBindEventProc, tv);
@@ -1082,7 +1084,7 @@ static void TreeviewCleanup(void *recordPtr)
static int
TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
unsigned showFlags = tv->tree.showFlags;
if (mask & COLUMNS_CHANGED) {
@@ -1098,10 +1100,9 @@ TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
TtkScrollbarUpdateRequired(tv->tree.xscrollHandle);
TtkScrollbarUpdateRequired(tv->tree.yscrollHandle);
}
- if ( (mask & SHOW_CHANGED)
- && GetEnumSetFromObj(
- interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK)
- {
+ if ((mask & SHOW_CHANGED)
+ && GetEnumSetFromObj(
+ interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) {
return TCL_ERROR;
}
@@ -1129,7 +1130,7 @@ static int ConfigureItem(
Ttk_ImageSpec *newImageSpec = NULL;
Ttk_TagSet newTagSet = NULL;
- if (Tk_SetOptions(interp, (ClientData)item, tv->tree.itemOptionTable,
+ if (Tk_SetOptions(interp, item, tv->tree.itemOptionTable,
objc, objv, tv->core.tkwin, &savedOptions, &mask)
!= TCL_OK)
{
@@ -1209,7 +1210,7 @@ static int ConfigureColumn(
Tk_SavedOptions savedOptions;
int mask;
- if (Tk_SetOptions(interp, (ClientData)column,
+ if (Tk_SetOptions(interp, column,
tv->tree.columnOptionTable, objc, objv, tv->core.tkwin,
&savedOptions,&mask) != TCL_OK)
{
@@ -1255,7 +1256,7 @@ static int ConfigureHeading(
Tk_SavedOptions savedOptions;
int mask;
- if (Tk_SetOptions(interp, (ClientData)column,
+ if (Tk_SetOptions(interp, column,
tv->tree.headingOptionTable, objc, objv, tv->core.tkwin,
&savedOptions,&mask) != TCL_OK)
{
@@ -1501,7 +1502,7 @@ typedef enum {
REGION_CELL
} TreeRegion;
-static const char *regionStrings[] = {
+static const char *const regionStrings[] = {
"nothing", "heading", "separator", "tree", "cell", 0
};
@@ -1561,7 +1562,7 @@ static Ttk_Layout GetSublayout(
static Ttk_Layout TreeviewGetLayout(
Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr)
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
Ttk_Layout treeLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr);
Tcl_Obj *objPtr;
int unused;
@@ -1610,7 +1611,7 @@ static Ttk_Layout TreeviewGetLayout(
*/
static void TreeviewDoLayout(void *clientData)
{
- Treeview *tv = clientData;
+ Treeview *tv = (Treeview *)clientData;
int visibleRows;
Ttk_PlaceLayout(tv->core.layout,tv->core.state,Ttk_WinBox(tv->core.tkwin));
@@ -1644,7 +1645,7 @@ static void TreeviewDoLayout(void *clientData)
*/
static int TreeviewSize(void *clientData, int *widthPtr, int *heightPtr)
{
- Treeview *tv = clientData;
+ Treeview *tv = (Treeview *)clientData;
int nRows, padHeight, padWidth;
Ttk_LayoutSize(tv->core.layout, tv->core.state, &padWidth, &padHeight);
@@ -1832,7 +1833,7 @@ static int DrawForest(
*/
static void TreeviewDisplay(void *clientData, Drawable d)
{
- Treeview *tv = clientData;
+ Treeview *tv = (Treeview *)clientData;
Ttk_DrawLayout(tv->core.layout, tv->core.state, d);
if (tv->tree.showFlags & SHOW_HEADINGS) {
@@ -1946,7 +1947,7 @@ static TreeItem *DeleteItems(TreeItem *item, TreeItem *delq)
static int TreeviewChildrenCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
Tcl_Obj *result;
@@ -2026,7 +2027,7 @@ static int TreeviewChildrenCommand(
static int TreeviewParentCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
if (objc != 3) {
@@ -2054,7 +2055,7 @@ static int TreeviewParentCommand(
static int TreeviewNextCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
if (objc != 3) {
@@ -2079,7 +2080,7 @@ static int TreeviewNextCommand(
static int TreeviewPrevCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
if (objc != 3) {
@@ -2104,9 +2105,9 @@ static int TreeviewPrevCommand(
static int TreeviewIndexCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
- int index = 0;
+ TkSizeT index = 0;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "item");
@@ -2122,7 +2123,7 @@ static int TreeviewIndexCommand(
item = item->prev;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
return TCL_OK;
}
@@ -2132,7 +2133,7 @@ static int TreeviewIndexCommand(
static int TreeviewExistsCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
Tcl_HashEntry *entryPtr;
if (objc != 3) {
@@ -2141,7 +2142,7 @@ static int TreeviewExistsCommand(
}
entryPtr = Tcl_FindHashEntry(&tv->tree.items, Tcl_GetString(objv[2]));
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(entryPtr != 0));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(entryPtr != 0));
return TCL_OK;
}
@@ -2151,7 +2152,7 @@ static int TreeviewExistsCommand(
static int TreeviewBBoxCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item = 0;
TreeColumn *column = 0;
Ttk_Box bbox;
@@ -2194,12 +2195,12 @@ static int TreeviewHorribleIdentify(
int dColumnNumber;
char dcolbuf[16];
int x, y, x1;
+ (void)objc;
/* ASSERT: objc == 4 */
- if ( Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK
- || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK
- ) {
+ if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) {
return TCL_ERROR;
}
@@ -2263,11 +2264,11 @@ done:
static int TreeviewIdentifyCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- static const char *submethodStrings[] =
+ static const char *const submethodStrings[] =
{ "region", "item", "column", "row", "element", NULL };
enum { I_REGION, I_ITEM, I_COLUMN, I_ROW, I_ELEMENT };
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
int submethod;
int x, y;
@@ -2369,11 +2370,11 @@ static int TreeviewIdentifyCommand(
static int TreeviewItemCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "item ?option ?value??...");
+ Tcl_WrongNumArgs(interp, 2, objv, "item ?-option ?value??...");
return TCL_ERROR;
}
if (!(item = FindItem(interp, tv, objv[2]))) {
@@ -2397,7 +2398,7 @@ static int TreeviewItemCommand(
static int TreeviewColumnCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeColumn *column;
if (objc < 3) {
@@ -2425,7 +2426,7 @@ static int TreeviewColumnCommand(
static int TreeviewHeadingCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
Tk_OptionTable optionTable = tv->tree.headingOptionTable;
Tk_Window tkwin = tv->core.tkwin;
TreeColumn *column;
@@ -2455,7 +2456,7 @@ static int TreeviewHeadingCommand(
static int TreeviewSetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
TreeColumn *column;
int columnNumber;
@@ -2549,7 +2550,7 @@ static int TreeviewSetCommand(
static int TreeviewInsertCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *parent, *sibling, *newItem;
Tcl_HashEntry *entryPtr;
int isNew;
@@ -2630,7 +2631,7 @@ static int TreeviewInsertCommand(
static int TreeviewDetachCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem **items;
int i;
@@ -2677,7 +2678,7 @@ static int TreeviewDetachCommand(
static int TreeviewDeleteCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem **items, *delq;
int i, selItemDeleted = 0;
@@ -2726,7 +2727,7 @@ static int TreeviewDeleteCommand(
ckfree(items);
if (selItemDeleted) {
- TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect");
+ Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
}
TtkRedisplayWidget(&tv->core);
return TCL_OK;
@@ -2738,7 +2739,7 @@ static int TreeviewDeleteCommand(
static int TreeviewMoveCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item, *parent;
TreeItem *sibling;
@@ -2746,9 +2747,8 @@ static int TreeviewMoveCommand(
Tcl_WrongNumArgs(interp, 2, objv, "item parent index");
return TCL_ERROR;
}
- if ( (item = FindItem(interp, tv, objv[2])) == 0
- || (parent = FindItem(interp, tv, objv[3])) == 0)
- {
+ if ((item = FindItem(interp, tv, objv[2])) == 0
+ || (parent = FindItem(interp, tv, objv[3])) == 0) {
return TCL_ERROR;
}
@@ -2801,14 +2801,14 @@ static int TreeviewMoveCommand(
static int TreeviewXViewCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
return TtkScrollviewCommand(interp, objc, objv, tv->tree.xscrollHandle);
}
static int TreeviewYViewCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
return TtkScrollviewCommand(interp, objc, objv, tv->tree.yscrollHandle);
}
@@ -2818,7 +2818,7 @@ static int TreeviewYViewCommand(
static int TreeviewSeeCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
TreeItem *item, *parent;
int rowNumber;
@@ -2864,7 +2864,7 @@ static int TreeviewSeeCommand(
static int TreeviewDragCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
int left = tv->tree.treeArea.x - tv->tree.xscroll.first;
int i = FirstColumn(tv);
TreeColumn *column;
@@ -2875,9 +2875,8 @@ static int TreeviewDragCommand(
return TCL_ERROR;
}
- if ( (column = FindColumn(interp, tv, objv[2])) == 0
- || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK)
- {
+ if ((column = FindColumn(interp, tv, objv[2])) == 0
+ || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK) {
return TCL_ERROR;
}
@@ -2901,7 +2900,7 @@ static int TreeviewDragCommand(
static int TreeviewDropCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "drop");
@@ -2921,7 +2920,7 @@ static int TreeviewDropCommand(
static int TreeviewFocusCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
if (objc == 2) {
if (tv->tree.focus) {
@@ -2949,17 +2948,17 @@ static int TreeviewSelectionCommand(
enum {
SELECTION_SET, SELECTION_ADD, SELECTION_REMOVE, SELECTION_TOGGLE
};
- static const char *selopStrings[] = {
+ static const char *const selopStrings[] = {
"set", "add", "remove", "toggle", NULL
};
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
int selop, i;
TreeItem *item, **items;
if (objc == 2) {
Tcl_Obj *result = Tcl_NewListObj(0,0);
- for (item = tv->tree.root->children; item; item=NextPreorder(item)) {
+ for (item = tv->tree.root->children; item; item = NextPreorder(item)) {
if (item->state & TTK_STATE_SELECTED)
Tcl_ListObjAppendElement(NULL, result, ItemID(tv, item));
}
@@ -2985,7 +2984,7 @@ static int TreeviewSelectionCommand(
switch (selop)
{
case SELECTION_SET:
- for (item=tv->tree.root; item; item=NextPreorder(item)) {
+ for (item=tv->tree.root; item; item = NextPreorder(item)) {
item->state &= ~TTK_STATE_SELECTED;
}
/*FALLTHRU*/
@@ -3007,7 +3006,7 @@ static int TreeviewSelectionCommand(
}
ckfree(items);
- TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect");
+ Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
TtkRedisplayWidget(&tv->core);
return TCL_OK;
@@ -3022,7 +3021,7 @@ static int TreeviewSelectionCommand(
static int TreeviewTagBindCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
Ttk_TagTable tagTable = tv->tree.tagTable;
Tk_BindingTable bindingTable = tv->tree.bindingTable;
Ttk_Tag tag;
@@ -3075,7 +3074,7 @@ static int TreeviewTagBindCommand(
static int TreeviewTagConfigureCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
Ttk_TagTable tagTable = tv->tree.tagTable;
Ttk_Tag tag;
@@ -3101,12 +3100,40 @@ static int TreeviewTagConfigureCommand(
return Ttk_ConfigureTag(interp, tagTable, tag, objc - 4, objv + 4);
}
+/* + $tv tag delete $tag
+ */
+static int TreeviewTagDeleteCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = (Treeview *)recordPtr;
+ Ttk_TagTable tagTable = tv->tree.tagTable;
+ TreeItem *item = tv->tree.root;
+ Ttk_Tag tag;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName");
+ return TCL_ERROR;
+ }
+
+ tag = Ttk_GetTagFromObj(tagTable, objv[3]);
+ /* remove the tag from all items */
+ while (item) {
+ RemoveTag(item, tag);
+ item = NextPreorder(item);
+ }
+ /* then remove the tag from the tag table */
+ Ttk_DeleteTagFromTable(tagTable, tag);
+ TtkRedisplayWidget(&tv->core);
+
+ return TCL_OK;
+}
+
/* + $tv tag has $tag ?$item?
*/
static int TreeviewTagHasCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
if (objc == 4) { /* Return list of all items with tag */
Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]);
@@ -3129,7 +3156,7 @@ static int TreeviewTagHasCommand(
return TCL_ERROR;
}
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(Ttk_TagSetContains(item->tagset, tag)));
+ Tcl_NewWideIntObj(Ttk_TagSetContains(item->tagset, tag)));
return TCL_OK;
} else {
Tcl_WrongNumArgs(interp, 3, objv, "tagName ?item?");
@@ -3142,7 +3169,7 @@ static int TreeviewTagHasCommand(
static int TreeviewTagNamesCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 3, objv, "");
@@ -3166,7 +3193,7 @@ static void AddTag(TreeItem *item, Ttk_Tag tag)
static int TreeviewTagAddCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
Ttk_Tag tag;
TreeItem **items;
int i;
@@ -3206,7 +3233,7 @@ static void RemoveTag(TreeItem *item, Ttk_Tag tag)
static int TreeviewTagRemoveCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Treeview *tv = recordPtr;
+ Treeview *tv = (Treeview *)recordPtr;
Ttk_Tag tag;
if (objc < 4) {
@@ -3230,7 +3257,7 @@ static int TreeviewTagRemoveCommand(
TreeItem *item = tv->tree.root;
while (item) {
RemoveTag(item, tag);
- item=NextPreorder(item);
+ item = NextPreorder(item);
}
}
@@ -3243,6 +3270,7 @@ static const Ttk_Ensemble TreeviewTagCommands[] = {
{ "add", TreeviewTagAddCommand,0 },
{ "bind", TreeviewTagBindCommand,0 },
{ "configure", TreeviewTagConfigureCommand,0 },
+ { "delete", TreeviewTagDeleteCommand,0 },
{ "has", TreeviewTagHasCommand,0 },
{ "names", TreeviewTagNamesCommand,0 },
{ "remove", TreeviewTagRemoveCommand,0 },
@@ -3267,8 +3295,8 @@ static const Ttk_Ensemble TreeviewCommands[] = {
{ "heading", TreeviewHeadingCommand,0 },
{ "identify", TreeviewIdentifyCommand,0 },
{ "index", TreeviewIndexCommand,0 },
- { "instate", TtkWidgetInstateCommand,0 },
{ "insert", TreeviewInsertCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
{ "item", TreeviewItemCommand,0 },
{ "move", TreeviewMoveCommand,0 },
{ "next", TreeviewNextCommand,0 },
@@ -3278,6 +3306,7 @@ static const Ttk_Ensemble TreeviewCommands[] = {
{ "selection" , TreeviewSelectionCommand,0 },
{ "set", TreeviewSetCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "tag", 0,TreeviewTagCommands },
{ "xview", TreeviewXViewCommand,0 },
{ "yview", TreeviewYViewCommand,0 },
@@ -3288,7 +3317,7 @@ static const Ttk_Ensemble TreeviewCommands[] = {
* +++ Widget definition.
*/
-static WidgetSpec TreeviewWidgetSpec = {
+static const WidgetSpec TreeviewWidgetSpec = {
"Treeview", /* className */
sizeof(Treeview), /* recordSize */
TreeviewOptionSpecs, /* optionSpecs */
@@ -3346,23 +3375,25 @@ typedef struct {
Tcl_Obj *marginsObj;
} TreeitemIndicator;
-static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = {
+static const Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = {
{ "-foreground", TK_OPTION_COLOR,
- Tk_Offset(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND },
+ offsetof(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND },
{ "-indicatorsize", TK_OPTION_PIXELS,
- Tk_Offset(TreeitemIndicator,sizeObj), "12" },
+ offsetof(TreeitemIndicator,sizeObj), "12" },
{ "-indicatormargins", TK_OPTION_STRING,
- Tk_Offset(TreeitemIndicator,marginsObj), "2 2 4 2" },
- { NULL, 0, 0, NULL }
+ offsetof(TreeitemIndicator,marginsObj), "2 2 4 2" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void TreeitemIndicatorSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- TreeitemIndicator *indicator = elementRecord;
+ TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord;
Ttk_Padding margins;
int size = 0;
+ (void)dummy;
+ (void)paddingPtr;
Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginsObj, &margins);
Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size);
@@ -3372,15 +3403,16 @@ static void TreeitemIndicatorSize(
}
static void TreeitemIndicatorDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- TreeitemIndicator *indicator = elementRecord;
+ TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord;
ArrowDirection direction =
(state & TTK_STATE_OPEN) ? ARROW_DOWN : ARROW_RIGHT;
Ttk_Padding margins;
XColor *borderColor = Tk_GetColorFromObj(tkwin, indicator->colorObj);
XGCValues gcvalues; GC gc; unsigned mask;
+ (void)dummy;
if (state & TTK_STATE_LEAF) /* don't draw anything */
return;
@@ -3398,7 +3430,7 @@ static void TreeitemIndicatorDraw(
Tk_FreeGC(Tk_Display(tkwin), gc);
}
-static Ttk_ElementSpec TreeitemIndicatorElementSpec = {
+static const Ttk_ElementSpec TreeitemIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TreeitemIndicator),
TreeitemIndicatorOptions,
@@ -3415,26 +3447,29 @@ typedef struct {
Tcl_Obj *rowNumberObj;
} RowElement;
-static Ttk_ElementOptionSpec RowElementOptions[] = {
+static const Ttk_ElementOptionSpec RowElementOptions[] = {
{ "-background", TK_OPTION_COLOR,
- Tk_Offset(RowElement,backgroundObj), DEFAULT_BACKGROUND },
+ offsetof(RowElement,backgroundObj), DEFAULT_BACKGROUND },
{ "-rownumber", TK_OPTION_INT,
- Tk_Offset(RowElement,rowNumberObj), "0" },
- { NULL, 0, 0, NULL }
+ offsetof(RowElement,rowNumberObj), "0" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void RowElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- RowElement *row = elementRecord;
+ RowElement *row = (RowElement *)elementRecord;
XColor *color = Tk_GetColorFromObj(tkwin, row->backgroundObj);
GC gc = Tk_GCForColor(color, d);
+ (void)dummy;
+ (void)state;
+
XFillRectangle(Tk_Display(tkwin), d, gc,
b.x, b.y, b.width, b.height);
}
-static Ttk_ElementSpec RowElementSpec = {
+static const Ttk_ElementSpec RowElementSpec = {
TK_STYLE_VERSION_2,
sizeof(RowElement),
RowElementOptions,
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index f5bfb4d..07e09e1 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003, Joe English
*
* Core widget utilities.
*/
#include "tkInt.h"
-#include "ttkTheme.h"
+#include "ttkThemeInt.h"
#include "ttkWidget.h"
/*------------------------------------------------------------------------
@@ -81,7 +81,7 @@ static void EndDrawing(Tk_Window tkwin, Drawable d)
#else
/* No double-buffering: draw directly into the window. */
static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); }
-static void EndDrawing(Tk_Window tkwin, Drawable d) { }
+static void EndDrawing(Tk_Window tkwin, Drawable d) { (void)tkwin; (void)d;}
#endif
/* DrawWidget --
@@ -89,7 +89,7 @@ static void EndDrawing(Tk_Window tkwin, Drawable d) { }
*/
static void DrawWidget(ClientData recordPtr)
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
corePtr->flags &= ~REDISPLAY_PENDING;
if (Tk_IsMapped(corePtr->tkwin)) {
@@ -148,7 +148,7 @@ static int
WidgetInstanceObjCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- WidgetCore *corePtr = clientData;
+ WidgetCore *corePtr = (WidgetCore *)clientData;
const Ttk_Ensemble *commands = corePtr->widgetSpec->commands;
int status;
@@ -183,7 +183,7 @@ WidgetInstanceObjCmd(
static void
WidgetInstanceObjCmdDeleted(ClientData clientData)
{
- WidgetCore *corePtr = clientData;
+ WidgetCore *corePtr = (WidgetCore *)clientData;
corePtr->widgetCmd = NULL;
if (corePtr->tkwin != NULL)
Tk_DestroyWindow(corePtr->tkwin);
@@ -209,7 +209,7 @@ DestroyWidget(WidgetCore *corePtr)
corePtr->widgetSpec->cleanupProc(corePtr);
Tk_FreeConfigOptions(
- (ClientData)corePtr, corePtr->optionTable, corePtr->tkwin);
+ corePtr, corePtr->optionTable, corePtr->tkwin);
if (corePtr->layout) {
Ttk_FreeLayout(corePtr->layout);
@@ -328,12 +328,12 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
*/
static void WidgetWorldChanged(ClientData clientData)
{
- WidgetCore *corePtr = clientData;
+ WidgetCore *corePtr = (WidgetCore *)clientData;
SizeChanged(corePtr);
TtkRedisplayWidget(corePtr);
}
-static Tk_ClassProcs widgetClassProcs = {
+static const Tk_ClassProcs widgetClassProcs = {
sizeof(Tk_ClassProcs), /* size */
WidgetWorldChanged, /* worldChangedProc */
NULL, /* createProc */
@@ -348,7 +348,7 @@ static Tk_ClassProcs widgetClassProcs = {
int TtkWidgetConstructorObjCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- WidgetSpec *widgetSpec = clientData;
+ WidgetSpec *widgetSpec = (WidgetSpec *)clientData;
const char *className = widgetSpec->className;
Tk_OptionTable optionTable =
Tk_CreateOptionTable(interp, widgetSpec->optionSpecs);
@@ -384,7 +384,7 @@ int TtkWidgetConstructorObjCmd(
*/
recordPtr = ckalloc(widgetSpec->recordSize);
memset(recordPtr, 0, widgetSpec->recordSize);
- corePtr = recordPtr;
+ corePtr = (WidgetCore *)recordPtr;
corePtr->tkwin = tkwin;
corePtr->interp = interp;
@@ -459,7 +459,7 @@ error:
Ttk_Layout TtkWidgetGetLayout(
Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr)
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
const char *styleName = 0;
if (corePtr->styleObj)
@@ -481,17 +481,17 @@ Ttk_Layout TtkWidgetGetLayout(
Ttk_Layout TtkWidgetGetOrientedLayout(
Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr, Tcl_Obj *orientObj)
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
const char *baseStyleName = 0;
Tcl_DString styleName;
- int orient = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orient = TTK_ORIENT_HORIZONTAL;
Ttk_Layout layout;
Tcl_DStringInit(&styleName);
/* Prefix:
*/
- Ttk_GetOrientFromObj(NULL, orientObj, &orient);
+ TtkGetOrientFromObj(NULL, orientObj, &orient);
if (orient == TTK_ORIENT_HORIZONTAL)
Tcl_DStringAppend(&styleName, "Horizontal.", -1);
else
@@ -521,6 +521,8 @@ Ttk_Layout TtkWidgetGetOrientedLayout(
*/
void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
{
+ (void)interp;
+ (void)recordPtr;
}
/* TtkNullPostConfigure --
@@ -528,6 +530,10 @@ void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
*/
int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
{
+ (void)interp;
+ (void)clientData;
+ (void)mask;
+
return TCL_OK;
}
@@ -537,7 +543,7 @@ int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
*/
int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask)
{
- WidgetCore *corePtr = clientData;
+ WidgetCore *corePtr = (WidgetCore *)clientData;
int status = TCL_OK;
if (mask & STYLE_CHANGED) {
@@ -552,6 +558,7 @@ int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask)
*/
void TtkNullCleanup(void *recordPtr)
{
+ (void)recordPtr;
return;
}
@@ -560,7 +567,7 @@ void TtkNullCleanup(void *recordPtr)
*/
void TtkWidgetDoLayout(void *clientData)
{
- WidgetCore *corePtr = clientData;
+ WidgetCore *corePtr = (WidgetCore *)clientData;
Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
}
@@ -569,7 +576,7 @@ void TtkWidgetDoLayout(void *clientData)
*/
void TtkWidgetDisplay(void *recordPtr, Drawable d)
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
Ttk_DrawLayout(corePtr->layout, corePtr->state, d);
}
@@ -578,7 +585,7 @@ void TtkWidgetDisplay(void *recordPtr, Drawable d)
*/
int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr)
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr);
return 1;
}
@@ -592,7 +599,7 @@ int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr)
int TtkWidgetCgetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
Tcl_Obj *result;
if (objc != 3) {
@@ -612,7 +619,7 @@ int TtkWidgetCgetCommand(
int TtkWidgetConfigureCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
Tcl_Obj *result;
if (objc == 2) {
@@ -682,7 +689,7 @@ int TtkWidgetConfigureCommand(
int TtkWidgetStateCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
Ttk_StateSpec spec;
int status;
Ttk_State oldState, changed;
@@ -722,7 +729,7 @@ int TtkWidgetStateCommand(
int TtkWidgetInstateCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
Ttk_State state = corePtr->state;
Ttk_StateSpec spec;
int status = TCL_OK;
@@ -737,7 +744,7 @@ int TtkWidgetInstateCommand(
if (objc == 3) {
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(Ttk_StateMatches(state,&spec)));
+ Tcl_NewWideIntObj(Ttk_StateMatches(state,&spec)));
} else if (objc == 4) {
if (Ttk_StateMatches(state,&spec)) {
status = Tcl_EvalObjEx(interp, objv[3], 0);
@@ -753,9 +760,9 @@ int TtkWidgetInstateCommand(
int TtkWidgetIdentifyCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- WidgetCore *corePtr = recordPtr;
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
Ttk_Element element;
- static const char *whatTable[] = { "element", NULL };
+ static const char *const whatTable[] = { "element", NULL };
int x, y, what;
if (objc < 4 || objc > 5) {
@@ -786,4 +793,24 @@ int TtkWidgetIdentifyCommand(
return TCL_OK;
}
+/* $w style
+ * Return the style currently applied to the widget.
+ */
+
+int TtkWidgetStyleCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "");
+ return TCL_ERROR;
+ }
+
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ Ttk_StyleName(Ttk_LayoutStyle(corePtr->layout)), -1));
+
+ return TCL_OK;
+}
+
/*EOF*/
diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h
index 6cd691b..9321cb0 100644
--- a/generic/ttk/ttkWidget.h
+++ b/generic/ttk/ttkWidget.h
@@ -89,15 +89,17 @@ MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask);
/* Common widget commands:
*/
+MODULE_SCOPE int TtkWidgetCgetCommand(
+ void *,Tcl_Interp *, int, Tcl_Obj*const[]);
MODULE_SCOPE int TtkWidgetConfigureCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
-MODULE_SCOPE int TtkWidgetCgetCommand(
+MODULE_SCOPE int TtkWidgetIdentifyCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
MODULE_SCOPE int TtkWidgetInstateCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
MODULE_SCOPE int TtkWidgetStateCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
-MODULE_SCOPE int TtkWidgetIdentifyCommand(
+MODULE_SCOPE int TtkWidgetStyleCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
/* Widget constructor:
@@ -117,21 +119,21 @@ MODULE_SCOPE int TtkWidgetConstructorObjCmd(
*/
#define WIDGET_TAKEFOCUS_TRUE \
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \
- "ttk::takefocus", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 }
+ "ttk::takefocus", offsetof(WidgetCore, takeFocusPtr), TCL_INDEX_NONE, 0,0,0 }
#define WIDGET_TAKEFOCUS_FALSE \
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \
- "", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 }
+ "", offsetof(WidgetCore, takeFocusPtr), TCL_INDEX_NONE, 0,0,0 }
/* WIDGET_INHERIT_OPTIONS(baseOptionSpecs) --
* Add this at the end of an OptionSpecs table to inherit
* the options from 'baseOptionSpecs'.
*/
#define WIDGET_INHERIT_OPTIONS(baseOptionSpecs) \
- {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0, (ClientData)baseOptionSpecs, 0}
+ {TK_OPTION_END, 0,0,0, NULL, TCL_INDEX_NONE,TCL_INDEX_NONE, 0, baseOptionSpecs, 0}
/* All widgets should inherit from ttkCoreOptionSpecs[].
*/
-MODULE_SCOPE Tk_OptionSpec ttkCoreOptionSpecs[];
+MODULE_SCOPE const Tk_OptionSpec ttkCoreOptionSpecs[];
/*
* Useful routines for use inside widget implementations:
@@ -165,11 +167,6 @@ MODULE_SCOPE void Ttk_UntraceVariable(Ttk_TraceHandle *);
MODULE_SCOPE int Ttk_FireTrace(Ttk_TraceHandle *);
/*
- * Virtual events:
- */
-MODULE_SCOPE void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName);
-
-/*
* Helper routines for data accessor commands:
*/
MODULE_SCOPE int TtkEnumerateOptions(
@@ -212,7 +209,7 @@ typedef struct TtkTagSet { /* TODO: make opaque */
} *Ttk_TagSet;
MODULE_SCOPE Ttk_TagTable Ttk_CreateTagTable(
- Tcl_Interp *, Tk_Window tkwin, Tk_OptionSpec[], int recordSize);
+ Tcl_Interp *, Tk_Window tkwin, const Tk_OptionSpec *, int recordSize);
MODULE_SCOPE void Ttk_DeleteTagTable(Ttk_TagTable);
MODULE_SCOPE Ttk_Tag Ttk_GetTag(Ttk_TagTable, const char *tagName);
@@ -226,6 +223,8 @@ MODULE_SCOPE int Ttk_EnumerateTagOptions(
MODULE_SCOPE int Ttk_EnumerateTags(Tcl_Interp *, Ttk_TagTable);
+MODULE_SCOPE void Ttk_DeleteTagFromTable(Ttk_TagTable, Ttk_Tag);
+
MODULE_SCOPE int Ttk_ConfigureTag(
Tcl_Interp *interp, Ttk_TagTable tagTable, Ttk_Tag tag,
int objc, Tcl_Obj *const objv[]);
@@ -247,9 +246,9 @@ MODULE_SCOPE void Ttk_TagSetApplyStyle(Ttk_TagTable,Ttk_Style,Ttk_State,void*);
* String tables for widget resource specifications:
*/
-MODULE_SCOPE const char *ttkOrientStrings[];
-MODULE_SCOPE const char *ttkCompoundStrings[];
-MODULE_SCOPE const char *ttkDefaultStrings[];
+MODULE_SCOPE const char *const ttkOrientStrings[];
+MODULE_SCOPE const char *const ttkCompoundStrings[];
+MODULE_SCOPE const char *const ttkDefaultStrings[];
/*
* ... other option types...
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index fe8dfe0..b5c28c4 100644
--- a/library/bgerror.tcl
+++ b/library/bgerror.tcl
@@ -6,10 +6,10 @@
# trace (like save it to a log). This is adapted from work done by
# Donal K. Fellows.
#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-# Copyright (c) 2007 by ActiveState Software Inc.
-# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
-# Copyright (c) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 1998-2000 Ajuba Solutions.
+# Copyright © 2007 ActiveState Software Inc.
+# Copyright © 2007 Daniel A. Steffen <das@users.sourceforge.net>
+# Copyright © 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
namespace eval ::tk::dialog::error {
namespace import -force ::tk::msgcat::*
diff --git a/library/button.tcl b/library/button.tcl
index 9b13607..4be16b1 100644
--- a/library/button.tcl
+++ b/library/button.tcl
@@ -4,9 +4,9 @@
# checkbutton, and radiobutton widgets and provides procedures
# that help in implementing those bindings.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 2002 ActiveState Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 2002 ActiveState Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -21,7 +21,7 @@ if {[tk windowingsystem] eq "aqua"} {
bind Radiobutton <Enter> {
tk::ButtonEnter %W
}
- bind Radiobutton <1> {
+ bind Radiobutton <Button-1> {
tk::ButtonDown %W
}
bind Radiobutton <ButtonRelease-1> {
@@ -30,7 +30,7 @@ if {[tk windowingsystem] eq "aqua"} {
bind Checkbutton <Enter> {
tk::ButtonEnter %W
}
- bind Checkbutton <1> {
+ bind Checkbutton <Button-1> {
tk::ButtonDown %W
}
bind Checkbutton <ButtonRelease-1> {
@@ -41,16 +41,16 @@ if {[tk windowingsystem] eq "aqua"} {
}
}
if {"win32" eq [tk windowingsystem]} {
- bind Checkbutton <equal> {
+ bind Checkbutton <=> {
tk::CheckRadioInvoke %W select
}
- bind Checkbutton <plus> {
+ bind Checkbutton <+> {
tk::CheckRadioInvoke %W select
}
bind Checkbutton <minus> {
tk::CheckRadioInvoke %W deselect
}
- bind Checkbutton <1> {
+ bind Checkbutton <Button-1> {
tk::CheckRadioDown %W
}
bind Checkbutton <ButtonRelease-1> {
@@ -63,7 +63,7 @@ if {"win32" eq [tk windowingsystem]} {
tk::ButtonLeave %W
}
- bind Radiobutton <1> {
+ bind Radiobutton <Button-1> {
tk::CheckRadioDown %W
}
bind Radiobutton <ButtonRelease-1> {
@@ -84,10 +84,10 @@ if {"x11" eq [tk windowingsystem]} {
tk::CheckRadioInvoke %W
}
}
- bind Checkbutton <1> {
+ bind Checkbutton <Button-1> {
tk::CheckInvoke %W
}
- bind Radiobutton <1> {
+ bind Radiobutton <Button-1> {
tk::CheckRadioInvoke %W
}
bind Checkbutton <Enter> {
@@ -127,7 +127,7 @@ bind Button <Enter> {
bind Button <Leave> {
tk::ButtonLeave %W
}
-bind Button <1> {
+bind Button <Button-1> {
tk::ButtonDown %W
}
bind Button <ButtonRelease-1> {
diff --git a/library/choosedir.tcl b/library/choosedir.tcl
index 68dd9b0..6b4f15e 100644
--- a/library/choosedir.tcl
+++ b/library/choosedir.tcl
@@ -2,7 +2,7 @@
#
# Choose directory dialog implementation for Unix/Mac.
#
-# Copyright (c) 1998-2000 by Scriptics Corporation.
+# Copyright © 1998-2000 Scriptics Corporation.
# All rights reserved.
# Make sure the tk::dialog namespace, in which all dialogs should live, exists
diff --git a/library/clrpick.tcl b/library/clrpick.tcl
index e408d03..8bdb7a7 100644
--- a/library/clrpick.tcl
+++ b/library/clrpick.tcl
@@ -3,7 +3,7 @@
# Color selection dialog for platforms that do not support a
# standard color selection dialog.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
+# Copyright © 1996 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -316,7 +316,7 @@ proc ::tk::dialog::color::BuildDialog {w} {
# Accelerator bindings
bind $lab <<AltUnderlined>> [list focus $ent]
- bind $w <KeyPress-Escape> [list tk::ButtonInvoke $data(cancelBtn)]
+ bind $w <Escape> [list tk::ButtonInvoke $data(cancelBtn)]
bind $w <Alt-Key> [list tk::AltKeyInDialog $w %A]
wm protocol $w WM_DELETE_WINDOW [list tk::dialog::color::CancelCmd $w]
diff --git a/library/comdlg.tcl b/library/comdlg.tcl
index b4d8978..0a7f65b 100644
--- a/library/comdlg.tcl
+++ b/library/comdlg.tcl
@@ -3,7 +3,7 @@
# Some functions needed for the common dialog boxes. Probably need to go
# in a different file.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
+# Copyright © 1996 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/console.tcl b/library/console.tcl
index 30c4d88..f88cfc1 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -4,9 +4,9 @@
# can be used by non-unix systems that do not have built-in support
# for shells.
#
-# Copyright (c) 1995-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 Ajuba Solutions.
-# Copyright (c) 2007-2008 Daniel A. Steffen <das@users.sourceforge.net>
+# Copyright © 1995-1997 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Ajuba Solutions.
+# Copyright © 2007-2008 Daniel A. Steffen <das@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -215,7 +215,7 @@ proc ::tk::ConsoleSource {} {
[list [mc "Tcl Scripts"] .tcl] \
[list [mc "All Files"] *]]]
if {$filename ne ""} {
- set cmd [list source $filename]
+ set cmd [list source -encoding utf-8 $filename]
if {[catch {consoleinterp eval $cmd} result]} {
ConsoleOutput stderr "$result\n"
}
@@ -416,61 +416,54 @@ proc ::tk::ConsoleBind {w} {
bind Console $ev [bind Text $ev]
}
## We really didn't want the newline insertion...
- bind Console <Control-Key-o> {}
+ bind Console <Control-o> {}
## ...or any Control-v binding (would block <<Paste>>)
- bind Console <Control-Key-v> {}
+ bind Console <Control-v> {}
# For the moment, transpose isn't enabled until the console
# gets and overhaul of how it handles input -- hobbs
- bind Console <Control-Key-t> {}
+ bind Console <Control-t> {}
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
# Otherwise, if a widget binding for one of these is defined, the
# <Keypress> class binding will also fire and insert the character
# which is wrong.
- bind Console <Alt-KeyPress> {# nothing }
- bind Console <Meta-KeyPress> {# nothing}
- bind Console <Control-KeyPress> {# nothing}
+ bind Console <Alt-Key> {# nothing }
+ bind Console <Meta-Key> {# nothing}
+ bind Console <Control-Key> {# nothing}
foreach {ev key} {
- <<Console_NextImmediate>> <Control-Key-n>
- <<Console_PrevImmediate>> <Control-Key-p>
- <<Console_PrevSearch>> <Control-Key-r>
- <<Console_NextSearch>> <Control-Key-s>
-
- <<Console_Expand>> <Key-Tab>
- <<Console_Expand>> <Key-Escape>
- <<Console_ExpandFile>> <Control-Shift-Key-F>
- <<Console_ExpandProc>> <Control-Shift-Key-P>
- <<Console_ExpandVar>> <Control-Shift-Key-V>
- <<Console_Tab>> <Control-Key-i>
- <<Console_Tab>> <Meta-Key-i>
- <<Console_Eval>> <Key-Return>
- <<Console_Eval>> <Key-KP_Enter>
-
- <<Console_Clear>> <Control-Key-l>
- <<Console_KillLine>> <Control-Key-k>
- <<Console_Transpose>> <Control-Key-t>
- <<Console_ClearLine>> <Control-Key-u>
- <<Console_SaveCommand>> <Control-Key-z>
- <<Console_FontSizeIncr>> <Control-Key-plus>
- <<Console_FontSizeDecr>> <Control-Key-minus>
+ <<Console_NextImmediate>> <Control-n>
+ <<Console_PrevImmediate>> <Control-p>
+ <<Console_PrevSearch>> <Control-r>
+ <<Console_NextSearch>> <Control-s>
+
+ <<Console_Expand>> <Tab>
+ <<Console_Expand>> <Escape>
+ <<Console_ExpandFile>> <Control-Shift-F>
+ <<Console_ExpandProc>> <Control-Shift-P>
+ <<Console_ExpandVar>> <Control-Shift-V>
+ <<Console_Tab>> <Control-i>
+ <<Console_Tab>> <Meta-i>
+ <<Console_Eval>> <Return>
+ <<Console_Eval>> <KP_Enter>
+
+ <<Console_Clear>> <Control-l>
+ <<Console_KillLine>> <Control-k>
+ <<Console_Transpose>> <Control-t>
+ <<Console_ClearLine>> <Control-u>
+ <<Console_SaveCommand>> <Control-z>
+ <<Console_FontSizeIncr>> <Control-+>
+ <<Console_FontSizeDecr>> <Control-minus>
+ <<Console_FontSizeIncr>> <Command-+>
+ <<Console_FontSizeDecr>> <Command-minus>
} {
event add $ev $key
bind Console $key {}
}
- if {[tk windowingsystem] eq "aqua"} {
- foreach {ev key} {
- <<Console_FontSizeIncr>> <Command-Key-plus>
- <<Console_FontSizeDecr>> <Command-Key-minus>
- } {
- event add $ev $key
- bind Console $key {}
- }
- if {$::tk::console::useFontchooser} {
- bind Console <Command-Key-t> [list ::tk::console::FontchooserToggle]
- }
+ if {$::tk::console::useFontchooser} {
+ bind Console <Command-t> [list ::tk::console::FontchooserToggle]
}
bind Console <<Console_Expand>> {
if {[%W compare insert > promptEnd]} {
@@ -587,17 +580,15 @@ proc ::tk::ConsoleBind {w} {
bind Console <Insert> {
catch {tk::ConsoleInsert %W [::tk::GetSelection %W PRIMARY]}
}
- bind Console <KeyPress> {
+ bind Console <Key> {
tk::ConsoleInsert %W %A
}
bind Console <F9> {
eval destroy [winfo child .]
source -encoding utf-8 [file join $tk_library console.tcl]
}
- if {[tk windowingsystem] eq "aqua"} {
- bind Console <Command-q> {
- exit
- }
+ bind Console <Command-q> {
+ exit
}
bind Console <<Cut>> { ::tk::console::Cut %W }
bind Console <<Copy>> { ::tk::console::Copy %W }
@@ -629,28 +620,28 @@ proc ::tk::ConsoleBind {w} {
##
## Bindings for doing special things based on certain keys
##
- bind PostConsole <Key-parenright> {
+ bind PostConsole <parenright> {
if {"\\" ne [%W get insert-2c]} {
::tk::console::MatchPair %W \( \) promptEnd
}
}
- bind PostConsole <Key-bracketright> {
+ bind PostConsole <bracketright> {
if {"\\" ne [%W get insert-2c]} {
::tk::console::MatchPair %W \[ \] promptEnd
}
}
- bind PostConsole <Key-braceright> {
+ bind PostConsole <braceright> {
if {"\\" ne [%W get insert-2c]} {
::tk::console::MatchPair %W \{ \} promptEnd
}
}
- bind PostConsole <Key-quotedbl> {
+ bind PostConsole <quotedbl> {
if {"\\" ne [%W get insert-2c]} {
::tk::console::MatchQuote %W promptEnd
}
}
- bind PostConsole <KeyPress> {
+ bind PostConsole <Key> {
if {"%A" ne ""} {
::tk::console::TagProc %W
}
diff --git a/library/demos/combo.tcl b/library/demos/combo.tcl
index 8631904..acab497 100644
--- a/library/demos/combo.tcl
+++ b/library/demos/combo.tcl
@@ -43,7 +43,8 @@ set secondValue unchangable
set ozCity Sydney
ttk::labelframe $w.c1 -text "Fully Editable"
-ttk::combobox $w.c1.c -textvariable firstValue
+ttk::combobox $w.c1.c -textvariable firstValue -placeholder {Enter text here}
+ttk::style configure TEntry -placeholderforeground gray50
ttk::labelframe $w.c2 -text Disabled
ttk::combobox $w.c2.c -textvariable secondValue -state disabled
ttk::labelframe $w.c3 -text "Defined List Only"
diff --git a/library/demos/entry1.tcl b/library/demos/entry1.tcl
index 7365fc7..58eda03 100644
--- a/library/demos/entry1.tcl
+++ b/library/demos/entry1.tcl
@@ -25,7 +25,7 @@ pack $btns -side bottom -fill x
entry $w.e1
entry $w.e2
-entry $w.e3
+entry $w.e3 -placeholder {Enter text here} -placeholderforeground gray75
pack $w.e1 $w.e2 $w.e3 -side top -pady 5 -padx 10 -fill x
$w.e1 insert 0 "Initial value"
diff --git a/library/demos/entry2.tcl b/library/demos/entry2.tcl
index 6405d85..1423e3f 100644
--- a/library/demos/entry2.tcl
+++ b/library/demos/entry2.tcl
@@ -44,3 +44,4 @@ $w.frame.e1 insert 0 "Initial value"
$w.frame.e2 insert end "This entry contains a long value, much too long "
$w.frame.e2 insert end "to fit in the window at one time, so long in fact "
$w.frame.e2 insert end "that you'll have to scan or scroll to see the end."
+$w.frame.e3 configure -placeholder {Enter text here} -placeholderforeground gray75
diff --git a/library/demos/entry3.tcl b/library/demos/entry3.tcl
index acde1b3..f229de6 100644
--- a/library/demos/entry3.tcl
+++ b/library/demos/entry3.tcl
@@ -64,13 +64,13 @@ proc focusAndFlash {W fg bg {count 9}} {
labelframe $w.l1 -text "Integer Entry"
# Alternatively try using {string is digit} for arbitrary length numbers,
# and not just 32-bit ones.
-entry $w.l1.e -validate focus -vcmd {string is integer %P}
+entry $w.l1.e -validate focus -validatecommand {string is integer %P}
$w.l1.e configure -invalidcommand \
"focusAndFlash %W [$w.l1.e cget -fg] [$w.l1.e cget -bg]"
pack $w.l1.e -fill x -expand 1 -padx 1m -pady 1m
labelframe $w.l2 -text "Length-Constrained Entry"
-entry $w.l2.e -validate key -invcmd bell -vcmd {expr {[string length %P]<10}}
+entry $w.l2.e -validate key -invcmd bell -validatecommand {expr {[string length %P]<10}}
pack $w.l2.e -fill x -expand 1 -padx 1m -pady 1m
### PHONE NUMBER ENTRY ###
@@ -161,7 +161,7 @@ proc phoneSkipRight {W {add 0}} {
labelframe $w.l3 -text "US Phone-Number Entry"
entry $w.l3.e -validate key -invcmd bell -textvariable entry3content \
- -vcmd {validatePhoneChange %W %v %i %S}
+ -validatecommand {validatePhoneChange %W %v %i %S}
# Click to focus goes to the first editable character...
bind $w.l3.e <FocusIn> {
if {"%d" ne "NotifyAncestor"} {
@@ -174,7 +174,7 @@ bind $w.l3.e <<NextChar>> {phoneSkipRight %W}
pack $w.l3.e -fill x -expand 1 -padx 1m -pady 1m
labelframe $w.l4 -text "Password Entry"
-entry $w.l4.e -validate key -show "*" -vcmd {expr {[string length %P]<=8}}
+entry $w.l4.e -validate key -show "*" -validatecommand {expr {[string length %P]<=8}}
pack $w.l4.e -fill x -expand 1 -padx 1m -pady 1m
lower [frame $w.mid]
diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl
index 1cc52c6..14ddb0b 100644
--- a/library/demos/goldberg.tcl
+++ b/library/demos/goldberg.tcl
@@ -113,9 +113,9 @@ proc DoDisplay {w} {
DoCtrlFrame $w
DoDetailFrame $w
if {[tk windowingsystem] ne "aqua"} {
- ttk::button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2
+ ttk::button $w.show -text "»" -command [list ShowCtrl $w] -width 2
} else {
- button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
+ button $w.show -text "»" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
}
place $w.show -in $w.c -relx 1 -rely 0 -anchor ne
update
@@ -204,10 +204,10 @@ proc DoDetailFrame {w} {
proc ShowCtrl {w} {
if {[winfo ismapped $w.ctrl]} {
pack forget $w.ctrl
- $w.show config -text "\u00bb"
+ $w.show config -text "»"
} else {
pack $w.ctrl -side right -fill both -ipady 5
- $w.show config -text "\u00ab"
+ $w.show config -text "»"
}
}
diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl
index 11b3b5c..09ceff0 100644
--- a/library/demos/knightstour.tcl
+++ b/library/demos/knightstour.tcl
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
#
# Calculate a Knight's tour of a chessboard.
#
@@ -205,10 +205,10 @@ proc CreateGUI {} {
}
if {[tk windowingsystem] ne "x11"} {
catch {eval font create KnightFont -size -24}
- $c create text 0 0 -font KnightFont -text "\u265e" \
+ $c create text 0 0 -font KnightFont -text "♞" \
-anchor nw -tags knight -fill black -activefill "#600000"
} else {
- # On X11 we cannot reliably tell if the \u265e glyph is available
+ # On X11 we cannot reliably tell if the ♞ glyph is available
# so just use a polygon
set pts {
2 25 24 25 21 19 20 8 14 0 10 0 0 13 0 16
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl
index 244361d..70e8cfd 100644
--- a/library/demos/menu.tcl
+++ b/library/demos/menu.tcl
@@ -131,7 +131,7 @@ $m entryconfigure 2 -columnbreak 1
set m $w.menu.more
$w.menu add cascade -label "More" -menu $m -underline 0
menu $m -tearoff 0
-foreach i {{An entry} {Another entry} {Does nothing} {Does almost nothing} {Make life meaningful}} {
+foreach i {{An entry} {Another entry} {Does nothing} {Does almost nothing} {Does almost nothing also} {Make life meaningful}} {
$m add command -label $i -command [list puts "You invoked \"$i\""]
}
set emojiLabel [encoding convertfrom utf-8 "\xF0\x9F\x98\x8D Make friends"]
@@ -143,6 +143,13 @@ $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \
text string. Other than this, it is just like any other\
menu entry." {} 0 OK ]
+$m entryconfigure "Does almost nothing also" -image lilearth -compound left \
+ -command [list \
+ tk_dialog $w.compound {Compound Menu Entry} \
+ "The menu entry you invoked displays both a image and a\
+ text string. Other than this, it is just like any other\
+ menu entry." {} 0 OK ]
+
set m $w.menu.colors
$w.menu add cascade -label "Colors" -menu $m -underline 1
menu $m -tearoff 1
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl
index 9833e8f..04f276b 100644
--- a/library/demos/pendulum.tcl
+++ b/library/demos/pendulum.tcl
@@ -50,8 +50,8 @@ for {set i 90} {$i>=0} {incr i -10} {
$w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i
}
-$w.k create text 0 0 -anchor ne -text "\u03b8" -tags label_theta
-$w.k create text 0 0 -anchor ne -text "\u03b4\u03b8" -tags label_dtheta
+$w.k create text 0 0 -anchor ne -text "θ" -tags label_theta
+$w.k create text 0 0 -anchor ne -text "δθ" -tags label_dtheta
pack $w.k -in $w.p.l2 -fill both -expand true
# Initialize some variables
diff --git a/library/demos/print.tcl b/library/demos/print.tcl
new file mode 100644
index 0000000..ebe6553
--- /dev/null
+++ b/library/demos/print.tcl
@@ -0,0 +1,53 @@
+# print.tcl --
+#
+# This demonstration script showcases the tk print commands.
+#
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+set w .print
+destroy $w
+toplevel $w
+wm title $w "Printing Demonstration"
+positionWindow $w
+
+image create photo logo -data {R0lGODlhMABLAPUAAP//////zP//mf//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM/8zMzMyZzMyZmcyZZsyZAMxmZsxmM8xmAMwzM8wzAJnMzJmZzJmZmZlmmZlmZplmM5kzZpkzM5kzAGaZzGZmzGZmmWYzZmYzMzNmzDNmmTMzmTMzZgAzmQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+BSAtZGwtACH5BAEKAAIALAAAAAAwAEsAAAb+QIFwSCwahY9HRMI8Op/JJVNSqVqv2OvjyRU8slbIJGwYg60S5ZR6jRi/4ITBOhkYIOd8dltEnAdmFQMJeoVXCEd/VnKGjRVOZ3NVgHlsjpBxVRCEYBIEAAARl4lgZmVgEQAKFx8Mo0ZnpqgAFyi2JqKGmGebWRIAILbCIo27cYFWASTCtievRXqSVwQfzLYeeYESxlnSVRIW1igjWHJmjBXbpKXeFQTizlh1eJNVHbYf0LGc39XW2PIoVZE0whasWPSqFBBHrkKEA3QG0DFTEMXBUsjCWesg4oMFAGwgtKsiwqA+jGiCiRPGAM6pLCVLGKHQ6EGJlc0IuDxzAgX+CCOW9DjAaUsEyAoT+GHpeSRoHgxEUWgAUEUpFhMWgTbKEPUBAU15TBZxekYD0RMEqCDLIpYIWTAcmGEd9rWQBxQyjeQqdK/ZTWEO3mK5l+9No75SrcHhm9WwnlzNoA5zdM+JHz0HCPQdUauZowoFnSw+c2CBvw6dUXT4LMKE6EIHUqMexgCiIREknOwl7Q+FhNQoLuzOc6Kw3kIIVOLqjYKBYCwinmgo9CBEswfMAziK7mRDoQhcUZxwoBKFibq3n3jXI0GyCPLC0DrS8GR1oaEoRBRYVhT99/qG4DcCA/yNU4Ajbjhhnx4P2DJggR3YZog6RyyYxwM9PSgMBaP+sQdgIRL0JAKBwnTooRMAFWLdiPyJ8JwvTnyQoh5midCASh149ZkTIFAmHnzOZOBfIU6U4Mhd4zF34DNEoDAhARGY50BvJkioyxFOGkKAShGkFsJwejiR5Xf8aZAaBp89coQJjuDXAQOApekEm45ANaAtIbyYxREf0OlICCK841uaahZBQjyfjXCACYjuaASjhFagRKSFNtloHg+hYWIxRohnBQWCSSAhBVZ+hkgRnlbxwJIVgIqGlaU6wkeTxHxjm6gVLImrFbHWVEQ1taZjWxJX7KqqnqgUEUxDwtqajrOaRkqhEDcxWwECbEjxTYe9gojqOJQ6JO231ob72bSqAjh4RgfsjiDCCfDCK8K8I9TL7r33nvGtCO7CO1dUAONk3LcBFxzwwEMwZ/DC4iAsRIE+CWNCbzeV8FfEtoDwVwnlacxMkcKQYIE/F5TQ2QcedUZCagyc3NsFGrXVZMipWVBCzKv4Q0JvCviDsjAwf4ylxBeX0KcwGs81ccgqGS3MBxc3RjDDVAvdBRcfeFy1MFd3bcQHJEQdlddkP5E1Cf9yXfbaV2d9RBAAOw==
+}
+
+
+pack [label $w.l -text "This demonstration showcases
+ the tk print command. Clicking the buttons below
+ print the data from the canvas and text widgets
+ using platform-native dialogs."] -side top
+
+pack [frame $w.m] -fill both -expand yes -side top
+
+set c [canvas $w.m.c -bg white]
+pack $c -fill both -expand no -side left
+
+$c create rectangle 30 10 200 50 -fill blue -outline black
+$c create oval 30 60 200 110 -fill green
+$c create image 130 150 -image logo
+$c create text 150 250 -anchor n -font {Helvetica 12} \
+ -text "A short demo of simple canvas elements."
+
+set txt {
+Tcl, or Tool Command Language, is an open-source multi-purpose C library which includes a powerful dynamic scripting language. Together they provide ideal cross-platform development environment for any programming project. It has served for decades as an essential system component in organizations ranging from NASA to Cisco Systems, is a must-know language in the fields of EDA, and powers companies such as FlightAware and F5 Networks.
+
+Tcl is fit for both the smallest and largest programming tasks, obviating the need to decide whether it is overkill for a given job or whether a system written in Tcl will scale up as needed. Wherever a shell script might be used Tcl is a better choice, and entire web ecosystems and mission-critical control and testing systems have also been written in Tcl. Tcl excels in all these roles due to the minimal syntax of the language, the unique programming paradigm exposed at the script level, and the careful engineering that has gone into the design of the Tcl internals.
+}
+
+set t [text $w.m.t -wrap word]
+pack $t -side right -fill both -expand no
+$t insert end $txt
+
+pack [frame $w.f] -side top -fill both -expand no
+pack [button $w.f.b -text "Print Canvas" -command [list tk print $w.m.c]] -expand no
+pack [button $w.f.x -text "Print Text" -command [list tk print $w.m.t]] -expand no
+
+## See Code / Dismiss buttons
+pack [addSeeDismiss $w.buttons $w] -side bottom -fill x
+
+
diff --git a/library/demos/spin.tcl b/library/demos/spin.tcl
index d897e6d..72f3aa4 100644
--- a/library/demos/spin.tcl
+++ b/library/demos/spin.tcl
@@ -38,7 +38,7 @@ set australianCities {
}
spinbox $w.s1 -from 1 -to 10 -width 10 -validate key \
- -vcmd {string is integer %P}
+ -validatecommand {string is integer %P}
spinbox $w.s2 -from 0 -to 3 -increment .5 -format %05.2f -width 10
spinbox $w.s3 -values $australianCities -width 10
diff --git a/library/demos/square b/library/demos/square
index 9f200ba..ee6dd31 100644
--- a/library/demos/square
+++ b/library/demos/square
@@ -11,8 +11,8 @@ exec wish "$0" ${1+"$@"}
# Button-1 press/drag: moves square to mouse
# "a": toggle size animation on/off
-package require Tk ;# We use Tk generally, and...
-package require Tktest ;# ... we use the square widget too.
+package require tk ;# We use Tk generally, and...
+package require tk::test ;# ... we use the square widget too.
square .s
pack .s -expand yes -fill both
diff --git a/library/demos/systray.tcl b/library/demos/systray.tcl
new file mode 100644
index 0000000..05315bb
--- /dev/null
+++ b/library/demos/systray.tcl
@@ -0,0 +1,89 @@
+# systray.tcl --
+#
+# This demonstration script showcases the tk systray and tk sysnotify commands.
+#
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+set w .systray
+destroy $w
+toplevel $w
+wm title $w "System Tray Demonstration"
+positionWindow $w
+
+catch {tk systray destroy}
+set trayIconExists false
+
+set iconmenu .menubar
+destroy $iconmenu
+menu $iconmenu
+$iconmenu add command -label "Status" -command { puts "status icon clicked" }
+$iconmenu add command -label "Exit" -command exit
+
+pack [label $w.l -text "This demonstration showcases
+ the tk systray and tk sysnotify commands.
+ Running this demo creates the systray icon.
+ Clicking the buttons below modifies and destroys the icon
+ and displays the notification."]
+
+image create photo book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+
+labelframe $w.f -text "Tray Icon"
+button $w.f.b0 -text "Create" -command create
+button $w.f.b1 -text "Modify" -command modify
+button $w.f.b2 -text "Destroy" -command remove
+pack $w.f.b0 $w.f.b1 $w.f.b2 -padx 5 -pady 3 -side left -expand true -fill x
+
+button $w.b3 -text "Display Notification" -command notify
+pack $w.f $w.b3 -expand true -fill x -padx 5 -pady 5
+
+proc create {} {
+ global trayIconExists
+ if {$trayIconExists} {
+ tk_messageBox -message "Systray icon already exists"
+ return
+ }
+ tk systray create -image book -text "Systray sample" \
+ -button1 {puts "foo"} \
+ -button3 {tk_popup $iconmenu [winfo pointerx .] [winfo pointery .]}
+ set trayIconExists true
+}
+
+proc modify {} {
+ global trayIconExists
+ if {!$trayIconExists} {
+ tk_messageBox -message "Please create systray icon first"
+ return
+ }
+ image create photo page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7
+ tk systray configure -image page
+ tk systray configure -text "Modified text"
+ tk systray configure -button1 {puts "this is a different output"}
+ tk systray configure -button3 {puts "hello yall"}
+}
+
+proc notify {} {
+ global trayIconExists
+ if {!$trayIconExists} {
+ tk_messageBox -message "Please create systray icon first"
+ return
+ }
+ tk sysnotify "Alert" "This is an alert"
+}
+
+proc remove {} {
+ global trayIconExists
+ if {!$trayIconExists} {
+ tk_messageBox -message "Systray icon was already destroyed"
+ return
+ }
+ tk systray destroy
+ set trayIconExists false
+}
+
+create
+
+## See Code / Dismiss buttons
+pack [addSeeDismiss $w.buttons $w] -side bottom -fill x
diff --git a/library/demos/tclIndex b/library/demos/tclIndex
index cdb2f2c..0c3a516 100644
--- a/library/demos/tclIndex
+++ b/library/demos/tclIndex
@@ -65,3 +65,5 @@ set auto_index(showMessageBox) [list source -encoding utf-8 [file join $dir msgb
set auto_index(setColor) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
set auto_index(setColor_helper) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
set auto_index(fileDialog) [list source -encoding utf-8 [file join $dir filebox.tcl]]
+set auto_index(systray) [list source -encoding utf-8 [file join $dir systray.tcl]]
+
diff --git a/library/demos/toolbar.tcl b/library/demos/toolbar.tcl
index cb2a495..a53e390 100644
--- a/library/demos/toolbar.tcl
+++ b/library/demos/toolbar.tcl
@@ -17,7 +17,7 @@ positionWindow $w
ttk::label $w.msg -wraplength 4i -text "This is a demonstration of how to do\
a toolbar that is styled correctly and which can be torn off. The\
- buttons are configured to be \u201Ctoolbar style\u201D buttons by\
+ buttons are configured to be “toolbar style” buttons by\
telling them that they are to use the Toolbutton style. At the left\
end of the toolbar is a simple marker that the cursor changes to a\
movement icon over; drag that away from the toolbar to tear off the\
diff --git a/library/demos/ttkbut.tcl b/library/demos/ttkbut.tcl
index ab49cf4..f6d94ac 100644
--- a/library/demos/ttkbut.tcl
+++ b/library/demos/ttkbut.tcl
@@ -17,7 +17,7 @@ wm title $w "Simple Ttk Widgets"
wm iconname $w "ttkbut"
positionWindow $w
-ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Ttk is the new Tk themed widget set. This is a Ttk themed label, and below are three groups of Ttk widgets in Ttk labelframes. The first group are all buttons that set the current application theme when pressed. The second group contains three sets of checkbuttons, with a separator widget between the sets. Note that the \u201cEnabled\u201d button controls whether all the other themed widgets in this toplevel are in the disabled state. The third group has a collection of linked radiobuttons."
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Ttk is the new Tk themed widget set. This is a Ttk themed label, and below are three groups of Ttk widgets in Ttk labelframes. The first group are all buttons that set the current application theme when pressed. The second group contains three sets of checkbuttons, with a separator widget between the sets. Note that the “Enabled” button controls whether all the other themed widgets in this toplevel are in the disabled state. The third group has a collection of linked radiobuttons."
pack $w.msg -side top -fill x
## See Code / Dismiss
diff --git a/library/demos/ttkprogress.tcl b/library/demos/ttkprogress.tcl
index 8a72cf9..29ac508 100644
--- a/library/demos/ttkprogress.tcl
+++ b/library/demos/ttkprogress.tcl
@@ -15,7 +15,7 @@ wm title $w "Progress Bar Demonstration"
wm iconname $w "ttkprogress"
positionWindow $w
-ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Below are two progress bars. The top one is a \u201Cdeterminate\u201D progress bar, which is used for showing how far through a defined task the program has got. The bottom one is an \u201Cindeterminate\u201D progress bar, which is used to show that the program is busy but does not know how long for. Both are run here in self-animated mode, which can be turned on and off using the buttons underneath."
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Below are two progress bars. The top one is a “determinate” progress bar, which is used for showing how far through a defined task the program has got. The bottom one is an “indeterminate” progress bar, which is used to show that the program is busy but does not know how long for. Both are run here in self-animated mode, which can be turned on and off using the buttons underneath."
pack $w.msg -side top -fill x
## See Code / Dismiss buttons
diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl
index 759dc00..1ecc064 100644
--- a/library/demos/unicodeout.tcl
+++ b/library/demos/unicodeout.tcl
@@ -21,9 +21,7 @@ label $w.msg -font $font -wraplength 4i -anchor w -justify left \
non-Western character sets. However, what you will actually see\
below depends largely on what character sets you have installed,\
and what you see for characters that are not present varies greatly\
- between platforms as well. The strings are written in Tcl using\
- UNICODE characters using the \\uXXXX escape so as to do so in a\
- portable fashion."
+ between platforms as well."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -98,46 +96,29 @@ update
## Add the samples...
if {[usePresentationFormsFor Arabic]} {
# Using presentation forms (pre-layouted)
- addSample $w Arabic \
- "\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D " \
- "\uFE94\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D"
+ addSample $w Arabic "ﺔﻴﺑﺮﻌﻟﺍ ﺔﻤﻠﻜﻟﺍ"
} else {
# Using standard text characters
- addSample $w Arabic \
- "\u0627\u0644\u0643\u0644\u0645\u0629 " \
- "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
+ addSample $w Arabic "الكلمة العربية"
}
-addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
-addSample $w "Simpl. Chinese" "\u6C49\u8BED"
-addSample $w French "Langue fran\xE7aise"
-addSample $w Greek \
- "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \
- "\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1"
+addSample $w "Trad. Chinese" "中國的漢字"
+addSample $w "Simpl. Chinese" "汉语"
+addSample $w French "Langue française"
+addSample $w Greek "Ελληνική γλώσσα"
if {[usePresentationFormsFor Hebrew]} {
# Visual order (pre-layouted)
- addSample $w Hebrew \
- "\u05EA\u05D9\u05E8\u05D1\u05E2 \u05D1\u05EA\u05DB"
+ addSample $w Hebrew "תירבע בתכ"
} else {
# Standard logical order
- addSample $w Hebrew \
- "\u05DB\u05EA\u05D1 \u05E2\u05D1\u05E8\u05D9\u05EA"
+ addSample $w Hebrew "כתב עברית"
}
-addSample $w Hindi \
- "\u0939\u093F\u0928\u094D\u0926\u0940 \u092D\u093E\u0937\u093E"
-addSample $w Icelandic "\xCDslenska"
-addSample $w Japanese \
- "\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \
- "\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA"
-addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00"
-addSample $w Russian \
- "\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A"
+addSample $w Hindi "हिन्दी भाषा"
+addSample $w Icelandic "Íslenska"
+addSample $w Japanese "日本語のひらがな, 漢字とカタカナ"
+addSample $w Korean "대한민국의 한글"
+addSample $w Russian "Русский язык"
if {([tk windowingsystem] ne "x11") || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))} {
- if {[package vsatisfies [package provide Tcl] 8.7-]} {
- addSample $w Emoji "😀💩👍🇳🇱"
- } else {
- addSample $w Emoji \
- "\uD83D\uDE00\uD83D\uDCA9\uD83D\uDC4D\uD83C\uDDF3\uD83C\uDDF1"
- }
+ addSample $w Emoji "😀💩👍🇳🇱"
}
## We're done processing, so change things back to normal running...
diff --git a/library/demos/widget b/library/demos/widget
index 13b8d0e..5bf1e2a 100644
--- a/library/demos/widget
+++ b/library/demos/widget
@@ -366,7 +366,6 @@ addFormattedText {
@@subtitle Scales and Progress Bars
@@demo hscale Horizontal scale
@@demo vscale Vertical scale
- @@new
@@demo ttkscale Themed scale linked to a label with traces
@@demo ttkprogress Progress bar
@@ -387,6 +386,10 @@ addFormattedText {
@@demo filebox File selection dialog
@@demo clrpick Color picker
@@demo fontchoose Font selection dialog
+ @@new
+ @@demo systray System tray icon and notification
+ @@new
+ @@demo print Printing from canvas and text widgets
@@subtitle Animation
@@demo anilabel Animated labels
@@ -640,80 +643,7 @@ proc showCode w {
# file - Name of the original file (implicitly for title)
proc printCode {w file} {
- set code [$w get 1.0 end-1c]
-
- set dir "."
- if {[info exists ::env(HOME)]} {
- set dir "$::env(HOME)"
- }
- if {[info exists ::env(TMP)]} {
- set dir $::env(TMP)
- }
- if {[info exists ::env(TEMP)]} {
- set dir $::env(TEMP)
- }
-
- set filename [file join $dir "tkdemo-$file"]
- set outfile [open $filename "w"]
- puts $outfile $code
- close $outfile
-
- switch -- $::tcl_platform(platform) {
- unix {
- if {[catch {exec lp -c $filename} msg]} {
- tk_messageBox -title "Print spooling failure" \
- -message "Print spooling probably failed: $msg"
- }
- }
- windows {
- if {[catch {PrintTextWin32 $filename} msg]} {
- tk_messageBox -title "Print spooling failure" \
- -message "Print spooling probably failed: $msg"
- }
- }
- default {
- tk_messageBox -title "Operation not Implemented" \
- -message "Wow! Unknown platform: $::tcl_platform(platform)"
- }
- }
-
- #
- # Be careful to throw away the temporary file in a gentle manner ...
- #
- if {[file exists $filename]} {
- catch {file delete $filename}
- }
-}
-
-# PrintTextWin32 --
-# Print a file under Windows using all the "intelligence" necessary
-#
-# Arguments:
-# filename - Name of the file
-#
-# Note:
-# Taken from the Wiki page by Keith Vetter, "Printing text files under
-# Windows".
-# Note:
-# Do not execute the command in the background: that way we can dispose of the
-# file smoothly.
-#
-proc PrintTextWin32 {filename} {
- package require registry
- set app [auto_execok notepad.exe]
- set pcmd "$app /p %1"
- catch {
- set app [registry get {HKEY_CLASSES_ROOT\.txt} {}]
- set pcmd [registry get \
- {HKEY_CLASSES_ROOT\\$app\\shell\\print\\command} {}]
- }
-
- regsub -all {%1} $pcmd $filename pcmd
- puts $pcmd
-
- regsub -all {\\} $pcmd {\\\\} pcmd
- set command "[auto_execok start] /min $pcmd"
- eval exec $command
+ tk print $w
}
# tkAboutDialog --
@@ -723,10 +653,11 @@ proc PrintTextWin32 {filename} {
proc tkAboutDialog {} {
tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \
-message [mc "Tk widget demonstration application"] -detail \
-"[mc "Copyright \xA9 %s" {1996-1997 Sun Microsystems, Inc.}]
-[mc "Copyright \xA9 %s" {1997-2000 Ajuba Solutions, Inc.}]
-[mc "Copyright \xA9 %s" {2001-2009 Donal K. Fellows}]
-[mc "Copyright \xA9 %s" {2002-2007 Daniel A. Steffen}]"
+"[mc "Copyright © %s" {1996-1997 Sun Microsystems, Inc.}]
+[mc "Copyright © %s" {1997-2000 Ajuba Solutions, Inc.}]
+[mc "Copyright © %s" {2001-2009 Donal K. Fellows}]
+[mc "Copyright © %s" {2002-2007 Daniel A. Steffen}]
+[mc "Copyright © %s" {2021 Kevin Walzer}]"
}
# Local Variables:
diff --git a/library/dialog.tcl b/library/dialog.tcl
index a099d90..ffbd8e4 100644
--- a/library/dialog.tcl
+++ b/library/dialog.tcl
@@ -3,8 +3,8 @@
# This file defines the procedure tk_dialog, which creates a dialog
# box containing a bitmap, a message, and one or more buttons.
#
-# Copyright (c) 1992-1993 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1992-1993 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/entry.tcl b/library/entry.tcl
index 6539af7..99f6eb4 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -3,8 +3,8 @@
# This file defines the default bindings for Tk entry widgets and provides
# procedures that help in implementing those bindings.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -209,9 +209,7 @@ bind Entry <KP_Enter> {# nothing}
bind Entry <Tab> {# nothing}
bind Entry <Prior> {# nothing}
bind Entry <Next> {# nothing}
-if {[tk windowingsystem] eq "aqua"} {
- bind Entry <Command-Key> {# nothing}
-}
+bind Entry <Command-Key> {# nothing}
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
bind Entry <<NextLine>> {# nothing}
bind Entry <<PrevLine>> {# nothing}
@@ -293,28 +291,15 @@ bind Entry <<TkAccentBackspace>> {
# A few additional bindings of my own.
-if {[tk windowingsystem] ne "aqua"} {
- bind Entry <Button-2> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanMark %W %x
- }
- }
- bind Entry <B2-Motion> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanDrag %W %x
- }
- }
-} else {
- bind Entry <Button-3> {
- if {!$tk_strictMotif} {
+bind Entry <Button-2> {
+ if {!$tk_strictMotif} {
::tk::EntryScanMark %W %x
- }
}
- bind Entry <B3-Motion> {
- if {!$tk_strictMotif} {
+}
+bind Entry <B2-Motion> {
+ if {!$tk_strictMotif} {
::tk::EntryScanDrag %W %x
- }
- }
+ }
}
# ::tk::EntryClosestGap --
diff --git a/library/focus.tcl b/library/focus.tcl
index 640406e..2cf5ad7 100644
--- a/library/focus.tcl
+++ b/library/focus.tcl
@@ -3,7 +3,7 @@
# This file defines several procedures for managing the input
# focus.
#
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/fontchooser.tcl b/library/fontchooser.tcl
index 9d49c57..a9a8f51 100644
--- a/library/fontchooser.tcl
+++ b/library/fontchooser.tcl
@@ -2,8 +2,8 @@
#
# A themeable Tk font selection dialog. See TIP #324.
#
-# Copyright (C) 2008 Keith Vetter
-# Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 2008 Keith Vetter
+# Copyright © 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/iconlist.tcl b/library/iconlist.tcl
index 34b19d0..fb372a3 100644
--- a/library/iconlist.tcl
+++ b/library/iconlist.tcl
@@ -3,8 +3,8 @@
# Implements the icon-list megawidget used in the "Tk" standard file
# selection dialog boxes.
#
-# Copyright (c) 1994-1998 Sun Microsystems, Inc.
-# Copyright (c) 2009 Donal K. Fellows
+# Copyright © 1994-1998 Sun Microsystems, Inc.
+# Copyright © 2009 Donal K. Fellows
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -26,7 +26,7 @@
# <path> selection includes <item>
# <path> selection set <first> ?<last>?
-package require Tk
+package require tk
::tk::Megawidget create ::tk::IconList ::tk::FocusableWidget {
variable w canvas sbar accel accelCB fill font index \
@@ -433,11 +433,11 @@ package require Tk
#
bind $canvas <Configure> [namespace code {my WhenIdle Arrange}]
- bind $canvas <1> [namespace code {my Btn1 %x %y}]
+ bind $canvas <Button-1> [namespace code {my Btn1 %x %y}]
bind $canvas <B1-Motion> [namespace code {my Motion1 %x %y}]
bind $canvas <B1-Leave> [namespace code {my Leave1 %x %y}]
- bind $canvas <Control-1> [namespace code {my CtrlBtn1 %x %y}]
- bind $canvas <Shift-1> [namespace code {my ShiftBtn1 %x %y}]
+ bind $canvas <Control-Button-1> [namespace code {my CtrlBtn1 %x %y}]
+ bind $canvas <Shift-Button-1> [namespace code {my ShiftBtn1 %x %y}]
bind $canvas <B1-Enter> [list tk::CancelRepeat]
bind $canvas <ButtonRelease-1> [list tk::CancelRepeat]
bind $canvas <Double-ButtonRelease-1> \
@@ -446,25 +446,18 @@ package require Tk
bind $canvas <Control-B1-Motion> {;}
bind $canvas <Shift-B1-Motion> [namespace code {my ShiftMotion1 %x %y}]
- if {[tk windowingsystem] eq "aqua"} {
- bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel [expr {40 * (%D)}]}]
- bind $canvas <Option-Shift-MouseWheel> [namespace code {my MouseWheel [expr {400 * (%D)}]}]
- } else {
- bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel %D}]
- }
- if {[tk windowingsystem] eq "x11"} {
- bind $canvas <Shift-4> [namespace code {my MouseWheel 120}]
- bind $canvas <Shift-5> [namespace code {my MouseWheel -120}]
- }
+ bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel %D}]
+ bind $canvas <Option-Shift-MouseWheel> [namespace code {my MouseWheel %D -12}]
+
bind $canvas <<PrevLine>> [namespace code {my UpDown -1}]
bind $canvas <<NextLine>> [namespace code {my UpDown 1}]
bind $canvas <<PrevChar>> [namespace code {my LeftRight -1}]
bind $canvas <<NextChar>> [namespace code {my LeftRight 1}]
bind $canvas <Return> [namespace code {my ReturnKey}]
- bind $canvas <KeyPress> [namespace code {my KeyPress %A}]
- bind $canvas <Control-KeyPress> ";"
- bind $canvas <Alt-KeyPress> ";"
+ bind $canvas <Key> [namespace code {my KeyPress %A}]
+ bind $canvas <Control-Key> ";"
+ bind $canvas <Alt-Key> ";"
bind $canvas <FocusIn> [namespace code {my FocusIn}]
bind $canvas <FocusOut> [namespace code {my FocusOut}]
@@ -503,15 +496,11 @@ package require Tk
# ----------------------------------------------------------------------
# Event handlers
- method MouseWheel {amount} {
+ method MouseWheel {amount {factor -120.0}} {
if {$noScroll || $::tk_strictMotif} {
return
}
- if {$amount > 0} {
- $canvas xview scroll [expr {(-119-$amount) / 120}] units
- } else {
- $canvas xview scroll [expr {-($amount / 120)}] units
- }
+ $canvas xview scroll [expr {$amount/$factor}] units
}
method Btn1 {x y} {
focus $canvas
diff --git a/library/icons.tcl b/library/icons.tcl
index 87af75a..1cd0e1e 100644
--- a/library/icons.tcl
+++ b/library/icons.tcl
@@ -8,7 +8,7 @@
#
# See http://tango.freedesktop.org/Tango_Desktop_Project
#
-# Copyright (c) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
namespace eval ::tk::icons {}
diff --git a/library/images/logo.eps b/library/images/logo.eps
index 0d05d34..006e72a 100644
--- a/library/images/logo.eps
+++ b/library/images/logo.eps
@@ -28,7 +28,7 @@
%%BeginProlog
%%BeginResource: procset Adobe_level2_AI5 1.0 0
%%Title: (Adobe Illustrator (R) Version 5.0 Level 2 Emulation)
-%%Version: 1.0
+%%Version: 1.0
%%CreationDate: (04/10/93) ()
%%Copyright: ((C) 1987-1993 Adobe Systems Incorporated All Rights Reserved)
userdict /Adobe_level2_AI5 21 dict dup begin
@@ -77,7 +77,7 @@ userdict /Adobe_level2_AI5 21 dict dup begin
}
def
} if
-
+
/gt38? mark {version cvx exec} stopped {cleartomark true} {38 gt exch pop} ifelse def
userdict /deviceDPI 72 0 matrix defaultmatrix dtransform dup mul exch dup mul add sqrt put
userdict /level2?
@@ -178,7 +178,7 @@ userdict /Adobe_level2_AI5 21 dict dup begin
%%EndResource
%%BeginResource: procset Adobe_IllustratorA_AI5 1.1 0
%%Title: (Adobe Illustrator (R) Version 5.0 Abbreviated Prolog)
-%%Version: 1.1
+%%Version: 1.1
%%CreationDate: (3/7/1994) ()
%%Copyright: ((C) 1987-1994 Adobe Systems Incorporated All Rights Reserved)
currentpacking true setpacking
@@ -1062,7 +1062,7 @@ end
}
{
/clipForward? true def
-
+
/Tx /pop load def
/Tj /pop load def
currentdict end clipRenderOff begin begin
@@ -1089,7 +1089,7 @@ end
end
end
begin
-
+
/clipForward? false ddef
} if
} ifelse
diff --git a/library/images/pwrdLogo.eps b/library/images/pwrdLogo.eps
index e11d9e9..674250f 100644
--- a/library/images/pwrdLogo.eps
+++ b/library/images/pwrdLogo.eps
@@ -28,7 +28,7 @@
%%BeginProlog
%%BeginResource: procset Adobe_level2_AI5 1.0 0
%%Title: (Adobe Illustrator (R) Version 5.0 Level 2 Emulation)
-%%Version: 1.0
+%%Version: 1.0
%%CreationDate: (04/10/93) ()
%%Copyright: ((C) 1987-1993 Adobe Systems Incorporated All Rights Reserved)
userdict /Adobe_level2_AI5 21 dict dup begin
@@ -77,7 +77,7 @@ userdict /Adobe_level2_AI5 21 dict dup begin
}
def
} if
-
+
/gt38? mark {version cvx exec} stopped {cleartomark true} {38 gt exch pop} ifelse def
userdict /deviceDPI 72 0 matrix defaultmatrix dtransform dup mul exch dup mul add sqrt put
userdict /level2?
@@ -178,7 +178,7 @@ userdict /Adobe_level2_AI5 21 dict dup begin
%%EndResource
%%BeginResource: procset Adobe_IllustratorA_AI5 1.1 0
%%Title: (Adobe Illustrator (R) Version 5.0 Abbreviated Prolog)
-%%Version: 1.1
+%%Version: 1.1
%%CreationDate: (3/7/1994) ()
%%Copyright: ((C) 1987-1994 Adobe Systems Incorporated All Rights Reserved)
currentpacking true setpacking
@@ -1062,7 +1062,7 @@ end
}
{
/clipForward? true def
-
+
/Tx /pop load def
/Tj /pop load def
currentdict end clipRenderOff begin begin
@@ -1089,7 +1089,7 @@ end
end
end
begin
-
+
/clipForward? false ddef
} if
} ifelse
diff --git a/library/listbox.tcl b/library/listbox.tcl
index 44abfb9..7166847 100644
--- a/library/listbox.tcl
+++ b/library/listbox.tcl
@@ -3,9 +3,9 @@
# This file defines the default bindings for Tk listbox widgets
# and provides procedures that help in implementing those bindings.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998 Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -31,7 +31,7 @@
# can put "break"s in their bindings to avoid the error, but this check
# makes that unnecessary.
-bind Listbox <1> {
+bind Listbox <Button-1> {
if {[winfo exists %W]} {
tk::ListboxBeginSelect %W [%W index @%x,%y] 1
}
@@ -41,7 +41,7 @@ bind Listbox <1> {
# Among other things, this prevents errors if the user deletes the
# listbox on a double click.
-bind Listbox <Double-1> {
+bind Listbox <Double-Button-1> {
# Empty script
}
@@ -54,10 +54,10 @@ bind Listbox <ButtonRelease-1> {
tk::CancelRepeat
%W activate @%x,%y
}
-bind Listbox <Shift-1> {
+bind Listbox <Shift-Button-1> {
tk::ListboxBeginExtend %W [%W index @%x,%y]
}
-bind Listbox <Control-1> {
+bind Listbox <Control-Button-1> {
tk::ListboxBeginToggle %W [%W index @%x,%y]
}
bind Listbox <B1-Leave> {
@@ -169,72 +169,24 @@ bind Listbox <<SelectNone>> {
# Additional Tk bindings that aren't part of the Motif look and feel:
-bind Listbox <2> {
+bind Listbox <Button-2> {
%W scan mark %x %y
}
bind Listbox <B2-Motion> {
%W scan dragto %x %y
}
-# The MouseWheel will typically only fire on Windows and Mac OS X.
-# However, someone could use the "event generate" command to produce
-# one on other platforms.
-
-if {[tk windowingsystem] eq "aqua"} {
- bind Listbox <MouseWheel> {
- %W yview scroll [expr {-(%D)}] units
- }
- bind Listbox <Option-MouseWheel> {
- %W yview scroll [expr {-10 * (%D)}] units
- }
- bind Listbox <Shift-MouseWheel> {
- %W xview scroll [expr {-(%D)}] units
- }
- bind Listbox <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-10 * (%D)}] units
- }
-} else {
- bind Listbox <MouseWheel> {
- if {%D >= 0} {
- %W yview scroll [expr {-%D/30}] units
- } else {
- %W yview scroll [expr {(29-%D)/30}] units
- }
- }
- bind Listbox <Shift-MouseWheel> {
- if {%D >= 0} {
- %W xview scroll [expr {-%D/30}] units
- } else {
- %W xview scroll [expr {(29-%D)/30}] units
- }
- }
+bind Listbox <MouseWheel> {
+ tk::MouseWheel %W y %D -40.0
}
-
-if {[tk windowingsystem] eq "x11"} {
- # Support for mousewheels on Linux/Unix commonly comes through mapping
- # the wheel to the extended buttons. If you have a mousewheel, find
- # Linux configuration info at:
- # https://linuxreviews.org/HOWTO_change_the_mouse_speed_in_X
- bind Listbox <4> {
- if {!$tk_strictMotif} {
- %W yview scroll -5 units
- }
- }
- bind Listbox <Shift-4> {
- if {!$tk_strictMotif} {
- %W xview scroll -5 units
- }
- }
- bind Listbox <5> {
- if {!$tk_strictMotif} {
- %W yview scroll 5 units
- }
- }
- bind Listbox <Shift-5> {
- if {!$tk_strictMotif} {
- %W xview scroll 5 units
- }
- }
+bind Listbox <Option-MouseWheel> {
+ tk::MouseWheel %W y %D -12.0
+}
+bind Listbox <Shift-MouseWheel> {
+ tk::MouseWheel %W x %D -40.0
+}
+bind Listbox <Shift-Option-MouseWheel> {
+ tk::MouseWheel %W x %D -12.0
}
# ::tk::ListboxBeginSelect --
diff --git a/library/megawidget.tcl b/library/megawidget.tcl
index ec9f469..ff7b2ce 100644
--- a/library/megawidget.tcl
+++ b/library/megawidget.tcl
@@ -4,13 +4,13 @@
# the ::tk::IconList megawdget, which is itself only designed for use in
# the Unix file dialogs.
#
-# Copyright (c) 2009-2010 Donal K. Fellows
+# Copyright © 2009-2010 Donal K. Fellows
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-package require Tk
+package require tk
::oo::class create ::tk::Megawidget {
superclass ::oo::class
diff --git a/library/menu.tcl b/library/menu.tcl
index 823fd69..75e173d 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -4,10 +4,10 @@
# It also implements keyboard traversal of menus and implements a few
# other utility procedures related to menus.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 Scriptics Corporation.
-# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 2007 Daniel A. Steffen <das@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -88,7 +88,7 @@ bind Menubutton <Enter> {
bind Menubutton <Leave> {
tk::MbLeave %W
}
-bind Menubutton <1> {
+bind Menubutton <Button-1> {
if {$tk::Priv(inMenubutton) ne ""} {
tk::MbPost $tk::Priv(inMenubutton) %X %Y
}
@@ -168,7 +168,7 @@ bind Menu <<PrevLine>> {
bind Menu <<NextLine>> {
tk::MenuDownArrow %W
}
-bind Menu <KeyPress> {
+bind Menu <Key> {
tk::TraverseWithinMenu %W %A
break
}
@@ -177,7 +177,7 @@ bind Menu <KeyPress> {
# implement keyboard menu traversal.
if {[tk windowingsystem] eq "x11"} {
- bind all <Alt-KeyPress> {
+ bind all <Alt-Key> {
tk::TraverseToMenu %W %A
}
@@ -185,7 +185,7 @@ if {[tk windowingsystem] eq "x11"} {
tk::FirstMenu %W
}
} else {
- bind Menubutton <Alt-KeyPress> {
+ bind Menubutton <Alt-Key> {
tk::TraverseToMenu %W %A
}
@@ -488,6 +488,7 @@ proc ::tk::MenuMotion {menu x y state} {
set index [$menu index @$x,$y]
if {[info exists Priv(menuActivated)] \
&& $index ne "none" \
+ && $index >= 0 \
&& $index ne $active} {
set mode [option get $menu clickToFocus ClickToFocus]
if {[string is false $mode]} {
@@ -527,7 +528,8 @@ proc ::tk::MenuButtonDown menu {
if {![winfo viewable $menu]} {
return
}
- if {[$menu index active] eq "none"} {
+ set active [$menu index active]
+ if {$active eq "none" || $active < 0} {
if {[$menu cget -type] ne "menubar" } {
set Priv(window) {}
}
@@ -585,7 +587,8 @@ proc ::tk::MenuButtonDown menu {
proc ::tk::MenuLeave {menu rootx rooty state} {
variable ::tk::Priv
set Priv(window) {}
- if {[$menu index active] eq "none"} {
+ set active [$menu index active]
+ if {$active eq "none" || $active < 0} {
return
}
if {[$menu type active] eq "cascade" \
@@ -653,7 +656,7 @@ proc ::tk::MenuInvoke {w buttonRelease} {
}
} else {
set active [$w index active]
- if {$Priv(popup) eq "" || $active ne "none"} {
+ if {$Priv(popup) eq "" || ($active ne "none" && $active >= 0)} {
MenuUnpost $w
}
uplevel #0 [list $w invoke active]
@@ -797,7 +800,8 @@ proc ::tk::MenuNextMenu {menu direction} {
if {[winfo class $mb] eq "Menubutton" \
&& [$mb cget -state] ne "disabled" \
&& [$mb cget -menu] ne "" \
- && [[$mb cget -menu] index last] ne "none"} {
+ && [[$mb cget -menu] index last] ne "none" \
+ && [[$mb cget -menu] index last] >= 0} {
break
}
if {$mb eq $w} {
@@ -819,13 +823,14 @@ proc ::tk::MenuNextMenu {menu direction} {
# -1 means go to the next higher entry.
proc ::tk::MenuNextEntry {menu count} {
- if {[$menu index last] eq "none"} {
+ set last [$menu index last]
+ if {$last eq "none" || $last < 0} {
return
}
set length [expr {[$menu index last]+1}]
set quitAfter $length
set active [$menu index active]
- if {$active eq "none"} {
+ if {$active eq "none" || $active < 0} {
set i 0
} else {
set i [expr {$active + $count}]
@@ -1068,7 +1073,8 @@ proc ::tk::MenuFirstEntry menu {
return
}
tk_menuSetFocus $menu
- if {[$menu index active] ne "none"} {
+ set active [$menu index active]
+ if {$active ne "none" && $active >= 0} {
return
}
set last [$menu index last]
diff --git a/library/msgbox.tcl b/library/msgbox.tcl
index 646c143..b401ad1 100644
--- a/library/msgbox.tcl
+++ b/library/msgbox.tcl
@@ -3,7 +3,7 @@
# Implements messageboxes for platforms that do not have native
# messagebox support.
#
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/msgs/cs.msg b/library/msgs/cs.msg
index d6be730..c9ee256 100644
--- a/library/msgs/cs.msg
+++ b/library/msgs/cs.msg
@@ -1,77 +1,95 @@
namespace eval ::tk {
- ::msgcat::mcset cs "&Abort" "&P\u0159eru\u0161it"
+ ::msgcat::mcset cs "&Abort" "&Přerušit"
::msgcat::mcset cs "&About..." "&O programu..."
- ::msgcat::mcset cs "All Files" "V\u0161echny soubory"
+ ::msgcat::mcset cs "All Files" "Všechny soubory"
::msgcat::mcset cs "Application Error" "Chyba programu"
::msgcat::mcset cs "Bold Italic"
- ::msgcat::mcset cs "&Blue" "&Modr\341"
- ::msgcat::mcset cs "Cancel" "Zru\u0161it"
- ::msgcat::mcset cs "&Cancel" "&Zru\u0161it"
- ::msgcat::mcset cs "Cannot change to the directory \"%1\$s\".\nPermission denied." "Nemohu zm\u011bnit atku\341ln\355 adres\341\u0159 na \"%1\$s\".\nP\u0159\355stup odm\355tnut."
- ::msgcat::mcset cs "Choose Directory" "V\375b\u011br adres\341\u0159e"
+ ::msgcat::mcset cs "&Blue" "&Modá"
+ ::msgcat::mcset cs "Cancel" "Zrušit"
+ ::msgcat::mcset cs "&Cancel" "&Zrušit"
+ ::msgcat::mcset cs "Cannot change to the directory \"%1\$s\".\nPermission denied." "Nemohu změnit atkálí adreář na \"%1\$s\".\nPístup odítnut."
+ ::msgcat::mcset cs "Choose Directory" "ýběr adreáře"
::msgcat::mcset cs "Cl&ear" "Sma&zat"
::msgcat::mcset cs "&Clear Console" "&Smazat konzolu"
::msgcat::mcset cs "Color" "Barva"
::msgcat::mcset cs "Console" "Konzole"
- ::msgcat::mcset cs "&Copy" "&Kop\355rovat"
- ::msgcat::mcset cs "Cu&t" "V&y\u0159\355znout"
+ ::msgcat::mcset cs "&Copy" "&Koírovat"
+ ::msgcat::mcset cs "Cu&t" "V&yíznout"
::msgcat::mcset cs "&Delete" "&Smazat"
::msgcat::mcset cs "Details >>" "Detaily >>"
- ::msgcat::mcset cs "Directory \"%1\$s\" does not exist." "Adres\341\u0159 \"%1\$s\" neexistuje."
- ::msgcat::mcset cs "&Directory:" "&Adres\341\u0159:"
- ::msgcat::mcset cs "&Edit" "&\332pravy"
+ ::msgcat::mcset cs "Directory \"%1\$s\" does not exist." "Adreář \"%1\$s\" neexistuje."
+ ::msgcat::mcset cs "&Directory:" "&Adreář:"
+ ::msgcat::mcset cs "&Edit" "Úpravy"
::msgcat::mcset cs "Error: %1\$s" "Chyba: %1\$s"
::msgcat::mcset cs "E&xit" "&Konec"
::msgcat::mcset cs "&File" "&Soubor"
- ::msgcat::mcset cs "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Soubor \"%1\$s\" ji\u017e existuje.\nChcete jej p\u0159epsat?"
- ::msgcat::mcset cs "File \"%1\$s\" already exists.\n\n" "Soubor \"%1\$s\" ji\u017e existuje.\n\n"
+ ::msgcat::mcset cs "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Soubor \"%1\$s\" již existuje.\nChcete jej přepsat?"
+ ::msgcat::mcset cs "File \"%1\$s\" already exists.\n\n" "Soubor \"%1\$s\" již existuje.\n\n"
::msgcat::mcset cs "File \"%1\$s\" does not exist." "Soubor \"%1\$s\" neexistuje."
- ::msgcat::mcset cs "File &name:" "&Jm\351no souboru:"
- ::msgcat::mcset cs "File &names:" "&Jm\351na soubor\u016f:"
- ::msgcat::mcset cs "Files of &type:" "&Typy soubor\u016f:"
+ ::msgcat::mcset cs "File &name:" "&Jéno souboru:"
+ ::msgcat::mcset cs "File &names:" "&Jéna souborů:"
+ ::msgcat::mcset cs "Files of &type:" "&Typy souborů:"
::msgcat::mcset cs "Fi&les:" "Sou&bory:"
::msgcat::mcset cs "&Filter" "&Filtr"
::msgcat::mcset cs "Fil&ter:" "Fil&tr:"
::msgcat::mcset cs "Font st&yle:"
- ::msgcat::mcset cs "&Green" "Ze&len\341"
- ::msgcat::mcset cs "&Help" "&N\341pov\u011bda"
+ ::msgcat::mcset cs "&Green" "Ze&leá"
+ ::msgcat::mcset cs "&Help" "&ápověda"
::msgcat::mcset cs "Hi" "Ahoj"
::msgcat::mcset cs "&Hide Console" "&Schovat Konzolu"
::msgcat::mcset cs "&Ignore" "&Ignorovat"
- ::msgcat::mcset cs "Invalid file name \"%1\$s\"." "\u0160patn\351 jm\351no souboru \"%1\$s\"."
+ ::msgcat::mcset cs "Invalid file name \"%1\$s\"." "Špaté jéno souboru \"%1\$s\"."
::msgcat::mcset cs "Log Files" "Log soubory"
::msgcat::mcset cs "&No" "&Ne"
::msgcat::mcset cs "&OK"
::msgcat::mcset cs "OK"
::msgcat::mcset cs "Ok"
- ::msgcat::mcset cs "Open" "Otev\u0159\355t"
- ::msgcat::mcset cs "&Open" "&Otev\u0159\355t"
- ::msgcat::mcset cs "Open Multiple Files" "Otev\u0159\355t v\355ce soubor\u016f"
- ::msgcat::mcset cs "P&aste" "&Vlo\u017eit"
- ::msgcat::mcset cs "&Quit" "&Ukon\u010dit"
- ::msgcat::mcset cs "&Red" "\u010ce&rven\341"
- ::msgcat::mcset cs "Replace existing file?" "Nahradit st\341vaj\355c\355 soubor?"
+ ::msgcat::mcset cs "Open" "Otevít"
+ ::msgcat::mcset cs "&Open" "&Otevít"
+ ::msgcat::mcset cs "Open Multiple Files" "Otevít íce souborů"
+ ::msgcat::mcset cs "P&aste" "&Vložit"
+ ::msgcat::mcset cs "&Quit" "&Ukončit"
+ ::msgcat::mcset cs "&Red" "Če&rveá"
+ ::msgcat::mcset cs "Replace existing file?" "Nahradit sávaíí soubor?"
::msgcat::mcset cs "&Retry" "Z&novu"
- ::msgcat::mcset cs "&Save" "&Ulo\u017eit"
- ::msgcat::mcset cs "Save As" "Ulo\u017eit jako"
- ::msgcat::mcset cs "Save To Log" "Ulo\u017eit do logu"
+ ::msgcat::mcset cs "&Save" "&Uložit"
+ ::msgcat::mcset cs "Save As" "Uložit jako"
+ ::msgcat::mcset cs "Save To Log" "Uložit do logu"
::msgcat::mcset cs "Select Log File" "Vybrat log soubor"
- ::msgcat::mcset cs "Select a file to source" "Vybrat soubor k nahr\341n\355"
- ::msgcat::mcset cs "&Selection:" "&V\375b\u011br:"
- ::msgcat::mcset cs "Skip Messages" "P\u0159esko\u010dit zpr\341vy"
+ ::msgcat::mcset cs "Select a file to source" "Vybrat soubor k naháí"
+ ::msgcat::mcset cs "&Selection:" "&ýběr:"
+ ::msgcat::mcset cs "Skip Messages" "Přeskočit zpávy"
::msgcat::mcset cs "&Source..." "&Zdroj..."
::msgcat::mcset cs "Tcl Scripts" "Tcl skripty"
::msgcat::mcset cs "Tcl for Windows" "Tcl pro Windows"
- ::msgcat::mcset cs "Text Files" "Textov\351 soubory"
- ::msgcat::mcset cs "abort" "p\u0159eru\u0161it"
- ::msgcat::mcset cs "blue" "modr\341"
- ::msgcat::mcset cs "cancel" "zru\u0161it"
- ::msgcat::mcset cs "extension" "p\u0159\355pona"
- ::msgcat::mcset cs "extensions" "p\u0159\355pony"
- ::msgcat::mcset cs "green" "zelen\341"
+ ::msgcat::mcset cs "Text Files" "Textoé soubory"
+ ::msgcat::mcset cs "abort" "přerušit"
+ ::msgcat::mcset cs "blue" "modá"
+ ::msgcat::mcset cs "cancel" "zrušit"
+ ::msgcat::mcset cs "extension" "pípona"
+ ::msgcat::mcset cs "extensions" "pípony"
+ ::msgcat::mcset cs "green" "zeleá"
::msgcat::mcset cs "ignore" "ignorovat"
::msgcat::mcset cs "ok"
- ::msgcat::mcset cs "red" "\u010derven\341"
+ ::msgcat::mcset cs "red" "červeá"
::msgcat::mcset cs "retry" "znovu"
::msgcat::mcset cs "yes" "ano"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset cs "Print" "Tisknout"
+ ::msgcat::mcset cs "Printer" "Tiskárna"
+ ::msgcat::mcset cs "Letter " "Dopis "
+ ::msgcat::mcset cs "Legal " "Legální "
+ ::msgcat::mcset cs "A4" "A4"
+ ::msgcat::mcset cs "Grayscale" "Stupně Šedi"
+ ::msgcat::mcset cs "RGB" "RGB"
+ ::msgcat::mcset cs "Options" "Možnosti"
+ ::msgcat::mcset cs "Copies" "Kopie"
+ ::msgcat::mcset cs "Paper" "Papír"
+ ::msgcat::mcset cs "Scale" "Škála"
+ ::msgcat::mcset cs "Orientation" "Orientace"
+ ::msgcat::mcset cs "Portrait" "Portrét"
+ ::msgcat::mcset cs "Landscape" "Krajina"
+ ::msgcat::mcset cs "Output" "Výstup"
+} \ No newline at end of file
diff --git a/library/msgs/da.msg b/library/msgs/da.msg
index c302c79..eb86516 100644
--- a/library/msgs/da.msg
+++ b/library/msgs/da.msg
@@ -3,11 +3,11 @@ namespace eval ::tk {
::msgcat::mcset da "&About..." "&Om..."
::msgcat::mcset da "All Files" "Alle filer"
::msgcat::mcset da "Application Error" "Programfejl"
- ::msgcat::mcset da "&Blue" "&Bl\u00E5"
+ ::msgcat::mcset da "&Blue" "&Blå"
::msgcat::mcset da "Cancel" "Annuller"
::msgcat::mcset da "&Cancel" "&Annuller"
::msgcat::mcset da "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan ikke skifte til katalog \"%1\$s\".\nIngen rettigheder."
- ::msgcat::mcset da "Choose Directory" "V\u00E6lg katalog"
+ ::msgcat::mcset da "Choose Directory" "Vælg katalog"
::msgcat::mcset da "Cl&ear" "&Ryd"
::msgcat::mcset da "&Clear Console" "&Ryd konsolen"
::msgcat::mcset da "Color" "Farve"
@@ -31,8 +31,8 @@ namespace eval ::tk {
::msgcat::mcset da "Fi&les:" "Fi&ler:"
::msgcat::mcset da "&Filter"
::msgcat::mcset da "Fil&ter:"
- ::msgcat::mcset da "&Green" "&Gr\u00F8n"
- ::msgcat::mcset da "&Help" "&Hj\u00E6lp"
+ ::msgcat::mcset da "&Green" "&Grøn"
+ ::msgcat::mcset da "&Help" "&Hjælp"
::msgcat::mcset da "Hi" "Hej"
::msgcat::mcset da "&Hide Console" "Skjul &konsol"
::msgcat::mcset da "&Ignore" "&Ignorer"
@@ -42,37 +42,55 @@ namespace eval ::tk {
::msgcat::mcset da "&OK" "&O.K."
::msgcat::mcset da "OK" "O.K."
::msgcat::mcset da "Ok"
- ::msgcat::mcset da "Open" "\u00C5bn"
- ::msgcat::mcset da "&Open" "&\u00C5bn"
- ::msgcat::mcset da "Open Multiple Files" "\u00C5bn flere filer"
- ::msgcat::mcset da "P&aste" "&Inds\u00E6t"
+ ::msgcat::mcset da "Open" "Åbn"
+ ::msgcat::mcset da "&Open" "&Åbn"
+ ::msgcat::mcset da "Open Multiple Files" "Åbn flere filer"
+ ::msgcat::mcset da "P&aste" "&Indsæt"
::msgcat::mcset da "&Quit" "&Afslut"
- ::msgcat::mcset da "&Red" "&R\u00F8d"
+ ::msgcat::mcset da "&Red" "&Rød"
::msgcat::mcset da "Replace existing file?" "Erstat eksisterende fil?"
::msgcat::mcset da "&Retry" "&Gentag"
::msgcat::mcset da "&Save" "&Gem"
::msgcat::mcset da "Save As" "Gem som"
::msgcat::mcset da "Save To Log" "Gem i log"
- ::msgcat::mcset da "Select Log File" "V\u00E6lg logfil"
- ::msgcat::mcset da "Select a file to source" "V\u00E6lg k\u00F8rbar fil"
+ ::msgcat::mcset da "Select Log File" "Vælg logfil"
+ ::msgcat::mcset da "Select a file to source" "Vælg kørbar fil"
::msgcat::mcset da "&Selection:" "&Udvalg:"
::msgcat::mcset da "Show &Hidden Directories" "Vis &skjulte kataloger"
::msgcat::mcset da "Show &Hidden Files and Directories" "Vis &skjulte filer og kataloger"
::msgcat::mcset da "Skip Messages" "Overspring beskeder"
- ::msgcat::mcset da "&Source..." "&K\u00F8r..."
+ ::msgcat::mcset da "&Source..." "&Kør..."
::msgcat::mcset da "Tcl Scripts" "Tcl-Skripter"
::msgcat::mcset da "Tcl for Windows" "Tcl for Windows"
::msgcat::mcset da "Text Files" "Tekstfiler"
::msgcat::mcset da "&Yes" "&Ja"
::msgcat::mcset da "abort" "afbryd"
- ::msgcat::mcset da "blue" "bl\u00E5"
+ ::msgcat::mcset da "blue" "blå"
::msgcat::mcset da "cancel" "afbryd"
::msgcat::mcset da "extension"
::msgcat::mcset da "extensions"
- ::msgcat::mcset da "green" "gr\u00F8n"
+ ::msgcat::mcset da "green" "grøn"
::msgcat::mcset da "ignore" "ignorer"
::msgcat::mcset da "ok"
- ::msgcat::mcset da "red" "r\u00F8d"
+ ::msgcat::mcset da "red" "rød"
::msgcat::mcset da "retry" "gentag"
::msgcat::mcset da "yes" "ja"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset da "Print" "Trykke"
+ ::msgcat::mcset da "Printer" "Printer"
+ ::msgcat::mcset da "Letter " "Brev"
+ ::msgcat::mcset da "Legal " "Juridisk"
+ ::msgcat::mcset da "A4" "A4"
+ ::msgcat::mcset da "Grayscale" "Gråtoneskala"
+ ::msgcat::mcset da "RGB" "Rgb"
+ ::msgcat::mcset da "Options" "Indstillinger"
+ ::msgcat::mcset da "Copies" "Kopier"
+ ::msgcat::mcset da "Paper" "Papir"
+ ::msgcat::mcset da "Scale" "Skalere"
+ ::msgcat::mcset da "Orientation" "Orientering"
+ ::msgcat::mcset da "Portrait" "Portræt"
+ ::msgcat::mcset da "Landscape" "Landskab"
+ ::msgcat::mcset da "Output" "Udskriv Publikation"
+} \ No newline at end of file
diff --git a/library/msgs/de.msg b/library/msgs/de.msg
index e420f8a..fb4a8e7 100644
--- a/library/msgs/de.msg
+++ b/library/msgs/de.msg
@@ -1,6 +1,6 @@
namespace eval ::tk {
::msgcat::mcset de "&Abort" "&Abbruch"
- ::msgcat::mcset de "&About..." "&\u00dcber..."
+ ::msgcat::mcset de "&About..." "&Über..."
::msgcat::mcset de "All Files" "Alle Dateien"
::msgcat::mcset de "Application Error" "Applikationsfehler"
::msgcat::mcset de "&Apply" "&Anwenden"
@@ -10,14 +10,14 @@ namespace eval ::tk {
::msgcat::mcset de "Cancel" "Abbruch"
::msgcat::mcset de "&Cancel" "&Abbruch"
::msgcat::mcset de "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kann nicht in das Verzeichnis \"%1\$s\" wechseln.\nKeine Rechte vorhanden."
- ::msgcat::mcset de "Choose Directory" "W\u00e4hle Verzeichnis"
- ::msgcat::mcset de "Cl&ear" "&R\u00fccksetzen"
- ::msgcat::mcset de "&Clear Console" "&Konsole l\u00f6schen"
+ ::msgcat::mcset de "Choose Directory" "Wähle Verzeichnis"
+ ::msgcat::mcset de "Cl&ear" "&Rücksetzen"
+ ::msgcat::mcset de "&Clear Console" "&Konsole löschen"
::msgcat::mcset de "Color" "Farbe"
::msgcat::mcset de "Console" "Konsole"
::msgcat::mcset de "&Copy" "&Kopieren"
::msgcat::mcset de "Cu&t" "Aus&schneiden"
- ::msgcat::mcset de "&Delete" "&L\u00f6schen"
+ ::msgcat::mcset de "&Delete" "&Löschen"
::msgcat::mcset de "Details >>"
::msgcat::mcset de "Directory \"%1\$s\" does not exist." "Das Verzeichnis \"%1\$s\" existiert nicht."
::msgcat::mcset de "&Directory:" "&Verzeichnis:"
@@ -26,7 +26,7 @@ namespace eval ::tk {
::msgcat::mcset de "Error: %1\$s" "Fehler: %1\$s"
::msgcat::mcset de "E&xit" "&Ende"
::msgcat::mcset de "&File" "&Datei"
- ::msgcat::mcset de "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Die Datei \"%1\$s\" ist bereits vorhanden.\nWollen sie diese Datei \u00fcberschreiben ?"
+ ::msgcat::mcset de "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Die Datei \"%1\$s\" ist bereits vorhanden.\nWollen sie diese Datei überschreiben ?"
::msgcat::mcset de "File \"%1\$s\" already exists.\n\n" "Die Datei \"%1\$s\" ist bereits vorhanden.\n\n"
::msgcat::mcset de "File \"%1\$s\" does not exist." "Die Datei \"%1\$s\" existiert nicht."
::msgcat::mcset de "File &name:" "Datei&name:"
@@ -38,22 +38,22 @@ namespace eval ::tk {
::msgcat::mcset de "Font" "Schriftart"
::msgcat::mcset de "&Font:" "Schriftart:"
::msgcat::mcset de "Font st&yle:" "Schriftschnitt:"
- ::msgcat::mcset de "&Green" "&Gr\u00fcn"
+ ::msgcat::mcset de "&Green" "&Grün"
::msgcat::mcset de "&Help" "&Hilfe"
::msgcat::mcset de "Hi" "Hallo"
::msgcat::mcset de "&Hide Console" "&Konsole unsichtbar machen"
::msgcat::mcset de "&Ignore" "&Ignorieren"
- ::msgcat::mcset de "Invalid file name \"%1\$s\"." "Ung\u00fcltiger Dateiname \"%1\$s\"."
+ ::msgcat::mcset de "Invalid file name \"%1\$s\"." "Ungültiger Dateiname \"%1\$s\"."
::msgcat::mcset de "Italic" "Kursiv"
::msgcat::mcset de "Log Files" "Protokolldatei"
::msgcat::mcset de "&No" "&Nein"
::msgcat::mcset de "&OK"
::msgcat::mcset de "OK"
::msgcat::mcset de "Ok"
- ::msgcat::mcset de "Open" "\u00d6ffnen"
- ::msgcat::mcset de "&Open" "\u00d6&ffnen"
- ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien \u00F6ffnen"
- ::msgcat::mcset de "P&aste" "E&inf\u00fcgen"
+ ::msgcat::mcset de "Open" "Öffnen"
+ ::msgcat::mcset de "&Open" "Ö&ffnen"
+ ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien Öffnen"
+ ::msgcat::mcset de "P&aste" "E&infügen"
::msgcat::mcset de "&Quit" "&Beenden"
::msgcat::mcset de "&Red" "&Rot"
::msgcat::mcset de "Regular" "Standard"
@@ -63,17 +63,17 @@ namespace eval ::tk {
::msgcat::mcset de "&Save" "&Speichern"
::msgcat::mcset de "Save As" "Speichern unter"
::msgcat::mcset de "Save To Log" "In Protokoll speichern"
- ::msgcat::mcset de "Select Log File" "Protokolldatei ausw\u00e4hlen"
- ::msgcat::mcset de "Select a file to source" "Auszuf\u00fchrende Datei ausw\u00e4hlen"
+ ::msgcat::mcset de "Select Log File" "Protokolldatei auswählen"
+ ::msgcat::mcset de "Select a file to source" "Auszuführende Datei auswählen"
::msgcat::mcset de "&Selection:" "Auswah&l:"
::msgcat::mcset de "&Size:" "Schriftgrad:"
::msgcat::mcset de "Show &Hidden Directories" "Zeige versteckte Dateien"
::msgcat::mcset de "Show &Hidden Files and Directories" "Zeige versteckte Dateien und Verzeichnisse"
- ::msgcat::mcset de "Skip Messages" "Weitere Nachrichten \u00fcberspringen"
- ::msgcat::mcset de "&Source..." "&Ausf\u00fchren..."
+ ::msgcat::mcset de "Skip Messages" "Weitere Nachrichten überspringen"
+ ::msgcat::mcset de "&Source..." "&Ausführen..."
::msgcat::mcset de "Stri&keout" "&Durchgestrichen"
::msgcat::mcset de "Tcl Scripts" "Tcl-Skripte"
- ::msgcat::mcset de "Tcl for Windows" "Tcl f\u00fcr Windows"
+ ::msgcat::mcset de "Tcl for Windows" "Tcl für Windows"
::msgcat::mcset de "Text Files" "Textdateien"
::msgcat::mcset de "&Underline" "&Unterstrichen"
::msgcat::mcset de "&Yes" "&Ja"
@@ -82,10 +82,28 @@ namespace eval ::tk {
::msgcat::mcset de "cancel" "abbrechen"
::msgcat::mcset de "extension" "Erweiterung"
::msgcat::mcset de "extensions" "Erweiterungen"
- ::msgcat::mcset de "green" "gr\u00fcn"
+ ::msgcat::mcset de "green" "grün"
::msgcat::mcset de "ignore" "ignorieren"
::msgcat::mcset de "ok"
::msgcat::mcset de "red" "rot"
::msgcat::mcset de "retry" "wiederholen"
::msgcat::mcset de "yes" "ja"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset de "Print" "Drucken"
+ ::msgcat::mcset de "Printer" "Drucker"
+ ::msgcat::mcset de "Letter " "Brief"
+ ::msgcat::mcset de "Legal " "Rechtlich"
+ ::msgcat::mcset de "A4" "A4"
+ ::msgcat::mcset de "Grayscale" "Graustufen"
+ ::msgcat::mcset de "RGB" "Rgb"
+ ::msgcat::mcset de "Options" "Optionen"
+ ::msgcat::mcset de "Copies" "Kopien"
+ ::msgcat::mcset de "Paper" "Papier"
+ ::msgcat::mcset de "Scale" "Skala"
+ ::msgcat::mcset de "Orientation" "Ausrichtung"
+ ::msgcat::mcset de "Portrait" "Porträt"
+ ::msgcat::mcset de "Landscape" "Landschaft"
+ ::msgcat::mcset de "Output" "Ausgabe"
+} \ No newline at end of file
diff --git a/library/msgs/el.msg b/library/msgs/el.msg
index 2e3f236..7aa6246 100644
--- a/library/msgs/el.msg
+++ b/library/msgs/el.msg
@@ -3,84 +3,102 @@
## petasis@iit.demokritos.gr
namespace eval ::tk {
- ::msgcat::mcset el "&Abort" "\u03a4\u03b5\u03c1\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2"
- ::msgcat::mcset el "About..." "\u03a3\u03c7\u03b5\u03c4\u03b9\u03ba\u03ac..."
- ::msgcat::mcset el "All Files" "\u038c\u03bb\u03b1 \u03c4\u03b1 \u0391\u03c1\u03c7\u03b5\u03af\u03b1"
- ::msgcat::mcset el "Application Error" "\u039b\u03ac\u03b8\u03bf\u03c2 \u0395\u03c6\u03b1\u03c1\u03bc\u03bf\u03b3\u03ae\u03c2"
- ::msgcat::mcset el "&Blue" "\u039c\u03c0\u03bb\u03b5"
- ::msgcat::mcset el "&Cancel" "\u0391\u03ba\u03cd\u03c1\u03c9\u03c3\u03b7"
+ ::msgcat::mcset el "&Abort" "Τερματισμός"
+ ::msgcat::mcset el "About..." "Σχετικά..."
+ ::msgcat::mcset el "All Files" "Όλα τα Αρχεία"
+ ::msgcat::mcset el "Application Error" "Λάθος Εφαρμογής"
+ ::msgcat::mcset el "&Blue" "Μπλε"
+ ::msgcat::mcset el "&Cancel" "Ακύρωση"
::msgcat::mcset el \
"Cannot change to the directory \"%1\$s\".\nPermission denied." \
-"\u0394\u03b5\u03bd \u03b5\u03af\u03bd\u03b1\u03b9 \u03b4\u03c5\u03bd\u03b1\u03c4\u03ae \u03b7 \u03b1\u03bb\u03bb\u03b1\u03b3\u03ae \u03ba\u03b1\u03c4\u03b1\u03bb\u03cc\u03b3\u03bf\u03c5 \u03c3\u03b5 \"%1\$s\".\n\u0397 \u03c0\u03c1\u03cc\u03c3\u03b2\u03b1\u03c3\u03b7 \u03b4\u03b5\u03bd \u03b5\u03c0\u03b9\u03c4\u03c1\u03ad\u03c0\u03b5\u03c4\u03b1\u03b9."
- ::msgcat::mcset el "Choose Directory" "\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u039a\u03b1\u03c4\u03b1\u03bb\u03cc\u03b3\u03bf\u03c5"
- ::msgcat::mcset el "Clear" "\u039a\u03b1\u03b8\u03b1\u03c1\u03b9\u03c3\u03bc\u03cc\u03c2"
- ::msgcat::mcset el "Color" "\u03a7\u03c1\u03ce\u03bc\u03b1"
- ::msgcat::mcset el "Console" "\u039a\u03bf\u03bd\u03c3\u03cc\u03bb\u03b1"
- ::msgcat::mcset el "Copy" "\u0391\u03bd\u03c4\u03b9\u03b3\u03c1\u03b1\u03c6\u03ae"
- ::msgcat::mcset el "Cut" "\u0391\u03c0\u03bf\u03ba\u03bf\u03c0\u03ae"
- ::msgcat::mcset el "Delete" "\u0394\u03b9\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae"
- ::msgcat::mcset el "Details >>" "\u039b\u03b5\u03c0\u03c4\u03bf\u03bc\u03ad\u03c1\u03b5\u03b9\u03b5\u03c2 >>"
+"Δεν είναι δυνατή η αλλαγή καταλόγου σε \"%1\$s\".\nΗ πρόσβαση δεν επιτρέπεται."
+ ::msgcat::mcset el "Choose Directory" "Επιλογή Καταλόγου"
+ ::msgcat::mcset el "Clear" "Καθαρισμός"
+ ::msgcat::mcset el "Color" "Χρώμα"
+ ::msgcat::mcset el "Console" "Κονσόλα"
+ ::msgcat::mcset el "Copy" "Αντιγραφή"
+ ::msgcat::mcset el "Cut" "Αποκοπή"
+ ::msgcat::mcset el "Delete" "Διαγραφή"
+ ::msgcat::mcset el "Details >>" "Λεπτομέρειες >>"
::msgcat::mcset el "Directory \"%1\$s\" does not exist." \
- "\u039f \u03ba\u03b1\u03c4\u03ac\u03bb\u03bf\u03b3\u03bf\u03c2 \"%1\$s\" \u03b4\u03b5\u03bd \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9."
- ::msgcat::mcset el "&Directory:" "&\u039a\u03b1\u03c4\u03ac\u03bb\u03bf\u03b3\u03bf\u03c2:"
- ::msgcat::mcset el "Error: %1\$s" "\u039b\u03ac\u03b8\u03bf\u03c2: %1\$s"
- ::msgcat::mcset el "Exit" "\u0388\u03be\u03bf\u03b4\u03bf\u03c2"
+ "Ο κατάλογος \"%1\$s\" δεν υπάρχει."
+ ::msgcat::mcset el "&Directory:" "&Κατάλογος:"
+ ::msgcat::mcset el "Error: %1\$s" "Λάθος: %1\$s"
+ ::msgcat::mcset el "Exit" "Έξοδος"
::msgcat::mcset el \
"File \"%1\$s\" already exists.\nDo you want to overwrite it?" \
- "\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \"%1\$s\" \u03ae\u03b4\u03b7 \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9.\n\u0398\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03b5\u03c0\u03b9\u03ba\u03b1\u03bb\u03c5\u03c6\u03b8\u03b5\u03af;"
+ "Το αρχείο \"%1\$s\" ήδη υπάρχει.\nΘέλετε να επικαλυφθεί;"
::msgcat::mcset el "File \"%1\$s\" already exists.\n\n" \
- "\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \"%1\$s\" \u03ae\u03b4\u03b7 \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9.\n\n"
+ "Το αρχείο \"%1\$s\" ήδη υπάρχει.\n\n"
::msgcat::mcset el "File \"%1\$s\" does not exist." \
- "\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \"%1\$s\" \u03b4\u03b5\u03bd \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9."
- ::msgcat::mcset el "File &name:" "\u038c&\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5:"
- ::msgcat::mcset el "File &names:" "\u038c&\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03c9\u03bd:"
- ::msgcat::mcset el "Files of &type:" "\u0391\u03c1\u03c7\u03b5\u03af\u03b1 \u03c4\u03bf\u03c5 &\u03c4\u03cd\u03c0\u03bf\u03c5:"
- ::msgcat::mcset el "Fi&les:" "\u0391\u03c1\u03c7\u03b5\u03af\u03b1:"
- ::msgcat::mcset el "&Filter" "\u03a6\u03af\u03bb\u03c4\u03c1\u03bf"
- ::msgcat::mcset el "Fil&ter:" "\u03a6\u03af\u03bb\u03c4\u03c1\u03bf:"
- ::msgcat::mcset el "&Green" "\u03a0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf"
- ::msgcat::mcset el "Hi" "\u0393\u03b5\u03b9\u03b1"
- ::msgcat::mcset el "Hide Console" "\u0391\u03c0\u03cc\u03ba\u03c1\u03c5\u03c8\u03b7 \u03ba\u03bf\u03bd\u03c3\u03cc\u03bb\u03b1\u03c2"
- ::msgcat::mcset el "&Ignore" "\u0391\u03b3\u03bd\u03cc\u03b7\u03c3\u03b7"
+ "Το αρχείο \"%1\$s\" δεν υπάρχει."
+ ::msgcat::mcset el "File &name:" "Ό&νομα αρχείου:"
+ ::msgcat::mcset el "File &names:" "Ό&νομα αρχείων:"
+ ::msgcat::mcset el "Files of &type:" "Αρχεία του &τύπου:"
+ ::msgcat::mcset el "Fi&les:" "Αρχεία:"
+ ::msgcat::mcset el "&Filter" "Φίλτρο"
+ ::msgcat::mcset el "Fil&ter:" "Φίλτρο:"
+ ::msgcat::mcset el "&Green" "Πράσινο"
+ ::msgcat::mcset el "Hi" "Γεια"
+ ::msgcat::mcset el "Hide Console" "Απόκρυψη κονσόλας"
+ ::msgcat::mcset el "&Ignore" "Αγνόηση"
::msgcat::mcset el "Invalid file name \"%1\$s\"." \
- "\u0386\u03ba\u03c5\u03c1\u03bf \u03cc\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5 \"%1\$s\"."
- ::msgcat::mcset el "Log Files" "\u0391\u03c1\u03c7\u03b5\u03af\u03b1 \u039a\u03b1\u03c4\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03c2"
- ::msgcat::mcset el "&No" "\u038c\u03c7\u03b9"
- ::msgcat::mcset el "&OK" "\u0395\u03bd\u03c4\u03ac\u03be\u03b5\u03b9"
- ::msgcat::mcset el "OK" "\u0395\u03bd\u03c4\u03ac\u03be\u03b5\u03b9"
- ::msgcat::mcset el "Ok" "\u0395\u03bd\u03c4\u03ac\u03be\u03b5\u03b9"
- ::msgcat::mcset el "Open" "\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1"
- ::msgcat::mcset el "&Open" "\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1"
+ "Άκυρο όνομα αρχείου \"%1\$s\"."
+ ::msgcat::mcset el "Log Files" "Αρχεία Καταγραφής"
+ ::msgcat::mcset el "&No" "Όχι"
+ ::msgcat::mcset el "&OK" "Εντάξει"
+ ::msgcat::mcset el "OK" "Εντάξει"
+ ::msgcat::mcset el "Ok" "Εντάξει"
+ ::msgcat::mcset el "Open" "Άνοιγμα"
+ ::msgcat::mcset el "&Open" "Άνοιγμα"
::msgcat::mcset el "Open Multiple Files" \
- "\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1 \u03c0\u03bf\u03bb\u03bb\u03b1\u03c0\u03bb\u03ce\u03bd \u03b1\u03c1\u03c7\u03b5\u03af\u03c9\u03bd"
- ::msgcat::mcset el "P&aste" "\u0395\u03c0\u03b9\u03ba\u03cc\u03bb\u03bb\u03b7\u03c3\u03b7"
- ::msgcat::mcset el "Quit" "\u0388\u03be\u03bf\u03b4\u03bf\u03c2"
- ::msgcat::mcset el "&Red" "\u039a\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf"
+ "Άνοιγμα πολλαπλών αρχείων"
+ ::msgcat::mcset el "P&aste" "Επικόλληση"
+ ::msgcat::mcset el "Quit" "Έξοδος"
+ ::msgcat::mcset el "&Red" "Κόκκινο"
::msgcat::mcset el "Replace existing file?" \
- "\u0395\u03c0\u03b9\u03ba\u03ac\u03bb\u03c5\u03c8\u03b7 \u03c5\u03c0\u03ac\u03c1\u03c7\u03bf\u03bd\u03c4\u03bf\u03c2 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5;"
- ::msgcat::mcset el "&Retry" "\u03a0\u03c1\u03bf\u03c3\u03c0\u03ac\u03b8\u03b7\u03c3\u03b5 \u03be\u03b1\u03bd\u03ac"
- ::msgcat::mcset el "&Save" "\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7"
- ::msgcat::mcset el "Save As" "\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7 \u03c3\u03b1\u03bd"
- ::msgcat::mcset el "Save To Log" "\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7 \u03c3\u03c4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03ba\u03b1\u03c4\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03c2"
- ::msgcat::mcset el "Select Log File" "\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5 \u03ba\u03b1\u03c4\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03c2"
+ "Επικάλυψη υπάρχοντος αρχείου;"
+ ::msgcat::mcset el "&Retry" "Προσπάθησε ξανά"
+ ::msgcat::mcset el "&Save" "Αποθήκευση"
+ ::msgcat::mcset el "Save As" "Αποθήκευση σαν"
+ ::msgcat::mcset el "Save To Log" "Αποθήκευση στο αρχείο καταγραφής"
+ ::msgcat::mcset el "Select Log File" "Επιλογή αρχείου καταγραφής"
::msgcat::mcset el "Select a file to source" \
- "\u0395\u03c0\u03b9\u03bb\u03ad\u03be\u03c4\u03b5 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03b3\u03b9\u03b1 \u03b5\u03ba\u03c4\u03ad\u03bb\u03b5\u03c3\u03b7"
- ::msgcat::mcset el "&Selection:" "\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae:"
- ::msgcat::mcset el "Skip Messages" "\u0391\u03c0\u03bf\u03c6\u03c5\u03b3\u03ae\u03bc\u03b7\u03bd\u03c5\u03bc\u03ac\u03c4\u03c9\u03bd"
- ::msgcat::mcset el "&Source..." "\u0395\u03ba\u03c4\u03ad\u03bb\u03b5\u03c3\u03b7..."
+ "Επιλέξτε αρχείο για εκτέλεση"
+ ::msgcat::mcset el "&Selection:" "Επιλογή:"
+ ::msgcat::mcset el "Skip Messages" "Αποφυγήμηνυμάτων"
+ ::msgcat::mcset el "&Source..." "Εκτέλεση..."
::msgcat::mcset el "Tcl Scripts" "Tcl Scripts"
- ::msgcat::mcset el "Tcl for Windows" "Tcl \u03b3\u03b9\u03b1 Windows"
- ::msgcat::mcset el "Text Files" "\u0391\u03c1\u03c7\u03b5\u03af\u03b1 \u039a\u03b5\u03b9\u03bc\u03ad\u03bd\u03bf\u03c5"
- ::msgcat::mcset el "&Yes" "\u039d\u03b1\u03b9"
- ::msgcat::mcset el "abort" "\u03c4\u03b5\u03c1\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2"
- ::msgcat::mcset el "blue" "\u03bc\u03c0\u03bb\u03b5"
- ::msgcat::mcset el "cancel" "\u03b1\u03ba\u03cd\u03c1\u03c9\u03c3\u03b7"
- ::msgcat::mcset el "extension" "\u03b5\u03c0\u03ad\u03ba\u03c4\u03b1\u03c3\u03b7"
- ::msgcat::mcset el "extensions" "\u03b5\u03c0\u03b5\u03ba\u03c4\u03ac\u03c3\u03b5\u03b9\u03c2"
- ::msgcat::mcset el "green" "\u03c0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf"
- ::msgcat::mcset el "ignore" "\u03b1\u03b3\u03bd\u03cc\u03b7\u03c3\u03b7"
- ::msgcat::mcset el "ok" "\u03b5\u03bd\u03c4\u03ac\u03be\u03b5\u03b9"
- ::msgcat::mcset el "red" "\u03ba\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf"
- ::msgcat::mcset el "retry" "\u03c0\u03c1\u03bf\u03c3\u03c0\u03ac\u03b8\u03b7\u03c3\u03b5 \u03be\u03b1\u03bd\u03ac"
- ::msgcat::mcset el "yes" "\u03bd\u03b1\u03b9"
+ ::msgcat::mcset el "Tcl for Windows" "Tcl για Windows"
+ ::msgcat::mcset el "Text Files" "Αρχεία Κειμένου"
+ ::msgcat::mcset el "&Yes" "Ναι"
+ ::msgcat::mcset el "abort" "τερματισμός"
+ ::msgcat::mcset el "blue" "μπλε"
+ ::msgcat::mcset el "cancel" "ακύρωση"
+ ::msgcat::mcset el "extension" "επέκταση"
+ ::msgcat::mcset el "extensions" "επεκτάσεις"
+ ::msgcat::mcset el "green" "πράσινο"
+ ::msgcat::mcset el "ignore" "αγνόηση"
+ ::msgcat::mcset el "ok" "εντάξει"
+ ::msgcat::mcset el "red" "κόκκινο"
+ ::msgcat::mcset el "retry" "προσπάθησε ξανά"
+ ::msgcat::mcset el "yes" "ναι"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset el "Print" "Τυπώνω"
+ ::msgcat::mcset el "Printer" "Εκτυπωτής"
+ ::msgcat::mcset el "Letter " "Γράμμα"
+ ::msgcat::mcset el "Legal " "Νομικός"
+ ::msgcat::mcset el "A4" "Α4"
+ ::msgcat::mcset el "Grayscale" "Κλίμακα Του Γκρι"
+ ::msgcat::mcset el "RGB" "Rgb"
+ ::msgcat::mcset el "Options" "Επιλογές"
+ ::msgcat::mcset el "Copies" "Αντίγραφα"
+ ::msgcat::mcset el "Paper" "Χαρτί"
+ ::msgcat::mcset el "Scale" "Κλίμακα"
+ ::msgcat::mcset el "Orientation" "Προσανατολισμός"
+ ::msgcat::mcset el "Portrait" "Προσωπογραφία"
+ ::msgcat::mcset el "Landscape" "Τοπίο"
+ ::msgcat::mcset el "Output" "Έξοδος"
+} \ No newline at end of file
diff --git a/library/msgs/en.msg b/library/msgs/en.msg
index 5ad1094..3f0d988 100644
--- a/library/msgs/en.msg
+++ b/library/msgs/en.msg
@@ -89,3 +89,22 @@ namespace eval ::tk {
::msgcat::mcset en "retry"
::msgcat::mcset en "yes"
}
+
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset en "Print"
+ ::msgcat::mcset en "Printer"
+ ::msgcat::mcset en "Letter "
+ ::msgcat::mcset en "Legal "
+ ::msgcat::mcset en "A4"
+ ::msgcat::mcset en "Grayscale"
+ ::msgcat::mcset en "RGB"
+ ::msgcat::mcset en "Options"
+ ::msgcat::mcset en "Copies"
+ ::msgcat::mcset en "Paper"
+ ::msgcat::mcset en "Scale"
+ ::msgcat::mcset en "Orientation"
+ ::msgcat::mcset en "Portrait"
+ ::msgcat::mcset en "Landscape"
+ ::msgcat::mcset en "Output"
+}
diff --git a/library/msgs/eo.msg b/library/msgs/eo.msg
index 3645630..08dfc1e 100644
--- a/library/msgs/eo.msg
+++ b/library/msgs/eo.msg
@@ -1,19 +1,19 @@
namespace eval ::tk {
- ::msgcat::mcset eo "&Abort" "&\u0108esigo"
+ ::msgcat::mcset eo "&Abort" "&Ĉesigo"
::msgcat::mcset eo "&About..." "Pri..."
- ::msgcat::mcset eo "All Files" "\u0108ioj dosieroj"
+ ::msgcat::mcset eo "All Files" "Ĉioj dosieroj"
::msgcat::mcset eo "Application Error" "Aplikoerraro"
::msgcat::mcset eo "&Blue" "&Blua"
::msgcat::mcset eo "Cancel" "Rezignu"
::msgcat::mcset eo "&Cancel" "&Rezignu"
- ::msgcat::mcset eo "Cannot change to the directory \"%1\$s\".\nPermission denied." "Neeble \u0109angi al dosierulon \"%1\$s\".\nVi ne rajtas tion."
+ ::msgcat::mcset eo "Cannot change to the directory \"%1\$s\".\nPermission denied." "Neeble ĉangi al dosierulon \"%1\$s\".\nVi ne rajtas tion."
::msgcat::mcset eo "Choose Directory" "Elektu Dosierujo"
::msgcat::mcset eo "Cl&ear" "&Klaru"
::msgcat::mcset eo "&Clear Console" "&Klaru konzolon"
::msgcat::mcset eo "Color" "Farbo"
::msgcat::mcset eo "Console" "Konzolo"
::msgcat::mcset eo "&Copy" "&Kopiu"
- ::msgcat::mcset eo "Cu&t" "&Enpo\u015digu"
+ ::msgcat::mcset eo "Cu&t" "&Enpoŝigu"
::msgcat::mcset eo "&Delete" "&Forprenu"
::msgcat::mcset eo "Details >>" "Detaloj >>"
::msgcat::mcset eo "Directory \"%1\$s\" does not exist." "La dosierujo \"%1\$s\" ne ekzistas."
@@ -22,7 +22,7 @@ namespace eval ::tk {
::msgcat::mcset eo "Error: %1\$s" "Eraro: %1\$s"
::msgcat::mcset eo "E&xit" "&Eliru"
::msgcat::mcset eo "&File" "&Dosiero"
- ::msgcat::mcset eo "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "La dosiero \"%1\$s\" jam ekzistas.\n\u0108u vi volas anstata\u00fbigi la dosieron?"
+ ::msgcat::mcset eo "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "La dosiero \"%1\$s\" jam ekzistas.\nĈu vi volas anstataûigi la dosieron?"
::msgcat::mcset eo "File \"%1\$s\" already exists.\n\n" "La dosiero \"%1\$s\" jam egzistas. \n\n"
::msgcat::mcset eo "File \"%1\$s\" does not exist." "La dosierp \"%1\$s\" ne estas."
::msgcat::mcset eo "File &name:" "Dosiero&nomo:"
@@ -34,7 +34,7 @@ namespace eval ::tk {
::msgcat::mcset eo "&Green" "&Verda"
::msgcat::mcset eo "&Help" "&Helpu"
::msgcat::mcset eo "Hi" "Saluton"
- ::msgcat::mcset eo "&Hide Console" "&Ka\u015du konzolon"
+ ::msgcat::mcset eo "&Hide Console" "&Kaŝu konzolon"
::msgcat::mcset eo "&Ignore" "&Ignoru"
::msgcat::mcset eo "Invalid file name \"%1\$s\"." "Malvalida dosieronomo \"%1\$s\"."
::msgcat::mcset eo "Log Files" "Protokolo"
@@ -45,10 +45,10 @@ namespace eval ::tk {
::msgcat::mcset eo "Open" "Malfermu"
::msgcat::mcset eo "&Open" "&Malfermu"
::msgcat::mcset eo "Open Multiple Files" "Melfermu multan dosierojn"
- ::msgcat::mcset eo "P&aste" "&Elpo\u015digi"
+ ::msgcat::mcset eo "P&aste" "&Elpoŝigi"
::msgcat::mcset eo "&Quit" "&Finigu"
::msgcat::mcset eo "&Red" "&Rosa"
- ::msgcat::mcset eo "Replace existing file?" "\u0108u anstata\u00fbu ekzistantan dosieron?"
+ ::msgcat::mcset eo "Replace existing file?" "Ĉu anstataûu ekzistantan dosieron?"
::msgcat::mcset eo "&Retry" "&Ripetu"
::msgcat::mcset eo "&Save" "&Savu"
::msgcat::mcset eo "Save As" "Savu kiel"
@@ -56,20 +56,38 @@ namespace eval ::tk {
::msgcat::mcset eo "Select Log File" "Elektu prokolodosieron"
::msgcat::mcset eo "Select a file to source" "Elektu dosieron por interpreti"
::msgcat::mcset eo "&Selection:" "&Elekto:"
- ::msgcat::mcset eo "Skip Messages" "transsaltu pluajn mesa\u011dojn"
+ ::msgcat::mcset eo "Skip Messages" "transsaltu pluajn mesaĝojn"
::msgcat::mcset eo "&Source..." "&Fontoprogramo..."
::msgcat::mcset eo "Tcl Scripts" "Tcl-skriptoj"
::msgcat::mcset eo "Tcl for Windows" "Tcl por vindoso"
::msgcat::mcset eo "Text Files" "Tekstodosierojn"
::msgcat::mcset eo "&Yes" "&Jes"
- ::msgcat::mcset eo "abort" "\u0109esigo"
+ ::msgcat::mcset eo "abort" "ĉesigo"
::msgcat::mcset eo "blue" "blua"
::msgcat::mcset eo "cancel" "rezignu"
::msgcat::mcset eo "extension" "ekspansio"
::msgcat::mcset eo "extensions" "ekspansioj"
::msgcat::mcset eo "green" "verda"
::msgcat::mcset eo "ignore" "ignorieren"
- ::msgcat::mcset eo "red" "ru\u011da"
+ ::msgcat::mcset eo "red" "ruĝa"
::msgcat::mcset eo "retry" "ripetu"
::msgcat::mcset eo "yes" "jes"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset eo "Print" "Presi"
+ ::msgcat::mcset eo "Printer" "Presilo"
+ ::msgcat::mcset eo "Letter " "Letero"
+ ::msgcat::mcset eo "Legal " "Laŭleĝa"
+ ::msgcat::mcset eo "A4" "A4"
+ ::msgcat::mcset eo "Grayscale" "Grizskalo"
+ ::msgcat::mcset eo "RGB" "RGB"
+ ::msgcat::mcset eo "Options" "Opcioj"
+ ::msgcat::mcset eo "Copies" "Kopioj"
+ ::msgcat::mcset eo "Paper" "Papero"
+ ::msgcat::mcset eo "Scale" "Skalo"
+ ::msgcat::mcset eo "Orientation" "Orientiĝo"
+ ::msgcat::mcset eo "Portrait" "Portreto"
+ ::msgcat::mcset eo "Landscape" "Pejzaĝo"
+ ::msgcat::mcset eo "Output" "Eligo"
+} \ No newline at end of file
diff --git a/library/msgs/es.msg b/library/msgs/es.msg
index 578c52c..724ea3b 100644
--- a/library/msgs/es.msg
+++ b/library/msgs/es.msg
@@ -2,7 +2,7 @@ namespace eval ::tk {
::msgcat::mcset es "&Abort" "&Abortar"
::msgcat::mcset es "&About..." "&Acerca de ..."
::msgcat::mcset es "All Files" "Todos los archivos"
- ::msgcat::mcset es "Application Error" "Error de la aplicaci\u00f3n"
+ ::msgcat::mcset es "Application Error" "Error de la aplicación"
::msgcat::mcset es "&Blue" "&Azul"
::msgcat::mcset es "Cancel" "Cancelar"
::msgcat::mcset es "&Cancel" "&Cancelar"
@@ -22,7 +22,7 @@ namespace eval ::tk {
::msgcat::mcset es "Error: %1\$s"
::msgcat::mcset es "E&xit" "Salir"
::msgcat::mcset es "&File" "&Archivo"
- ::msgcat::mcset es "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "El archivo \"%1\$s\" ya existe.\n\u00bfDesea sobreescribirlo?"
+ ::msgcat::mcset es "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "El archivo \"%1\$s\" ya existe.\n¿Desea sobreescribirlo?"
::msgcat::mcset es "File \"%1\$s\" already exists.\n\n" "El archivo \"%1\$s\" ya existe.\n\n"
::msgcat::mcset es "File \"%1\$s\" does not exist." "El archivo \"%1\$s\" no existe."
::msgcat::mcset es "File &name:" "&Nombre de archivo:"
@@ -36,7 +36,7 @@ namespace eval ::tk {
::msgcat::mcset es "Hi" "Hola"
::msgcat::mcset es "&Hide Console" "&Esconder la consola"
::msgcat::mcset es "&Ignore" "&Ignorar"
- ::msgcat::mcset es "Invalid file name \"%1\$s\"." "Nombre de archivo inv\u00e1lido \"%1\$s\"."
+ ::msgcat::mcset es "Invalid file name \"%1\$s\"." "Nombre de archivo inválido \"%1\$s\"."
::msgcat::mcset es "Log Files" "Ficheros de traza"
::msgcat::mcset es "&No"
::msgcat::mcset es "&OK"
@@ -44,33 +44,51 @@ namespace eval ::tk {
::msgcat::mcset es "Ok"
::msgcat::mcset es "Open" "Abrir"
::msgcat::mcset es "&Open" "&Abrir"
- ::msgcat::mcset es "Open Multiple Files" "Abrir m\u00faltiples archivos"
+ ::msgcat::mcset es "Open Multiple Files" "Abrir múltiples archivos"
::msgcat::mcset es "P&aste" "Peg&ar"
::msgcat::mcset es "&Quit" "&Abandonar"
::msgcat::mcset es "&Red" "&Rojo"
- ::msgcat::mcset es "Replace existing file?" "\u00bfReemplazar el archivo existente?"
+ ::msgcat::mcset es "Replace existing file?" "¿Reemplazar el archivo existente?"
::msgcat::mcset es "&Retry" "&Reintentar"
::msgcat::mcset es "&Save" "&Guardar"
::msgcat::mcset es "Save As" "Guardar como"
::msgcat::mcset es "Save To Log" "Guardar al archivo de traza"
::msgcat::mcset es "Select Log File" "Elegir un archivo de traza"
::msgcat::mcset es "Select a file to source" "Seleccionar un archivo a evaluar"
- ::msgcat::mcset es "&Selection:" "&Selecci\u00f3n:"
+ ::msgcat::mcset es "&Selection:" "&Selección:"
::msgcat::mcset es "Skip Messages" "Omitir los mensajes"
::msgcat::mcset es "&Source..." "E&valuar..."
::msgcat::mcset es "Tcl Scripts" "Scripts Tcl"
::msgcat::mcset es "Tcl for Windows" "Tcl para Windows"
::msgcat::mcset es "Text Files" "Archivos de texto"
- ::msgcat::mcset es "&Yes" "&S\u00ed"
+ ::msgcat::mcset es "&Yes" "&Sí"
::msgcat::mcset es "abort" "abortar"
::msgcat::mcset es "blue" "azul"
::msgcat::mcset es "cancel" "cancelar"
- ::msgcat::mcset es "extension" "extensi\u00f3n"
+ ::msgcat::mcset es "extension" "extensión"
::msgcat::mcset es "extensions" "extensiones"
::msgcat::mcset es "green" "verde"
::msgcat::mcset es "ignore" "ignorar"
::msgcat::mcset es "ok"
::msgcat::mcset es "red" "rojo"
::msgcat::mcset es "retry" "reintentar"
- ::msgcat::mcset es "yes" "s\u00ed"
+ ::msgcat::mcset es "yes" "sí"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset es "Print" "Imprimir"
+ ::msgcat::mcset es "Printer" "Impresora"
+ ::msgcat::mcset es "Letter " "Carta"
+ ::msgcat::mcset es "Legal " "Legal"
+ ::msgcat::mcset es "A4" "A4"
+ ::msgcat::mcset es "Grayscale" "Escala De Grises"
+ ::msgcat::mcset es "RGB" "Rgb"
+ ::msgcat::mcset es "Options" "Opciones"
+ ::msgcat::mcset es "Copies" "Copias"
+ ::msgcat::mcset es "Paper" "Papel"
+ ::msgcat::mcset es "Scale" "Escama"
+ ::msgcat::mcset es "Orientation" "Orientación"
+ ::msgcat::mcset es "Portrait" "Retrato"
+ ::msgcat::mcset es "Landscape" "Paisaje"
+ ::msgcat::mcset es "Output" "Salida"
+} \ No newline at end of file
diff --git a/library/msgs/fr.msg b/library/msgs/fr.msg
index 7f42aca..0d3ef08 100644
--- a/library/msgs/fr.msg
+++ b/library/msgs/fr.msg
@@ -1,26 +1,26 @@
namespace eval ::tk {
::msgcat::mcset fr "&Abort" "&Annuler"
- ::msgcat::mcset fr "About..." "\u00c0 propos..."
+ ::msgcat::mcset fr "About..." "À propos..."
::msgcat::mcset fr "All Files" "Tous les fichiers"
::msgcat::mcset fr "Application Error" "Erreur d'application"
::msgcat::mcset fr "&Blue" "&Bleu"
::msgcat::mcset fr "Cancel" "Annuler"
::msgcat::mcset fr "&Cancel" "&Annuler"
- ::msgcat::mcset fr "Cannot change to the directory \"%1\$s\".\nPermission denied." "Impossible d'acc\u00e9der au r\u00e9pertoire \"%1\$s\".\nPermission refus\u00e9e."
- ::msgcat::mcset fr "Choose Directory" "Choisir r\u00e9pertoire"
+ ::msgcat::mcset fr "Cannot change to the directory \"%1\$s\".\nPermission denied." "Impossible d'accéder au répertoire \"%1\$s\".\nPermission refusée."
+ ::msgcat::mcset fr "Choose Directory" "Choisir répertoire"
::msgcat::mcset fr "Cl&ear" "Effacer"
::msgcat::mcset fr "Color" "Couleur"
::msgcat::mcset fr "Console"
::msgcat::mcset fr "Copy" "Copier"
::msgcat::mcset fr "Cu&t" "Couper"
::msgcat::mcset fr "Delete" "Effacer"
- ::msgcat::mcset fr "Details >>" "D\u00e9tails >>"
- ::msgcat::mcset fr "Directory \"%1\$s\" does not exist." "Le r\u00e9pertoire \"%1\$s\" n'existe pas."
- ::msgcat::mcset fr "&Directory:" "&R\u00e9pertoire:"
+ ::msgcat::mcset fr "Details >>" "Détails >>"
+ ::msgcat::mcset fr "Directory \"%1\$s\" does not exist." "Le répertoire \"%1\$s\" n'existe pas."
+ ::msgcat::mcset fr "&Directory:" "&Répertoire:"
::msgcat::mcset fr "Error: %1\$s" "Erreur: %1\$s"
::msgcat::mcset fr "E&xit" "Quitter"
- ::msgcat::mcset fr "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Le fichier \"%1\$s\" existe d\u00e9j\u00e0.\nVoulez-vous l'\u00e9craser?"
- ::msgcat::mcset fr "File \"%1\$s\" already exists.\n\n" "Le fichier \"%1\$s\" existe d\u00e9j\u00e0.\n\n"
+ ::msgcat::mcset fr "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Le fichier \"%1\$s\" existe déjà.\nVoulez-vous l'écraser?"
+ ::msgcat::mcset fr "File \"%1\$s\" already exists.\n\n" "Le fichier \"%1\$s\" existe déjà.\n\n"
::msgcat::mcset fr "File \"%1\$s\" does not exist." "Le fichier \"%1\$s\" n'existe pas."
::msgcat::mcset fr "File &name:" "&Nom de fichier:"
::msgcat::mcset fr "File &names:" "&Noms de fichiers:"
@@ -45,15 +45,15 @@ namespace eval ::tk {
::msgcat::mcset fr "&Quit" "&Quitter"
::msgcat::mcset fr "&Red" "&Rouge"
::msgcat::mcset fr "Replace existing file?" "Remplacer le fichier existant?"
- ::msgcat::mcset fr "&Retry" "&R\u00e9-essayer"
+ ::msgcat::mcset fr "&Retry" "&Ré-essayer"
::msgcat::mcset fr "&Save" "&Sauvegarder"
::msgcat::mcset fr "Save As" "Sauvegarder sous"
::msgcat::mcset fr "Save To Log" "Sauvegarde au fichier de trace"
::msgcat::mcset fr "Select Log File" "Choisir un fichier de trace"
- ::msgcat::mcset fr "Select a file to source" "Choisir un fichier \u00e0 \u00e9valuer"
- ::msgcat::mcset fr "&Selection:" "&S\u00e9lection:"
+ ::msgcat::mcset fr "Select a file to source" "Choisir un fichier à évaluer"
+ ::msgcat::mcset fr "&Selection:" "&Sélection:"
::msgcat::mcset fr "Skip Messages" "Omettre les messages"
- ::msgcat::mcset fr "&Source..." "\u00c9valuer..."
+ ::msgcat::mcset fr "&Source..." "Évaluer..."
::msgcat::mcset fr "Tcl Scripts" "Scripts Tcl"
::msgcat::mcset fr "Tcl for Windows" "Tcl pour Windows"
::msgcat::mcset fr "Text Files" "Fichiers texte"
@@ -67,6 +67,24 @@ namespace eval ::tk {
::msgcat::mcset fr "ignore" "ignorer"
::msgcat::mcset fr "ok"
::msgcat::mcset fr "red" "rouge"
- ::msgcat::mcset fr "retry" "r\u00e9essayer"
+ ::msgcat::mcset fr "retry" "réessayer"
::msgcat::mcset fr "yes" "oui"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset fr "Print" "Imprimer"
+ ::msgcat::mcset fr "Printer" "Imprimante"
+ ::msgcat::mcset fr "Letter " "Lettre"
+ ::msgcat::mcset fr "Legal " "Légal"
+ ::msgcat::mcset fr "A4" "A4"
+ ::msgcat::mcset fr "Grayscale" "Niveaux de Gris"
+ ::msgcat::mcset fr "RGB" "RVB"
+ ::msgcat::mcset fr "Options" "Options"
+ ::msgcat::mcset fr "Copies" "Nombre d'exemplaires"
+ ::msgcat::mcset fr "Paper" "Papier"
+ ::msgcat::mcset fr "Scale" "Échelle"
+ ::msgcat::mcset fr "Orientation" "Orientation"
+ ::msgcat::mcset fr "Portrait" "Portrait"
+ ::msgcat::mcset fr "Landscape" "Paysage"
+ ::msgcat::mcset fr "Output" "Sortie"
+} \ No newline at end of file
diff --git a/library/msgs/hu.msg b/library/msgs/hu.msg
index 38ef0b8..5c1d929 100644
--- a/library/msgs/hu.msg
+++ b/library/msgs/hu.msg
@@ -1,78 +1,96 @@
namespace eval ::tk {
- ::msgcat::mcset hu "&Abort" "&Megszak\u00edt\u00e1s"
- ::msgcat::mcset hu "&About..." "N\u00e9vjegy..."
- ::msgcat::mcset hu "All Files" "Minden f\u00e1jl"
- ::msgcat::mcset hu "Application Error" "Alkalmaz\u00e1s hiba"
- ::msgcat::mcset hu "&Blue" "&K\u00e9k"
- ::msgcat::mcset hu "Cancel" "M\u00e9gsem"
- ::msgcat::mcset hu "&Cancel" "M\u00e9g&sem"
- ::msgcat::mcset hu "Cannot change to the directory \"%1\$s\".\nPermission denied." "A k\u00f6nyvt\u00e1rv\u00e1lt\u00e1s nem siker\u00fclt: \"%1\$s\".\nHozz\u00e1f\u00e9r\u00e9s megtagadva."
- ::msgcat::mcset hu "Choose Directory" "K\u00f6nyvt\u00e1r kiv\u00e1laszt\u00e1sa"
- ::msgcat::mcset hu "Cl&ear" "T\u00f6rl\u00e9s"
- ::msgcat::mcset hu "&Clear Console" "&T\u00f6rl\u00e9s Konzol"
- ::msgcat::mcset hu "Color" "Sz\u00edn"
+ ::msgcat::mcset hu "&Abort" "&Megszakítás"
+ ::msgcat::mcset hu "&About..." "Névjegy..."
+ ::msgcat::mcset hu "All Files" "Minden fájl"
+ ::msgcat::mcset hu "Application Error" "Alkalmazás hiba"
+ ::msgcat::mcset hu "&Blue" "&Kék"
+ ::msgcat::mcset hu "Cancel" "Mégsem"
+ ::msgcat::mcset hu "&Cancel" "Még&sem"
+ ::msgcat::mcset hu "Cannot change to the directory \"%1\$s\".\nPermission denied." "A könyvtárváltás nem sikerült: \"%1\$s\".\nHozzáférés megtagadva."
+ ::msgcat::mcset hu "Choose Directory" "Könyvtár kiválasztása"
+ ::msgcat::mcset hu "Cl&ear" "Törlés"
+ ::msgcat::mcset hu "&Clear Console" "&Törlés Konzol"
+ ::msgcat::mcset hu "Color" "Szín"
::msgcat::mcset hu "Console" "Konzol"
- ::msgcat::mcset hu "&Copy" "&M\u00e1sol\u00e1s"
- ::msgcat::mcset hu "Cu&t" "&Kiv\u00e1g\u00e1s"
- ::msgcat::mcset hu "&Delete" "&T\u00f6rl\u00e9s"
- ::msgcat::mcset hu "Details >>" "R\u00e9szletek >>"
- ::msgcat::mcset hu "Directory \"%1\$s\" does not exist." "\"%1\$s\" k\u00f6nyvt\u00e1r nem l\u00e9tezik."
- ::msgcat::mcset hu "&Directory:" "&K\u00f6nyvt\u00e1r:"
+ ::msgcat::mcset hu "&Copy" "&Másolás"
+ ::msgcat::mcset hu "Cu&t" "&Kivágás"
+ ::msgcat::mcset hu "&Delete" "&Törlés"
+ ::msgcat::mcset hu "Details >>" "Részletek >>"
+ ::msgcat::mcset hu "Directory \"%1\$s\" does not exist." "\"%1\$s\" könyvtár nem létezik."
+ ::msgcat::mcset hu "&Directory:" "&Könyvtár:"
#::msgcat::mcset hu "&Edit"
::msgcat::mcset hu "Error: %1\$s" "Hiba: %1\$s"
- ::msgcat::mcset hu "E&xit" "Kil\u00e9p\u00e9s"
- ::msgcat::mcset hu "&File" "&F\u00e1jl"
- ::msgcat::mcset hu "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "\"%1\$s\" f\u00e1jl m\u00e1r l\u00e9tezik.\nFel\u00fcl\u00edrjam?"
- ::msgcat::mcset hu "File \"%1\$s\" already exists.\n\n" "\"%1\$s\" f\u00e1jl m\u00e1r l\u00e9tezik.\n\n"
- ::msgcat::mcset hu "File \"%1\$s\" does not exist." "\"%1\$s\" f\u00e1jl nem l\u00e9tezik."
- ::msgcat::mcset hu "File &name:" "F\u00e1jl &neve:"
- ::msgcat::mcset hu "File &names:" "F\u00e1jlok &nevei:"
- ::msgcat::mcset hu "Files of &type:" "F\u00e1jlok &t\u00edpusa:"
- ::msgcat::mcset hu "Fi&les:" "F\u00e1j&lok:"
- ::msgcat::mcset hu "&Filter" "&Sz\u0171r\u0151"
- ::msgcat::mcset hu "Fil&ter:" "S&z\u0171r\u0151:"
- ::msgcat::mcset hu "&Green" "&Z\u00f6ld"
+ ::msgcat::mcset hu "E&xit" "Kilépés"
+ ::msgcat::mcset hu "&File" "&Fájl"
+ ::msgcat::mcset hu "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "\"%1\$s\" fájl már létezik.\nFelülírjam?"
+ ::msgcat::mcset hu "File \"%1\$s\" already exists.\n\n" "\"%1\$s\" fájl már létezik.\n\n"
+ ::msgcat::mcset hu "File \"%1\$s\" does not exist." "\"%1\$s\" fájl nem létezik."
+ ::msgcat::mcset hu "File &name:" "Fájl &neve:"
+ ::msgcat::mcset hu "File &names:" "Fájlok &nevei:"
+ ::msgcat::mcset hu "Files of &type:" "Fájlok &típusa:"
+ ::msgcat::mcset hu "Fi&les:" "Fáj&lok:"
+ ::msgcat::mcset hu "&Filter" "&Szűrő"
+ ::msgcat::mcset hu "Fil&ter:" "S&zűrő:"
+ ::msgcat::mcset hu "&Green" "&Zöld"
#::msgcat::mcset hu "&Help"
- ::msgcat::mcset hu "Hi" "\u00dcdv"
- ::msgcat::mcset hu "&Hide Console" "Konzol &elrejt\u00e9se"
- ::msgcat::mcset hu "&Ignore" "K&ihagy\u00e1s"
- ::msgcat::mcset hu "Invalid file name \"%1\$s\"." "\u00c9rv\u00e9nytelen f\u00e1jln\u00e9v: \"%1\$s\"."
- ::msgcat::mcset hu "Log Files" "Log f\u00e1jlok"
+ ::msgcat::mcset hu "Hi" "Üdv"
+ ::msgcat::mcset hu "&Hide Console" "Konzol &elrejtése"
+ ::msgcat::mcset hu "&Ignore" "K&ihagyás"
+ ::msgcat::mcset hu "Invalid file name \"%1\$s\"." "Érvénytelen fájlnév: \"%1\$s\"."
+ ::msgcat::mcset hu "Log Files" "Log fájlok"
::msgcat::mcset hu "&No" "&Nem"
::msgcat::mcset hu "&OK"
::msgcat::mcset hu "OK"
::msgcat::mcset hu "Ok"
- ::msgcat::mcset hu "Open" "Megnyit\u00e1s"
- ::msgcat::mcset hu "&Open" "&Megnyit\u00e1s"
- ::msgcat::mcset hu "Open Multiple Files" "T\u00f6bb f\u00e1jl megnyit\u00e1sa"
- ::msgcat::mcset hu "P&aste" "&Beilleszt\u00e9s"
- ::msgcat::mcset hu "&Quit" "&Kil\u00e9p\u00e9s"
- ::msgcat::mcset hu "&Red" "&V\u00f6r\u00f6s"
- ::msgcat::mcset hu "Replace existing file?" "Megl\u00e9v\u0151 f\u00e1jl cser\u00e9je?"
- ::msgcat::mcset hu "&Retry" "\u00daj&ra"
- ::msgcat::mcset hu "&Save" "&Ment\u00e9s"
- ::msgcat::mcset hu "Save As" "Ment\u00e9s m\u00e1sk\u00e9nt"
- ::msgcat::mcset hu "Save To Log" "Ment\u00e9s log f\u00e1jlba"
- ::msgcat::mcset hu "Select Log File" "Log f\u00e1jl kiv\u00e1laszt\u00e1sa"
- ::msgcat::mcset hu "Select a file to source" "Forr\u00e1sf\u00e1jl kiv\u00e1laszt\u00e1sa"
- ::msgcat::mcset hu "&Selection:" "&Kijel\u00f6l\u00e9s:"
- ::msgcat::mcset hu "Show &Hidden Directories" "&Rejtett k\u00f6nyvt\u00e1rak megjelen\u00edt\u00e9se"
- ::msgcat::mcset hu "Show &Hidden Files and Directories" "&Rejtett f\u00e1jlok \u00e9s k\u00f6nyvt\u00e1rak megjelen\u00edt\u00e9se"
- ::msgcat::mcset hu "Skip Messages" "\u00dczenetek kihagy\u00e1sa"
- ::msgcat::mcset hu "&Source..." "&Forr\u00e1s..."
+ ::msgcat::mcset hu "Open" "Megnyitás"
+ ::msgcat::mcset hu "&Open" "&Megnyitás"
+ ::msgcat::mcset hu "Open Multiple Files" "Több fájl megnyitása"
+ ::msgcat::mcset hu "P&aste" "&Beillesztés"
+ ::msgcat::mcset hu "&Quit" "&Kilépés"
+ ::msgcat::mcset hu "&Red" "&Vörös"
+ ::msgcat::mcset hu "Replace existing file?" "Meglévő fájl cseréje?"
+ ::msgcat::mcset hu "&Retry" "Új&ra"
+ ::msgcat::mcset hu "&Save" "&Mentés"
+ ::msgcat::mcset hu "Save As" "Mentés másként"
+ ::msgcat::mcset hu "Save To Log" "Mentés log fájlba"
+ ::msgcat::mcset hu "Select Log File" "Log fájl kiválasztása"
+ ::msgcat::mcset hu "Select a file to source" "Forrásfájl kiválasztása"
+ ::msgcat::mcset hu "&Selection:" "&Kijelölés:"
+ ::msgcat::mcset hu "Show &Hidden Directories" "&Rejtett könyvtárak megjelenítése"
+ ::msgcat::mcset hu "Show &Hidden Files and Directories" "&Rejtett fájlok és könyvtárak megjelenítése"
+ ::msgcat::mcset hu "Skip Messages" "Üzenetek kihagyása"
+ ::msgcat::mcset hu "&Source..." "&Forrás..."
::msgcat::mcset hu "Tcl Scripts" "Tcl scriptek"
::msgcat::mcset hu "Tcl for Windows" "Tcl Windows-hoz"
- ::msgcat::mcset hu "Text Files" "Sz\u00f6vegf\u00e1jlok"
+ ::msgcat::mcset hu "Text Files" "Szövegfájlok"
::msgcat::mcset hu "&Yes" "&Igen"
- ::msgcat::mcset hu "abort" "megszak\u00edt\u00e1s"
- ::msgcat::mcset hu "blue" "k\u00e9k"
- ::msgcat::mcset hu "cancel" "m\u00e9gsem"
- ::msgcat::mcset hu "extension" "kiterjeszt\u00e9s"
- ::msgcat::mcset hu "extensions" "kiterjeszt\u00e9sek"
- ::msgcat::mcset hu "green" "z\u00f6ld"
+ ::msgcat::mcset hu "abort" "megszakítás"
+ ::msgcat::mcset hu "blue" "kék"
+ ::msgcat::mcset hu "cancel" "mégsem"
+ ::msgcat::mcset hu "extension" "kiterjesztés"
+ ::msgcat::mcset hu "extensions" "kiterjesztések"
+ ::msgcat::mcset hu "green" "zöld"
::msgcat::mcset hu "ignore" "ignorer"
::msgcat::mcset hu "ok"
- ::msgcat::mcset hu "red" "v\u00f6r\u00f6s"
- ::msgcat::mcset hu "retry" "\u00fajra"
+ ::msgcat::mcset hu "red" "vörös"
+ ::msgcat::mcset hu "retry" "újra"
::msgcat::mcset hu "yes" "igen"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset hu "Print" "Nyomtat"
+ ::msgcat::mcset hu "Printer" "Nyomtató"
+ ::msgcat::mcset hu "Letter " "Levél"
+ ::msgcat::mcset hu "Legal " "Törvényes"
+ ::msgcat::mcset hu "A4" "A4"
+ ::msgcat::mcset hu "Grayscale" "Szürkeárnyalatos"
+ ::msgcat::mcset hu "RGB" "Rgb"
+ ::msgcat::mcset hu "Options" "Beállítások"
+ ::msgcat::mcset hu "Copies" "Másolatok"
+ ::msgcat::mcset hu "Paper" "Papír"
+ ::msgcat::mcset hu "Scale" "Hangsor"
+ ::msgcat::mcset hu "Orientation" "Tájékozódás"
+ ::msgcat::mcset hu "Portrait" "Portré"
+ ::msgcat::mcset hu "Landscape" "Táj"
+ ::msgcat::mcset hu "Output" "Hozam"
+} \ No newline at end of file
diff --git a/library/msgs/it.msg b/library/msgs/it.msg
index 2e1b4bd..d7d9263 100644
--- a/library/msgs/it.msg
+++ b/library/msgs/it.msg
@@ -20,8 +20,8 @@ namespace eval ::tk {
::msgcat::mcset it "&Directory:"
::msgcat::mcset it "Error: %1\$s" "Errore: %1\$s"
::msgcat::mcset it "E&xit" "Esci"
- ::msgcat::mcset it "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Il file \"%1\$s\" esiste gi\u00e0.\nVuoi sovrascriverlo?"
- ::msgcat::mcset it "File \"%1\$s\" already exists.\n\n" "Il file \"%1\$s\" esiste gi\u00e0.\n\n"
+ ::msgcat::mcset it "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Il file \"%1\$s\" esiste già.\nVuoi sovrascriverlo?"
+ ::msgcat::mcset it "File \"%1\$s\" already exists.\n\n" "Il file \"%1\$s\" esiste già.\n\n"
::msgcat::mcset it "File \"%1\$s\" does not exist." "Il file \"%1\$s\" non esiste."
::msgcat::mcset it "File &name:" "&Nome del file:"
::msgcat::mcset it "File &names:" "&Nomi dei file:"
@@ -58,7 +58,7 @@ namespace eval ::tk {
::msgcat::mcset it "Tcl Scripts" "Script Tcl"
::msgcat::mcset it "Tcl for Windows" "Tcl per Windows"
::msgcat::mcset it "Text Files" "File di testo"
- ::msgcat::mcset it "&Yes" "&S\u00ec"
+ ::msgcat::mcset it "&Yes" "&Sì"
::msgcat::mcset it "abort" "interrompi"
::msgcat::mcset it "blue" "blu"
::msgcat::mcset it "cancel" "annulla"
@@ -69,5 +69,23 @@ namespace eval ::tk {
::msgcat::mcset it "ok"
::msgcat::mcset it "red" "rosso"
::msgcat::mcset it "retry" "riprova"
- ::msgcat::mcset it "yes" "s\u00ec"
+ ::msgcat::mcset it "yes" "sì"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset it "Print" "Stampare"
+ ::msgcat::mcset it "Printer" "Stampante"
+ ::msgcat::mcset it "Letter " "Lettera"
+ ::msgcat::mcset it "Legal " "Legale"
+ ::msgcat::mcset it "A4" "A4"
+ ::msgcat::mcset it "Grayscale" "Scala Di Grigi"
+ ::msgcat::mcset it "RGB" "Rgb"
+ ::msgcat::mcset it "Options" "Opzioni"
+ ::msgcat::mcset it "Copies" "Copie"
+ ::msgcat::mcset it "Paper" "Carta"
+ ::msgcat::mcset it "Scale" "Scala"
+ ::msgcat::mcset it "Orientation" "Orientamento"
+ ::msgcat::mcset it "Portrait" "Ritratto"
+ ::msgcat::mcset it "Landscape" "Paesaggio"
+ ::msgcat::mcset it "Output" "Prodotto"
+} \ No newline at end of file
diff --git a/library/msgs/nl.msg b/library/msgs/nl.msg
index 148a9e6..b751824 100644
--- a/library/msgs/nl.msg
+++ b/library/msgs/nl.msg
@@ -15,7 +15,7 @@ namespace eval ::tk {
::msgcat::mcset nl "&Clear Console" "&Wis Console"
::msgcat::mcset nl "Color" "Kleur"
::msgcat::mcset nl "Console"
- ::msgcat::mcset nl "&Copy" "Kopi\u00ebren"
+ ::msgcat::mcset nl "&Copy" "Kopiëren"
::msgcat::mcset nl "Cu&t" "Knippen"
::msgcat::mcset nl "&Delete" "Wissen"
::msgcat::mcset nl "Details >>"
@@ -24,7 +24,7 @@ namespace eval ::tk {
::msgcat::mcset nl "&Edit" "Bewerken"
::msgcat::mcset nl "Effects" "Effecten"
::msgcat::mcset nl "Error: %1\$s" "Fout: %1\$s"
- ::msgcat::mcset nl "E&xit" "Be\u00ebindigen"
+ ::msgcat::mcset nl "E&xit" "Beëindigen"
::msgcat::mcset nl "&File" "Bestand"
::msgcat::mcset nl "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Bestand \"%1\$s\" bestaat al.\nWilt u het overschrijven?"
::msgcat::mcset nl "File \"%1\$s\" already exists.\n\n" "Bestand \"%1\$s\" bestaat al.\n\n"
@@ -40,7 +40,7 @@ namespace eval ::tk {
::msgcat::mcset nl "Font st&yle:" "Font stijl:"
::msgcat::mcset nl "&Green" "&Groen"
::msgcat::mcset nl "&Help"
- ::msgcat::mcset nl "Hi" "H\u00e9"
+ ::msgcat::mcset nl "Hi" "Hé"
::msgcat::mcset nl "&Hide Console" "Verberg Console"
::msgcat::mcset nl "&Ignore" "&Negeren"
::msgcat::mcset nl "Invalid file name \"%1\$s\"." "Ongeldige bestandsnaam \"%1\$s\"."
@@ -89,3 +89,21 @@ namespace eval ::tk {
::msgcat::mcset nl "retry" "opnieuw"
::msgcat::mcset nl "yes" "ja"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset nl "Print" "Afdrukken"
+ ::msgcat::mcset nl "Printer" "Printer"
+ ::msgcat::mcset nl "Letter " "Brief"
+ ::msgcat::mcset nl "Legal " "Legaal"
+ ::msgcat::mcset nl "A4" "A4"
+ ::msgcat::mcset nl "Grayscale" "Grijswaarden"
+ ::msgcat::mcset nl "RGB" "Rgb"
+ ::msgcat::mcset nl "Options" "Opties"
+ ::msgcat::mcset nl "Copies" "Kopieën"
+ ::msgcat::mcset nl "Paper" "Papier"
+ ::msgcat::mcset nl "Scale" "Schub"
+ ::msgcat::mcset nl "Orientation" "Oriëntatie"
+ ::msgcat::mcset nl "Portrait" "Portret"
+ ::msgcat::mcset nl "Landscape" "Landschap"
+ ::msgcat::mcset nl "Output" "Uitvoer"
+} \ No newline at end of file
diff --git a/library/msgs/pl.msg b/library/msgs/pl.msg
index c20f41e..d47b834 100644
--- a/library/msgs/pl.msg
+++ b/library/msgs/pl.msg
@@ -2,35 +2,35 @@ namespace eval ::tk {
::msgcat::mcset pl "&Abort" "&Przerwij"
::msgcat::mcset pl "&About..." "O programie..."
::msgcat::mcset pl "All Files" "Wszystkie pliki"
- ::msgcat::mcset pl "Application Error" "B\u0142\u0105d w programie"
+ ::msgcat::mcset pl "Application Error" "Błąd w programie"
::msgcat::mcset pl "&Apply" "Zastosuj"
::msgcat::mcset pl "Bold" "Pogrubienie"
::msgcat::mcset pl "Bold Italic" "Pogrubiona kursywa"
::msgcat::mcset pl "&Blue" "&Niebieski"
::msgcat::mcset pl "Cancel" "Anuluj"
::msgcat::mcset pl "&Cancel" "&Anuluj"
- ::msgcat::mcset pl "Cannot change to the directory \"%1\$s\".\nPermission denied." "Nie mo\u017cna otworzy\u0107 katalogu \"%1\$s\".\nOdmowa dost\u0119pu."
+ ::msgcat::mcset pl "Cannot change to the directory \"%1\$s\".\nPermission denied." "Nie można otworzyć katalogu \"%1\$s\".\nOdmowa dostępu."
::msgcat::mcset pl "Choose Directory" "Wybierz katalog"
- ::msgcat::mcset pl "Cl&ear" "&Wyczy\u015b\u0107"
- ::msgcat::mcset pl "&Clear Console" "&Wyczy\u015b\u0107 konsol\u0119"
+ ::msgcat::mcset pl "Cl&ear" "&Wyczyść"
+ ::msgcat::mcset pl "&Clear Console" "&Wyczyść konsolę"
::msgcat::mcset pl "Color" "Kolor"
::msgcat::mcset pl "Console" "Konsola"
::msgcat::mcset pl "&Copy" "&Kopiuj"
::msgcat::mcset pl "Cu&t" "&Wytnij"
- ::msgcat::mcset pl "&Delete" "&Usu\u0144"
- ::msgcat::mcset pl "Details >>" "Szczeg\u00f3\u0142y >>"
+ ::msgcat::mcset pl "&Delete" "&Usuń"
+ ::msgcat::mcset pl "Details >>" "Szczegóły >>"
::msgcat::mcset pl "Directory \"%1\$s\" does not exist." "Katalog \"%1\$s\" nie istnieje."
::msgcat::mcset pl "&Directory:" "&Katalog:"
::msgcat::mcset pl "&Edit" "&Edytuj"
::msgcat::mcset pl "Effects" "Efekty"
- ::msgcat::mcset pl "Error: %1\$s" "B\u0142\u0105d: %1\$s"
- ::msgcat::mcset pl "E&xit" "&Wyjd\u017a"
+ ::msgcat::mcset pl "Error: %1\$s" "Błąd: %1\$s"
+ ::msgcat::mcset pl "E&xit" "&Wyjdź"
::msgcat::mcset pl "&File" "&Plik"
- ::msgcat::mcset pl "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Plik \"%1\$s\" ju\u017c istnieje.\nCzy chcesz go nadpisa\u0107?"
- ::msgcat::mcset pl "File \"%1\$s\" already exists.\n\n" "Plik \"%1\$s\" ju\u017c istnieje.\n\n"
+ ::msgcat::mcset pl "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Plik \"%1\$s\" już istnieje.\nCzy chcesz go nadpisać?"
+ ::msgcat::mcset pl "File \"%1\$s\" already exists.\n\n" "Plik \"%1\$s\" już istnieje.\n\n"
::msgcat::mcset pl "File \"%1\$s\" does not exist." "Plik \"%1\$s\" nie istnieje."
::msgcat::mcset pl "File &name:" "Nazwa &pliku:"
- ::msgcat::mcset pl "File &names:" "Nazwy &plik\u00f3w:"
+ ::msgcat::mcset pl "File &names:" "Nazwy &plików:"
::msgcat::mcset pl "Files of &type:" "Pliki &typu:"
::msgcat::mcset pl "Fi&les:" "Pli&ki:"
::msgcat::mcset pl "&Filter" "&Filtr"
@@ -41,41 +41,41 @@ namespace eval ::tk {
::msgcat::mcset pl "&Green" "&Zielony"
::msgcat::mcset pl "&Help" "&Pomoc"
::msgcat::mcset pl "Hi" "Witaj"
- ::msgcat::mcset pl "&Hide Console" "&Ukryj konsol\u0119"
+ ::msgcat::mcset pl "&Hide Console" "&Ukryj konsolę"
::msgcat::mcset pl "&Ignore" "&Ignoruj"
- ::msgcat::mcset pl "Invalid file name \"%1\$s\"." "Niew\u0142a\u015bciwa nazwa pliku \"%1\$s\"."
+ ::msgcat::mcset pl "Invalid file name \"%1\$s\"." "Niewłaściwa nazwa pliku \"%1\$s\"."
::msgcat::mcset pl "Italic" "Kursywa"
::msgcat::mcset pl "Log Files" "Pliki dziennika"
::msgcat::mcset pl "&No" "&Nie"
::msgcat::mcset pl "&OK"
::msgcat::mcset pl "OK"
::msgcat::mcset pl "Ok"
- ::msgcat::mcset pl "Open" "Otw\u00f3rz"
- ::msgcat::mcset pl "&Open" "&Otw\u00f3rz"
- ::msgcat::mcset pl "Open Multiple Files" "Otw\u00f3rz wiele plik\u00f3w"
+ ::msgcat::mcset pl "Open" "Otwórz"
+ ::msgcat::mcset pl "&Open" "&Otwórz"
+ ::msgcat::mcset pl "Open Multiple Files" "Otwórz wiele plików"
::msgcat::mcset pl "P&aste" "&Wklej"
- ::msgcat::mcset pl "&Quit" "&Zako\u0144cz"
+ ::msgcat::mcset pl "&Quit" "&Zakończ"
::msgcat::mcset pl "&Red" "&Czerwony"
::msgcat::mcset pl "Regular" "Regularne"
- ::msgcat::mcset pl "Replace existing file?" "Czy zast\u0105pi\u0107 istniej\u0105cy plik?"
- ::msgcat::mcset pl "&Retry" "&Pon\u00f3w"
- ::msgcat::mcset pl "Sample" "Przyk\u0142ad"
+ ::msgcat::mcset pl "Replace existing file?" "Czy zastąpić istniejący plik?"
+ ::msgcat::mcset pl "&Retry" "&Ponów"
+ ::msgcat::mcset pl "Sample" "Przykład"
::msgcat::mcset pl "&Save" "&Zapisz"
::msgcat::mcset pl "Save As" "Zapisz jako"
::msgcat::mcset pl "Save To Log" "Wpisz do dziennika"
::msgcat::mcset pl "Select Log File" "Wybierz plik dziennika"
::msgcat::mcset pl "Select a file to source" "Wybierz plik do wykonania"
- ::msgcat::mcset pl "&Selection:" "&Wyb\u00f3r:"
+ ::msgcat::mcset pl "&Selection:" "&Wybór:"
::msgcat::mcset pl "&Size:" "&Rozmiar:"
- ::msgcat::mcset pl "Show &Hidden Directories" "Poka\u017c &ukryte katalogi"
- ::msgcat::mcset pl "Show &Hidden Files and Directories" "Poka\u017c &ukryte pliki i katalogi"
- ::msgcat::mcset pl "Skip Messages" "Pomi\u0144 pozosta\u0142e komunikaty"
- ::msgcat::mcset pl "&Source..." "&Kod \u017ar\u00f3d\u0142owy..."
- ::msgcat::mcset pl "Stri&keout" "&Przekre\u015blenie"
+ ::msgcat::mcset pl "Show &Hidden Directories" "Pokaż &ukryte katalogi"
+ ::msgcat::mcset pl "Show &Hidden Files and Directories" "Pokaż &ukryte pliki i katalogi"
+ ::msgcat::mcset pl "Skip Messages" "Pomiń pozostałe komunikaty"
+ ::msgcat::mcset pl "&Source..." "&Kod źródłowy..."
+ ::msgcat::mcset pl "Stri&keout" "&Przekreślenie"
::msgcat::mcset pl "Tcl Scripts" "Skrypty Tcl"
::msgcat::mcset pl "Tcl for Windows" "Tcl dla Windows"
::msgcat::mcset pl "Text Files" "Pliki tekstowe"
- ::msgcat::mcset pl "&Underline" "Po&dkre\u015blenie"
+ ::msgcat::mcset pl "&Underline" "Po&dkreślenie"
::msgcat::mcset pl "&Yes" "&Tak"
::msgcat::mcset pl "abort" "przerwij"
::msgcat::mcset pl "blue" "niebieski"
@@ -86,6 +86,24 @@ namespace eval ::tk {
::msgcat::mcset pl "ignore" "ignoruj"
::msgcat::mcset pl "ok"
::msgcat::mcset pl "red" "czerwony"
- ::msgcat::mcset pl "retry" "pon\u00f3w"
+ ::msgcat::mcset pl "retry" "ponów"
::msgcat::mcset pl "yes" "tak"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset pl "Print" "Drukować"
+ ::msgcat::mcset pl "Printer" "Drukarka"
+ ::msgcat::mcset pl "Letter " "Litera"
+ ::msgcat::mcset pl "Legal " "Legalny"
+ ::msgcat::mcset pl "A4" "A4"
+ ::msgcat::mcset pl "Grayscale" "Skala Szarości"
+ ::msgcat::mcset pl "RGB" "Rgb"
+ ::msgcat::mcset pl "Options" "Opcje"
+ ::msgcat::mcset pl "Copies" "Kopie"
+ ::msgcat::mcset pl "Paper" "Papier"
+ ::msgcat::mcset pl "Scale" "Skala"
+ ::msgcat::mcset pl "Orientation" "Orientacja"
+ ::msgcat::mcset pl "Portrait" "Portret"
+ ::msgcat::mcset pl "Landscape" "Krajobraz"
+ ::msgcat::mcset pl "Output" "Produkt Wyjściowy"
+} \ No newline at end of file
diff --git a/library/msgs/pt.msg b/library/msgs/pt.msg
index c29e293..d4fdfea 100644
--- a/library/msgs/pt.msg
+++ b/library/msgs/pt.msg
@@ -2,12 +2,12 @@ namespace eval ::tk {
::msgcat::mcset pt "&Abort" "&Abortar"
::msgcat::mcset pt "About..." "Sobre ..."
::msgcat::mcset pt "All Files" "Todos os arquivos"
- ::msgcat::mcset pt "Application Error" "Erro de aplica\u00e7\u00e3o"
+ ::msgcat::mcset pt "Application Error" "Erro de aplicação"
::msgcat::mcset pt "&Blue" "&Azul"
::msgcat::mcset pt "Cancel" "Cancelar"
::msgcat::mcset pt "&Cancel" "&Cancelar"
- ::msgcat::mcset pt "Cannot change to the directory \"%1\$s\".\nPermission denied." "N\u00e3o foi poss\u00edvel mudar para o diret\u00f3rio \"%1\$s\".\nPermiss\u00e3o negada."
- ::msgcat::mcset pt "Choose Directory" "Escolha um diret\u00f3rio"
+ ::msgcat::mcset pt "Cannot change to the directory \"%1\$s\".\nPermission denied." "Não foi possível mudar para o diretório \"%1\$s\".\nPermissão negada."
+ ::msgcat::mcset pt "Choose Directory" "Escolha um diretório"
::msgcat::mcset pt "Cl&ear" "Apagar"
::msgcat::mcset pt "&Clear Console" "Apagar Console"
::msgcat::mcset pt "Color" "Cor"
@@ -16,14 +16,14 @@ namespace eval ::tk {
::msgcat::mcset pt "Cu&t" "Recortar"
::msgcat::mcset pt "&Delete" "Excluir"
::msgcat::mcset pt "Details >>" "Detalhes >>"
- ::msgcat::mcset pt "Directory \"%1\$s\" does not exist." "O diret\u00f3rio \"%1\$s\" n\u00e3o existe."
- ::msgcat::mcset pt "&Directory:" "&Diret\u00f3rio:"
+ ::msgcat::mcset pt "Directory \"%1\$s\" does not exist." "O diretório \"%1\$s\" não existe."
+ ::msgcat::mcset pt "&Directory:" "&Diretório:"
::msgcat::mcset pt "Error: %1\$s" "Erro: %1\$s"
::msgcat::mcset pt "E&xit" "Sair"
::msgcat::mcset pt "&File" "Arquivo"
- ::msgcat::mcset pt "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "O arquivo \"%1\$s\" j\u00e1 existe.\nDeseja sobrescreve-lo?"
- ::msgcat::mcset pt "File \"%1\$s\" already exists.\n\n" "O arquivo \"%1\$s\" j\u00e1 existe.\n\n"
- ::msgcat::mcset pt "File \"%1\$s\" does not exist." "Arquivo \"%1\$s\" n\u00e3o existe."
+ ::msgcat::mcset pt "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "O arquivo \"%1\$s\" já existe.\nDeseja sobrescreve-lo?"
+ ::msgcat::mcset pt "File \"%1\$s\" already exists.\n\n" "O arquivo \"%1\$s\" já existe.\n\n"
+ ::msgcat::mcset pt "File \"%1\$s\" does not exist." "Arquivo \"%1\$s\" não existe."
::msgcat::mcset pt "File &name:" "&Nome do arquivo:"
::msgcat::mcset pt "File &names:" "&Nomes dos arquivos:"
::msgcat::mcset pt "Files of &type:" "Arquivos do &tipo:"
@@ -34,15 +34,15 @@ namespace eval ::tk {
::msgcat::mcset pt "Hi" "Oi"
::msgcat::mcset pt "&Hide Console" "Ocultar console"
::msgcat::mcset pt "&Ignore" "&Ignorar"
- ::msgcat::mcset pt "Invalid file name \"%1\$s\"." "O nome do arquivo \u00e9 inv\u00e1lido \"%1\$s\"."
+ ::msgcat::mcset pt "Invalid file name \"%1\$s\"." "O nome do arquivo é inválido \"%1\$s\"."
::msgcat::mcset pt "Log Files" "Arquivos de log"
- ::msgcat::mcset pt "&No" "&N\u00e3o"
+ ::msgcat::mcset pt "&No" "&Não"
::msgcat::mcset pt "&OK"
::msgcat::mcset pt "OK"
::msgcat::mcset pt "Ok"
::msgcat::mcset pt "Open" "Abrir"
::msgcat::mcset pt "&Open" "&Abrir"
- ::msgcat::mcset pt "Open Multiple Files" "Abrir m\u00faltiplos arquivos"
+ ::msgcat::mcset pt "Open Multiple Files" "Abrir múltiplos arquivos"
::msgcat::mcset pt "P&aste" "Col&ar"
::msgcat::mcset pt "Quit" "Encerrar"
::msgcat::mcset pt "&Red" "&Vermelho"
@@ -53,7 +53,7 @@ namespace eval ::tk {
::msgcat::mcset pt "Save To Log" "Salvar arquivo de log"
::msgcat::mcset pt "Select Log File" "Selecionar arquivo de log"
::msgcat::mcset pt "Select a file to source" "Selecione um arquivo como fonte"
- ::msgcat::mcset pt "&Selection:" "&Sele\u00e7\u00e3o:"
+ ::msgcat::mcset pt "&Selection:" "&Seleção:"
::msgcat::mcset pt "Skip Messages" "Omitir as mensagens"
::msgcat::mcset pt "&Source..." "&Fonte..."
::msgcat::mcset pt "Tcl Scripts" "Scripts Tcl"
@@ -63,8 +63,8 @@ namespace eval ::tk {
::msgcat::mcset pt "abort" "abortar"
::msgcat::mcset pt "blue" "azul"
::msgcat::mcset pt "cancel" "cancelar"
- ::msgcat::mcset pt "extension" "extens\u00e3o"
- ::msgcat::mcset pt "extensions" "extens\u00f5es"
+ ::msgcat::mcset pt "extension" "extensão"
+ ::msgcat::mcset pt "extensions" "extensões"
::msgcat::mcset pt "green" "verde"
::msgcat::mcset pt "ignore" "ignorar"
::msgcat::mcset pt "ok"
@@ -72,3 +72,21 @@ namespace eval ::tk {
::msgcat::mcset pt "retry" "tentar novamente"
::msgcat::mcset pt "yes" "sim"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset pt "Print" "Imprimir"
+ ::msgcat::mcset pt "Printer" "Impressora"
+ ::msgcat::mcset pt "Letter " "Letra"
+ ::msgcat::mcset pt "Legal " "Legal"
+ ::msgcat::mcset pt "A4" "A4"
+ ::msgcat::mcset pt "Grayscale" "Escala De Cinza"
+ ::msgcat::mcset pt "RGB" "Rgb"
+ ::msgcat::mcset pt "Options" "Opções"
+ ::msgcat::mcset pt "Copies" "Exemplares"
+ ::msgcat::mcset pt "Paper" "Papel"
+ ::msgcat::mcset pt "Scale" "Escala"
+ ::msgcat::mcset pt "Orientation" "Orientação"
+ ::msgcat::mcset pt "Portrait" "Retrato"
+ ::msgcat::mcset pt "Landscape" "Paisagem"
+ ::msgcat::mcset pt "Output" "Saída"
+} \ No newline at end of file
diff --git a/library/msgs/ru.msg b/library/msgs/ru.msg
index 2aac5bb..bd7c7b2 100644
--- a/library/msgs/ru.msg
+++ b/library/msgs/ru.msg
@@ -1,75 +1,93 @@
namespace eval ::tk {
- ::msgcat::mcset ru "&Abort" "&\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c"
- ::msgcat::mcset ru "&About..." "\u041f\u0440\u043e..."
- ::msgcat::mcset ru "All Files" "\u0412\u0441\u0435 \u0444\u0430\u0439\u043b\u044b"
- ::msgcat::mcset ru "Application Error" "\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435"
- ::msgcat::mcset ru "&Blue" " &\u0413\u043e\u043b\u0443\u0431\u043e\u0439"
- ::msgcat::mcset ru "Cancel" "\u041e\u0442&\u043c\u0435\u043d\u0430"
- ::msgcat::mcset ru "&Cancel" "\u041e\u0442&\u043c\u0435\u043d\u0430"
+ ::msgcat::mcset ru "&Abort" "&Отменить"
+ ::msgcat::mcset ru "&About..." "Про..."
+ ::msgcat::mcset ru "All Files" "Все файлы"
+ ::msgcat::mcset ru "Application Error" "Ошибка в программе"
+ ::msgcat::mcset ru "&Blue" " &Голубой"
+ ::msgcat::mcset ru "Cancel" "От&мена"
+ ::msgcat::mcset ru "&Cancel" "От&мена"
::msgcat::mcset ru "Cannot change to the directory \"%1\$s\".\nPermission denied." \
- "\u041d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \"%1\$s\".\n\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430"
- ::msgcat::mcset ru "Choose Directory" "\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433"
- ::msgcat::mcset ru "Cl&ear" "\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c"
- ::msgcat::mcset ru "Color" "\u0426\u0432\u0435\u0442"
- ::msgcat::mcset ru "Console" "\u041a\u043e\u043d\u0441\u043e\u043b\u044c"
- ::msgcat::mcset ru "&Copy" "\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c"
- ::msgcat::mcset ru "Cu&t" "\u0412\u044b\u0440\u0435\u0437\u0430\u0442\u044c"
- ::msgcat::mcset ru "&Delete" "\u0423\u0434\u0430\u043b\u0438\u0442\u044c"
- ::msgcat::mcset ru "Details >>" "\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 >>"
- ::msgcat::mcset ru "Directory \"%1\$s\" does not exist." "\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \"%1\$s\" \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442."
- ::msgcat::mcset ru "&Directory:" "&\u041a\u0430\u0442\u0430\u043b\u043e\u0433:"
- ::msgcat::mcset ru "Error: %1\$s" "\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s"
- ::msgcat::mcset ru "E&xit" "\u0412\u044b\u0445\u043e\u0434"
+ "Не могу перейти в каталог \"%1\$s\".\nНедостаточно прав доступа"
+ ::msgcat::mcset ru "Choose Directory" "Выберите каталог"
+ ::msgcat::mcset ru "Cl&ear" "Очистить"
+ ::msgcat::mcset ru "Color" "Цвет"
+ ::msgcat::mcset ru "Console" "Консоль"
+ ::msgcat::mcset ru "&Copy" "Копировать"
+ ::msgcat::mcset ru "Cu&t" "Вырезать"
+ ::msgcat::mcset ru "&Delete" "Удалить"
+ ::msgcat::mcset ru "Details >>" "Подробнее >>"
+ ::msgcat::mcset ru "Directory \"%1\$s\" does not exist." "Каталога \"%1\$s\" не существует."
+ ::msgcat::mcset ru "&Directory:" "&Каталог:"
+ ::msgcat::mcset ru "Error: %1\$s" "Ошибка: %1\$s"
+ ::msgcat::mcset ru "E&xit" "Выход"
::msgcat::mcset ru "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \
- "\u0424\u0430\u0439\u043b \"%1\$s\" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\n\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e?"
- ::msgcat::mcset ru "File \"%1\$s\" already exists.\n\n" "\u0424\u0430\u0439\u043b \"%1\$s\" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\n\n"
- ::msgcat::mcset ru "File \"%1\$s\" does not exist." "\u0424\u0430\u0439\u043b \"%1\$s\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d."
- ::msgcat::mcset ru "File &name:" "&\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430:"
- ::msgcat::mcset ru "File &names:" "&\u0418\u043c\u0435\u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432:"
- ::msgcat::mcset ru "Files of &type:" "&\u0422\u0438\u043f \u0444\u0430\u0439\u043b\u043e\u0432:"
- ::msgcat::mcset ru "Fi&les:" "\u0424\u0430\u0439&\u043b\u044b:"
- ::msgcat::mcset ru "&Filter" "&\u0424\u0438\u043b\u044c\u0442\u0440"
- ::msgcat::mcset ru "Fil&ter:" "\u0424\u0438\u043b\u044c&\u0442\u0440:"
- ::msgcat::mcset ru "&Green" " &\u0417\u0435\u043b\u0435\u043d\u044b\u0439"
- ::msgcat::mcset ru "Hi" "\u041f\u0440\u0438\u0432\u0435\u0442"
- ::msgcat::mcset ru "&Hide Console" "\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c"
- ::msgcat::mcset ru "&Ignore" "&\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c"
- ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \"%1\$s\"."
- ::msgcat::mcset ru "Log Files" "\u0424\u0430\u0439\u043b\u044b \u0436\u0443\u0440\u043d\u0430\u043b\u0430"
- ::msgcat::mcset ru "&No" "&\u041d\u0435\u0442"
- ::msgcat::mcset ru "&OK" "&\u041e\u041a"
- ::msgcat::mcset ru "OK" "\u041e\u041a"
- ::msgcat::mcset ru "Ok" "\u0414\u0430"
- ::msgcat::mcset ru "Open" "\u041e\u0442\u043a\u0440\u044b\u0442\u044c"
- ::msgcat::mcset ru "&Open" "&\u041e\u0442\u043a\u0440\u044b\u0442\u044c"
- ::msgcat::mcset ru "Open Multiple Files" "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432"
- ::msgcat::mcset ru "P&aste" "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c"
- ::msgcat::mcset ru "&Quit" "\u0412\u044b\u0445\u043e\u0434"
- ::msgcat::mcset ru "&Red" " &\u041a\u0440\u0430\u0441\u043d\u044b\u0439"
- ::msgcat::mcset ru "Replace existing file?" "\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b?"
- ::msgcat::mcset ru "&Retry" "&\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c"
- ::msgcat::mcset ru "&Save" "&\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c"
- ::msgcat::mcset ru "Save As" "\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a"
- ::msgcat::mcset ru "Save To Log" "\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0436\u0443\u0440\u043d\u0430\u043b"
- ::msgcat::mcset ru "Select Log File" "\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0436\u0443\u0440\u043d\u0430\u043b"
- ::msgcat::mcset ru "Select a file to source" "\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438"
+ "Файл \"%1\$s\" уже существует.\nЗаменить его?"
+ ::msgcat::mcset ru "File \"%1\$s\" already exists.\n\n" "Файл \"%1\$s\" уже существует.\n\n"
+ ::msgcat::mcset ru "File \"%1\$s\" does not exist." "Файл \"%1\$s\" не найден."
+ ::msgcat::mcset ru "File &name:" "&Имя файла:"
+ ::msgcat::mcset ru "File &names:" "&Имена файлов:"
+ ::msgcat::mcset ru "Files of &type:" "&Тип файлов:"
+ ::msgcat::mcset ru "Fi&les:" "Фай&лы:"
+ ::msgcat::mcset ru "&Filter" "&Фильтр"
+ ::msgcat::mcset ru "Fil&ter:" "Филь&тр:"
+ ::msgcat::mcset ru "&Green" " &Зеленый"
+ ::msgcat::mcset ru "Hi" "Привет"
+ ::msgcat::mcset ru "&Hide Console" "Спрятать консоль"
+ ::msgcat::mcset ru "&Ignore" "&Игнорировать"
+ ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "Неверное имя файла \"%1\$s\"."
+ ::msgcat::mcset ru "Log Files" "Файлы журнала"
+ ::msgcat::mcset ru "&No" "&Нет"
+ ::msgcat::mcset ru "&OK" "&ОК"
+ ::msgcat::mcset ru "OK" "ОК"
+ ::msgcat::mcset ru "Ok" "Да"
+ ::msgcat::mcset ru "Open" "Открыть"
+ ::msgcat::mcset ru "&Open" "&Открыть"
+ ::msgcat::mcset ru "Open Multiple Files" "Открыть несколько файлов"
+ ::msgcat::mcset ru "P&aste" "Вставить"
+ ::msgcat::mcset ru "&Quit" "Выход"
+ ::msgcat::mcset ru "&Red" " &Красный"
+ ::msgcat::mcset ru "Replace existing file?" "Заменить существующий файл?"
+ ::msgcat::mcset ru "&Retry" "&Повторить"
+ ::msgcat::mcset ru "&Save" "&Сохранить"
+ ::msgcat::mcset ru "Save As" "Сохранить как"
+ ::msgcat::mcset ru "Save To Log" "Сохранить в журнал"
+ ::msgcat::mcset ru "Select Log File" "Выбрать журнал"
+ ::msgcat::mcset ru "Select a file to source" "Выберите файл для интерпретации"
::msgcat::mcset ru "&Selection:"
- ::msgcat::mcset ru "Skip Messages" "\u041f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f"
- ::msgcat::mcset ru "&Source..." "\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b..."
- ::msgcat::mcset ru "Tcl Scripts" "\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 TCL"
- ::msgcat::mcset ru "Tcl for Windows" "TCL \u0434\u043b\u044f Windows"
- ::msgcat::mcset ru "Text Files" "\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0444\u0430\u0439\u043b\u044b"
- ::msgcat::mcset ru "&Yes" "&\u0414\u0430"
- ::msgcat::mcset ru "abort" "\u043e\u0442\u043c\u0435\u043d\u0430"
- ::msgcat::mcset ru "blue" " \u0433\u043e\u043b\u0443\u0431\u043e\u0439"
- ::msgcat::mcset ru "cancel" "\u043e\u0442\u043c\u0435\u043d\u0430"
- ::msgcat::mcset ru "extension" "\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435"
- ::msgcat::mcset ru "extensions" "\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f"
- ::msgcat::mcset ru "green" " \u0437\u0435\u043b\u0435\u043d\u044b\u0439"
- ::msgcat::mcset ru "ignore" "\u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c"
- ::msgcat::mcset ru "ok" "\u043e\u043a"
- ::msgcat::mcset ru "red" " \u043a\u0440\u0430\u0441\u043d\u044b\u0439"
- ::msgcat::mcset ru "retry" "\u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c"
- ::msgcat::mcset ru "yes" "\u0434\u0430"
+ ::msgcat::mcset ru "Skip Messages" "Пропустить сообщения"
+ ::msgcat::mcset ru "&Source..." "Интерпретировать файл..."
+ ::msgcat::mcset ru "Tcl Scripts" "Программа на языке TCL"
+ ::msgcat::mcset ru "Tcl for Windows" "TCL для Windows"
+ ::msgcat::mcset ru "Text Files" "Текстовые файлы"
+ ::msgcat::mcset ru "&Yes" "&Да"
+ ::msgcat::mcset ru "abort" "отмена"
+ ::msgcat::mcset ru "blue" " голубой"
+ ::msgcat::mcset ru "cancel" "отмена"
+ ::msgcat::mcset ru "extension" "расширение"
+ ::msgcat::mcset ru "extensions" "расширения"
+ ::msgcat::mcset ru "green" " зеленый"
+ ::msgcat::mcset ru "ignore" "пропустить"
+ ::msgcat::mcset ru "ok" "ок"
+ ::msgcat::mcset ru "red" " красный"
+ ::msgcat::mcset ru "retry" "повторить"
+ ::msgcat::mcset ru "yes" "да"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset ru "Print" "Печатать"
+ ::msgcat::mcset ru "Printer" "Принтер"
+ ::msgcat::mcset ru "Letter " "Письмо"
+ ::msgcat::mcset ru "Legal " "Законный"
+ ::msgcat::mcset ru "A4" "A4"
+ ::msgcat::mcset ru "Grayscale" "Серый Масштаб"
+ ::msgcat::mcset ru "RGB" "Ргб"
+ ::msgcat::mcset ru "Options" "Параметры"
+ ::msgcat::mcset ru "Copies" "Копии"
+ ::msgcat::mcset ru "Paper" "Бумага"
+ ::msgcat::mcset ru "Scale" "Шкала"
+ ::msgcat::mcset ru "Orientation" "Ориентация"
+ ::msgcat::mcset ru "Portrait" "Портрет"
+ ::msgcat::mcset ru "Landscape" "Ландшафт"
+ ::msgcat::mcset ru "Output" "Выпуск"
+} \ No newline at end of file
diff --git a/library/msgs/sv.msg b/library/msgs/sv.msg
index 62bfcbd..5858221 100644
--- a/library/msgs/sv.msg
+++ b/library/msgs/sv.msg
@@ -3,14 +3,14 @@ namespace eval ::tk {
::msgcat::mcset sv "&About..." "&Om..."
::msgcat::mcset sv "All Files" "Samtliga filer"
::msgcat::mcset sv "Application Error" "Programfel"
- ::msgcat::mcset sv "&Blue" "&Bl\u00e5"
+ ::msgcat::mcset sv "&Blue" "&Blå"
::msgcat::mcset sv "Cancel" "Avbryt"
::msgcat::mcset sv "&Cancel" "&Avbryt"
- ::msgcat::mcset sv "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan ej n\u00e5 mappen \"%1\$s\".\nSaknar r\u00e4ttigheter."
- ::msgcat::mcset sv "Choose Directory" "V\u00e4lj mapp"
+ ::msgcat::mcset sv "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan ej nå mappen \"%1\$s\".\nSaknar rättigheter."
+ ::msgcat::mcset sv "Choose Directory" "Välj mapp"
::msgcat::mcset sv "Cl&ear" "&Radera"
::msgcat::mcset sv "&Clear Console" "&Radera konsollen"
- ::msgcat::mcset sv "Color" "F\u00e4rg"
+ ::msgcat::mcset sv "Color" "Färg"
::msgcat::mcset sv "Console" "Konsoll"
::msgcat::mcset sv "&Copy" "&Kopiera"
::msgcat::mcset sv "Cu&t" "Klipp u&t"
@@ -22,7 +22,7 @@ namespace eval ::tk {
::msgcat::mcset sv "Error: %1\$s" "Fel: %1\$s"
::msgcat::mcset sv "E&xit" "&Avsluta"
::msgcat::mcset sv "&File" "&Fil"
- ::msgcat::mcset sv "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Filen \"%1\$s\" finns redan.\nVill du skriva \u00f6ver den?"
+ ::msgcat::mcset sv "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Filen \"%1\$s\" finns redan.\nVill du skriva över den?"
::msgcat::mcset sv "File \"%1\$s\" already exists.\n\n" "Filen \"%1\$s\" finns redan.\n\n"
::msgcat::mcset sv "File \"%1\$s\" does not exist." "Filen \"%1\$s\" finns ej."
::msgcat::mcset sv "File &name:" "Fil&namn:"
@@ -31,10 +31,10 @@ namespace eval ::tk {
::msgcat::mcset sv "Fi&les:" "Fi&ler:"
::msgcat::mcset sv "&Filter"
::msgcat::mcset sv "Fil&ter:"
- ::msgcat::mcset sv "&Green" "&Gr\u00f6n"
- ::msgcat::mcset sv "&Help" "&Hj\u00e4lp"
+ ::msgcat::mcset sv "&Green" "&Grön"
+ ::msgcat::mcset sv "&Help" "&Hjälp"
::msgcat::mcset sv "Hi" "Hej"
- ::msgcat::mcset sv "&Hide Console" "&G\u00f6m konsollen"
+ ::msgcat::mcset sv "&Hide Console" "&Göm konsollen"
::msgcat::mcset sv "&Ignore" "&Ignorera"
::msgcat::mcset sv "Invalid file name \"%1\$s\"." "Ogiltigt filnamn \"%1\$s\"."
::msgcat::mcset sv "Log Files" "Loggfiler"
@@ -42,35 +42,53 @@ namespace eval ::tk {
::msgcat::mcset sv "&OK"
::msgcat::mcset sv "OK"
::msgcat::mcset sv "Ok"
- ::msgcat::mcset sv "Open" "\u00d6ppna"
- ::msgcat::mcset sv "&Open" "&\u00d6ppna"
- ::msgcat::mcset sv "Open Multiple Files" "\u00d6ppna flera filer"
+ ::msgcat::mcset sv "Open" "Öppna"
+ ::msgcat::mcset sv "&Open" "&Öppna"
+ ::msgcat::mcset sv "Open Multiple Files" "Öppna flera filer"
::msgcat::mcset sv "P&aste" "&Klistra in"
::msgcat::mcset sv "&Quit" "&Avsluta"
- ::msgcat::mcset sv "&Red" "&R\u00f6d"
- ::msgcat::mcset sv "Replace existing file?" "Ers\u00e4tt existerande fil?"
- ::msgcat::mcset sv "&Retry" "&F\u00f6rs\u00f6k igen"
+ ::msgcat::mcset sv "&Red" "&Röd"
+ ::msgcat::mcset sv "Replace existing file?" "Ersätt existerande fil?"
+ ::msgcat::mcset sv "&Retry" "&Försök igen"
::msgcat::mcset sv "&Save" "&Spara"
::msgcat::mcset sv "Save As" "Spara som"
::msgcat::mcset sv "Save To Log" "Spara till logg"
- ::msgcat::mcset sv "Select Log File" "V\u00e4lj loggfil"
- ::msgcat::mcset sv "Select a file to source" "V\u00e4lj k\u00e4llfil"
+ ::msgcat::mcset sv "Select Log File" "Välj loggfil"
+ ::msgcat::mcset sv "Select a file to source" "Välj källfil"
::msgcat::mcset sv "&Selection:" "&Val:"
- ::msgcat::mcset sv "Skip Messages" "Hoppa \u00f6ver meddelanden"
- ::msgcat::mcset sv "&Source..." "&K\u00e4lla..."
+ ::msgcat::mcset sv "Skip Messages" "Hoppa över meddelanden"
+ ::msgcat::mcset sv "&Source..." "&Källa..."
::msgcat::mcset sv "Tcl Scripts" "Tcl skript"
- ::msgcat::mcset sv "Tcl for Windows" "Tcl f\u00f6r Windows"
+ ::msgcat::mcset sv "Tcl for Windows" "Tcl för Windows"
::msgcat::mcset sv "Text Files" "Textfiler"
::msgcat::mcset sv "&Yes" "&Ja"
::msgcat::mcset sv "abort" "avbryt"
- ::msgcat::mcset sv "blue" "bl\u00e5"
+ ::msgcat::mcset sv "blue" "blå"
::msgcat::mcset sv "cancel" "avbryt"
::msgcat::mcset sv "extension" "utvidgning"
::msgcat::mcset sv "extensions" "utvidgningar"
- ::msgcat::mcset sv "green" "gr\u00f6n"
+ ::msgcat::mcset sv "green" "grön"
::msgcat::mcset sv "ignore" "ignorera"
::msgcat::mcset sv "ok"
- ::msgcat::mcset sv "red" "r\u00f6d"
- ::msgcat::mcset sv "retry" "f\u00f6rs\u00f6k igen"
+ ::msgcat::mcset sv "red" "röd"
+ ::msgcat::mcset sv "retry" "försök igen"
::msgcat::mcset sv "yes" "ja"
}
+#localization of print terms by Kevin Walzer via Microsoft Translator
+namespace eval ::tk {
+ ::msgcat::mcset sv "Print" "Trycka"
+ ::msgcat::mcset sv "Printer" "Skrivare"
+ ::msgcat::mcset sv "Letter " "Brev"
+ ::msgcat::mcset sv "Legal " "Laglig"
+ ::msgcat::mcset sv "A4" "A4 (På 199"
+ ::msgcat::mcset sv "Grayscale" "Gråskala"
+ ::msgcat::mcset sv "RGB" "Rgb"
+ ::msgcat::mcset sv "Options" "Alternativ"
+ ::msgcat::mcset sv "Copies" "Kopior"
+ ::msgcat::mcset sv "Paper" "Papper"
+ ::msgcat::mcset sv "Scale" "Skala"
+ ::msgcat::mcset sv "Orientation" "Orientering"
+ ::msgcat::mcset sv "Portrait" "Porträtt"
+ ::msgcat::mcset sv "Landscape" "Landskap"
+ ::msgcat::mcset sv "Output" "Utdata"
+} \ No newline at end of file
diff --git a/library/obsolete.tcl b/library/obsolete.tcl
index 3ee7f28..a31884d 100644
--- a/library/obsolete.tcl
+++ b/library/obsolete.tcl
@@ -3,8 +3,8 @@
# This file contains obsolete procedures that people really shouldn't
# be using anymore, but which are kept around for backward compatibility.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -103,7 +103,7 @@ proc ::tk::classic::restore_listbox {args} {
option add *Listbox.selectBorderWidth 1 $prio; # 0
}
# Remove focus into Listbox added for 8.5
- bind Listbox <1> {
+ bind Listbox <Button-1> {
if {[winfo exists %W]} {
tk::ListboxBeginSelect %W [%W index @%x,%y]
}
diff --git a/library/optMenu.tcl b/library/optMenu.tcl
index 7cfdaa0..4beb3c7 100644
--- a/library/optMenu.tcl
+++ b/library/optMenu.tcl
@@ -3,8 +3,8 @@
# This file defines the procedure tk_optionMenu, which creates
# an option button and its associated menu.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/palette.tcl b/library/palette.tcl
index 42c6a90..e658067 100644
--- a/library/palette.tcl
+++ b/library/palette.tcl
@@ -3,7 +3,7 @@
# This file contains procedures that change the color palette used
# by Tk.
#
-# Copyright (c) 1995-1997 Sun Microsystems, Inc.
+# Copyright © 1995-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/print.tcl b/library/print.tcl
new file mode 100644
index 0000000..7820a5f
--- /dev/null
+++ b/library/print.tcl
@@ -0,0 +1,995 @@
+# print.tcl --
+
+# This file defines the 'tk print' command for printing of the canvas
+# widget and text on X11, Windows, and macOS. It implements an abstraction
+# layer that presents a consistent API across the three platforms.
+
+# Copyright © 2009 Michael I. Schwartz.
+# Copyright © 2021 Kevin Walzer/WordTech Communications LLC.
+# Copyright © 2021 Harald Oehlmann, Elmicron GmbH
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+namespace eval ::tk::print {
+ namespace import -force ::tk::msgcat::*
+
+ # makeTempFile:
+ # Create a temporary file and populate its contents
+ # Arguments:
+ # filename - base of the name of the file to create
+ # contents - what to put in the file; defaults to empty
+ # Returns:
+ # Full filename for created file
+ #
+ proc makeTempFile {filename {contents ""}} {
+ set f [file tempfile filename $filename]
+ try {
+ puts -nonewline $f $contents
+ return $filename
+ } finally {
+ close $f
+ }
+ }
+
+ if {[tk windowingsystem] eq "win32"} {
+ variable printer_name
+ variable copies
+ variable dpi_x
+ variable dpi_y
+ variable paper_width
+ variable paper_height
+ variable margin_left
+ variable margin_top
+ variable printargs
+ array set printargs {}
+
+ # Multiple utility procedures for printing text based on the
+ # C printer primitives.
+
+ # _set_dc:
+ # Select printer and set device context and other parameters
+ # for print job.
+ #
+ proc _set_dc {} {
+ variable printargs
+ variable printer_name
+ variable paper_width
+ variable paper_height
+ variable dpi_x
+ variable dpi_y
+ variable copies
+
+ #First, we select the printer.
+ _selectprinter
+
+ #Next, set values. Some are taken from the printer,
+ #some are sane defaults.
+
+ if {[info exists printer_name] && $printer_name ne ""} {
+ set printargs(hDC) $printer_name
+ set printargs(pw) $paper_width
+ set printargs(pl) $paper_height
+ set printargs(lm) 1000
+ set printargs(tm) 1000
+ set printargs(rm) 1000
+ set printargs(bm) 1000
+ set printargs(resx) $dpi_x
+ set printargs(resy) $dpi_y
+ set printargs(copies) $copies
+ set printargs(resolution) [list $dpi_x $dpi_y]
+ }
+ }
+
+ # _print_data
+ # This function prints multiple-page files, using a line-oriented
+ # function, taking advantage of knowing the character widths.
+ # Arguments:
+ # data - Text data for printing
+ # breaklines - If non-zero, keep newlines in the string as
+ # newlines in the output.
+ # font - Font for printing
+ proc _print_data {data {breaklines 1} {font ""}} {
+ variable printargs
+ variable printer_name
+
+ _set_dc
+
+ if {![info exists printer_name]} {
+ return
+ }
+
+ if {$font eq ""} {
+ _gdi characters $printargs(hDC) -array printcharwid
+ } else {
+ _gdi characters $printargs(hDC) -font $font -array printcharwid
+ }
+ set pagewid [expr {($printargs(pw) - $printargs(rm) ) / 1000 * $printargs(resx)}]
+ set pagehgt [expr {($printargs(pl) - $printargs(bm) ) / 1000 * $printargs(resy)}]
+ set totallen [string length $data]
+ set curlen 0
+ set curhgt [expr {$printargs(tm) * $printargs(resy) / 1000}]
+
+ _opendoc
+ _openpage
+
+ while {$curlen < $totallen} {
+ set linestring [string range $data $curlen end]
+ if {$breaklines} {
+ set endind [string first "\n" $linestring]
+ if {$endind != -1} {
+ set linestring [string range $linestring 0 $endind]
+ # handle blank lines....
+ if {$linestring eq ""} {
+ set linestring " "
+ }
+ }
+ }
+
+ set result [_print_page_nextline $linestring \
+ printcharwid printargs $curhgt $font]
+ incr curlen [lindex $result 0]
+ incr curhgt [lindex $result 1]
+ if {$curhgt + [lindex $result 1] > $pagehgt} {
+ _closepage
+ _openpage
+ set curhgt [expr {$printargs(tm) * $printargs(resy) / 1000}]
+ }
+ }
+
+ _closepage
+ _closedoc
+ }
+
+ # _print_file
+ # This function prints multiple-page files
+ # It will either break lines or just let them run over the
+ # margins (and thus truncate).
+ # The font argument is JUST the font name, not any additional
+ # arguments.
+ # Arguments:
+ # filename - File to open for printing
+ # breaklines - 1 to break lines as done on input, 0 to ignore newlines
+ # font - Optional arguments to supply to the text command
+ proc _print_file {filename {breaklines 1} {font ""}} {
+ set fn [open $filename r]
+ set data [read $fn]
+ close $fn
+ _print_data $data $breaklines $font
+ }
+
+ # _print_page_nextline
+ # Returns the pair "chars y"
+ # where chars is the number of characters printed on the line
+ # and y is the height of the line printed
+ # Arguments:
+ # string - Data to print
+ # pdata - Array of values for printer characteristics
+ # cdata - Array of values for character widths
+ # y - Y value to begin printing at
+ # font - if non-empty specifies a font to draw the line in
+ proc _print_page_nextline {string carray parray y font} {
+ upvar #0 $carray charwidths
+ upvar #0 $parray printargs
+
+ variable printargs
+
+ set endindex 0
+ set totwidth 0
+ set maxwidth [expr {
+ (($printargs(pw) - $printargs(rm)) / 1000) * $printargs(resx)
+ }]
+ set maxstring [string length $string]
+ set lm [expr {$printargs(lm) * $printargs(resx) / 1000}]
+
+ for {set i 0} {($i < $maxstring) && ($totwidth < $maxwidth)} {incr i} {
+ incr totwidth $charwidths([string index $string $i])
+ # set width($i) $totwidth
+ }
+
+ set endindex $i
+ set startindex $endindex
+
+ if {$i < $maxstring} {
+ # In this case, the whole data string is not used up, and we
+ # wish to break on a word. Since we have all the partial
+ # widths calculated, this should be easy.
+
+ set endindex [expr {[string wordstart $string $endindex] - 1}]
+ set startindex [expr {$endindex + 1}]
+
+ # If the line is just too long (no word breaks), print as much
+ # as you can....
+ if {$endindex <= 1} {
+ set endindex $i
+ set startindex $i
+ }
+ }
+
+ set txt [string trim [string range $string 0 $endindex] "\r\n"]
+ if {$font ne ""} {
+ set result [_gdi text $printargs(hDC) $lm $y \
+ -anchor nw -justify left \
+ -text $txt -font $font]
+ } else {
+ set result [_gdi text $printargs(hDC) $lm $y \
+ -anchor nw -justify left -text $txt]
+ }
+ return "$startindex $result"
+ }
+
+ # These procedures read in the canvas widget, and write all of
+ # its contents out to the Windows printer.
+
+ variable option
+ variable vtgPrint
+
+ proc _init_print_canvas {} {
+ variable option
+ variable vtgPrint
+ variable printargs
+
+ set vtgPrint(printer.bg) white
+ }
+
+ proc _is_win {} {
+ variable printargs
+
+ return [info exist tk_patchLevel]
+ }
+
+ # _print_widget
+ # Main procedure for printing a widget. Currently supports
+ # canvas widgets. Handles opening and closing of printer.
+ # Arguments:
+ # wid - The widget to be printed.
+ # printer - Flag whether to use the default printer.
+ # name - App name to pass to printer.
+
+ proc _print_widget {wid {printer default} {name "Tk Print Output"}} {
+ variable printargs
+ variable printer_name
+
+ _set_dc
+
+ if {![info exists printer_name]} {
+ return
+ }
+
+ _opendoc
+ _openpage
+
+ # Here is where any scaling/gdi mapping should take place
+ # For now, scale so the dimensions of the window are sized to the
+ # width of the page. Scale evenly.
+
+ # For normal windows, this may be fine--but for a canvas, one
+ # wants the canvas dimensions, and not the WINDOW dimensions.
+ if {[winfo class $wid] eq "Canvas"} {
+ set sc [$wid cget -scrollregion]
+ # if there is no scrollregion, use width and height.
+ if {$sc eq ""} {
+ set window_x [$wid cget -width]
+ set window_y [$wid cget -height]
+ } else {
+ set window_x [lindex $sc 2]
+ set window_y [lindex $sc 3]
+ }
+ } else {
+ set window_x [winfo width $wid]
+ set window_y [winfo height $wid]
+ }
+
+ set printer_x [expr {
+ ( $printargs(pw) - $printargs(lm) - $printargs(rm) ) *
+ $printargs(resx) / 1000.0
+ }]
+ set printer_y [expr {
+ ( $printargs(pl) - $printargs(tm) - $printargs(bm) ) *
+ $printargs(resy) / 1000.0
+ }]
+ set factor_x [expr {$window_x / $printer_x}]
+ set factor_y [expr {$window_y / $printer_y}]
+
+ if {$factor_x < $factor_y} {
+ set lo $window_y
+ set ph $printer_y
+ } else {
+ set lo $window_x
+ set ph $printer_x
+ }
+
+ _gdi map $printargs(hDC) -logical $lo -physical $ph \
+ -offset $printargs(resolution)
+
+ # Handling of canvas widgets.
+ switch [winfo class $wid] {
+ Canvas {
+ _print_canvas $printargs(hDC) $wid
+ }
+ default {
+ puts "Can't print items of type [winfo class $wid]. No handler registered"
+ }
+ }
+
+ # End printing process.
+ _closepage
+ _closedoc
+ }
+
+ # _print_canvas
+ # Main procedure for writing canvas widget items to printer.
+ # Arguments:
+ # hdc - The printer handle.
+ # cw - The canvas widget.
+ proc _print_canvas {hdc cw} {
+ variable vtgPrint
+ variable printargs
+
+ # Get information about page being printed to
+ # print_canvas.CalcSizing $cw
+ set vtgPrint(canvas.bg) [string tolower [$cw cget -background]]
+
+ # Re-write each widget from cw to printer
+ foreach id [$cw find all] {
+ set type [$cw type $id]
+ if {[info commands _print_canvas.$type] eq "_print_canvas.$type"} {
+ _print_canvas.[$cw type $id] $printargs(hDC) $cw $id
+ } else {
+ puts "Omitting canvas item of type $type since there is no handler registered for it"
+ }
+ }
+ }
+
+ # These procedures support the various canvas item types, reading the
+ # information about the item on the real canvas and then writing a
+ # similar item to the printer.
+
+ # _print_canvas.line
+ # Description:
+ # Prints a line item.
+ # Arguments:
+ # hdc - The printer handle.
+ # cw - The canvas widget.
+ # id - The id of the canvas item.
+ proc _print_canvas.line {hdc cw id} {
+ variable vtgPrint
+ variable printargs
+
+ set color [_print_canvas.TransColor [$cw itemcget $id -fill]]
+ if {[string match $vtgPrint(printer.bg) $color]} {
+ return
+ }
+
+ set coords [$cw coords $id]
+ set wdth [$cw itemcget $id -width]
+ set arrow [$cw itemcget $id -arrow]
+ set arwshp [$cw itemcget $id -arrowshape]
+ set dash [$cw itemcget $id -dash]
+ set smooth [$cw itemcget $id -smooth]
+ set splinesteps [$cw itemcget $id -splinesteps]
+
+ set cmdargs {}
+
+ if {$wdth > 1} {
+ lappend cmdargs -width $wdth
+ }
+ if {$dash ne ""} {
+ lappend cmdargs -dash $dash
+ }
+ if {$smooth ne ""} {
+ lappend cmdargs -smooth $smooth
+ }
+ if {$splinesteps ne ""} {
+ lappend cmdargs -splinesteps $splinesteps
+ }
+
+ set result [_gdi line $hdc {*}$coords \
+ -fill $color -arrow $arrow -arrowshape $arwshp \
+ {*}$cmdargs]
+ if {$result ne ""} {
+ puts $result
+ }
+ }
+
+ # _print_canvas.arc
+ # Prints a arc item.
+ # Args:
+ # hdc - The printer handle.
+ # cw - The canvas widget.
+ # id - The id of the canvas item.
+ proc _print_canvas.arc {hdc cw id} {
+ variable vtgPrint
+ variable printargs
+
+ set color [_print_canvas.TransColor [$cw itemcget $id -outline]]
+ if {[string match $vtgPrint(printer.bg) $color]} {
+ return
+ }
+ set coords [$cw coords $id]
+ set wdth [$cw itemcget $id -width]
+ set style [$cw itemcget $id -style]
+ set start [$cw itemcget $id -start]
+ set extent [$cw itemcget $id -extent]
+ set fill [$cw itemcget $id -fill]
+
+ set cmdargs {}
+ if {$wdth > 1} {
+ lappend cmdargs -width $wdth
+ }
+ if {$fill ne ""} {
+ lappend cmdargs -fill $fill
+ }
+
+ _gdi arc $hdc {*}$coords \
+ -outline $color -style $style -start $start -extent $extent \
+ {*}$cmdargs
+ }
+
+ # _print_canvas.polygon
+ # Prints a polygon item.
+ # Arguments:
+ # hdc - The printer handle.
+ # cw - The canvas widget.
+ # id - The id of the canvas item.
+ proc _print_canvas.polygon {hdc cw id} {
+ variable vtgPrint
+ variable printargs
+
+ set fcolor [_print_canvas.TransColor [$cw itemcget $id -fill]]
+ if {$fcolor eq ""} {
+ set fcolor $vtgPrint(printer.bg)
+ }
+ set ocolor [_print_canvas.TransColor [$cw itemcget $id -outline]]
+ if {$ocolor eq ""} {
+ set ocolor $vtgPrint(printer.bg)
+ }
+ set coords [$cw coords $id]
+ set wdth [$cw itemcget $id -width]
+ set smooth [$cw itemcget $id -smooth]
+ set splinesteps [$cw itemcget $id -splinesteps]
+
+ set cmdargs {}
+ if {$smooth ne ""} {
+ lappend cmdargs -smooth $smooth
+ }
+ if {$splinesteps ne ""} {
+ lappend cmdargs -splinesteps $splinesteps
+ }
+
+ _gdi polygon $hdc {*}$coords \
+ -width $wdth -fill $fcolor -outline $ocolor {*}$cmdargs
+ }
+
+ # _print_canvas.oval
+ # Prints an oval item.
+ # Arguments:
+ # hdc - The printer handle.
+ # cw - The canvas widget.
+ # id - The id of the canvas item.
+ proc _print_canvas.oval {hdc cw id} {
+ variable vtgPrint
+
+ set fcolor [_print_canvas.TransColor [$cw itemcget $id -fill]]
+ if {$fcolor eq ""} {
+ set fcolor $vtgPrint(printer.bg)
+ }
+ set ocolor [_print_canvas.TransColor [$cw itemcget $id -outline]]
+ if {$ocolor eq ""} {
+ set ocolor $vtgPrint(printer.bg)
+ }
+ set coords [$cw coords $id]
+ set wdth [$cw itemcget $id -width]
+
+ _gdi oval $hdc {*}$coords \
+ -width $wdth -fill $fcolor -outline $ocolor
+ }
+
+ # _print_canvas.rectangle
+ # Prints a rectangle item.
+ # Arguments:
+ # hdc - The printer handle.
+ # cw - The canvas widget.
+ # id - The id of the canvas item.
+ proc _print_canvas.rectangle {hdc cw id} {
+ variable vtgPrint
+
+ set fcolor [_print_canvas.TransColor [$cw itemcget $id -fill]]
+ if {$fcolor eq ""} {
+ set fcolor $vtgPrint(printer.bg)
+ }
+ set ocolor [_print_canvas.TransColor [$cw itemcget $id -outline]]
+ if {$ocolor eq ""} {
+ set ocolor $vtgPrint(printer.bg)
+ }
+ set coords [$cw coords $id]
+ set wdth [$cw itemcget $id -width]
+
+ _gdi rectangle $hdc {*}$coords \
+ -width $wdth -fill $fcolor -outline $ocolor
+ }
+
+ # _print_canvas.text
+ # Prints a text item.
+ # Arguments:
+ # hdc - The printer handle.
+ # cw - The canvas widget.
+ # id - The id of the canvas item.
+ proc _print_canvas.text {hdc cw id} {
+ variable vtgPrint
+ variable printargs
+
+ set color [_print_canvas.TransColor [$cw itemcget $id -fill]]
+ # if {"white" eq [string tolower $color]} {return}
+ # set color black
+ set txt [$cw itemcget $id -text]
+ if {$txt eq ""} {
+ return
+ }
+ set coords [$cw coords $id]
+ set anchr [$cw itemcget $id -anchor]
+
+ set bbox [$cw bbox $id]
+ set wdth [expr {[lindex $bbox 2] - [lindex $bbox 0]}]
+
+ set just [$cw itemcget $id -justify]
+
+ # Get the real canvas font info and create a compatible font,
+ # suitable for printer name extraction.
+ set font [font create {*}[font actual [$cw itemcget $id -font]]]
+
+ # Just get the name and family, or some of the _gdi commands will
+ # fail.
+ set font [list [font configure $font -family] \
+ -[font configure $font -size]]
+
+ _gdi text $hdc {*}$coords \
+ -fill $color -text $txt -font $font \
+ -anchor $anchr -width $wdth -justify $just
+ }
+
+ # _print_canvas.image
+ # Prints an image item.
+ # Arguments:
+ # hdc - The printer handle.
+ # cw - The canvas widget.
+ # id - The id of the canvas item.
+ proc _print_canvas.image {hdc cw id} {
+ # First, we have to get the image name.
+ set imagename [$cw itemcget $id -image]
+
+ # Now we get the size.
+ set wid [image width $imagename]
+ set hgt [image height $imagename]
+
+ # Next, we get the location and anchor
+ set anchor [$cw itemcget $id -anchor]
+ set coords [$cw coords $id]
+
+ _gdi photo $hdc -destination $coords -photo $imagename
+ }
+
+ # _print_canvas.bitmap
+ # Prints a bitmap item.
+ # Arguments:
+ # hdc - The printer handle.
+ # cw - The canvas widget.
+ # id - The id of the canvas item.
+ proc _print_canvas.bitmap {hdc cw id} {
+ variable option
+ variable vtgPrint
+
+ # First, we have to get the bitmap name.
+ set imagename [$cw itemcget $id -image]
+
+ # Now we get the size.
+ set wid [image width $imagename]
+ set hgt [image height $imagename]
+
+ #Next, we get the location and anchor.
+ set anchor [$cw itemcget $id -anchor]
+ set coords [$cw coords $id]
+
+ # Since the GDI commands don't yet support images and bitmaps,
+ # and since this represents a rendered bitmap, we CAN use
+ # copybits IF we create a new temporary toplevel to hold the beast.
+ # If this is too ugly, change the option!
+
+ if {[info exist option(use_copybits)]} {
+ set firstcase $option(use_copybits)
+ } else {
+ set firstcase 0
+ }
+ if {$firstcase > 0} {
+ set tl [toplevel .tmptop[expr {int( rand() * 65535 )}] \
+ -height $hgt -width $wid \
+ -background $vtgPrint(canvas.bg)]
+ canvas $tl.canvas -width $wid -height $hgt
+ $tl.canvas create image 0 0 -image $imagename -anchor nw
+ pack $tl.canvas -side left -expand false -fill none
+ tkwait visibility $tl.canvas
+ update
+ set srccoords [list 0 0 [expr {$wid - 1}] [expr {$hgt - 1}]]
+ set dstcoords [list [lindex $coords 0] [lindex $coords 1] [expr {$wid - 1}] [expr {$hgt - 1}]]
+ _gdi copybits $hdc -window $tl -client \
+ -source $srccoords -destination $dstcoords
+ destroy $tl
+ } else {
+ _gdi bitmap $hdc {*}$coords \
+ -anchor $anchor -bitmap $imagename
+ }
+ }
+
+ # These procedures transform attribute setting from the real
+ # canvas to the appropriate setting for printing to paper.
+
+ # _print_canvas.TransColor
+ # Does the actual transformation of colors from the
+ # canvas widget to paper.
+ # Arguments:
+ # color - The color value to be transformed.
+ proc _print_canvas.TransColor {color} {
+ variable vtgPrint
+ variable printargs
+
+ switch [string toupper $color] {
+ $vtgPrint(canvas.bg) {return $vtgPrint(printer.bg)}
+ }
+ return $color
+ }
+
+ # Initialize all the variables once.
+ _init_print_canvas
+ }
+ #end win32 procedures
+
+ #begin X11 procedures
+
+ # X11 procedures wrap standard Unix shell commands such as lp/lpr and
+ # lpstat for printing. Some output configuration that on other platforms
+ # is managed through the printer driver/dialog is configured through the
+ # canvas postscript command.
+
+ if {[tk windowingsystem] eq "x11"} {
+ variable printcmd ""
+ variable printlist {}
+ variable choosepaper
+ variable chooseprinter {}
+ variable p
+
+ # _setprintenv
+ # Set the print environtment - print command, and list of printers.
+ # Arguments:
+ # none.
+
+ proc _setprintenv {} {
+ variable printcmd
+ variable printlist
+
+ #Test for existence of lpstat command to obtain list of printers. Return error
+ #if not found.
+
+ catch {exec lpstat -a} msg
+ set notfound "command not found"
+ if {[string first $notfound $msg] != -1} {
+ error "Unable to obtain list of printers. Please install the CUPS package \
+ for your system."
+ return
+ }
+ set notfound "No destinations added"
+ if {[string first $notfound $msg] != -1} {
+ error "Please check or update your CUPS installation."
+ return
+ }
+
+ # Select print command. We prefer lpr, but will fall back to lp if
+ # necessary.
+ if {[auto_execok lpr] ne ""} {
+ set printcmd lpr
+ } else {
+ set printcmd lp
+ }
+
+ #Build list of printers.
+ set printdata [exec lpstat -a]
+ foreach item [split $printdata \n] {
+ lappend printlist [lindex [split $item] 0]
+ }
+ }
+
+ # _print
+ # Main printer dialog. Select printer, set options, and
+ # fire print command.
+ # Arguments:
+ # w - widget with contents to print.
+ #
+
+ proc _print {w} {
+ variable printlist
+ variable printcmd
+ variable chooseprinter
+ variable printcopies
+ variable printorientation
+ variable choosepaper
+ variable color
+ variable p
+ variable zoomnumber
+
+ _setprintenv
+
+ set chooseprinter [lindex $printlist 0]
+
+ set p ._print
+ catch {destroy $p}
+
+ toplevel $p
+ wm title $p "Print"
+ wm resizable $p 0 0
+
+ frame $p.frame -padx 10 -pady 10
+ pack $p.frame -fill x -expand no
+
+ #The main dialog
+ frame $p.frame.printframe -padx 5 -pady 5
+ pack $p.frame.printframe -side top -fill x -expand no
+
+ label $p.frame.printframe.printlabel -text [mc "Printer"]
+ ttk::combobox $p.frame.printframe.mb \
+ -textvariable [namespace which -variable chooseprinter] \
+ -state readonly -values [lsort -unique $printlist]
+ pack $p.frame.printframe.printlabel $p.frame.printframe.mb \
+ -side left -fill x -expand no
+
+ bind $p.frame.printframe.mb <<ComboboxSelected>> {
+ set chooseprinter {$p.frame.printframe.mb get}
+ }
+
+ set paperlist [list [mc Letter] [mc Legal] [mc A4]]
+ set colorlist [list [mc Grayscale] [mc RGB]]
+
+ #Initialize with sane defaults.
+ set printcopies 1
+ set choosepaper [mc A4]
+ set color [mc RGB]
+ set printorientation portrait
+
+ set percentlist {100 90 80 70 60 50 40 30 20 10}
+
+ #Base widgets to load.
+ labelframe $p.frame.copyframe -text [mc "Options"] -padx 5 -pady 5
+ pack $p.frame.copyframe -fill x -expand no
+
+ frame $p.frame.copyframe.l -padx 5 -pady 5
+ pack $p.frame.copyframe.l -side top -fill x -expand no
+
+ label $p.frame.copyframe.l.copylabel -text [mc "Copies"]
+ spinbox $p.frame.copyframe.l.field -from 1 -to 1000 \
+ -textvariable [namespace which -variable printcopies] -width 5
+
+ pack $p.frame.copyframe.l.copylabel $p.frame.copyframe.l.field \
+ -side left -fill x -expand no
+
+ set printcopies [$p.frame.copyframe.l.field get]
+
+ frame $p.frame.copyframe.r -padx 5 -pady 5
+ pack $p.frame.copyframe.r -fill x -expand no
+
+ label $p.frame.copyframe.r.paper -text [mc "Paper"]
+ tk_optionMenu $p.frame.copyframe.r.menu \
+ [namespace which -variable choosepaper] \
+ {*}$paperlist
+
+ pack $p.frame.copyframe.r.paper $p.frame.copyframe.r.menu \
+ -side left -fill x -expand no
+
+ #Widgets with additional options for canvas output.
+ if {[winfo class $w] eq "Canvas"} {
+
+ frame $p.frame.copyframe.z -padx 5 -pady 5
+ pack $p.frame.copyframe.z -fill x -expand no
+
+ label $p.frame.copyframe.z.zlabel -text [mc "Scale"]
+ tk_optionMenu $p.frame.copyframe.z.zentry \
+ [namespace which -variable zoomnumber] \
+ {*}$percentlist
+
+ pack $p.frame.copyframe.z.zlabel $p.frame.copyframe.z.zentry \
+ -side left -fill x -expand no
+
+ frame $p.frame.copyframe.orient -padx 5 -pady 5
+ pack $p.frame.copyframe.orient -fill x -expand no
+
+ label $p.frame.copyframe.orient.text -text [mc "Orientation"]
+ radiobutton $p.frame.copyframe.orient.v -text [mc "Portrait"] \
+ -value portrait -compound left \
+ -variable [namespace which -variable printorientation]
+ radiobutton $p.frame.copyframe.orient.h -text [mc "Landscape"] \
+ -value landscape -compound left \
+ -variable [namespace which -variable printorientation]
+
+ pack $p.frame.copyframe.orient.text \
+ $p.frame.copyframe.orient.v $p.frame.copyframe.orient.h \
+ -side left -fill x -expand no
+
+ frame $p.frame.copyframe.c -padx 5 -pady 5
+ pack $p.frame.copyframe.c -fill x -expand no
+
+ label $p.frame.copyframe.c.l -text [mc "Output"]
+ tk_optionMenu $p.frame.copyframe.c.c \
+ [namespace which -variable color] \
+ {*}$colorlist
+ pack $p.frame.copyframe.c.l $p.frame.copyframe.c.c -side left \
+ -fill x -expand no
+ }
+
+ #Build rest of GUI.
+ frame $p.frame.buttonframe
+ pack $p.frame.buttonframe -fill x -expand no -side bottom
+
+ button $p.frame.buttonframe.printbutton -text [mc "Print"] \
+ -command [namespace code [list _runprint $w]]
+ button $p.frame.buttonframe.cancel -text [mc "Cancel"] \
+ -command {destroy ._print}
+
+ pack $p.frame.buttonframe.printbutton $p.frame.buttonframe.cancel \
+ -side right -fill x -expand no
+ #Center the window as a dialog.
+ ::tk::PlaceWindow $p
+ }
+
+ # _runprint -
+ # Execute the print command--print the file.
+ # Arguments:
+ # w - widget with contents to print.
+ #
+ proc _runprint {w} {
+ variable printlist
+ variable printcmd
+ variable choosepaper
+ variable chooseprinter
+ variable color
+ variable printcopies
+ variable printorientation
+ variable zoomnumber
+ variable p
+
+ #First, generate print file.
+
+ if {[winfo class $w] eq "Text"} {
+ set file [makeTempFile tk_text.txt [$w get 1.0 end]]
+ }
+
+ if {[winfo class $w] eq "Canvas"} {
+ if {$color eq [mc "RGB"]} {
+ set colormode color
+ } else {
+ set colormode gray
+ }
+
+ if {$printorientation eq "landscape"} {
+ set willrotate "1"
+ } else {
+ set willrotate "0"
+ }
+
+ #Scale based on size of widget, not size of paper.
+ set printwidth [expr {$zoomnumber / 100.00 * [winfo width $w]}]
+ set file [makeTempFile tk_canvas.ps]
+ $w postscript -file $file -colormode $colormode \
+ -rotate $willrotate -pagewidth $printwidth
+ }
+
+ #Build list of args to pass to print command.
+
+ set printargs {}
+ set printcopies [$p.frame.copyframe.l.field get]
+ if {$printcmd eq "lpr"} {
+ lappend printargs -P $chooseprinter -# $printcopies
+ } else {
+ lappend printargs -d $chooseprinter -n $printcopies
+ }
+
+ after 500
+ exec $printcmd {*}$printargs -o PageSize=$choosepaper $file
+
+ after 500
+ destroy ._print
+ }
+ }
+ #end X11 procedures
+
+ #begin macOS Aqua procedures
+ if {[tk windowingsystem] eq "aqua"} {
+ # makePDF -
+ # Convert a file to PDF
+ # Arguments:
+ # inFilename - file containing the data to convert; format is
+ # autodetected.
+ # outFilename - base for filename to write to; conventionally should
+ # have .pdf as suffix
+ # Returns:
+ # The full pathname of the generated PDF.
+ #
+ proc makePDF {inFilename outFilename} {
+ set out [::tk::print::makeTempFile $outFilename]
+ try {
+ exec /usr/sbin/cupsfilter $inFilename > $out
+ } trap NONE {msg} {
+ # cupsfilter produces a lot of debugging output, which we
+ # don't want.
+ regsub -all -line {^(?:DEBUG|INFO):.*$} $msg "" msg
+ set msg [string trimleft [regsub -all {\n+} $msg "\n"] "\n"]
+ if {$msg ne ""} {
+ # Lines should be prefixed with WARN or ERROR now
+ puts $msg
+ }
+ }
+ return $out
+ }
+ }
+ #end macOS Aqua procedures
+
+ namespace export canvas text
+ namespace ensemble create
+}
+
+# tk print --
+# This procedure prints the canvas and text widgets using platform-
+# native API's.
+# Arguments:
+# w: Widget to print.
+proc ::tk::print {w} {
+ switch [winfo class $w],[tk windowingsystem] {
+ "Canvas,win32" {
+ tailcall ::tk::print::_print_widget $w 0 "Tk Print Output"
+ }
+ "Canvas,x11" {
+ tailcall ::tk::print::_print $w
+ }
+ "Canvas,aqua" {
+ set psfile [::tk::print::makeTempFile tk_canvas.ps]
+ try {
+ $w postscript -file $psfile
+ set printfile [::tk::print::makePDF $psfile tk_canvas.pdf]
+ ::tk::print::_print $printfile
+ } finally {
+ file delete $psfile
+ }
+ }
+
+ "Text,win32" {
+ tailcall ::tk::print::_print_data [$w get 1.0 end] 1 {Arial 12}
+ }
+ "Text,x11" {
+ tailcall ::tk::print::_print $w
+ }
+ "Text,aqua" {
+ set txtfile [::tk::print::makeTempFile tk_text.txt [$w get 1.0 end]]
+ try {
+ set printfile [::tk::print::makePDF $txtfile tk_text.pdf]
+ ::tk::print::_print $printfile
+ } finally {
+ file delete $txtfile
+ }
+ }
+
+ default {
+ return -code error -errorcode {TK PRINT CLASS_UNSUPPORTED} \
+ "widgets of class [winfo class $w] are not supported on\
+ this platform"
+ }
+ }
+}
+
+#Add this command to the tk command ensemble: tk print
+#Thanks to Christian Gollwitzer for the guidance here
+namespace ensemble configure tk -map \
+ [dict merge [namespace ensemble configure tk -map] \
+ {print ::tk::print}]
+
+return
+
+# Local Variables:
+# mode: tcl
+# fill-column: 78
+# End:
diff --git a/library/safetk.tcl b/library/safetk.tcl
index 9e71cc6..0eb1220 100644
--- a/library/safetk.tcl
+++ b/library/safetk.tcl
@@ -2,7 +2,7 @@
#
# Support procs to use Tk in safe interpreters.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
+# Copyright © 1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/scale.tcl b/library/scale.tcl
index fb9b81b..0da5472 100644
--- a/library/scale.tcl
+++ b/library/scale.tcl
@@ -3,8 +3,8 @@
# This file defines the default bindings for Tk scale widgets and provides
# procedures that help in implementing the bindings.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -34,7 +34,7 @@ bind Scale <Leave> {
%W configure -state normal
}
}
-bind Scale <1> {
+bind Scale <Button-1> {
tk::ScaleButtonDown %W %x %y
}
bind Scale <B1-Motion> {
@@ -47,7 +47,7 @@ bind Scale <ButtonRelease-1> {
tk::ScaleEndDrag %W
tk::ScaleActivate %W %x %y
}
-bind Scale <2> {
+bind Scale <Button-2> {
tk::ScaleButton2Down %W %x %y
}
bind Scale <B2-Motion> {
@@ -60,15 +60,7 @@ bind Scale <ButtonRelease-2> {
tk::ScaleEndDrag %W
tk::ScaleActivate %W %x %y
}
-if {[tk windowingsystem] eq "win32"} {
- # On Windows do the same with button 3, as that is the right mouse button
- bind Scale <3> [bind Scale <2>]
- bind Scale <B3-Motion> [bind Scale <B2-Motion>]
- bind Scale <B3-Leave> [bind Scale <B2-Leave>]
- bind Scale <B3-Enter> [bind Scale <B2-Enter>]
- bind Scale <ButtonRelease-3> [bind Scale <ButtonRelease-2>]
-}
-bind Scale <Control-1> {
+bind Scale <Control-Button-1> {
tk::ScaleControlPress %W %x %y
}
bind Scale <<PrevLine>> {
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl
index a1c4398..c18d4a8 100644
--- a/library/scrlbar.tcl
+++ b/library/scrlbar.tcl
@@ -3,8 +3,8 @@
# This file defines the default bindings for Tk scrollbar widgets.
# It also provides procedures that help in implementing the bindings.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -39,7 +39,7 @@ bind Scrollbar <Leave> {
}
%W activate {}
}
-bind Scrollbar <1> {
+bind Scrollbar <Button-1> {
tk::ScrollButtonDown %W %x %y
}
bind Scrollbar <B1-Motion> {
@@ -57,13 +57,13 @@ bind Scrollbar <B1-Leave> {
bind Scrollbar <B1-Enter> {
# Prevents <Enter> binding from being invoked.
}
-bind Scrollbar <2> {
+bind Scrollbar <Button-2> {
tk::ScrollButton2Down %W %x %y
}
-bind Scrollbar <B1-2> {
+bind Scrollbar <B1-Button-2> {
# Do nothing, since button 1 is already down.
}
-bind Scrollbar <B2-1> {
+bind Scrollbar <B2-Button-1> {
# Do nothing, since button 2 is already down.
}
bind Scrollbar <B2-Motion> {
@@ -84,10 +84,10 @@ bind Scrollbar <B2-Leave> {
bind Scrollbar <B2-Enter> {
# Prevents <Enter> binding from being invoked.
}
-bind Scrollbar <Control-1> {
+bind Scrollbar <Control-Button-1> {
tk::ScrollTopBottom %W %x %y
}
-bind Scrollbar <Control-2> {
+bind Scrollbar <Control-Button-2> {
tk::ScrollTopBottom %W %x %y
}
@@ -129,41 +129,11 @@ bind Scrollbar <<LineEnd>> {
}
}
-if {[tk windowingsystem] eq "aqua"} {
- bind Scrollbar <MouseWheel> {
- tk::ScrollByUnits %W v [expr {-(%D)}]
- }
- bind Scrollbar <Option-MouseWheel> {
- tk::ScrollByUnits %W v [expr {-10 * (%D)}]
- }
- bind Scrollbar <Shift-MouseWheel> {
- tk::ScrollByUnits %W h [expr {-(%D)}]
- }
- bind Scrollbar <Shift-Option-MouseWheel> {
- tk::ScrollByUnits %W h [expr {-10 * (%D)}]
- }
-} else {
- bind Scrollbar <MouseWheel> {
- if {%D >= 0} {
- tk::ScrollByUnits %W v [expr {-%D/30}]
- } else {
- tk::ScrollByUnits %W v [expr {(29-%D)/30}]
- }
- }
- bind Scrollbar <Shift-MouseWheel> {
- if {%D >= 0} {
- tk::ScrollByUnits %W h [expr {-%D/30}]
- } else {
- tk::ScrollByUnits %W h [expr {(29-%D)/30}]
- }
- }
+bind Scrollbar <MouseWheel> {
+ tk::ScrollByUnits %W hv %D -40.0
}
-
-if {[tk windowingsystem] eq "x11"} {
- bind Scrollbar <4> {tk::ScrollByUnits %W v -5}
- bind Scrollbar <5> {tk::ScrollByUnits %W v 5}
- bind Scrollbar <Shift-4> {tk::ScrollByUnits %W h -5}
- bind Scrollbar <Shift-5> {tk::ScrollByUnits %W h 5}
+bind Scrollbar <Option-MouseWheel> {
+ tk::ScrollByUnits %W hv %D -12.0
}
# tk::ScrollButtonDown --
@@ -336,7 +306,7 @@ proc ::tk::ScrollEndDrag {w x y} {
# horizontal, "v" for vertical, "hv" for both.
# amount - How many units to scroll: typically 1 or -1.
-proc ::tk::ScrollByUnits {w orient amount} {
+proc ::tk::ScrollByUnits {w orient amount {factor 1.0}} {
set cmd [$w cget -command]
if {$cmd eq "" || ([string first \
[string index [$w cget -orient] 0] $orient] < 0)} {
@@ -344,9 +314,9 @@ proc ::tk::ScrollByUnits {w orient amount} {
}
set info [$w get]
if {[llength $info] == 2} {
- uplevel #0 $cmd scroll $amount units
+ uplevel #0 $cmd scroll [expr {$amount/$factor}] units
} else {
- uplevel #0 $cmd [expr {[lindex $info 2] + $amount}]
+ uplevel #0 $cmd [expr {[lindex $info 2] + [expr {$amount/$factor}]}]
}
}
diff --git a/library/spinbox.tcl b/library/spinbox.tcl
index 2b387d2..ad4aacc 100644
--- a/library/spinbox.tcl
+++ b/library/spinbox.tcl
@@ -4,10 +4,10 @@
# procedures that help in implementing those bindings. The spinbox builds
# off the entry widget, so it can reuse Entry bindings and procedures.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1999-2000 Jeffrey Hobbs
-# Copyright (c) 2000 Ajuba Solutions
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1999-2000 Jeffrey Hobbs
+# Copyright © 2000 Ajuba Solutions
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -79,31 +79,31 @@ bind Spinbox <<TraverseIn>> {
# Standard Motif bindings:
-bind Spinbox <1> {
+bind Spinbox <Button-1> {
::tk::spinbox::ButtonDown %W %x %y
}
bind Spinbox <B1-Motion> {
::tk::spinbox::Motion %W %x %y
}
-bind Spinbox <Double-1> {
+bind Spinbox <Double-Button-1> {
::tk::spinbox::ArrowPress %W %x %y
set tk::Priv(selectMode) word
::tk::spinbox::MouseSelect %W %x sel.first
}
-bind Spinbox <Triple-1> {
+bind Spinbox <Triple-Button-1> {
::tk::spinbox::ArrowPress %W %x %y
set tk::Priv(selectMode) line
::tk::spinbox::MouseSelect %W %x 0
}
-bind Spinbox <Shift-1> {
+bind Spinbox <Shift-Button-1> {
set tk::Priv(selectMode) char
%W selection adjust @%x
}
-bind Spinbox <Double-Shift-1> {
+bind Spinbox <Double-Shift-Button-1> {
set tk::Priv(selectMode) word
::tk::spinbox::MouseSelect %W %x
}
-bind Spinbox <Triple-Shift-1> {
+bind Spinbox <Triple-Shift-Button-1> {
set tk::Priv(selectMode) line
::tk::spinbox::MouseSelect %W %x
}
@@ -117,7 +117,7 @@ bind Spinbox <B1-Enter> {
bind Spinbox <ButtonRelease-1> {
::tk::spinbox::ButtonUp %W %x %y
}
-bind Spinbox <Control-1> {
+bind Spinbox <Control-Button-1> {
%W icursor @%x
}
@@ -200,27 +200,25 @@ bind Spinbox <<SelectAll>> {
bind Spinbox <<SelectNone>> {
%W selection clear
}
-bind Spinbox <KeyPress> {
+bind Spinbox <Key> {
::tk::EntryInsert %W %A
}
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
# Otherwise, if a widget binding for one of these is defined, the
-# <KeyPress> class binding will also fire and insert the character,
+# <Key> class binding will also fire and insert the character,
# which is wrong. Ditto for Escape, Return, and Tab.
-bind Spinbox <Alt-KeyPress> {# nothing}
-bind Spinbox <Meta-KeyPress> {# nothing}
-bind Spinbox <Control-KeyPress> {# nothing}
+bind Spinbox <Alt-Key> {# nothing}
+bind Spinbox <Meta-Key> {# nothing}
+bind Spinbox <Control-Key> {# nothing}
bind Spinbox <Escape> {# nothing}
bind Spinbox <Return> {# nothing}
bind Spinbox <KP_Enter> {# nothing}
bind Spinbox <Tab> {# nothing}
bind Spinbox <Prior> {# nothing}
bind Spinbox <Next> {# nothing}
-if {[tk windowingsystem] eq "aqua"} {
- bind Spinbox <Command-KeyPress> {# nothing}
-}
+bind Spinbox <Command-Key> {# nothing}
# On Windows, paste is done using Shift-Insert. Shift-Insert already
# generates the <<Paste>> event, so we don't need to do anything here.
@@ -280,27 +278,14 @@ bind Spinbox <Meta-Delete> {
# A few additional bindings of my own.
-if {[tk windowingsystem] ne "aqua"} {
- bind Spinbox <2> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanMark %W %x
- }
- }
- bind Spinbox <B2-Motion> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanDrag %W %x
- }
- }
-} else {
- bind Spinbox <3> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanMark %W %x
- }
+bind Spinbox <Button-2> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanMark %W %x
}
- bind Spinbox <B3-Motion> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanDrag %W %x
- }
+}
+bind Spinbox <B2-Motion> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanDrag %W %x
}
}
@@ -589,5 +574,5 @@ proc ::tk::spinbox::AutoScan {w} {
proc ::tk::spinbox::GetSelection {w} {
return [string range [$w get] [$w index sel.first] \
- [expr {[$w index sel.last] - 1}]]
+ [$w index sel.last]-1]
}
diff --git a/library/systray.tcl b/library/systray.tcl
new file mode 100644
index 0000000..931d6a8
--- /dev/null
+++ b/library/systray.tcl
@@ -0,0 +1,328 @@
+# systray.tcl --
+
+# This file defines the 'tk systray' command for icon display and manipulation
+# in the system tray on X11, Windows, and macOS, and the 'tk sysnotify' command
+# for system alerts on each platform. It implements an abstraction layer that
+# presents a consistent API across the three platforms.
+
+# Copyright © 2020 Kevin Walzer/WordTech Communications LLC.
+# Copyright © 2020 Eric Boudaillier.
+# Copyright © 2020 Francois Vogel.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+# Pure-Tcl system tooltip window for use with system tray icon if native
+# implementation not available.
+
+namespace eval ::tk::systray {
+ variable _created 0
+ variable _options {-image "" -text "" -button1 "" -button3 ""}
+ variable _current {}
+ variable _ico
+
+ proc _balloon {w help} {
+ bind $w <Any-Enter> "after 1000 [list ::tk::systray::_balloon_show %W [list $help]]"
+ bind $w <Any-Leave> "destroy %W._balloon"
+ }
+
+ proc _balloon_show {w arg} {
+ if {[winfo containing {*}[winfo pointerxy .]] ne $w} {
+ return
+ }
+ set top $w._balloon
+ catch {destroy $top}
+ toplevel $top -bg black
+ wm overrideredirect $top 1
+ if {[tk windowingsystem] eq "aqua"} {
+ ::tk::unsupported::MacWindowStyle style $top help none
+ }
+ pack [message $top._txt -aspect 10000 -text $arg]
+ set wmx [winfo rootx $w]
+ set wmy [expr {[winfo rooty $w] + [winfo height $w]}]
+ wm geometry $top [winfo reqwidth $top._txt]x[winfo reqheight $top._txt]+$wmx+$wmy
+ raise $top
+ }
+
+ proc _win_callback {msg} {
+ variable _current
+ # The API at the Tk level does not feature bindings to double clicks. Whatever
+ # the speed the user clicks with, he expects the single click binding to fire.
+ # Therefore we need to bind to both WM_*BUTTONDOWN and to WM_*BUTTONDBLCLK.
+ switch -exact -- $msg {
+ WM_LBUTTONDOWN - WM_LBUTTONDBLCLK {
+ uplevel #0 [dict get $_current -button1]
+ }
+ WM_RBUTTONDOWN - WM_RBUTTONDBLCLK {
+ uplevel #0 [dict get $_current -button3]
+ }
+ }
+ }
+
+ namespace export create configure destroy
+ namespace ensemble create
+}
+
+
+# Pure-Tcl system notification window for use if native implementation not available.
+namespace eval ::tk::sysnotify:: {
+
+ proc _notifywindow {title msg} {
+ catch {destroy ._notify}
+ set w [toplevel ._notify]
+ if {[tk windowingsystem] eq "aqua"} {
+ ::tk::unsupported::MacWindowStyle style $w utility {hud closeBox resizable}
+ wm title $w "Alert"
+ }
+ if {[tk windowingsystem] eq "win32"} {
+ wm attributes $w -toolwindow true
+ wm title $w "Alert"
+ }
+ label $w.l -bg gray30 -fg white -image ::tk::icons::information
+ pack $w.l -fill both -expand yes -side left
+ message $w.message -aspect 150 -bg gray30 -fg white -aspect 150 -text $title\n\n$msg -width 280
+ pack $w.message -side right -fill both -expand yes
+ if {[tk windowingsystem] eq "x11"} {
+ wm overrideredirect $w true
+ }
+ wm attributes $w -alpha 0.0
+ set xpos [expr {[winfo screenwidth $w] - 325}]
+ wm geometry $w +$xpos+30
+ ::tk::sysnotify::_fade_in $w
+ after 3000 ::tk::sysnotify::_fade_out $w
+ }
+
+ #Fade and destroy window.
+ proc _fade_out {w} {
+ catch {
+ set prev_degree [wm attributes $w -alpha]
+ set new_degree [expr {$prev_degree - 0.05}]
+ set current_degree [wm attributes $w -alpha $new_degree]
+ if {$new_degree > 0.0 && $new_degree != $prev_degree} {
+ after 10 [list ::tk::sysnotify::_fade_out $w]
+ } else {
+ destroy $w
+ }
+ }
+ }
+
+ #Fade the window into view.
+ proc _fade_in {w} {
+ catch {
+ raise $w
+ wm attributes $w -topmost 1
+ set prev_degree [wm attributes $w -alpha]
+ set new_degree [expr {$prev_degree + 0.05}]
+ set current_degree [wm attributes $w -alpha $new_degree]
+ focus -force $w
+ if {$new_degree < 0.9 && $new_degree != $prev_degree} {
+ after 10 [list ::tk::sysnotify::_fade_in $w]
+ }
+ }
+ }
+ namespace export *
+}
+
+
+# tk systray --
+# This procedure creates an icon display in the platform-specific system tray.
+#
+# Subcommands:
+#
+# create - create systray icon.
+# Arguments:
+# -image - Tk image to display.
+# -text - string to display in tooltip over image.
+# -button1 - Tcl proc to invoke on <Button-1> event.
+# -button3 - Tcl proc to invoke on <Button-3> event.
+#
+# configure - change one of the systray properties.
+# Arguments (Any or all can be called):
+# -image - Tk image to update.
+# -text - string to update.
+# -button1 - Tcl proc to change for <Button-1> event.
+# -button3 - Tcl proc to change for <Button-3> event.
+#
+# destroy - destroy systray icon.
+# Arguments:
+# none.
+proc ::tk::systray::create {args} {
+ variable _created
+ variable _options
+ variable _current
+ variable _ico
+
+ if {$_created} {
+ return -code error -errorcode {TK SYSTRAY CREATE} "only one system tray icon supported per interpeter"
+ }
+ _check_options $args 0
+ if {![dict exists $args -image]} {
+ return -code error -errorcode {TK SYSTRAY CREATE} "missing required option \"-image\""
+ }
+ set values [dict merge $_options $args]
+ try {
+ switch -- [tk windowingsystem] {
+ "win32" {
+ set _ico [_systray add -image [dict get $values -image] \
+ -text [dict get $values -text] \
+ -callback [list ::tk::systray::_win_callback %m]]
+ }
+ "x11" {
+ _systray ._tray -image [dict get $values -image] -visible true
+ _balloon ._tray [dict get $values -text]
+ bind ._tray <Button-1> [dict get $values -button1]
+ bind ._tray <Button-3> [dict get $values -button3]
+ }
+ "aqua" {
+ _systray create [dict get $values -image] [dict get $values -text] \
+ [dict get $values -button1] [dict get $values -button3]
+ }
+ }
+ } on ok {} {
+ set _current $values
+ set _created 1
+ return
+ } on error {msg opts} {
+ return -code error -errorcode [dict get $opts -errorcode] $msg
+ }
+}
+
+# Modify the systray icon.
+proc ::tk::systray::configure {args} {
+ variable _created
+ variable _options
+ variable _current
+ variable _ico
+
+ if {!$_created} {
+ return -code error -errorcode {TK SYSTRAY CREATE} "systray not created"
+ }
+ _check_options $args 1
+ if {[llength $args] == 0} {
+ return $_current
+ } elseif {[llength $args] == 1} {
+ return [dict get $_current [lindex $args 0]]
+ }
+ set values [dict merge $_current $args]
+ try {
+ switch -- [tk windowingsystem] {
+ "win32" {
+ if {[dict exists $args -image]} {
+ _systray modify $_ico -image [dict get $args -image]
+ }
+ if {[dict exists $args -text]} {
+ _systray modify $_ico -text [dict get $args -text]
+ }
+ }
+ "x11" {
+ if {[dict exists $args -image]} {
+ ._tray configure -image [dict get $args -image]
+ }
+ if {[dict exists $args -text]} {
+ _balloon ._tray [dict get $args -text]
+ }
+ if {[dict exists $args -button1]} {
+ bind ._tray <Button-1> [dict get $args -button1]
+ }
+ if {[dict exists $args -button3]} {
+ bind ._tray <Button-3> [dict get $args -button3]
+ }
+ }
+ "aqua" {
+ foreach {key opt} {image -image text \
+ -text b1_callback -button1 b3_callback -button3} {
+ if {[dict exists $args $opt]} {
+ _systray modify $key [dict get $args $opt]
+ }
+ }
+ }
+ }
+ } on ok {} {
+ set _current $values
+ return
+ } on error {msg opts} {
+ return -code error -errorcode [dict get $opts -errorcode] $msg
+ }
+}
+
+
+# Remove the systray icon.
+proc ::tk::systray::destroy {} {
+ variable _created
+ variable _current
+ variable _ico
+
+ if {!$_created} {
+ return -code error -errorcode {TK SYSTRAY DESTROY} "systray not created"
+ }
+ switch -- [tk windowingsystem] {
+ "win32" {
+ _systray delete $_ico
+ set _ico ""
+ }
+ "x11" {
+ ::destroy ._tray
+ }
+ "aqua" {
+ _systray destroy
+ }
+ }
+ set _created 0
+ set _current {}
+ return
+}
+
+# Check systray options
+proc ::tk::systray::_check_options {argsList singleOk} {
+ variable _options
+
+ set len [llength $argsList]
+ while {[llength $argsList] > 0} {
+ set opt [lindex $argsList 0]
+ if {![dict exists $_options $opt]} {
+ tailcall return -code error -errorcode {TK SYSTRAY OPTION} \
+ "unknown option \"$opt\": must be -image, -text, -button1 or -button3"
+ }
+ if {[llength $argsList] == 1 && !($len == 1 && $singleOk)} {
+ tailcall return -code error -errorcode {TK SYSTRAY OPTION} \
+ "missing value for option \"$opt\""
+ }
+ set argsList [lrange $argsList 2 end]
+ }
+}
+
+# tk sysnotify --
+# This procedure implements a platform-specific system notification alert.
+#
+# Arguments:
+# title - main text of alert.
+# message - body text of alert.
+
+proc ::tk::sysnotify::sysnotify {title message} {
+
+ switch -- [tk windowingsystem] {
+ "win32" {
+ if {!$::tk::systray::_created} {
+ error "must create a system tray icon with the \"tk systray\" command first"
+ }
+ _sysnotify notify $::tk::systray::_ico $title $message
+ }
+ "x11" {
+ if {[info commands ::tk::sysnotify::_sysnotify] eq ""} {
+ _notifywindow $title $message
+ } else {
+ _sysnotify $title $message
+ }
+ }
+ "aqua" {
+ _sysnotify $title $message
+ }
+ }
+ return
+}
+
+#Add these commands to the tk command ensemble: tk systray, tk sysnotify
+#Thanks to Christian Gollwitzer for the guidance here
+namespace ensemble configure tk -map \
+ [dict merge [namespace ensemble configure tk -map] \
+ {systray ::tk::systray sysnotify ::tk::sysnotify::sysnotify}]
diff --git a/library/tclIndex b/library/tclIndex
index b3f37fa..06006cd 100644
--- a/library/tclIndex
+++ b/library/tclIndex
@@ -199,6 +199,7 @@ set auto_index(::tk::RestoreFocusGrab) [list source [file join $dir tk.tcl]]
set auto_index(::tk::ScreenChanged) [list source [file join $dir tk.tcl]]
set auto_index(::tk::EventMotifBindings) [list source [file join $dir tk.tcl]]
set auto_index(::tk::CancelRepeat) [list source [file join $dir tk.tcl]]
+set auto_index(::tk::MouseWheel) [list source [file join $dir tk.tcl]]
set auto_index(::tk::TabToWindow) [list source [file join $dir tk.tcl]]
set auto_index(::tk::dialog::file::) [list source [file join $dir tkfbox.tcl]]
set auto_index(::tk::dialog::file::Config) [list source [file join $dir tkfbox.tcl]]
@@ -247,7 +248,6 @@ set auto_index(::tk::ListBoxKeyAccel_Unset) [list source [file join $dir xmfbox.
set auto_index(::tk::ListBoxKeyAccel_Key) [list source [file join $dir xmfbox.tcl]]
set auto_index(::tk::ListBoxKeyAccel_Goto) [list source [file join $dir xmfbox.tcl]]
set auto_index(::tk::ListBoxKeyAccel_Reset) [list source [file join $dir xmfbox.tcl]]
-set auto_index(tk_getFileType) [list source [file join $dir xmfbox.tcl]]
set auto_index(::tk::unsupported::ExposePrivateCommand) [list source [file join $dir unsupported.tcl]]
set auto_index(::tk::unsupported::ExposePrivateVariable) [list source [file join $dir unsupported.tcl]]
set auto_index(::tk::fontchooser) [list source [file join $dir fontchooser.tcl]]
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index 96e275f..6df8b72 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -2,8 +2,8 @@
#
# This file contains procedures that implement tear-off menus.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/text.tcl b/library/text.tcl
index d1f9b86..9af3816 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -3,9 +3,9 @@
# This file defines the default bindings for Tk text widgets and provides
# procedures that help in implementing the bindings.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998 Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -42,7 +42,7 @@
# Standard Motif bindings:
-bind Text <1> {
+bind Text <Button-1> {
tk::TextButton1 %W %x %y
%W tag remove sel 0.0 end
}
@@ -51,26 +51,26 @@ bind Text <B1-Motion> {
set tk::Priv(y) %y
tk::TextSelectTo %W %x %y
}
-bind Text <Double-1> {
+bind Text <Double-Button-1> {
set tk::Priv(selectMode) word
tk::TextSelectTo %W %x %y
catch {%W mark set insert sel.first}
}
-bind Text <Triple-1> {
+bind Text <Triple-Button-1> {
set tk::Priv(selectMode) line
tk::TextSelectTo %W %x %y
catch {%W mark set insert sel.first}
}
-bind Text <Shift-1> {
+bind Text <Shift-Button-1> {
tk::TextResetAnchor %W @%x,%y
set tk::Priv(selectMode) char
tk::TextSelectTo %W %x %y
}
-bind Text <Double-Shift-1> {
+bind Text <Double-Shift-Button-1> {
set tk::Priv(selectMode) word
tk::TextSelectTo %W %x %y 1
}
-bind Text <Triple-Shift-1> {
+bind Text <Triple-Shift-Button-1> {
set tk::Priv(selectMode) line
tk::TextSelectTo %W %x %y
}
@@ -86,7 +86,7 @@ bind Text <ButtonRelease-1> {
tk::CancelRepeat
}
-bind Text <Control-1> {
+bind Text <Control-Button-1> {
%W mark set insert @%x,%y
# An operation that moves the insert mark without making it
# one end of the selection must insert an autoseparator
@@ -95,7 +95,7 @@ bind Text <Control-1> {
}
}
# stop an accidental double click triggering <Double-Button-1>
-bind Text <Double-Control-1> { # nothing }
+bind Text <Double-Control-Button-1> { # nothing }
# stop an accidental movement triggering <B1-Motion>
bind Text <Control-B1-Motion> { # nothing }
bind Text <<PrevChar>> {
@@ -292,23 +292,21 @@ bind Text <<PasteSelection>> {
bind Text <Insert> {
catch {tk::TextInsert %W [::tk::GetSelection %W PRIMARY]}
}
-bind Text <KeyPress> {
+bind Text <Key> {
tk::TextInsert %W %A
}
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
# Otherwise, if a widget binding for one of these is defined, the
-# <KeyPress> class binding will also fire and insert the character,
+# <Key> class binding will also fire and insert the character,
# which is wrong. Ditto for <Escape>.
-bind Text <Alt-KeyPress> {# nothing }
-bind Text <Meta-KeyPress> {# nothing}
-bind Text <Control-KeyPress> {# nothing}
+bind Text <Alt-Key> {# nothing }
+bind Text <Meta-Key> {# nothing}
+bind Text <Control-Key> {# nothing}
bind Text <Escape> {# nothing}
bind Text <KP_Enter> {# nothing}
-if {[tk windowingsystem] eq "aqua"} {
- bind Text <Command-KeyPress> {# nothing}
-}
+bind Text <Command-Key> {# nothing}
# Additional emacs-like bindings:
@@ -429,97 +427,29 @@ bind Text <Control-h> {
%W see insert
}
}
-if {[tk windowingsystem] ne "aqua"} {
- bind Text <2> {
- if {!$tk_strictMotif} {
- tk::TextScanMark %W %x %y
- }
- }
- bind Text <B2-Motion> {
- if {!$tk_strictMotif} {
- tk::TextScanDrag %W %x %y
- }
- }
-} else {
- bind Text <3> {
- if {!$tk_strictMotif} {
- tk::TextScanMark %W %x %y
- }
+bind Text <Button-2> {
+ if {!$tk_strictMotif} {
+ tk::TextScanMark %W %x %y
}
- bind Text <B3-Motion> {
- if {!$tk_strictMotif} {
- tk::TextScanDrag %W %x %y
- }
+}
+bind Text <B2-Motion> {
+ if {!$tk_strictMotif} {
+ tk::TextScanDrag %W %x %y
}
}
set ::tk::Priv(prevPos) {}
-# The MouseWheel will typically only fire on Windows and MacOS X.
-# However, someone could use the "event generate" command to produce one
-# on other platforms. We must be careful not to round -ve values of %D
-# down to zero.
-
-if {[tk windowingsystem] eq "aqua"} {
- bind Text <MouseWheel> {
- %W yview scroll [expr {-15 * (%D)}] pixels
- }
- bind Text <Option-MouseWheel> {
- %W yview scroll [expr {-150 * (%D)}] pixels
- }
- bind Text <Shift-MouseWheel> {
- %W xview scroll [expr {-15 * (%D)}] pixels
- }
- bind Text <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-150 * (%D)}] pixels
- }
-} else {
- # We must make sure that positive and negative movements are rounded
- # equally to integers, avoiding the problem that
- # (int)1/3 = 0,
- # but
- # (int)-1/3 = -1
- # The following code ensure equal +/- behaviour.
- bind Text <MouseWheel> {
- if {%D >= 0} {
- %W yview scroll [expr {-%D/3}] pixels
- } else {
- %W yview scroll [expr {(2-%D)/3}] pixels
- }
- }
- bind Text <Shift-MouseWheel> {
- if {%D >= 0} {
- %W xview scroll [expr {-%D/3}] pixels
- } else {
- %W xview scroll [expr {(2-%D)/3}] pixels
- }
- }
+bind Text <MouseWheel> {
+ tk::MouseWheel %W y %D -4.0 pixels
}
-
-if {[tk windowingsystem] eq "x11"} {
- # Support for mousewheels on Linux/Unix commonly comes through mapping
- # the wheel to the extended buttons. If you have a mousewheel, find
- # Linux configuration info at:
- # https://linuxreviews.org/HOWTO_change_the_mouse_speed_in_X
- bind Text <4> {
- if {!$tk_strictMotif} {
- %W yview scroll -50 pixels
- }
- }
- bind Text <5> {
- if {!$tk_strictMotif} {
- %W yview scroll 50 pixels
- }
- }
- bind Text <Shift-4> {
- if {!$tk_strictMotif} {
- %W xview scroll -50 pixels
- }
- }
- bind Text <Shift-5> {
- if {!$tk_strictMotif} {
- %W xview scroll 50 pixels
- }
- }
+bind Text <Option-MouseWheel> {
+ tk::MouseWheel %W y %D -1.2 pixels
+}
+bind Text <Shift-MouseWheel> {
+ tk::MouseWheel %W x %D -4.0 pixels
+}
+bind Text <Shift-Option-MouseWheel> {
+ tk::MouseWheel %W x %D -1.2 pixels
}
# ::tk::TextClosestGap --
@@ -1235,3 +1165,96 @@ proc ::tk::TextScanDrag {w x y} {
$w scan dragto $x $y
}
}
+# ::tk::TextUndoRedoProcessMarks --
+#
+# This proc is executed after an undo or redo action.
+# It processes the list of undo/redo marks temporarily set in the
+# text widget to positions delimiting where changes happened, and
+# returns a flat list of ranges. The temporary marks are removed
+# from the text widget.
+#
+# Arguments:
+# w - The text widget
+
+proc ::tk::TextUndoRedoProcessMarks {w} {
+ set indices {}
+ set undoMarks {}
+
+ # only consider the temporary marks set by an undo/redo action
+ foreach mark [$w mark names] {
+ if {[string range $mark 0 11] eq "tk::undoMark"} {
+ lappend undoMarks $mark
+ }
+ }
+
+ # transform marks into indices
+ # the number of undo/redo marks is always even, each right mark
+ # completes a left mark to give a range
+ # this is true because:
+ # - undo/redo only deals with insertions and deletions of text
+ # - insertions may move marks but not delete them
+ # - when deleting text, marks located inside the deleted range
+ # are not erased but moved to the start of the deletion range
+ # . this is done in TkBTreeDeleteIndexRange ("This segment
+ # refuses to die...")
+ # . because MarkDeleteProc does nothing else than returning
+ # a value indicating that marks are not deleted by this
+ # deleteProc
+ # . mark deletion rather happen through [.text mark unset xxx]
+ # which was not used _up to this point of the code_ (it
+ # is a bit later just before exiting the present proc)
+ set nUndoMarks [llength $undoMarks]
+ set n [expr {$nUndoMarks / 2}]
+ set undoMarks [lsort -dictionary $undoMarks]
+ if {$n > 0} {
+ set Lmarks [lrange $undoMarks 0 [expr {$n - 1}]]
+ } else {
+ set Lmarks {}
+ }
+ set Rmarks [lrange $undoMarks $n [llength $undoMarks]]
+ foreach Lmark $Lmarks Rmark $Rmarks {
+ lappend indices [$w index $Lmark] [$w index $Rmark]
+ $w mark unset $Lmark $Rmark
+ }
+
+ # process ranges to:
+ # - remove those already fully included in another range
+ # - merge overlapping ranges
+ set ind [lsort -dictionary -stride 2 $indices]
+ set indices {}
+
+ for {set i 0} {$i < $nUndoMarks} {incr i 2} {
+ set il1 [lindex $ind $i]
+ set ir1 [lindex $ind [expr {$i + 1}]]
+ lappend indices $il1 $ir1
+
+ for {set j [expr {$i + 2}]} {$j < $nUndoMarks} {incr j 2} {
+ set il2 [lindex $ind $j]
+ set ir2 [lindex $ind [expr {$j + 1}]]
+
+ if {[$w compare $il2 > $ir1]} {
+ # second range starts after the end of first range
+ # -> further second ranges do not need to be considered
+ # because ranges were sorted by increasing first index
+ set j $nUndoMarks
+ } else {
+ if {[$w compare $ir2 > $ir1]} {
+ # second range overlaps first range
+ # -> merge them into a single range
+ set indices [lreplace $indices end-1 end]
+ lappend indices $il1 $ir2
+ } else {
+ # second range is fully included in first range
+ # -> ignore it
+ }
+ # in both cases above, the second range shall be
+ # trimmed out from the list of ranges
+ set ind [lreplace $ind $j [expr {$j + 1}]]
+ incr j -2
+ incr nUndoMarks -2
+ }
+ }
+ }
+
+ return $indices
+}
diff --git a/library/tk.tcl b/library/tk.tcl
index be934c1..538edd5 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -3,15 +3,15 @@
# Initialization script normally executed in the interpreter for each Tk-based
# application. Arranges class bindings for widgets.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 Ajuba Solutions.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Ajuba Solutions.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
# Verify that we have Tk binary and script components from the same release
-package require -exact Tk 8.6.11
+package require -exact tk 8.7a6
# Create a ::tk namespace
namespace eval ::tk {
@@ -306,21 +306,21 @@ proc ::tk::EventMotifBindings {n1 dummy dummy} {
set op add
}
- event $op <<Cut>> <Control-Key-w> <Control-Lock-Key-W> <Shift-Key-Delete>
- event $op <<Copy>> <Meta-Key-w> <Meta-Lock-Key-W> <Control-Key-Insert>
- event $op <<Paste>> <Control-Key-y> <Control-Lock-Key-Y> <Shift-Key-Insert>
- event $op <<PrevChar>> <Control-Key-b> <Control-Lock-Key-B>
- event $op <<NextChar>> <Control-Key-f> <Control-Lock-Key-F>
- event $op <<PrevLine>> <Control-Key-p> <Control-Lock-Key-P>
- event $op <<NextLine>> <Control-Key-n> <Control-Lock-Key-N>
- event $op <<LineStart>> <Control-Key-a> <Control-Lock-Key-A>
- event $op <<LineEnd>> <Control-Key-e> <Control-Lock-Key-E>
- event $op <<SelectPrevChar>> <Control-Key-B> <Control-Lock-Key-b>
- event $op <<SelectNextChar>> <Control-Key-F> <Control-Lock-Key-f>
- event $op <<SelectPrevLine>> <Control-Key-P> <Control-Lock-Key-p>
- event $op <<SelectNextLine>> <Control-Key-N> <Control-Lock-Key-n>
- event $op <<SelectLineStart>> <Control-Key-A> <Control-Lock-Key-a>
- event $op <<SelectLineEnd>> <Control-Key-E> <Control-Lock-Key-e>
+ event $op <<Cut>> <Control-w> <Control-Lock-W> <Shift-Delete>
+ event $op <<Copy>> <Meta-w> <Meta-Lock-W> <Control-Insert>
+ event $op <<Paste>> <Control-y> <Control-Lock-Y> <Shift-Insert>
+ event $op <<PrevChar>> <Control-b> <Control-Lock-B>
+ event $op <<NextChar>> <Control-f> <Control-Lock-F>
+ event $op <<PrevLine>> <Control-p> <Control-Lock-P>
+ event $op <<NextLine>> <Control-n> <Control-Lock-N>
+ event $op <<LineStart>> <Control-a> <Control-Lock-A>
+ event $op <<LineEnd>> <Control-e> <Control-Lock-E>
+ event $op <<SelectPrevChar>> <Control-B> <Control-Lock-b>
+ event $op <<SelectNextChar>> <Control-F> <Control-Lock-f>
+ event $op <<SelectPrevLine>> <Control-P> <Control-Lock-p>
+ event $op <<SelectNextLine>> <Control-N> <Control-Lock-n>
+ event $op <<SelectLineStart>> <Control-A> <Control-Lock-a>
+ event $op <<SelectLineEnd>> <Control-E> <Control-Lock-e>
}
#----------------------------------------------------------------------
@@ -366,20 +366,21 @@ if {![llength [info command tk_chooseDirectory]]} {
# Define the set of common virtual events.
#----------------------------------------------------------------------
+event add <<ContextMenu>> <Button-3>
+event add <<PasteSelection>> <ButtonRelease-2>
+
switch -exact -- [tk windowingsystem] {
"x11" {
- event add <<Cut>> <Control-Key-x> <Key-F20> <Control-Lock-Key-X>
- event add <<Copy>> <Control-Key-c> <Key-F16> <Control-Lock-Key-C>
- event add <<Paste>> <Control-Key-v> <Key-F18> <Control-Lock-Key-V>
- event add <<PasteSelection>> <ButtonRelease-2>
- event add <<Undo>> <Control-Key-z> <Control-Lock-Key-Z>
- event add <<Redo>> <Control-Key-Z> <Control-Lock-Key-z>
- event add <<ContextMenu>> <Button-3>
+ event add <<Cut>> <Control-x> <F20> <Control-Lock-X>
+ event add <<Copy>> <Control-c> <F16> <Control-Lock-C>
+ event add <<Paste>> <Control-v> <F18> <Control-Lock-V>
+ event add <<Undo>> <Control-z> <Control-Lock-Z>
+ event add <<Redo>> <Control-Z> <Control-Lock-z>
# On Darwin/Aqua, buttons from left to right are 1,3,2. On Darwin/X11 with recent
# XQuartz as the X server, they are 1,2,3; other X servers may differ.
- event add <<SelectAll>> <Control-Key-slash>
- event add <<SelectNone>> <Control-Key-backslash>
+ event add <<SelectAll>> <Control-/>
+ event add <<SelectNone>> <Control-backslash>
event add <<NextChar>> <Right>
event add <<SelectNextChar>> <Shift-Right>
event add <<PrevChar>> <Left>
@@ -419,16 +420,14 @@ switch -exact -- [tk windowingsystem] {
set ::tk::AlwaysShowSelection 1
}
"win32" {
- event add <<Cut>> <Control-Key-x> <Shift-Key-Delete> <Control-Lock-Key-X>
- event add <<Copy>> <Control-Key-c> <Control-Key-Insert> <Control-Lock-Key-C>
- event add <<Paste>> <Control-Key-v> <Shift-Key-Insert> <Control-Lock-Key-V>
- event add <<PasteSelection>> <ButtonRelease-2>
- event add <<Undo>> <Control-Key-z> <Control-Lock-Key-Z>
- event add <<Redo>> <Control-Key-y> <Control-Lock-Key-Y>
- event add <<ContextMenu>> <Button-3>
-
- event add <<SelectAll>> <Control-Key-slash> <Control-Key-a> <Control-Lock-Key-A>
- event add <<SelectNone>> <Control-Key-backslash>
+ event add <<Cut>> <Control-x> <Shift-Delete> <Control-Lock-X>
+ event add <<Copy>> <Control-c> <Control-Insert> <Control-Lock-C>
+ event add <<Paste>> <Control-v> <Shift-Insert> <Control-Lock-V>
+ event add <<Undo>> <Control-z> <Control-Lock-Z>
+ event add <<Redo>> <Control-y> <Control-Lock-Y>
+
+ event add <<SelectAll>> <Control-/> <Control-a> <Control-Lock-A>
+ event add <<SelectNone>> <Control-backslash>
event add <<NextChar>> <Right>
event add <<SelectNextChar>> <Shift-Right>
event add <<PrevChar>> <Left>
@@ -452,16 +451,14 @@ switch -exact -- [tk windowingsystem] {
event add <<ToggleSelection>> <Control-Button-1>
}
"aqua" {
- event add <<Cut>> <Command-Key-x> <Key-F2> <Command-Lock-Key-X>
- event add <<Copy>> <Command-Key-c> <Key-F3> <Command-Lock-Key-C>
- event add <<Paste>> <Command-Key-v> <Key-F4> <Command-Lock-Key-V>
- event add <<PasteSelection>> <ButtonRelease-3>
+ event add <<Cut>> <Command-x> <F2> <Command-Lock-X>
+ event add <<Copy>> <Command-c> <F3> <Command-Lock-C>
+ event add <<Paste>> <Command-v> <F4> <Command-Lock-V>
event add <<Clear>> <Clear>
- event add <<ContextMenu>> <Button-2>
# Official bindings
# See https://support.apple.com/en-us/HT201236
- event add <<SelectAll>> <Command-Key-a>
+ event add <<SelectAll>> <Command-a>
event add <<Undo>> <Command-Key-z> <Command-Lock-Key-Z>
event add <<Redo>> <Shift-Command-Key-z> <Shift-Command-Lock-Key-z>
event add <<NextChar>> <Right> <Control-Key-f> <Control-Lock-Key-F>
@@ -472,14 +469,14 @@ switch -exact -- [tk windowingsystem] {
event add <<SelectNextWord>> <Shift-Option-Right>
event add <<PrevWord>> <Option-Left>
event add <<SelectPrevWord>> <Shift-Option-Left>
- event add <<LineStart>> <Home> <Command-Left> <Control-Key-a> <Control-Lock-Key-A>
- event add <<SelectLineStart>> <Shift-Home> <Shift-Command-Left> <Shift-Control-Key-A> <Shift-Control-Lock-Key-A>
- event add <<LineEnd>> <End> <Command-Right> <Control-Key-e> <Control-Lock-Key-E>
- event add <<SelectLineEnd>> <Shift-End> <Shift-Command-Right> <Shift-Control-Key-E> <Shift-Control-Lock-Key-E>
- event add <<PrevLine>> <Up> <Control-Key-p> <Control-Lock-Key-P>
- event add <<SelectPrevLine>> <Shift-Up> <Shift-Control-Key-P> <Shift-Control-Lock-Key-P>
- event add <<NextLine>> <Down> <Control-Key-n> <Control-Lock-Key-N>
- event add <<SelectNextLine>> <Shift-Down> <Shift-Control-Key-N> <Shift-Control-Lock-Key-N>
+ event add <<LineStart>> <Home> <Command-Left> <Control-a> <Control-Lock-A>
+ event add <<SelectLineStart>> <Shift-Home> <Shift-Command-Left> <Shift-Control-A> <Shift-Control-Lock-A>
+ event add <<LineEnd>> <End> <Command-Right> <Control-e> <Control-Lock-E>
+ event add <<SelectLineEnd>> <Shift-End> <Shift-Command-Right> <Shift-Control-E> <Shift-Control-Lock-E>
+ event add <<PrevLine>> <Up> <Control-p> <Control-Lock-P>
+ event add <<SelectPrevLine>> <Shift-Up> <Shift-Control-P> <Shift-Control-Lock-P>
+ event add <<NextLine>> <Down> <Control-n> <Control-Lock-N>
+ event add <<SelectNextLine>> <Shift-Down> <Shift-Control-N> <Shift-Control-Lock-N>
# Not official, but logical extensions of above. Also derived from
# bindings present in MS Word on OSX.
event add <<PrevPara>> <Option-Up>
@@ -505,9 +502,11 @@ if {$::tk_library ne ""} {
SourceLibFile listbox
SourceLibFile menu
SourceLibFile panedwindow
+ SourceLibFile print
SourceLibFile scale
SourceLibFile scrlbar
SourceLibFile spinbox
+ SourceLibFile systray
SourceLibFile text
}
}
@@ -536,6 +535,13 @@ proc ::tk::CancelRepeat {} {
set Priv(afterId) {}
}
+## ::tk::MouseWheel $w $dir $amount $factor $units
+
+proc ::tk::MouseWheel {w dir amount {factor -120.0} {units units}} {
+ $w ${dir}view scroll [expr {$amount/$factor}] $units
+}
+
+
# ::tk::TabToWindow --
# This procedure moves the focus to the given widget.
# It sends a <<TraverseOut>> virtual event to the previous focus window,
@@ -627,8 +633,8 @@ proc ::tk::FindAltKeyTarget {path char} {
[string index [$path cget -text] [$path cget -underline]]]} {
return $path
}
- set subwins [concat [grid slaves $path] [pack slaves $path] \
- [place slaves $path]]
+ set subwins [concat [grid content $path] [pack content $path] \
+ [place content $path]]
if {$class eq "Canvas"} {
foreach item [$path find all] {
if {[$path type $item] eq "window"} {
@@ -694,6 +700,11 @@ if {[tk windowingsystem] eq "aqua"} {
uplevel #0 $script
eval $script
}
+ #This procedure is required to silence warnings generated
+ #by inline AppleScript execution.
+ proc ::tk::mac::GetDynamicSdef {} {
+ puts ""
+ }
}
# Create a dictionary to store the starting index of the IME marked
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index f73fdc5..af40a12 100644
--- a/library/tkfbox.tcl
+++ b/library/tkfbox.tcl
@@ -10,7 +10,7 @@
# "Directory" option menu. The user can select files by clicking on the
# file icons or by entering a filename in the "Filename:" entry.
#
-# Copyright (c) 1994-1998 Sun Microsystems, Inc.
+# Copyright © 1994-1998 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -463,7 +463,7 @@ proc ::tk::dialog::file::Create {w class} {
wm protocol $w WM_DELETE_WINDOW [list ::tk::dialog::file::CancelCmd $w]
$data(upBtn) configure -command [list ::tk::dialog::file::UpDirCmd $w]
$data(cancelBtn) configure -command [list ::tk::dialog::file::CancelCmd $w]
- bind $w <KeyPress-Escape> [list $data(cancelBtn) invoke]
+ bind $w <Escape> [list $data(cancelBtn) invoke]
bind $w <Alt-Key> [list tk::AltKeyInDialog $w %A]
# Set up event handlers specific to File or Directory Dialogs
diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl
index e8c24a1..14460a2 100644
--- a/library/ttk/button.tcl
+++ b/library/ttk/button.tcl
@@ -42,7 +42,7 @@ ttk::copyBindings TButton TRadiobutton
bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 }
bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 }
-# bind TCheckbutton <plus> { %W select }
+# bind TCheckbutton <+> { %W select }
# bind TCheckbutton <minus> { %W deselect }
# activate --
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index e339f97..917efd5 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -182,13 +182,20 @@ proc ttk::combobox::SelectEntry {cb index} {
## Scroll -- Mousewheel binding
#
-proc ttk::combobox::Scroll {cb dir} {
+proc ttk::combobox::Scroll {cb dir {factor 1.0}} {
$cb instate disabled { return }
set max [llength [$cb cget -values]]
set current [$cb current]
- incr current $dir
- if {$max != 0 && $current == $current % $max} {
- SelectEntry $cb $current
+ if {$current < 0} {
+ set index 0
+ } else {
+ set d [expr {$dir/$factor}]
+ set index [expr {$current + int($d > 0 ? ceil($d) : floor($d))}]
+ if {$index >= $max} {set index [expr {$max - 1}]}
+ if {$index < 0} {set index 0}
+ }
+ if {$max != 0 && $index != $current} {
+ SelectEntry $cb $index
}
}
@@ -197,7 +204,7 @@ proc ttk::combobox::Scroll {cb dir} {
# and unpost the listbox.
#
proc ttk::combobox::LBSelected {lb} {
- set cb [LBMaster $lb]
+ set cb [LBMain $lb]
LBSelect $lb
Unpost $cb
focus $cb
@@ -207,14 +214,14 @@ proc ttk::combobox::LBSelected {lb} {
# Unpost the listbox.
#
proc ttk::combobox::LBCancel {lb} {
- Unpost [LBMaster $lb]
+ Unpost [LBMain $lb]
}
## LBTab -- Tab key binding for combobox listbox.
# Set the selection, and navigate to next/prev widget.
#
proc ttk::combobox::LBTab {lb dir} {
- set cb [LBMaster $lb]
+ set cb [LBMain $lb]
switch -- $dir {
next { set newFocus [tk_focusNext $cb] }
prev { set newFocus [tk_focusPrev $cb] }
@@ -414,10 +421,10 @@ proc ttk::combobox::Unpost {cb} {
grab release $cb.popdown ;# in case of stuck or unexpected grab [#1239190]
}
-## LBMaster $lb --
+## LBMain $lb --
# Return the combobox main widget that owns the listbox.
#
-proc ttk::combobox::LBMaster {lb} {
+proc ttk::combobox::LBMain {lb} {
winfo parent [winfo parent [winfo parent $lb]]
}
@@ -425,7 +432,7 @@ proc ttk::combobox::LBMaster {lb} {
# Transfer listbox selection to combobox value.
#
proc ttk::combobox::LBSelect {lb} {
- set cb [LBMaster $lb]
+ set cb [LBMain $lb]
set selection [$lb curselection]
if {[llength $selection] == 1} {
SelectEntry $cb [lindex $selection 0]
@@ -442,7 +449,7 @@ proc ttk::combobox::LBSelect {lb} {
#
proc ttk::combobox::LBCleanup {lb} {
variable Values
- unset Values([LBMaster $lb])
+ unset Values([LBMain $lb])
}
#*EOF*
diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl
index f1f9fa1..9d1e1ae 100644
--- a/library/ttk/cursors.tcl
+++ b/library/ttk/cursors.tcl
@@ -99,23 +99,20 @@ namespace eval ttk {
}
"aqua" {
- if {[package vsatisfies [package provide Tk] 8.5]} {
- # appeared 2007-04-23, Tk 8.5a6
- array set Cursors {
- standard arrow
- text ibeam
- link pointinghand
- crosshair crosshair
- busy watch
- forbidden notallowed
-
- hresize resizeleftright
- vresize resizeupdown
- nresize resizeup
- sresize resizedown
- wresize resizeleft
- eresize resizeright
- }
+ array set Cursors {
+ standard arrow
+ text ibeam
+ link pointinghand
+ crosshair crosshair
+ busy watch
+ forbidden notallowed
+
+ hresize resizeleftright
+ vresize resizeupdown
+ nresize resizeup
+ sresize resizedown
+ wresize resizeleft
+ eresize resizeright
}
}
}
@@ -201,7 +198,7 @@ proc ttk::CursorSampler {f} {
if {[info exists argv0] && $argv0 eq [info script]} {
wm title . "[array size ::ttk::Cursors] cursors"
pack [ttk::CursorSampler .f] -expand true -fill both
- bind . <KeyPress-Escape> [list destroy .]
+ bind . <Escape> [list destroy .]
focus .f
}
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index 4cdb5ac..fb49055 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -1,9 +1,9 @@
#
# DERIVED FROM: tk/library/entry.tcl r1.22
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 2004, Joe English
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 2004, Joe English
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -82,20 +82,14 @@ bind TEntry <<ToggleSelection>> {
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
}
-## Button2 (Button3 on Aqua) bindings:
+## Button2 bindings:
# Used for scanning and primary transfer.
-# Note: ButtonRelease-2 (ButtonRelease-3 on Aqua)
+# Note: ButtonRelease-2
# is mapped to <<PasteSelection>> in tk.tcl.
#
-if {[tk windowingsystem] ne "aqua"} {
- bind TEntry <Button-2> { ttk::entry::ScanMark %W %x }
- bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
- bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
-} else {
- bind TEntry <Button-3> { ttk::entry::ScanMark %W %x }
- bind TEntry <B3-Motion> { ttk::entry::ScanDrag %W %x }
- bind TEntry <ButtonRelease-3> { ttk::entry::ScanRelease %W %x }
-}
+bind TEntry <Button-2> { ttk::entry::ScanMark %W %x }
+bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
+bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
bind TEntry <<PasteSelection>> { ttk::entry::ScanRelease %W %x }
## Keyboard navigation bindings:
@@ -136,12 +130,8 @@ bind TEntry <Escape> {# nothing}
bind TEntry <Return> {# nothing}
bind TEntry <KP_Enter> {# nothing}
bind TEntry <Tab> {# nothing}
+bind TEntry <Command-Key> {# nothing}
-# Argh. Apparently on Windows, the NumLock modifier is interpreted
-# as a Command modifier.
-if {[tk windowingsystem] eq "aqua"} {
- bind TEntry <Command-Key> {# nothing}
-}
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
bind TEntry <<PrevLine>> {# nothing}
bind TEntry <<NextLine>> {# nothing}
@@ -179,7 +169,7 @@ bind TEntry <<TkAccentBackspace>> {
#
proc ttk::entry::EntrySelection {w} {
set entryString [string range [$w get] [$w index sel.first] \
- [expr {[$w index sel.last] - 1}]]
+ [$w index sel.last]-1]
if {[$w cget -show] ne ""} {
return [string repeat [string index [$w cget -show] 0] \
[string length $entryString]]
diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl
index bf4ccd0..65f2c5e 100644
--- a/library/ttk/fonts.tcl
+++ b/library/ttk/fonts.tcl
@@ -53,10 +53,6 @@
# Most other toolkits use medium weight for all UI elements,
# which is what we do now.
#
-# Font size specified in pixels on X11, not points.
-# This is Theoretically Wrong, but in practice works better; using
-# points leads to huge inconsistencies across different servers.
-#
namespace eval ttk {
@@ -131,10 +127,10 @@ switch -- [tk windowingsystem] {
set F(family) "Helvetica"
set F(fixed) "courier"
}
- set F(size) -12
- set F(ttsize) -10
- set F(capsize) -14
- set F(fixedsize) -12
+ set F(size) 10
+ set F(ttsize) 9
+ set F(capsize) 12
+ set F(fixedsize) 10
font configure TkDefaultFont -family $F(family) -size $F(size)
font configure TkTextFont -family $F(family) -size $F(size)
diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl
index 518c6f5..7097c45 100644
--- a/library/ttk/notebook.tcl
+++ b/library/ttk/notebook.tcl
@@ -16,6 +16,8 @@ bind TNotebook <Control-ISO_Left_Tab> { ttk::notebook::CycleTab %W -1; break }
}
bind TNotebook <Destroy> { ttk::notebook::Cleanup %W }
+ttk::bindMouseWheel TNotebook [list ttk::notebook::CycleTab %W]
+
# ActivateTab $nb $tab --
# Select the specified tab and set focus.
#
@@ -56,12 +58,14 @@ proc ttk::notebook::Press {w x y} {
# CycleTab --
# Select the next/previous tab in the list.
#
-proc ttk::notebook::CycleTab {w dir} {
+proc ttk::notebook::CycleTab {w dir {factor 1.0}} {
set current [$w index current]
if {$current >= 0} {
set tabCount [$w index end]
- set select [expr {($current + $dir) % $tabCount}]
- set step [expr {$dir > 0 ? 1 : -1}]
+ set d [expr {$dir/$factor}]
+ set d [expr {int($d > 0 ? ceil($d) : floor($d))}]
+ set select [expr {($current + $d) % $tabCount}]
+ set step [expr {$d > 0 ? 1 : -1}]
while {[$w tab $select -state] ne "normal" && ($select != $current)} {
set select [expr {($select + $step) % $tabCount}]
}
@@ -114,13 +118,8 @@ proc ttk::notebook::enableTraversal {nb} {
catch {
bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1}
}
- if {[tk windowingsystem] eq "aqua"} {
- bind $top <Option-Key> \
- +[list ttk::notebook::MnemonicActivation $top %K]
- } else {
- bind $top <Alt-Key> \
- +[list ttk::notebook::MnemonicActivation $top %K]
- }
+ bind $top <Option-Key> \
+ +[list ttk::notebook::MnemonicActivation $top %K]
bind $top <Destroy> {+ttk::notebook::TLCleanup %W}
}
diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl
index 61c4136..a97440d 100644
--- a/library/ttk/scale.tcl
+++ b/library/ttk/scale.tcl
@@ -1,4 +1,4 @@
-# scale.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
+# scale.tcl - Copyright © 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
#
# Bindings for the TScale widget
diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl
index 8be9887..8f6cf64 100644
--- a/library/ttk/scrollbar.tcl
+++ b/library/ttk/scrollbar.tcl
@@ -19,22 +19,8 @@ bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y }
# Redirect scrollwheel bindings to the scrollbar widget
#
-# The shift-bindings scroll left/right (not up/down)
-# if a widget has both possibilities
-set eventList [list <MouseWheel> <Shift-MouseWheel>]
-switch [tk windowingsystem] {
- aqua {
- lappend eventList <Option-MouseWheel> <Shift-Option-MouseWheel>
- }
- x11 {
- lappend eventList <Button-4> <Button-5> \
- <Shift-Button-4> <Shift-Button-5>
- }
-}
-foreach event $eventList {
- bind TScrollbar $event [bind Scrollbar $event]
-}
-unset eventList event
+bind TScrollbar <MouseWheel> [bind Scrollbar <MouseWheel>]
+bind TScrollbar <Option-MouseWheel> [bind Scrollbar <Option-MouseWheel>]
proc ttk::scrollbar::Scroll {w n units} {
set cmd [$w cget -command]
diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl
index 8aba5e1..9f002cd 100644
--- a/library/ttk/spinbox.tcl
+++ b/library/ttk/spinbox.tcl
@@ -23,7 +23,7 @@ bind TSpinbox <Down> { event generate %W <<Decrement>> }
bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 }
bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 }
-ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W]
+ttk::bindMouseWheel TSpinbox [list ttk::spinbox::Spin %W]
## Motion --
# Sets cursor.
@@ -80,13 +80,13 @@ proc ttk::spinbox::Release {w} {
## MouseWheel --
# Mousewheel callback. Turn these into <<Increment>> (-1, up)
-# or <<Decrement> (+1, down) events.
+# or <<Decrement> (+1, down) events. Not used any more.
#
-proc ttk::spinbox::MouseWheel {w dir} {
+proc ttk::spinbox::MouseWheel {w dir {factor 1.0}} {
if {[$w instate disabled]} { return }
- if {$dir < 0} {
+ if {($dir < 0) ^ ($factor < 0)} {
event generate $w <<Increment>>
- } else {
+ } elseif {$dir != 0} {
event generate $w <<Decrement>>
}
}
@@ -134,7 +134,7 @@ proc ttk::spinbox::Adjust {w v min max} {
# Otherwise cycle through numeric range based on
# -from, -to, and -increment.
#
-proc ttk::spinbox::Spin {w dir} {
+proc ttk::spinbox::Spin {w dir {factor -1.0}} {
variable State
if {[$w instate disabled]} { return }
@@ -146,6 +146,8 @@ proc ttk::spinbox::Spin {w dir} {
set State($w,values) [$w cget -values]
set State($w,values.length) [llength $State($w,values)]
+ set d [expr {-($dir/$factor)}]
+ set d [expr {int($d > 0 ? ceil($d) : floor($d))}]
if {$State($w,values.length) > 0} {
set value [$w get]
set current $State($w,values.index)
@@ -153,13 +155,13 @@ proc ttk::spinbox::Spin {w dir} {
set current [lsearch -exact $State($w,values) $value]
if {$current < 0} {set current -1}
}
- set State($w,values.index) [Adjust $w [expr {$current + $dir}] 0 \
+ set State($w,values.index) [Adjust $w [expr {$current + $d}] 0 \
[expr {$State($w,values.length) - 1}]]
set State($w,values.last) [lindex $State($w,values) $State($w,values.index)]
$w set $State($w,values.last)
} else {
if {[catch {
- set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
+ set v [expr {[scan [$w get] %f] + $d * [$w cget -increment]}]
}]} {
set v [$w cget -from]
}
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index 2571914..d95f6b9 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -273,18 +273,6 @@ proc ttk::copyBindings {from to} {
#
# Platform inconsistencies:
#
-# On X11, the server typically maps the mouse wheel to Button4 and Button5.
-#
-# On OSX, Tk generates sensible values for the %D field in <MouseWheel> events.
-#
-# On Windows, %D must be scaled by a factor of 120.
-#
-# OSX conventionally uses Shift+MouseWheel for horizontal scrolling,
-# and Option+MouseWheel for accelerated scrolling.
-#
-# The Shift+MouseWheel behavior is not conventional on Windows or most
-# X11 toolkits, but it's useful.
-#
# MouseWheel scrolling is accelerated on X11, which is conventional
# for Tk and appears to be conventional for other toolkits (although
# Gtk+ and Qt do not appear to use as large a factor).
@@ -292,46 +280,25 @@ proc ttk::copyBindings {from to} {
## ttk::bindMouseWheel $bindtag $command...
# Adds basic mousewheel support to $bindtag.
-# $command will be passed one additional argument
-# specifying the mousewheel direction (-1: up, +1: down).
+# $command will be passed two additional arguments
+# specifying the mousewheel change and a factor.
#
proc ttk::bindMouseWheel {bindtag callback} {
- if {[tk windowingsystem] eq "x11"} {
- bind $bindtag <Button-4> "$callback -1"
- bind $bindtag <Button-5> "$callback +1"
- }
- if {[tk windowingsystem] eq "aqua"} {
- bind $bindtag <MouseWheel> "$callback \[expr {-%D}\]"
- bind $bindtag <Option-MouseWheel> "$callback \[expr {-10 * %D}\]"
- } else {
- bind $bindtag <MouseWheel> "$callback \[expr {-%D / 120}\]"
- }
+ bind $bindtag <MouseWheel> "$callback %D -120.0"
+ bind $bindtag <Option-MouseWheel> "$callback %D -12.0"
}
## Mousewheel bindings for standard scrollable widgets.
#
-if {[tk windowingsystem] eq "x11"} {
- bind TtkScrollable <Button-4> { %W yview scroll -5 units }
- bind TtkScrollable <Button-5> { %W yview scroll 5 units }
- bind TtkScrollable <Shift-Button-4> { %W xview scroll -5 units }
- bind TtkScrollable <Shift-Button-5> { %W xview scroll 5 units }
-}
-if {[tk windowingsystem] eq "aqua"} {
- bind TtkScrollable <MouseWheel> \
- { %W yview scroll [expr {-%D}] units }
- bind TtkScrollable <Shift-MouseWheel> \
- { %W xview scroll [expr {-%D}] units }
- bind TtkScrollable <Option-MouseWheel> \
- { %W yview scroll [expr {-10 * %D}] units }
- bind TtkScrollable <Shift-Option-MouseWheel> \
- { %W xview scroll [expr {-10 * %D}] units }
-} else {
- bind TtkScrollable <MouseWheel> \
- { %W yview scroll [expr {-%D / 120}] units }
- bind TtkScrollable <Shift-MouseWheel> \
- { %W xview scroll [expr {-%D / 120}] units }
-}
+bind TtkScrollable <MouseWheel> \
+ { tk::MouseWheel %W y %D -40.0 }
+bind TtkScrollable <Option-MouseWheel> \
+ { tk::MouseWheel %W y %D -12.0 }
+bind TtkScrollable <Shift-MouseWheel> \
+ { tk::MouseWheel %W x %D -40.0 }
+bind TtkScrollable <Shift-Option-MouseWheel> \
+ { tk::MouseWheel %W x %D -12.0 }
#*EOF*
diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl
index 0700353..d841962 100644
--- a/library/ttk/vistaTheme.tcl
+++ b/library/ttk/vistaTheme.tcl
@@ -187,6 +187,7 @@ namespace eval ttk::theme::vista {
ttk::style layout Horizontal.TProgressbar {
Horizontal.Progressbar.trough -sticky nswe -children {
Horizontal.Progressbar.pbar -side left -sticky ns
+ Horizontal.Progressbar.text -sticky nesw
}
}
ttk::style element create Vertical.Progressbar.pbar vsapi \
diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl
index 14d2be5..71f3f1a 100644
--- a/library/xmfbox.tcl
+++ b/library/xmfbox.tcl
@@ -4,8 +4,8 @@
# Unix platform. This implementation is used only if the
# "::tk_strictMotif" flag is set.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 Scriptics Corporation
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Scriptics Corporation
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -210,7 +210,6 @@ proc ::tk::MotifFDialog_SetFilter {w type} {
variable ::tk::Priv
set data(filter) [lindex $type 1]
- set Priv(selectFileType) [lindex [lindex $type 0] 0]
MotifFDialog_Update $w
}
@@ -907,9 +906,9 @@ proc ::tk::MotifFDialog_CancelCmd {w} {
}
proc ::tk::ListBoxKeyAccel_Set {w} {
- bind Listbox <Any-KeyPress> ""
+ bind Listbox <Key> ""
bind $w <Destroy> [list tk::ListBoxKeyAccel_Unset $w]
- bind $w <Any-KeyPress> [list tk::ListBoxKeyAccel_Key $w %A]
+ bind $w <Key> [list tk::ListBoxKeyAccel_Key $w %A]
}
proc ::tk::ListBoxKeyAccel_Unset {w} {
@@ -981,9 +980,3 @@ proc ::tk::ListBoxKeyAccel_Reset {w} {
unset -nocomplain Priv(lbAccel,$w)
}
-proc ::tk_getFileType {} {
- variable ::tk::Priv
-
- return $Priv(selectFileType)
-}
-
diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile
index dd4c025..208fe87 100644
--- a/macosx/GNUmakefile
+++ b/macosx/GNUmakefile
@@ -109,7 +109,7 @@ PROJECT := tk
PRODUCT_NAME := Tk
UNIX_DIR := ${CURDIR}/../unix
-VERSION := $(shell awk -F= '/^TK_VERSION/ {print $$2; nextfile}' ${UNIX_DIR}/configure.in)
+VERSION := $(shell awk -F= '/^TK_VERSION/ {print $$2; nextfile}' ${UNIX_DIR}/configure.ac)
TCL_VERSION := ${VERSION}
wish := wish
WISH = wish${VERSION}
@@ -187,7 +187,7 @@ ${objdir}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \
mkdir -p "${OBJ_DIR}" && cd "${OBJ_DIR}" && \
if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure -C \
--prefix="${PREFIX}" --bindir="${BINDIR}" --libdir="${LIBDIR}" \
- --mandir="${MANDIR}" --enable-threads --enable-framework \
+ --mandir="${MANDIR}" --enable-framework --disable-zipfs \
--with-tcl="${TCL_DIR}" \
${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS}; else ./config.status; fi
ifneq (${VERSION},${TCL_VERSION})
diff --git a/macosx/README b/macosx/README
index 834dea4..ac641b1 100644
--- a/macosx/README
+++ b/macosx/README
@@ -169,12 +169,12 @@ newAppearance option: "aqua", "darkaqua", or "auto". If the appearance is set
to aqua or darkaqua then the window will be displayed with the corresponding
appearance independent of any preferences settings. If it is set to "auto"
the appearance will be determined by the preferences. This command can be
-used to opt out of Dark Mode on a per-window basis. It may be best to run the "update" command before setting the appearance property, to allow the event loop to run.
+used to opt out of Dark Mode on a per-window basis. It may be best to run the "update" command before setting the appearance property, to allow the event loop to run.
- To determine the current appearance of a window in macOS 10.14 (Mojave) and
higher, one can use the command:
- tk::unsupported::MacWindowStyle isdark window?
+ tk::unsupported::MacWindowStyle isdark
The boolean return value is true if the window is currently displayed with the
dark appearance.
@@ -272,20 +272,24 @@ appearance. Part of the implementation of the Dark Mode was to make
some of the named NSColors have dynamic values. Apple calls these
"semantic colors" because the name does not specify a specific color,
but rather refers to the context in which the color should be used.
-Tk now provides the following semantic colors as system colors:
-systemTextColor, systemTextBackgroundColor, systemSelectedTextColor,
-systemSelectedTextBackgroundColor, systemControlTextColor,
-systemDisabledControlTextColor, systemLabelColor, systemLinkColor, and
-systemControlAccentColor. All of these except the last three were
-present in OSX 10.0 (and those three are simulated in systems where they
-do not exist). The change in 10.14 was that the RGB color value of
-these colors became dynamic, meaning that the color value can change
-when the application appearance changes. In particular, when a user
-selects Dark Mode in the system preferences these colors change
-appearance. For example systemTextColor is dark in Aqua and light in
-DarkAqua. One additional color, systemSelectedTabTextColor, does not
-exist in macOS but is used by Tk to match the different colors used
-for Notebook tab text in different OS versions.
+In particular, when a user selects Dark Mode in the system preferences
+these colors change appearance. For example systemTextColor is dark in
+Aqua and light in DarkAqua.
+
+Tk now provides colors corresponding to all of the NSColors in Apple's System
+ColorList. The convention for naming these colors is that the Tk name is
+generated by capitalizing the macOS name and adding the prefix "system". The
+System ColorList differs between releases of macOS and some colors, such as
+systemLinkColor and systemControlAccentColor, are simulated on older systems
+which did not provide them. The following colors are available on all
+supported macOS releases, although newer systems will support additional
+colors: systemControlAccentColor, systemControlTextColor,
+systemDisabledControlTextColor, systemLabelColor, systemLinkColor,
+systemPlaceholderTextColor, systemSelectedTextBackgroundColor,
+systemSelectedTextColor, systemSeparatorColor, systemTextBackgroundColor, and
+systemTextColor. One additional color, systemSelectedTabTextColor, does not
+exist in macOS but is used by Tk to match the different colors used for
+Notebook tab titles in different OS versions.
The default background and foreground colors of most of the Tk widgets
have been set to semantic colors, which means that the widgets will change
diff --git a/macosx/Tk-Common.xcconfig b/macosx/Tk-Common.xcconfig
index 4ec1a52..72ef08a 100644
--- a/macosx/Tk-Common.xcconfig
+++ b/macosx/Tk-Common.xcconfig
@@ -23,7 +23,7 @@ GCC_NO_COMMON_BLOCKS = YES
GCC_DYNAMIC_NO_PIC = YES
GCC_VERSION = 4.2
GCC = gcc-$(GCC_VERSION)
-WARNING_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-value -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
+WARNING_CFLAGS = -Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -Winit-self -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
REZ_RESOURCE_MAP_READ_ONLY = YES
APPLICATION_INSTALL_PATH = /Applications/Utilities
BINDIR = $(PREFIX)/bin
@@ -36,11 +36,11 @@ MANDIR = $(PREFIX)/man
PER_ARCH_CFLAGS_ppc = -mcpu=G3 -mtune=G4 $(PER_ARCH_CFLAGS_ppc)
PREFIX = /usr/local
TCL_BUILD_DIR = $(OBJROOT)/../tcl/Tcl.build/$(CONFIGURATION)/Tcl.build/Objects
-TCL_CONFIGURE_ARGS = --enable-threads --enable-dtrace
+TCL_CONFIGURE_ARGS = --enable-dtrace
TCL_FRAMEWORK_DIR = $(SYMROOT)/../tcl/$(CONFIGURATION)
TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION)
TCL_PACKAGE_PATH = "$(LIBDIR)"
TCL_DEFS = HAVE_TCL_CONFIG_H
TK_LIBRARY = $(LIBDIR)/tk$(VERSION)
-TK_DEFS = HAVE_TK_CONFIG_H
-VERSION = 8.6
+TK_DEFS = HAVE_TK_CONFIG_H TCL_NO_DEPRECATED
+VERSION = 8.7
diff --git a/macosx/Tk.xcode/project.pbxproj b/macosx/Tk.xcode/project.pbxproj
index c93b15b..c1c5b41 100644
--- a/macosx/Tk.xcode/project.pbxproj
+++ b/macosx/Tk.xcode/project.pbxproj
@@ -1043,7 +1043,6 @@
F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXEmbed.c; sourceTree = "<group>"; };
F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXEntry.c; sourceTree = "<group>"; };
F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXEvent.c; sourceTree = "<group>"; };
- F966BBD508F27A3B005CB29B /* tkMacOSXEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXEvent.h; sourceTree = "<group>"; };
F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXFont.c; sourceTree = "<group>"; };
F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXHLEvents.c; sourceTree = "<group>"; };
F966BBD808F27A3B005CB29B /* tkMacOSXInit.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXInit.c; sourceTree = "<group>"; };
@@ -1172,7 +1171,7 @@
F966BC6A08F27A3D005CB29B /* xmfbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.test; sourceTree = "<group>"; };
F966BC6C08F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
F966BC6D08F27A3D005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F966BC6E08F27A3D005CB29B /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F966BC6E08F27A3D005CB29B /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F966BC6F08F27A3D005CB29B /* install-sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "install-sh"; sourceTree = "<group>"; };
F966BC7008F27A3D005CB29B /* installManPage */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = installManPage; sourceTree = "<group>"; };
F966BC7108F27A3D005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
@@ -1211,16 +1210,14 @@
F966BC9408F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
F966BC9508F27A3D005CB29B /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; };
F966BC9608F27A3E005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F966BC9708F27A3E005CB29B /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F966BC9708F27A3E005CB29B /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F966BC9908F27A3E005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
F966BC9A08F27A3E005CB29B /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
- F966BC9B08F27A3E005CB29B /* mkd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mkd.bat; sourceTree = "<group>"; };
F966BC9C08F27A3E005CB29B /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
F966BCEE08F27A3E005CB29B /* tk.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.rc; sourceTree = "<group>"; };
F966BCEF08F27A3E005CB29B /* tk_base.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk_base.rc; sourceTree = "<group>"; };
F966BCF208F27A3E005CB29B /* wish.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wish.rc; sourceTree = "<group>"; };
F966BCF308F27A3E005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
- F966BCF408F27A3E005CB29B /* rmd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rmd.bat; sourceTree = "<group>"; };
F966BCF508F27A3F005CB29B /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; };
F966BCF608F27A3F005CB29B /* stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stubs.c; sourceTree = "<group>"; };
F966BCF708F27A3F005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
@@ -1915,7 +1912,7 @@
F96D43CF08F272B7004A47F5 /* winTime.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTime.test; sourceTree = "<group>"; };
F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = checkLibraryDoc.tcl; sourceTree = "<group>"; };
F96D43D208F272B8004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F96D43D308F272B8004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D43D308F272B8004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F96D442208F272B8004A47F5 /* eolFix.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = eolFix.tcl; sourceTree = "<group>"; };
F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fix_tommath_h.tcl; sourceTree = "<group>"; };
F96D442508F272B8004A47F5 /* genStubs.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = genStubs.tcl; sourceTree = "<group>"; };
@@ -1940,7 +1937,7 @@
F96D443C08F272B9004A47F5 /* uniParse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniParse.tcl; sourceTree = "<group>"; };
F96D444008F272B9004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
F96D444108F272B9004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F96D444208F272B9004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D444208F272B9004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F96D444408F272B9004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
F96D444508F272B9004A47F5 /* pkga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkga.c; sourceTree = "<group>"; };
F96D444608F272B9004A47F5 /* pkgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgb.c; sourceTree = "<group>"; };
@@ -1984,7 +1981,7 @@
F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; };
F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; };
F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F96D447508F272BA004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D447508F272BA004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F96D447708F272BA004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
F96D447808F272BA004A47F5 /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
F96D447908F272BA004A47F5 /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
@@ -2586,7 +2583,6 @@
F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */,
F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */,
F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */,
- F966BBD508F27A3B005CB29B /* tkMacOSXEvent.h */,
F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */,
F93E5EFD09CF8711008FA367 /* tkMacOSXFont.h */,
F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */,
@@ -2740,7 +2736,7 @@
children = (
F966BC6C08F27A3D005CB29B /* aclocal.m4 */,
F966BC6D08F27A3D005CB29B /* configure */,
- F966BC6E08F27A3D005CB29B /* configure.in */,
+ F966BC6E08F27A3D005CB29B /* configure.ac */,
F966BC6F08F27A3D005CB29B /* install-sh */,
F966BC7008F27A3D005CB29B /* installManPage */,
F966BC7108F27A3D005CB29B /* Makefile.in */,
@@ -2787,10 +2783,9 @@
F966BC9408F27A3D005CB29B /* aclocal.m4 */,
F966BC9508F27A3D005CB29B /* buildall.vc.bat */,
F966BC9608F27A3E005CB29B /* configure */,
- F966BC9708F27A3E005CB29B /* configure.in */,
+ F966BC9708F27A3E005CB29B /* configure.ac */,
F966BC9908F27A3E005CB29B /* Makefile.in */,
F966BC9A08F27A3E005CB29B /* makefile.vc */,
- F966BC9B08F27A3E005CB29B /* mkd.bat */,
F966BC9C08F27A3E005CB29B /* nmakehlp.c */,
F966BC9D08F27A3E005CB29B /* rc */,
F966BCF308F27A3E005CB29B /* README */,
@@ -3722,7 +3717,7 @@
children = (
F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */,
F96D43D208F272B8004A47F5 /* configure */,
- F96D43D308F272B8004A47F5 /* configure.in */,
+ F96D43D308F272B8004A47F5 /* configure.ac */,
F96D442208F272B8004A47F5 /* eolFix.tcl */,
F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */,
F96D442508F272B8004A47F5 /* genStubs.tcl */,
@@ -3755,7 +3750,7 @@
children = (
F96D444008F272B9004A47F5 /* aclocal.m4 */,
F96D444108F272B9004A47F5 /* configure */,
- F96D444208F272B9004A47F5 /* configure.in */,
+ F96D444208F272B9004A47F5 /* configure.ac */,
F96D444308F272B9004A47F5 /* dltest */,
F96D444D08F272B9004A47F5 /* install-sh */,
F96D444E08F272B9004A47F5 /* installManPage */,
@@ -3816,7 +3811,7 @@
F96D447108F272BA004A47F5 /* buildall.vc.bat */,
F96D447208F272BA004A47F5 /* cat.c */,
F96D447408F272BA004A47F5 /* configure */,
- F96D447508F272BA004A47F5 /* configure.in */,
+ F96D447508F272BA004A47F5 /* configure.ac */,
F96D447708F272BA004A47F5 /* Makefile.in */,
F96D447808F272BA004A47F5 /* makefile.vc */,
F96D447908F272BA004A47F5 /* nmakehlp.c */,
@@ -3968,7 +3963,7 @@
);
inputPaths = (
"$(TCL_SRCROOT)/macosx/configure.ac",
- "$(TCL_SRCROOT)/unix/configure.in",
+ "$(TCL_SRCROOT)/unix/configure.ac",
"$(TCL_SRCROOT)/unix/tcl.m4",
"$(TCL_SRCROOT)/unix/aclocal.m4",
"$(TCL_SRCROOT)/unix/tclConfig.sh.in",
@@ -3981,7 +3976,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
showEnvVarsInLog = 0;
};
F9A5C5F608F651AB008AE941 /* Configure Tk */ = {
@@ -3991,7 +3986,7 @@
);
inputPaths = (
"$(TK_SRCROOT)/macosx/configure.ac",
- "$(TK_SRCROOT)/unix/configure.in",
+ "$(TK_SRCROOT)/unix/configure.ac",
"$(TK_SRCROOT)/unix/tcl.m4",
"$(TK_SRCROOT)/unix/aclocal.m4",
"$(TK_SRCROOT)/unix/tkConfig.sh.in",
@@ -4002,7 +3997,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
showEnvVarsInLog = 0;
};
F9FD30B40CC1AD070073837D /* Configure Tcl */ = {
@@ -4012,7 +4007,7 @@
);
inputPaths = (
"$(TCL_SRCROOT)/macosx/configure.ac",
- "$(TCL_SRCROOT)/unix/configure.in",
+ "$(TCL_SRCROOT)/unix/configure.ac",
"$(TCL_SRCROOT)/unix/tcl.m4",
"$(TCL_SRCROOT)/unix/aclocal.m4",
"$(TCL_SRCROOT)/unix/tclConfig.sh.in",
@@ -4025,7 +4020,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
showEnvVarsInLog = 0;
};
F9FD30B50CC1AD070073837D /* Configure Tk */ = {
@@ -4035,7 +4030,7 @@
);
inputPaths = (
"$(TK_SRCROOT)/macosx/configure.ac",
- "$(TK_SRCROOT)/unix/configure.in",
+ "$(TK_SRCROOT)/unix/configure.ac",
"$(TK_SRCROOT)/unix/tcl.m4",
"$(TK_SRCROOT)/unix/aclocal.m4",
"$(TK_SRCROOT)/unix/tkConfig.sh.in",
@@ -4046,7 +4041,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-xft --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-xft --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
diff --git a/macosx/Tk.xcodeproj/project.pbxproj b/macosx/Tk.xcodeproj/project.pbxproj
index 10a9c9a..ea4ecfc 100644
--- a/macosx/Tk.xcodeproj/project.pbxproj
+++ b/macosx/Tk.xcodeproj/project.pbxproj
@@ -1043,7 +1043,6 @@
F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXEmbed.c; sourceTree = "<group>"; };
F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXEntry.c; sourceTree = "<group>"; };
F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXEvent.c; sourceTree = "<group>"; };
- F966BBD508F27A3B005CB29B /* tkMacOSXEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXEvent.h; sourceTree = "<group>"; };
F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXFont.c; sourceTree = "<group>"; };
F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXHLEvents.c; sourceTree = "<group>"; };
F966BBD808F27A3B005CB29B /* tkMacOSXInit.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = tkMacOSXInit.c; sourceTree = "<group>"; };
@@ -1172,7 +1171,7 @@
F966BC6A08F27A3D005CB29B /* xmfbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.test; sourceTree = "<group>"; };
F966BC6C08F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
F966BC6D08F27A3D005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F966BC6E08F27A3D005CB29B /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F966BC6E08F27A3D005CB29B /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F966BC6F08F27A3D005CB29B /* install-sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "install-sh"; sourceTree = "<group>"; };
F966BC7008F27A3D005CB29B /* installManPage */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = installManPage; sourceTree = "<group>"; };
F966BC7108F27A3D005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
@@ -1211,16 +1210,14 @@
F966BC9408F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
F966BC9508F27A3D005CB29B /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; };
F966BC9608F27A3E005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F966BC9708F27A3E005CB29B /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F966BC9708F27A3E005CB29B /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F966BC9908F27A3E005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
F966BC9A08F27A3E005CB29B /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
- F966BC9B08F27A3E005CB29B /* mkd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mkd.bat; sourceTree = "<group>"; };
F966BC9C08F27A3E005CB29B /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
F966BCEE08F27A3E005CB29B /* tk.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.rc; sourceTree = "<group>"; };
F966BCEF08F27A3E005CB29B /* tk_base.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk_base.rc; sourceTree = "<group>"; };
F966BCF208F27A3E005CB29B /* wish.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wish.rc; sourceTree = "<group>"; };
F966BCF308F27A3E005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
- F966BCF408F27A3E005CB29B /* rmd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rmd.bat; sourceTree = "<group>"; };
F966BCF508F27A3F005CB29B /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; };
F966BCF608F27A3F005CB29B /* stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stubs.c; sourceTree = "<group>"; };
F966BCF708F27A3F005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
@@ -1915,7 +1912,7 @@
F96D43CF08F272B7004A47F5 /* winTime.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTime.test; sourceTree = "<group>"; };
F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = checkLibraryDoc.tcl; sourceTree = "<group>"; };
F96D43D208F272B8004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F96D43D308F272B8004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D43D308F272B8004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F96D442208F272B8004A47F5 /* eolFix.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = eolFix.tcl; sourceTree = "<group>"; };
F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fix_tommath_h.tcl; sourceTree = "<group>"; };
F96D442508F272B8004A47F5 /* genStubs.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = genStubs.tcl; sourceTree = "<group>"; };
@@ -1940,7 +1937,7 @@
F96D443C08F272B9004A47F5 /* uniParse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniParse.tcl; sourceTree = "<group>"; };
F96D444008F272B9004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
F96D444108F272B9004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F96D444208F272B9004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D444208F272B9004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F96D444408F272B9004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
F96D444508F272B9004A47F5 /* pkga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkga.c; sourceTree = "<group>"; };
F96D444608F272B9004A47F5 /* pkgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgb.c; sourceTree = "<group>"; };
@@ -1984,7 +1981,7 @@
F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; };
F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; };
F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
- F96D447508F272BA004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D447508F272BA004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; };
F96D447708F272BA004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
F96D447808F272BA004A47F5 /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
F96D447908F272BA004A47F5 /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
@@ -2586,7 +2583,6 @@
F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */,
F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */,
F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */,
- F966BBD508F27A3B005CB29B /* tkMacOSXEvent.h */,
F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */,
F93E5EFD09CF8711008FA367 /* tkMacOSXFont.h */,
F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */,
@@ -2740,7 +2736,7 @@
children = (
F966BC6C08F27A3D005CB29B /* aclocal.m4 */,
F966BC6D08F27A3D005CB29B /* configure */,
- F966BC6E08F27A3D005CB29B /* configure.in */,
+ F966BC6E08F27A3D005CB29B /* configure.ac */,
F966BC6F08F27A3D005CB29B /* install-sh */,
F966BC7008F27A3D005CB29B /* installManPage */,
F966BC7108F27A3D005CB29B /* Makefile.in */,
@@ -2787,14 +2783,12 @@
F966BC9408F27A3D005CB29B /* aclocal.m4 */,
F966BC9508F27A3D005CB29B /* buildall.vc.bat */,
F966BC9608F27A3E005CB29B /* configure */,
- F966BC9708F27A3E005CB29B /* configure.in */,
+ F966BC9708F27A3E005CB29B /* configure.ac */,
F966BC9908F27A3E005CB29B /* Makefile.in */,
F966BC9A08F27A3E005CB29B /* makefile.vc */,
- F966BC9B08F27A3E005CB29B /* mkd.bat */,
F966BC9C08F27A3E005CB29B /* nmakehlp.c */,
F966BC9D08F27A3E005CB29B /* rc */,
F966BCF308F27A3E005CB29B /* README */,
- F966BCF408F27A3E005CB29B /* rmd.bat */,
F966BCF508F27A3F005CB29B /* rules.vc */,
F966BCF608F27A3F005CB29B /* stubs.c */,
F966BCF708F27A3F005CB29B /* tcl.m4 */,
@@ -3722,7 +3716,7 @@
children = (
F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */,
F96D43D208F272B8004A47F5 /* configure */,
- F96D43D308F272B8004A47F5 /* configure.in */,
+ F96D43D308F272B8004A47F5 /* configure.ac */,
F96D442208F272B8004A47F5 /* eolFix.tcl */,
F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */,
F96D442508F272B8004A47F5 /* genStubs.tcl */,
@@ -3755,7 +3749,7 @@
children = (
F96D444008F272B9004A47F5 /* aclocal.m4 */,
F96D444108F272B9004A47F5 /* configure */,
- F96D444208F272B9004A47F5 /* configure.in */,
+ F96D444208F272B9004A47F5 /* configure.ac */,
F96D444308F272B9004A47F5 /* dltest */,
F96D444D08F272B9004A47F5 /* install-sh */,
F96D444E08F272B9004A47F5 /* installManPage */,
@@ -3816,7 +3810,7 @@
F96D447108F272BA004A47F5 /* buildall.vc.bat */,
F96D447208F272BA004A47F5 /* cat.c */,
F96D447408F272BA004A47F5 /* configure */,
- F96D447508F272BA004A47F5 /* configure.in */,
+ F96D447508F272BA004A47F5 /* configure.ac */,
F96D447708F272BA004A47F5 /* Makefile.in */,
F96D447808F272BA004A47F5 /* makefile.vc */,
F96D447908F272BA004A47F5 /* nmakehlp.c */,
@@ -3971,7 +3965,7 @@
);
inputPaths = (
"$(TCL_SRCROOT)/macosx/configure.ac",
- "$(TCL_SRCROOT)/unix/configure.in",
+ "$(TCL_SRCROOT)/unix/configure.ac",
"$(TCL_SRCROOT)/unix/tcl.m4",
"$(TCL_SRCROOT)/unix/aclocal.m4",
"$(TCL_SRCROOT)/unix/tclConfig.sh.in",
@@ -3984,7 +3978,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
showEnvVarsInLog = 0;
};
F9A5C5F608F651AB008AE941 /* Configure Tk */ = {
@@ -3994,7 +3988,7 @@
);
inputPaths = (
"$(TK_SRCROOT)/macosx/configure.ac",
- "$(TK_SRCROOT)/unix/configure.in",
+ "$(TK_SRCROOT)/unix/configure.ac",
"$(TK_SRCROOT)/unix/tcl.m4",
"$(TK_SRCROOT)/unix/aclocal.m4",
"$(TK_SRCROOT)/unix/tkConfig.sh.in",
@@ -4005,7 +3999,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
showEnvVarsInLog = 0;
};
F9FD30B40CC1AD070073837D /* Configure Tcl */ = {
@@ -4015,7 +4009,7 @@
);
inputPaths = (
"$(TCL_SRCROOT)/macosx/configure.ac",
- "$(TCL_SRCROOT)/unix/configure.in",
+ "$(TCL_SRCROOT)/unix/configure.ac",
"$(TCL_SRCROOT)/unix/tcl.m4",
"$(TCL_SRCROOT)/unix/aclocal.m4",
"$(TCL_SRCROOT)/unix/tclConfig.sh.in",
@@ -4028,7 +4022,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
showEnvVarsInLog = 0;
};
F9FD30B50CC1AD070073837D /* Configure Tk */ = {
@@ -4038,7 +4032,7 @@
);
inputPaths = (
"$(TK_SRCROOT)/macosx/configure.ac",
- "$(TK_SRCROOT)/unix/configure.in",
+ "$(TK_SRCROOT)/unix/configure.ac",
"$(TK_SRCROOT)/unix/tcl.m4",
"$(TK_SRCROOT)/unix/aclocal.m4",
"$(TK_SRCROOT)/unix/tkConfig.sh.in",
@@ -4049,7 +4043,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-xft --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-xft --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
diff --git a/macosx/configure.ac b/macosx/configure.ac
index 69573c5..41f39d6 100644
--- a/macosx/configure.ac
+++ b/macosx/configure.ac
@@ -8,4 +8,4 @@ dnl include the configure sources from ../unix:
m4_include(../unix/aclocal.m4)
m4_define(SC_USE_CONFIG_HEADERS)
-m4_include(../unix/configure.in)
+m4_include(../unix/configure.ac)
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index 4f51fc6..b5652b7 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -3,9 +3,9 @@
*
* This file handles the implementation of native bitmaps.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index b083531..40743f6 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -4,12 +4,12 @@
* This file implements the Macintosh specific portion of the button
* widgets.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
- * Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2007 Revar Desmera.
- * Copyright 2015 Kevin Walzer/WordTech Communications LLC.
- * Copyright 2015 Marc Culler.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 2001 Apple Computer, Inc.
+ * Copyright © 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2007 Revar Desmera.
+ * Copyright © 2015 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 2015 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c
index b8159d6..41887f4 100644
--- a/macosx/tkMacOSXClipboard.c
+++ b/macosx/tkMacOSXClipboard.c
@@ -3,9 +3,9 @@
*
* This file manages the clipboard for the Tk toolkit.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -174,6 +174,7 @@ XSetSelectionOwner(
TCL_UNUSED(Time)) /* The current time? */
{
TkDisplay *dispPtr = TkGetDisplayList();
+ (void)time;
if (dispPtr && selection == dispPtr->clipboardAtom) {
clipboardOwner = owner ? Tk_IdToWindow(display, owner) : NULL;
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index f82305e..1e1fc4e 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -5,11 +5,11 @@
* toolkit, in order to avoid round-trips to the server to
* map color names to pixel values.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1996 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2020 Marc Culler
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1996 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2020 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -336,28 +336,6 @@ GetRGBA(
}
[color getComponents: rgba];
break;
- case HIText:
-#ifdef __LP64__
- color = [[NSColor textColor] colorUsingColorSpace:sRGB];
- [color getComponents: rgba];
-#else
- {
- OSStatus err = noErr;
- RGBColor rgb;
- err = GetThemeTextColor(kThemeTextColorPushButtonActive, 32,
- true, &rgb);
- if (err == noErr) {
- rgba[0] = (CGFloat) rgb.red / 65535;
- rgba[1] = (CGFloat) rgb.green / 65535;
- rgba[2] = (CGFloat) rgb.blue / 65535;
- }
- }
-#endif
- break;
- case HIBackground:
- color = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB];
- [color getComponents: rgba];
- break;
default:
break;
}
@@ -374,12 +352,6 @@ GetRGBA(
* values are copied into the CGColorRef. Otherwise the components are
* computed from the SystemColorDatum.
*
- * In 64 bit macOS systems there are no HITheme functions which convert
- * HIText or HIBackground colors to CGColors. (GetThemeTextColor was
- * removed, and it was never possible with backgrounds.) On 64-bit systems
- * we replace all HIText colors by systemTextColor and all HIBackground
- * colors by systemWindowBackgroundColor.
- *
* Results:
* True if the function succeeds, false otherwise.
*
@@ -449,6 +421,8 @@ TkMacOSXInDarkMode(Tk_Window tkwin)
}
return (name == NSAppearanceNameDarkAqua);
}
+#else
+ (void) tkwin;
#endif
return false;
}
@@ -506,7 +480,7 @@ TkSetMacColor(
NSColor*
TkMacOSXGetNSColor(
- GC gc,
+ TCL_UNUSED(GC),
unsigned long pixel) /* Pixel value to convert. */
{
CGColorRef cgColor;
@@ -539,15 +513,13 @@ TkMacOSXGetNSColor(
void
TkMacOSXSetColorInContext(
- GC gc,
+ TCL_UNUSED(GC),
unsigned long pixel,
CGContextRef context)
{
OSStatus err = noErr;
CGColorRef cgColor = nil;
SystemColorDatum *entry = GetEntryFromPixel(pixel);
- CGRect rect;
- HIThemeBackgroundDrawInfo info = {0, kThemeStateActive, 0};
if (entry) {
switch (entry->type) {
@@ -559,16 +531,6 @@ TkMacOSXSetColorInContext(
kHIThemeOrientationNormal);
}
break;
- case HIText:
- err = ChkErr(HIThemeSetTextFill, entry->value, NULL, context,
- kHIThemeOrientationNormal);
- break;
- case HIBackground:
- info.kind = entry->value;
- rect = CGContextGetClipBoundingBox(context);
- err = ChkErr(HIThemeApplyBackground, &rect, &info,
- context, kHIThemeOrientationNormal);
- break;
default:
SetCGColorComponents(entry, pixel, &cgColor);
break;
diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h
index deffbbc..8fa400b 100644
--- a/macosx/tkMacOSXColor.h
+++ b/macosx/tkMacOSXColor.h
@@ -38,14 +38,12 @@ enum colorType {
rgbColor, /* The 24 bit value is an rgb color. */
clearColor, /* The unique rgba color with all channels 0. */
HIBrush, /* A HITheme brush color.*/
- HIText, /* A HITheme text color. */
- HIBackground, /* A HITheme background color. */
ttkBackground, /* A background color which indicates nesting level.*/
semantic, /* A semantic NSColor.*/
};
typedef struct xpixel_t {
- unsigned value: 24; /* Either RGB or an index into systemColorMap. */
+ unsigned value: 24; /* Either RGB or an index into systemColorData. */
unsigned colortype: 8;
} xpixel;
@@ -163,70 +161,6 @@ static SystemColorDatum systemColorData[] = {
{"ListViewEvenRowBackground", HIBrush, kThemeBrushListViewEvenRowBackground, NULL, 0, NULL },
{"ListViewColumnDivider", HIBrush, kThemeBrushListViewColumnDivider, NULL, 0, NULL },
-{"ButtonText", HIText, kThemeTextColorPushButtonActive, NULL, 0, NULL },
-{"MenuActiveText", HIText, kThemeTextColorMenuItemSelected, NULL, 0, NULL },
-{"MenuDisabled", HIText, kThemeTextColorMenuItemDisabled, NULL, 0, NULL },
-{"MenuText", HIText, kThemeTextColorMenuItemActive, NULL, 0, NULL },
-{"BlackText", HIText, kThemeTextColorBlack, NULL, 0, NULL },
-{"DialogActiveText", HIText, kThemeTextColorDialogActive, NULL, 0, NULL },
-{"DialogInactiveText", HIText, kThemeTextColorDialogInactive, NULL, 0, NULL },
-{"AlertActiveText", HIText, kThemeTextColorAlertActive, NULL, 0, NULL },
-{"AlertInactiveText", HIText, kThemeTextColorAlertInactive, NULL, 0, NULL },
-{"ModelessDialogActiveText", HIText, kThemeTextColorModelessDialogActive, NULL, 0, NULL },
-{"ModelessDialogInactiveText", HIText, kThemeTextColorModelessDialogInactive, NULL, 0, NULL },
-{"WindowHeaderActiveText", HIText, kThemeTextColorWindowHeaderActive, NULL, 0, NULL },
-{"WindowHeaderInactiveText", HIText, kThemeTextColorWindowHeaderInactive, NULL, 0, NULL },
-{"PlacardActiveText", HIText, kThemeTextColorPlacardActive, NULL, 0, NULL },
-{"PlacardInactiveText", HIText, kThemeTextColorPlacardInactive, NULL, 0, NULL },
-{"PlacardPressedText", HIText, kThemeTextColorPlacardPressed, NULL, 0, NULL },
-{"PushButtonActiveText", HIText, kThemeTextColorPushButtonActive, NULL, 0, NULL },
-{"PushButtonInactiveText", HIText, kThemeTextColorPushButtonInactive, NULL, 0, NULL },
-{"PushButtonPressedText", HIText, kThemeTextColorPushButtonPressed, NULL, 0, NULL },
-{"BevelButtonActiveText", HIText, kThemeTextColorBevelButtonActive, NULL, 0, NULL },
-{"BevelButtonInactiveText", HIText, kThemeTextColorBevelButtonInactive, NULL, 0, NULL },
-{"BevelButtonPressedText", HIText, kThemeTextColorBevelButtonPressed, NULL, 0, NULL },
-{"PopupButtonActiveText", HIText, kThemeTextColorPopupButtonActive, NULL, 0, NULL },
-{"PopupButtonInactiveText", HIText, kThemeTextColorPopupButtonInactive, NULL, 0, NULL },
-{"PopupButtonPressedText", HIText, kThemeTextColorPopupButtonPressed, NULL, 0, NULL },
-{"IconLabelText", HIText, kThemeTextColorIconLabel, NULL, 0, NULL },
-{"ListViewText", HIText, kThemeTextColorListView, NULL, 0, NULL },
-{"DocumentWindowTitleActiveText", HIText, kThemeTextColorDocumentWindowTitleActive, NULL, 0, NULL },
-{"DocumentWindowTitleInactiveText", HIText, kThemeTextColorDocumentWindowTitleInactive, NULL, 0, NULL },
-{"MovableModalWindowTitleActiveText", HIText, kThemeTextColorMovableModalWindowTitleActive, NULL, 0, NULL },
-{"MovableModalWindowTitleInactiveText", HIText, kThemeTextColorMovableModalWindowTitleInactive, NULL, 0, NULL },
-{"UtilityWindowTitleActiveText", HIText, kThemeTextColorUtilityWindowTitleActive, NULL, 0, NULL },
-{"UtilityWindowTitleInactiveText", HIText, kThemeTextColorUtilityWindowTitleInactive, NULL, 0, NULL },
-{"PopupWindowTitleActiveText", HIText, kThemeTextColorPopupWindowTitleActive, NULL, 0, NULL },
-{"PopupWindowTitleInactiveText", HIText, kThemeTextColorPopupWindowTitleInactive, NULL, 0, NULL },
-{"RootMenuActiveText", HIText, kThemeTextColorRootMenuActive, NULL, 0, NULL },
-{"RootMenuSelectedText", HIText, kThemeTextColorRootMenuSelected, NULL, 0, NULL },
-{"RootMenuDisabledText", HIText, kThemeTextColorRootMenuDisabled, NULL, 0, NULL },
-{"MenuItemActiveText", HIText, kThemeTextColorMenuItemActive, NULL, 0, NULL },
-{"MenuItemSelectedText", HIText, kThemeTextColorMenuItemSelected, NULL, 0, NULL },
-{"MenuItemDisabledText", HIText, kThemeTextColorMenuItemDisabled, NULL, 0, NULL },
-{"PopupLabelActiveText", HIText, kThemeTextColorPopupLabelActive, NULL, 0, NULL },
-{"PopupLabelInactiveText", HIText, kThemeTextColorPopupLabelInactive, NULL, 0, NULL },
-{"TabFrontActiveText", HIText, kThemeTextColorTabFrontActive, NULL, 0, NULL },
-{"TabNonFrontActiveText", HIText, kThemeTextColorTabNonFrontActive, NULL, 0, NULL },
-{"TabNonFrontPressedText", HIText, kThemeTextColorTabNonFrontPressed, NULL, 0, NULL },
-{"TabFrontInactiveText", HIText, kThemeTextColorTabFrontInactive, NULL, 0, NULL },
-{"TabNonFrontInactiveText", HIText, kThemeTextColorTabNonFrontInactive, NULL, 0, NULL },
-{"IconLabelSelectedText", HIText, kThemeTextColorIconLabelSelected, NULL, 0, NULL },
-{"BevelButtonStickyActiveText", HIText, kThemeTextColorBevelButtonStickyActive, NULL, 0, NULL },
-{"BevelButtonStickyInactiveText", HIText, kThemeTextColorBevelButtonStickyInactive, NULL, 0, NULL },
-{"NotificationText", HIText, kThemeTextColorNotification, NULL, 0, NULL },
-{"SystemDetailText", HIText, kThemeTextColorSystemDetail, NULL, 0, NULL },
-{"PlacardBackground", HIBackground, kThemeBackgroundPlacard, NULL, 0, NULL },
-{"WindowHeaderBackground", HIBackground, kThemeBackgroundWindowHeader, NULL, 0, NULL },
-{"ListViewWindowHeaderBackground", HIBackground, kThemeBackgroundListViewWindowHeader, NULL, 0, NULL },
-{"MetalBackground", HIBackground, kThemeBackgroundMetal, NULL, 0, NULL },
-
-{"SecondaryGroupBoxBackground", HIBackground, kThemeBackgroundSecondaryGroupBox, NULL, 0, NULL },
-{"TabPaneBackground", HIBackground, kThemeBackgroundTabPane, NULL, 0, NULL },
-{"WhiteText", HIText, kThemeTextColorWhite, NULL, 0, NULL },
-{"Black", HIBrush, kThemeBrushBlack, NULL, 0, NULL },
-{"White", HIBrush, kThemeBrushWhite, NULL, 0, NULL },
-
/*
* Dynamic Colors
*/
@@ -244,6 +178,7 @@ static SystemColorDatum systemColorData[] = {
/* Color to use for notebook tab labels -- depends on OS version. */
{"SelectedTabTextColor", semantic, 0, "textColor", 0, NULL },
/* Semantic colors that we simulate on older systems which don't supoort them. */
+{"SelectedMenuItemTextColor", semantic, 0, "selectedMenuItemTextColor", 0, NULL },
{"ControlAccentColor", semantic, 0, "controlAccentColor", 0, NULL },
{"LabelColor", semantic, 0, "blackColor", 0, NULL },
{"LinkColor", semantic, 0, "blueColor", 0, NULL },
diff --git a/macosx/tkMacOSXConfig.c b/macosx/tkMacOSXConfig.c
index 841fc54..1588d21 100644
--- a/macosx/tkMacOSXConfig.c
+++ b/macosx/tkMacOSXConfig.c
@@ -4,8 +4,8 @@
* This module implements the Macintosh system defaults for
* the configuration package.
*
- * Copyright (c) 1997 by Sun Microsystems, Inc.
- * Copyright 2001, Apple Inc.
+ * Copyright © 1997 Sun Microsystems, Inc.
+ * Copyright © 2001, Apple Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -39,6 +39,10 @@ TkpGetSystemDefault(
const char *dbName, /* The option database name. */
const char *className) /* The name of the option class. */
{
+ (void)tkwin;
+ (void)dbName;
+ (void)className;
+
return NULL;
}
diff --git a/macosx/tkMacOSXConstants.h b/macosx/tkMacOSXConstants.h
index 0b6ae2b..8ab6a80 100644
--- a/macosx/tkMacOSXConstants.h
+++ b/macosx/tkMacOSXConstants.h
@@ -6,7 +6,7 @@
* operating system. (Each new OS release seems to come with a new
* naming convention for the same old constants.)
*
- * Copyright (c) 2017 Marc Culler
+ * Copyright © 2017 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c
index dc5b61a..dc6aade 100644
--- a/macosx/tkMacOSXCursor.c
+++ b/macosx/tkMacOSXCursor.c
@@ -3,9 +3,9 @@
*
* This file contains Macintosh specific cursor related routines.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -187,15 +187,6 @@ static const struct CursorName cursorNames[] = {
static TkMacOSXCursor *gCurrentCursor = NULL;
/* A pointer to the current cursor. */
-static int gResizeOverride = false;
- /* A boolean indicating whether we should use
- * the resize cursor during installations. */
-static int gTkOwnsCursor = true;/* A boolean indicating whether Tk owns the
- * cursor. If not (for instance, in the case
- * where a Tk window is embedded in another
- * app's window, and the cursor is out of the
- * Tk window, we will not attempt to adjust
- * the cursor. */
/*
* Declarations of procedures local to this file
@@ -489,17 +480,15 @@ TkpFreeCursor(
*----------------------------------------------------------------------
*/
-void
+static void
TkMacOSXInstallCursor(
- int resizeOverride)
+ void)
{
TkMacOSXCursor *macCursorPtr = gCurrentCursor;
static int cursorHidden = 0;
int cursorNone = 0;
- gResizeOverride = resizeOverride;
-
- if (resizeOverride || !macCursorPtr) {
+ if (!macCursorPtr) {
[[NSCursor arrowCursor] set];
} else {
switch (macCursorPtr->type) {
@@ -547,10 +536,6 @@ TkpSetCursor(
{
int cursorChanged = 1;
- if (!gTkOwnsCursor) {
- return;
- }
-
if (cursor == NULL) {
/*
* This is a little tricky. We can't really tell whether
@@ -569,34 +554,11 @@ TkpSetCursor(
}
if (Tk_MacOSXIsAppInFront() && cursorChanged) {
- TkMacOSXInstallCursor(gResizeOverride);
+ TkMacOSXInstallCursor();
}
}
/*
- *----------------------------------------------------------------------
- *
- * Tk_MacOSXTkOwnsCursor --
- *
- * Sets whether Tk has the right to adjust the cursor.
- *
- * Results:
- * None.
- *
- * Side effects:
- * May keep Tk from changing the cursor.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_MacOSXTkOwnsCursor(
- int tkOwnsIt)
-{
- gTkOwnsCursor = tkOwnsIt;
-}
-
-/*
* Local Variables:
* mode: objc
* c-basic-offset: 4
diff --git a/macosx/tkMacOSXCursors.h b/macosx/tkMacOSXCursors.h
index 2cf00fb..9434cc3 100644
--- a/macosx/tkMacOSXCursors.h
+++ b/macosx/tkMacOSXCursors.h
@@ -4,9 +4,9 @@
* This file defines a set of Macintosh cursor resources that
* are only available on the Macintosh platform.
*
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- * Copyright 2008-2009, Apple Inc.
- * Copyright (c) 2008-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1995-1996 Sun Microsystems, Inc.
+ * Copyright © 2008-2009 Apple Inc.
+ * Copyright © 2008-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c
index fc01ef4..b2022b9 100644
--- a/macosx/tkMacOSXDebug.c
+++ b/macosx/tkMacOSXDebug.c
@@ -4,8 +4,8 @@
* Implementation of Macintosh specific functions for debugging MacOS
* events, regions, etc...
*
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXDebug.h b/macosx/tkMacOSXDebug.h
index ab37187..18cf9b4 100644
--- a/macosx/tkMacOSXDebug.h
+++ b/macosx/tkMacOSXDebug.h
@@ -4,8 +4,8 @@
* Declarations of Macintosh specific functions for debugging MacOS events,
* regions, etc...
*
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h
index c0f72fb..d258118 100644
--- a/macosx/tkMacOSXDefault.h
+++ b/macosx/tkMacOSXDefault.h
@@ -45,7 +45,7 @@
#define INACTIVE_SELECT_BG "systemUnemphasizedSelectedTextBackgroundColor"
#define TROUGH "#c3c3c3"
#define INDICATOR "#b03060"
-#define DISABLED "#a3a3a3"
+#define DISABLED "systemDisabledControlTextColor"
#define IGNORED "#abcdef"
/*
@@ -105,7 +105,6 @@
#define DEF_BUTTON_TAKE_FOCUS NULL
#define DEF_BUTTON_TEXT ""
#define DEF_BUTTON_TEXT_VARIABLE ""
-#define DEF_BUTTON_UNDERLINE "-1"
#define DEF_BUTTON_VALUE ""
#define DEF_BUTTON_WIDTH "0"
#define DEF_BUTTON_WRAP_LENGTH "0"
@@ -183,6 +182,8 @@
#define DEF_ENTRY_INSERT_ON_TIME "600"
#define DEF_ENTRY_INSERT_WIDTH "1"
#define DEF_ENTRY_JUSTIFY "left"
+#define DEF_ENTRY_PLACEHOLDER ""
+#define DEF_ENTRY_PLACEHOLDERFG "systemPlaceholderTextColor"
#define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG
#define DEF_ENTRY_READONLY_BG_MONO WHITE
#define DEF_ENTRY_RELIEF "sunken"
@@ -204,7 +205,9 @@
*/
#define DEF_FRAME_BG_COLOR NORMAL_BG
+#define DEF_FRAME_BG_IMAGE NULL
#define DEF_FRAME_BG_MONO WHITE
+#define DEF_FRAME_BG_TILE "0"
#define DEF_FRAME_BORDER_WIDTH "0"
#define DEF_FRAME_CLASS "Frame"
#define DEF_FRAME_COLORMAP ""
@@ -292,7 +295,6 @@
#define DEF_MENU_ENTRY_CHECK_VARIABLE NULL
#define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
#define DEF_MENU_ENTRY_SELECT NULL
-#define DEF_MENU_ENTRY_UNDERLINE "-1"
/*
* Defaults for menus overall:
@@ -303,6 +305,7 @@
#define DEF_MENU_ACTIVE_BORDER_WIDTH "0"
#define DEF_MENU_ACTIVE_FG_COLOR IGNORED
#define DEF_MENU_ACTIVE_FG_MONO IGNORED
+#define DEF_MENU_ACTIVE_RELIEF "flat"
#define DEF_MENU_BG_COLOR "#000001" /* Detects custom bg. */
#define DEF_MENU_BG_MONO IGNORED
#define DEF_MENU_BORDER_WIDTH "0"
@@ -326,12 +329,12 @@
*/
#define DEF_MENUBUTTON_ANCHOR "w"
-#define DEF_MENUBUTTON_ACTIVE_BG_COLOR ACTIVE_BG
-#define DEF_MENUBUTTON_ACTIVE_BG_MONO WHITE
-#define DEF_MENUBUTTON_ACTIVE_FG_COLOR ACTIVE_FG
-#define DEF_MENUBUTTON_ACTIVE_FG_MONO BLACK
-#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG
-#define DEF_MENUBUTTON_BG_MONO WHITE
+#define DEF_MENUBUTTON_ACTIVE_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENUBUTTON_ACTIVE_BG_MONO NORMAL_BG /*ignored*/
+#define DEF_MENUBUTTON_ACTIVE_FG_COLOR "systemTextColor"
+#define DEF_MENUBUTTON_ACTIVE_FG_MONO "systemTextColor"
+#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENUBUTTON_BG_MONO NORMAL_BG /*ignored*/
#define DEF_MENUBUTTON_BITMAP ""
#define DEF_MENUBUTTON_BORDER_WIDTH "0"
#define DEF_MENUBUTTON_CURSOR ""
@@ -356,7 +359,6 @@
#define DEF_MENUBUTTON_TAKE_FOCUS "0"
#define DEF_MENUBUTTON_TEXT ""
#define DEF_MENUBUTTON_TEXT_VARIABLE ""
-#define DEF_MENUBUTTON_UNDERLINE "-1"
#define DEF_MENUBUTTON_WIDTH "0"
#define DEF_MENUBUTTON_WRAP_LENGTH "0"
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 4bcaedf..1123346 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -3,10 +3,10 @@
*
* Contains the Mac implementation of the common dialog boxes.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2017 Christian Gollwitzer.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2017 Christian Gollwitzer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -1550,7 +1550,7 @@ Tk_MessageBoxObjCmd(
*----------------------------------------------------------------------
*/
-#include "tkMacOSXEvent.h"
+#include "tkMacOSXInt.h"
#include "tkMacOSXFont.h"
typedef struct FontchooserData {
@@ -1683,7 +1683,7 @@ FontchooserEvent(
switch (kind) {
case FontchooserClosed:
if (fcdPtr->parent != NULL) {
- TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL);
fontchooserInterp = NULL;
}
break;
@@ -1706,7 +1706,7 @@ FontchooserEvent(
ckfree(tmpv);
}
}
- TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged", NULL);
+ Tk_SendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged", NULL);
}
break;
}
@@ -1767,8 +1767,8 @@ FontchooserCget(
}
break;
case FontchooserVisible:
- resObj = Tcl_NewBooleanObj([[[NSFontManager sharedFontManager]
- fontPanel:NO] isVisible]);
+ resObj = Tcl_NewWideIntObj([[[NSFontManager sharedFontManager]
+ fontPanel:NO] isVisible] != 0);
break;
default:
resObj = Tcl_NewObj();
@@ -1915,7 +1915,7 @@ FontchooserConfigureCmd(
[fm setSelectedAttributes:fontPanelFontAttributes
isMultiple:NO];
if ([fp isVisible]) {
- TkSendVirtualEvent(fcdPtr->parent,
+ Tk_SendVirtualEvent(fcdPtr->parent,
"TkFontchooserFontChanged", NULL);
}
break;
@@ -1982,7 +1982,7 @@ FontchooserShowCmd(
}
if (![fp isVisible]) {
[fm orderFrontFontPanel:NSApp];
- TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL);
}
fontchooserInterp = interp;
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index d5396eb..9f6966a 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -4,10 +4,10 @@
* This file contains functions that draw to windows. Many of thees
* functions emulate Xlib functions.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 2001-2009 Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2014-2020 Marc Culler.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2014-2020 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -227,7 +227,7 @@ CreateNSImageFromPixmap(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetCGContextForDrawable --
+ * Tk_MacOSXGetCGContextForDrawable --
*
* Get CGContext for given Drawable, creating one if necessary.
*
@@ -240,8 +240,8 @@ CreateNSImageFromPixmap(
*----------------------------------------------------------------------
*/
-CGContextRef
-TkMacOSXGetCGContextForDrawable(
+void *
+Tk_MacOSXGetCGContextForDrawable(
Drawable drawable)
{
MacDrawable *macDraw = (MacDrawable *)drawable;
@@ -618,7 +618,6 @@ XDrawRectangle(
return Success;
}
-#ifdef TK_MACOSXDRAW_UNUSED
/*
*----------------------------------------------------------------------
*
@@ -678,7 +677,6 @@ XDrawRectangles(
TkMacOSXRestoreDrawingContext(&dc);
return Success;
}
-#endif
/*
*----------------------------------------------------------------------
@@ -849,7 +847,6 @@ XDrawArc(
return Success;
}
-#ifdef TK_MACOSXDRAW_UNUSED
/*
*----------------------------------------------------------------------
*
@@ -930,7 +927,6 @@ XDrawArcs(
TkMacOSXRestoreDrawingContext(&dc);
return Success;
}
-#endif
/*
*----------------------------------------------------------------------
@@ -1011,7 +1007,6 @@ XFillArc(
return Success;
}
-#ifdef TK_MACOSXDRAW_UNUSED
/*
*----------------------------------------------------------------------
*
@@ -1093,24 +1088,6 @@ XFillArcs(
TkMacOSXRestoreDrawingContext(&dc);
return Success;
}
-#endif
-
-#ifdef TK_MACOSXDRAW_UNUSED
-/*
- *----------------------------------------------------------------------
- *
- * XMaxRequestSize --
- *
- *----------------------------------------------------------------------
- */
-
-long
-XMaxRequestSize(
- Display *display)
-{
- return (SHRT_MAX / 4);
-}
-#endif
/*
*----------------------------------------------------------------------
@@ -1137,7 +1114,7 @@ TkScrollWindow(
int x, int y, /* Position rectangle to be scrolled. */
int width, int height,
int dx, int dy, /* Distance rectangle should be moved. */
- TkRegion damageRgn) /* Region to accumulate damage in. */
+ Region damageRgn) /* Region to accumulate damage in. */
{
Drawable drawable = Tk_WindowId(tkwin);
MacDrawable *macDraw = (MacDrawable *)drawable;
@@ -1358,15 +1335,6 @@ TkMacOSXSetupDrawingContext(
* Finish configuring the drawing context.
*/
- drawingHeight = view ? [view bounds].size.height :
- CGContextGetClipBoundingBox(dc.context).size.height;
- CGAffineTransform t = {
- .a = 1, .b = 0,
- .c = 0, .d = -1,
- .tx = 0,
- .ty = drawingHeight
- };
-
#ifdef TK_MAC_DEBUG_CG
fprintf(stderr, "TkMacOSXSetupDrawingContext: pushing GState for %s\n",
macDraw->winPtr ? Tk_PathName(macDraw->winPtr) : "None");
@@ -1374,7 +1342,17 @@ TkMacOSXSetupDrawingContext(
CGContextSaveGState(dc.context);
CGContextSetTextDrawingMode(dc.context, kCGTextFill);
- CGContextConcatCTM(dc.context, t);
+ { /* Restricted scope for t needed for C++ */
+ drawingHeight = view ? [view bounds].size.height :
+ CGContextGetClipBoundingBox(dc.context).size.height;
+ CGAffineTransform t = {
+ .a = 1, .b = 0,
+ .c = 0, .d = -1,
+ .tx = 0,
+ .ty = drawingHeight
+ };
+ CGContextConcatCTM(dc.context, t);
+ }
if (dc.clipRgn) {
#ifdef TK_MAC_DEBUG_DRAWING
@@ -1585,29 +1563,6 @@ TkMacOSXGetClipRgn(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXSetUpClippingRgn --
- *
- * Set up the clipping region so that drawing only occurs on the specified
- * X subwindow.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXSetUpClippingRgn(
- Drawable drawable) /* Drawable to update. */
-{
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpClipDrawableToRect --
*
* Clip all drawing into the drawable d to the given rectangle. If width
@@ -1677,7 +1632,7 @@ ClipToGC(
{
if (gc && gc->clip_mask &&
((TkpClipMask *)gc->clip_mask)->type == TKP_CLIP_REGION) {
- TkRegion gcClip = ((TkpClipMask *)gc->clip_mask)->value.region;
+ Region gcClip = ((TkpClipMask *)gc->clip_mask)->value.region;
int xOffset = ((MacDrawable *)d)->xOff + gc->clip_x_origin;
int yOffset = ((MacDrawable *)d)->yOff + gc->clip_y_origin;
HIShapeRef clipRgn = *clipRgnPtr, gcClipRgn;
@@ -1767,7 +1722,7 @@ TkpDrawHighlightBorder (
/*
*----------------------------------------------------------------------
*
- * TkpDrawFrame --
+ * TkpDrawFrameEx --
*
* This procedure draws the rectangular frame area. If the user has
* requested themeing, it draws with the background theme.
@@ -1782,8 +1737,9 @@ TkpDrawHighlightBorder (
*/
void
-TkpDrawFrame(
+TkpDrawFrameEx(
Tk_Window tkwin,
+ Drawable drawable,
Tk_3DBorder border,
int highlightWidth,
int borderWidth,
@@ -1801,11 +1757,9 @@ TkpDrawFrame(
}
}
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
- border, highlightWidth, highlightWidth,
- Tk_Width(tkwin) - 2 * highlightWidth,
- Tk_Height(tkwin) - 2 * highlightWidth,
- borderWidth, relief);
+ Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth,
+ highlightWidth, Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth, borderWidth, relief);
}
/*
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index 2f04e74..029624d 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -7,9 +7,9 @@
* other application). Currently only Toplevel embedding within the same
* Tk application is allowed on the Macintosh.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -43,11 +43,6 @@ typedef struct Container {
static Container *firstContainerPtr = NULL;
/* First in list of all containers managed by
* this process. */
-/*
- * Globals defined in this file:
- */
-
-TkMacOSXEmbedHandler *tkMacOSXEmbedHandler = NULL;
/*
* Prototypes for static procedures defined in this file:
@@ -66,42 +61,6 @@ static void EmbedWindowDeleted(TkWindow *winPtr);
/*
*----------------------------------------------------------------------
*
- * Tk_MacOSXSetEmbedHandler --
- *
- * Registers a handler for an in process form of embedding, like Netscape
- * plugins, where Tk is loaded into the process, but does not control the
- * main window
- *
- * Results:
- * None
- *
- * Side effects:
- * The embed handler is set.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_MacOSXSetEmbedHandler(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProc,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProc,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProc,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
-{
- if (tkMacOSXEmbedHandler == NULL) {
- tkMacOSXEmbedHandler = ckalloc(sizeof(TkMacOSXEmbedHandler));
- }
- tkMacOSXEmbedHandler->registerWinProc = registerWinProc;
- tkMacOSXEmbedHandler->getPortProc = getPortProc;
- tkMacOSXEmbedHandler->containerExistProc = containerExistProc;
- tkMacOSXEmbedHandler->getClipProc = getClipProc;
- tkMacOSXEmbedHandler->getOffsetProc = getOffsetProc;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpMakeWindow --
*
* Creates an X Window (Mac subwindow).
@@ -121,6 +80,7 @@ TkpMakeWindow(
Window parent)
{
MacDrawable *macWin;
+ (void)parent;
/*
* If this window is marked as embedded then the window structure should
@@ -134,7 +94,7 @@ TkpMakeWindow(
* Allocate sub window
*/
- macWin = ckalloc(sizeof(MacDrawable));
+ macWin = (MacDrawable *)ckalloc(sizeof(MacDrawable));
if (macWin == NULL) {
winPtr->privatePtr = NULL;
return None;
@@ -306,7 +266,7 @@ TkpUseWindow(
* Make the embedded window.
*/
- macWin = ckalloc(sizeof(MacDrawable));
+ macWin = (MacDrawable *)ckalloc(sizeof(MacDrawable));
if (macWin == NULL) {
winPtr->privatePtr = NULL;
return TCL_ERROR;
@@ -392,7 +352,7 @@ TkpMakeContainer(
*/
Tk_MakeWindowExist(tkwin);
- containerPtr = ckalloc(sizeof(Container));
+ containerPtr = (Container *)ckalloc(sizeof(Container));
containerPtr->parent = Tk_WindowId(tkwin);
containerPtr->parentPtr = winPtr;
containerPtr->embedded = None;
@@ -559,7 +519,7 @@ TkpClaimFocus(
int
TkpTestembedCmd(
- ClientData clientData, /* Main window for application. */
+ ClientData dummy, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
@@ -569,6 +529,7 @@ TkpTestembedCmd(
Tcl_DString dString;
char buffer[50];
Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL;
+ (void)dummy;
if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) {
all = 1;
@@ -596,7 +557,8 @@ TkpTestembedCmd(
if (containerPtr->parent == None) {
Tcl_DStringAppendElement(&dString, "");
} else if (all) {
- sprintf(buffer, "0x%lx", containerPtr->parent);
+ sprintf(buffer, "0x%" TCL_Z_MODIFIER "x",
+ (size_t) containerPtr->parent);
Tcl_DStringAppendElement(&dString, buffer);
} else {
Tcl_DStringAppendElement(&dString, "XXX");
@@ -666,6 +628,9 @@ TkpRedirectKeyEvent(
XEvent *eventPtr) /* X event to redirect (should be KeyPress or
* KeyRelease). */
{
+ (void)winPtr;
+ (void)eventPtr;
+
/* TODO: Implement this or decide it definitely needs no implementation */
}
@@ -1081,6 +1046,7 @@ static void
EmbedSendConfigure(
Container *containerPtr) /* Information about the embedding. */
{
+ (void)containerPtr;
}
/*
@@ -1191,12 +1157,14 @@ void
TkpShowBusyWindow(
TkBusy busy)
{
+ (void)busy;
}
void
TkpHideBusyWindow(
TkBusy busy)
{
+ (void)busy;
}
void
@@ -1204,6 +1172,8 @@ TkpMakeTransparentWindowExist(
Tk_Window tkwin, /* Token for window. */
Window parent) /* Parent window. */
{
+ (void)tkwin;
+ (void)parent;
}
void
@@ -1214,6 +1184,11 @@ TkpCreateBusy(
Tk_Window tkParent,
TkBusy busy)
{
+ (void)winPtr;
+ (void)tkRef;
+ (void)parentPtr;
+ (void)tkParent;
+ (void)busy;
}
/*
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c
index 75cd198..66c4bce 100644
--- a/macosx/tkMacOSXEntry.c
+++ b/macosx/tkMacOSXEntry.c
@@ -3,9 +3,9 @@
*
* This file implements the native aqua entry widget.
*
- * Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2008-2009, Apple Inc.
+ * Copyright © 2001 Apple Computer, Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2008-2009 Apple Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index 31a7663..6ed7dbf 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -3,16 +3,16 @@
*
* This file contains the basic Mac OS X Event handling routines.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXPrivate.h"
-#include "tkMacOSXEvent.h"
+#include "tkMacOSXInt.h"
#include "tkMacOSXDebug.h"
#include "tkMacOSXConstants.h"
@@ -105,7 +105,27 @@ enum {
}
@end
#pragma mark -
+int
+XSync(
+ Display *display,
+ TCL_UNUSED(Bool))
+{
+ /*
+ * The main use of XSync is by the update command, which alternates
+ * between running an event loop to process all events without waiting and
+ * calling XSync on all displays until no events are left. There is
+ * nothing for the mac to do with respect to syncing its one display but
+ * it can (and, during regression testing, frequently does) happen that
+ * timer events fire during the event loop. Processing those here seems
+ * to make the update command work in a way that is more consistent with
+ * its behavior on other platforms.
+ */
+ while (Tcl_DoOneEvent(TCL_TIMER_EVENTS|TCL_DONT_WAIT)){}
+ display->request++;
+ return 0;
+}
+
/*
* Local Variables:
* mode: objc
diff --git a/macosx/tkMacOSXEvent.h b/macosx/tkMacOSXEvent.h
deleted file mode 100644
index 850e9f6..0000000
--- a/macosx/tkMacOSXEvent.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * tkMacOSXEvent.h --
- *
- * Declarations of Macintosh specific functions for implementing the
- * Mac OS X Notifier.
- *
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#ifndef _TKMACEVENT
-#define _TKMACEVENT
-
-#ifndef _TKMACINT
-#include "tkMacOSXInt.h"
-#endif
-
-/*
- * Currently nothing needs to be declared here.
- */
-
-#endif
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index d9c1c01..496dc35 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -4,9 +4,9 @@
* Contains the Macintosh implementation of the platform-independent font
* package interface.
*
- * Copyright 2002-2004 Benjamin Riefenstahl, Benjamin.Riefenstahl@epost.de
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2008-2009, Apple Inc.
+ * Copyright © 2002-2004 Benjamin Riefenstahl, Benjamin.Riefenstahl@epost.de
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2008-2009 Apple Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -112,7 +112,7 @@ static int CreateNamedSystemFont(Tcl_Interp *interp,
self = [self init];
if (self) {
Tcl_DStringInit(&_ds);
- Tcl_UtfToUniCharDString((const char *)bytes, len, &_ds);
+ Tcl_UtfToChar16DString((const char *)bytes, len, &_ds);
_string = [[NSString alloc]
initWithCharactersNoCopy:(unichar *)Tcl_DStringValue(&_ds)
length:Tcl_DStringLength(&_ds)>>1
@@ -1032,7 +1032,7 @@ TkpMeasureCharsInContext(
[attributedString release];
[string release];
length = ceil(width - offset);
- fit = (TkUtfAtIndex(source, index) - source) - rangeStart;
+ fit = (Tcl_UtfAtIndex(source, index) - source) - rangeStart;
done:
#ifdef TK_MAC_DEBUG_FONTS
TkMacOSXDbgMsg("measure: source=\"%s\" range=\"%.*s\" maxLength=%d "
@@ -1153,6 +1153,7 @@ TkpDrawCharsInContext(
* whole (not just the range) string when
* drawing. */
{
+ (void)display;
TkpDrawAngledCharsInContext(display, drawable, gc, tkfont, source, numBytes,
rangeStart, rangeLength, x, y, 0.0);
}
diff --git a/macosx/tkMacOSXFont.h b/macosx/tkMacOSXFont.h
index 7fc9265..5babfa8 100644
--- a/macosx/tkMacOSXFont.h
+++ b/macosx/tkMacOSXFont.h
@@ -4,10 +4,10 @@
* Contains the Macintosh implementation of the platform-independent
* font package interface.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index 5055f38..aefc63c 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -3,11 +3,11 @@
*
* Implements high level event support for the Macintosh.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2015-2019 Marc Culler
- * Copyright (c) 2019 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2015-2019 Marc Culler
+ * Copyright © 2019 Kevin Walzer/WordTech Communications LLC.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -54,27 +54,31 @@ static void ProcessAppleEvent(ClientData clientData);
* Names of the procedures which can be used to process AppleEvents.
*/
-static const char *openDocumentProc = "::tk::mac::OpenDocument";
-static const char *launchURLProc = "::tk::mac::LaunchURL";
-static const char *printDocProc = "::tk::mac::PrintDocument";
-static const char *scriptFileProc = "::tk::mac::DoScriptFile";
-static const char *scriptTextProc = "::tk::mac::DoScriptText";
+static const char openDocumentProc[] = "::tk::mac::OpenDocument";
+static const char launchURLProc[] = "::tk::mac::LaunchURL";
+static const char printDocProc[] = "::tk::mac::PrintDocument";
+static const char scriptFileProc[] = "::tk::mac::DoScriptFile";
+static const char scriptTextProc[] = "::tk::mac::DoScriptText";
+static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
#pragma mark TKApplication(TKHLEvents)
@implementation TKApplication(TKHLEvents)
- (void) terminate: (id) sender
{
+ (void)sender;
[self handleQuitApplicationEvent:Nil withReplyEvent:Nil];
}
- (void) superTerminate: (id) sender
{
+ (void) sender;
[super terminate:nil];
}
- (void) preferences: (id) sender
{
+ (void)sender;
[self handleShowPreferencesEvent:Nil withReplyEvent:Nil];
}
@@ -82,6 +86,8 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
withReplyEvent: (NSAppleEventDescriptor *)replyEvent
{
KillEvent *eventPtr;
+ (void)event;
+ (void)replyEvent;
if (_eventInterp) {
/*
@@ -92,7 +98,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
* quickly as possible.
*/
- eventPtr = ckalloc(sizeof(KillEvent));
+ eventPtr = (KillEvent *)ckalloc(sizeof(KillEvent));
eventPtr->header.proc = ReallyKillMe;
eventPtr->interp = _eventInterp;
@@ -103,6 +109,9 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
- (void) handleOpenApplicationEvent: (NSAppleEventDescriptor *)event
withReplyEvent: (NSAppleEventDescriptor *)replyEvent
{
+ (void)event;
+ (void)replyEvent;
+
if (_eventInterp &&
Tcl_FindCommand(_eventInterp, "::tk::mac::OpenApplication", NULL, 0)){
int code = Tcl_EvalEx(_eventInterp, "::tk::mac::OpenApplication",
@@ -116,6 +125,9 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
- (void) handleReopenApplicationEvent: (NSAppleEventDescriptor *)event
withReplyEvent: (NSAppleEventDescriptor *)replyEvent
{
+ (void)event;
+ (void)replyEvent;
+
[NSApp activateIgnoringOtherApps: YES];
if (_eventInterp && Tcl_FindCommand(_eventInterp,
"::tk::mac::ReopenApplication", NULL, 0)) {
@@ -130,6 +142,9 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
- (void) handleShowPreferencesEvent: (NSAppleEventDescriptor *)event
withReplyEvent: (NSAppleEventDescriptor *)replyEvent
{
+ (void)event;
+ (void)replyEvent;
+
if (_eventInterp &&
Tcl_FindCommand(_eventInterp, "::tk::mac::ShowPreferences", NULL, 0)){
int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ShowPreferences",
@@ -153,7 +168,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
long count, index;
AEKeyword keyword;
Tcl_DString pathName;
-
+ (void)replyEvent;
/*
* Do nothing if we don't have an interpreter.
@@ -193,7 +208,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
* procedure, passing the paths contained in the AppleEvent as arguments.
*/
- AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo));
+ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
Tcl_DString *openCommand = &AEInfo->command;
Tcl_DStringInit(openCommand);
Tcl_DStringAppend(openCommand, openDocumentProc, -1);
@@ -222,6 +237,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->interp = _eventInterp;
AEInfo->procedure = openDocumentProc;
AEInfo->replyEvent = nil;
+ Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
AEInfo->retryCount = 0;
if (Tcl_FindCommand(_eventInterp, "::tk::mac::OpenDocuments", NULL, 0)){
@@ -237,14 +253,17 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
NSString* file = [[event paramDescriptorForKeyword:keyDirectObject]
stringValue];
const char *printFile = [file UTF8String];
- AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo));
+ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
Tcl_DString *printCommand = &AEInfo->command;
+ (void)replyEvent;
+
Tcl_DStringInit(printCommand);
Tcl_DStringAppend(printCommand, printDocProc, -1);
Tcl_DStringAppendElement(printCommand, printFile);
AEInfo->interp = _eventInterp;
AEInfo->procedure = printDocProc;
AEInfo->replyEvent = nil;
+ Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
AEInfo->retryCount = 0;
ProcessAppleEvent((ClientData)AEInfo);
}
@@ -299,7 +318,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
URLBuffer[actual] = '\0';
NSString *urlString = [NSString stringWithUTF8String:(char*)URLBuffer];
NSURL *fileURL = [NSURL URLWithString:urlString];
- AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo));
+ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
Tcl_DString *scriptFileCommand = &AEInfo->command;
Tcl_DStringInit(scriptFileCommand);
Tcl_DStringAppend(scriptFileCommand, scriptFileProc, -1);
@@ -307,6 +326,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->interp = _eventInterp;
AEInfo->procedure = scriptFileProc;
AEInfo->replyEvent = nil;
+ Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
AEInfo->retryCount = 0;
ProcessAppleEvent((ClientData)AEInfo);
}
@@ -320,25 +340,26 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
*/
if (actual > 0) {
- char *data = ckalloc(actual + 1);
+ char *data = (char *)ckalloc(actual + 1);
if (noErr == AEGetParamPtr(theDesc, keyDirectObject,
typeUTF8Text, &type,
data, actual, NULL)) {
- data[actual] = '\0';
- AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo));
- Tcl_DString *scriptTextCommand = &AEInfo->command;
- Tcl_DStringInit(scriptTextCommand);
- Tcl_DStringAppend(scriptTextCommand, scriptTextProc, -1);
+ data[actual] = '\0';
+ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
+ Tcl_DString *scriptTextCommand = &AEInfo->command;
+ Tcl_DStringInit(scriptTextCommand);
+ Tcl_DStringAppend(scriptTextCommand, scriptTextProc, -1);
Tcl_DStringAppendElement(scriptTextCommand, data);
AEInfo->interp = _eventInterp;
AEInfo->procedure = scriptTextProc;
AEInfo->retryCount = 0;
if (Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) {
AEInfo->replyEvent = replyEvent;
- ProcessAppleEvent((ClientData)AEInfo);
+ ProcessAppleEvent(AEInfo);
} else {
AEInfo->replyEvent = nil;
- ProcessAppleEvent((ClientData)AEInfo);
+ Tcl_DoWhenIdle(ProcessAppleEvent, AEInfo);
+ ProcessAppleEvent(AEInfo);
}
}
}
@@ -351,16 +372,35 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
NSString* url = [[event paramDescriptorForKeyword:keyDirectObject]
stringValue];
const char *cURL=[url UTF8String];
- AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo));
+ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
Tcl_DString *launchCommand = &AEInfo->command;
+ (void)replyEvent;
+
Tcl_DStringInit(launchCommand);
Tcl_DStringAppend(launchCommand, launchURLProc, -1);
Tcl_DStringAppendElement(launchCommand, cURL);
AEInfo->interp = _eventInterp;
AEInfo->procedure = launchURLProc;
AEInfo->replyEvent = nil;
+ Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ AEInfo->retryCount = 0;
+ ProcessAppleEvent((ClientData)AEInfo);
+}
+
+- (void)handleGetSDEFEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
+ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
+ Tcl_DString *sdefCommand = &AEInfo->command;
+ (void)replyEvent;
+
+ Tcl_DStringInit(sdefCommand);
+ Tcl_DStringAppend(sdefCommand, getSdefProc, -1);
+ AEInfo->interp = _eventInterp;
+ AEInfo->procedure = getSdefProc;
+ AEInfo->replyEvent = nil;
+ Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
AEInfo->retryCount = 0;
ProcessAppleEvent((ClientData)AEInfo);
+
}
@end
@@ -460,7 +500,7 @@ static void ProcessAppleEvent(
void
TkMacOSXInitAppleEvents(
- Tcl_Interp *interp) /* not used */
+ TCL_UNUSED(Tcl_Interp *))
{
NSAppleEventManager *aeManager = [NSAppleEventManager sharedAppleEventManager];
static Boolean initialized = FALSE;
@@ -500,6 +540,15 @@ TkMacOSXInitAppleEvents(
andSelector:@selector(handleURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass andEventID:kAEGetURL];
+ /*
+ * We do not load our sdef dynamically but this event handler
+ * is required to silence error messages from inline execution
+ * of AppleScript at the Objective-C level.
+ */
+ [aeManager setEventHandler:NSApp
+ andSelector:@selector(handleGetSDEFEvent:withReplyEvent:)
+ forEventClass:'ascr' andEventID:'gsdf'];
+
}
}
@@ -619,8 +668,7 @@ MissedAnyParameters(
typeWildCard, &returnedType, NULL, 0, &actualSize);
return (err != errAEDescNotFound);
-}
-
+}
/*
* Local Variables:
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c
index 1ca7b64..7eadb39 100644
--- a/macosx/tkMacOSXImage.c
+++ b/macosx/tkMacOSXImage.c
@@ -455,15 +455,16 @@ XCreateImage(
* TkPutImage, XPutImage, TkpPutRGBAImage --
*
* These functions, which all have the same signature, copy a rectangular
- * subimage of an XImage into a drawable. The first two are identical on
- * macOS. They assume that the XImage data has the structure of a 32bpp
- * ZPixmap in which the image data is an array of 32bit integers packed
- * with 8 bit values for the Red Green and Blue channels. They ignore the
- * fourth byte. The function TkpPutRGBAImage assumes that the XImage data
- * has been extended by using the fourth byte to store an 8-bit Alpha
- * value. (The Alpha data is assumed not to pre-multiplied). The image
- * is then drawn into the drawable using standard Porter-Duff Source Atop
- * Composition (kCGBlendModeSourceAtop in Apple's Core Graphics).
+ * subimage of an XImage into a drawable. TkPutImage is an alias for
+ * XPutImage, which assumes that the XImage data has the structure of a
+ * 32bpp ZPixmap in which the image data is an array of 32bit integers
+ * packed with 8 bit values for the Red Green and Blue channels. The
+ * fourth byte is ignored. The function TkpPutRGBAImage assumes that the
+ * XImage data has been extended by using the fourth byte to store an
+ * 8-bit Alpha value. (The Alpha data is assumed not to pre-multiplied).
+ * The image is then drawn into the drawable using standard Porter-Duff
+ * Source Atop Composition (kCGBlendModeSourceAtop in Apple's Core
+ * Graphics).
*
* The TkpPutRGBAImage function is used by TkImgPhotoDisplay to render photo
* images if the compile-time variable TK_CAN_RENDER_RGBA is defined in
@@ -498,6 +499,7 @@ TkMacOSXPutImage(
TkMacOSXDrawingContext dc;
MacDrawable *macDraw = (MacDrawable *)drawable;
int result = Success;
+
display->request++;
if (!TkMacOSXSetupDrawingContext(drawable, gc, &dc)) {
return BadDrawable;
@@ -548,23 +550,6 @@ int XPutImage(
src_x, src_y, dest_x, dest_y, width, height);
}
-int TkPutImage(
- TCL_UNUSED(unsigned long *),
- TCL_UNUSED(int),
- Display* display,
- Drawable drawable,
- GC gc,
- XImage* image,
- int src_x,
- int src_y,
- int dest_x,
- int dest_y,
- unsigned int width,
- unsigned int height) {
- return TkMacOSXPutImage(IGNORE_ALPHA, display, drawable, gc, image,
- src_x, src_y, dest_x, dest_y, width, height);
-}
-
int TkpPutRGBAImage(
Display* display,
Drawable drawable,
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 440383f..7dc9f32 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -4,10 +4,10 @@
* This file contains Mac OS X -specific interpreter initialization
* functions.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2017 Marc Culler
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2017 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -41,6 +41,7 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
@synthesize macOSVersion = _macOSVersion;
@synthesize isDrawing = _isDrawing;
@synthesize needsToDraw = _needsToDraw;
+@synthesize isSigned = _isSigned;
@end
/*
@@ -584,6 +585,8 @@ TkpInit(
TkMacOSXIconBitmapObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath",
TkMacOSXGetAppPathCmd, NULL, NULL);
+ MacSystrayInit(interp);
+ MacPrint_Init(interp);
return TCL_OK;
}
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index 61771a0..b0af85b 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -24,7 +24,9 @@
#ifndef _TKMAC
#include "tkMacOSX.h"
+#define Cursor QDCursor
#import <Cocoa/Cocoa.h>
+#undef Cursor
#endif
/*
@@ -99,24 +101,6 @@ typedef struct TkWindowPrivate MacDrawable;
*/
/*
- * This structure is for handling Netscape-type in process
- * embedding where Tk does not control the top-level. It contains
- * various functions that are needed by Mac specific routines, like
- * TkMacOSXGetDrawablePort. The definitions of the function types
- * are in tkMacOSX.h.
- */
-
-typedef struct {
- Tk_MacOSXEmbedRegisterWinProc *registerWinProc;
- Tk_MacOSXEmbedGetGrafPortProc *getPortProc;
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProc;
- Tk_MacOSXEmbedGetClipProc *getClipProc;
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc;
-} TkMacOSXEmbedHandler;
-
-MODULE_SCOPE TkMacOSXEmbedHandler *tkMacOSXEmbedHandler;
-
-/*
* Undef compatibility platform types defined above.
*/
@@ -178,6 +162,8 @@ MODULE_SCOPE TkMacOSXEmbedHandler *tkMacOSXEmbedHandler;
MODULE_SCOPE void TkMacOSXDefaultStartupScript(void);
MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x,
int y, int width, int height);
+MODULE_SCOPE void TkpRetainRegion(Region r);
+MODULE_SCOPE void TkpReleaseRegion(Region r);
MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta);
MODULE_SCOPE Bool TkTestLogDisplay(Drawable drawable);
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 961072f..794e704 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -4,10 +4,10 @@
* This file implements functions that decode & handle keyboard events on
* MacOS X.
*
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2012 Adrian Robert.
- * Copyright 2015-2020 Marc Culler.
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2012 Adrian Robert.
+ * Copyright © 2015-2020 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -344,7 +344,7 @@ static NSUInteger textInputModifiers;
if (repRange.location == 0) {
Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr;
- TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL);
+ Tk_SendVirtualEvent(focusWin, "TkAccentBackspace", NULL);
}
/*
@@ -400,6 +400,9 @@ static NSUInteger textInputModifiers;
- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)theRange
actualRange:(NSRangePointer)thePointer
{
+ (void)theRange;
+ (void)thePointer;
+
return nil;
}
@@ -417,6 +420,7 @@ static NSUInteger textInputModifiers;
Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr;
NSString *temp;
NSString *str;
+ (void)selRange;
str = ([aString isKindOfClass: [NSAttributedString class]]) ?
[aString string] : aString;
@@ -449,12 +453,12 @@ static NSUInteger textInputModifiers;
* Use our insertText method to display the marked text.
*/
- TkSendVirtualEvent(focusWin, "TkStartIMEMarkedText", NULL);
+ Tk_SendVirtualEvent(focusWin, "TkStartIMEMarkedText", NULL);
processingCompose = YES;
temp = [str copy];
[self insertText: temp replacementRange:repRange];
privateWorkingText = temp;
- TkSendVirtualEvent(focusWin, "TkEndIMEMarkedText", NULL);
+ Tk_SendVirtualEvent(focusWin, "TkEndIMEMarkedText", NULL);
}
- (BOOL)hasMarkedText
@@ -493,6 +497,9 @@ static NSUInteger textInputModifiers;
{
NSRect rect;
NSPoint pt;
+ (void)theRange;
+ (void)thePointer;
+
pt.x = caret_x;
pt.y = caret_y;
@@ -520,7 +527,7 @@ static NSUInteger textInputModifiers;
if (aSelector == @selector (deleteBackward:)) {
TkWindow *winPtr = TkMacOSXGetTkWindow([self window]);
Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr;
- TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL);
+ Tk_SendVirtualEvent(focusWin, "TkAccentBackspace", NULL);
}
}
@@ -547,6 +554,7 @@ static NSUInteger textInputModifiers;
- (NSUInteger)characterIndexForPoint: (NSPoint)thePoint
{
+ (void)thePoint;
if (NS_KEYLOG) {
TKLog(@"characterIndexForPoint request");
}
@@ -556,6 +564,8 @@ static NSUInteger textInputModifiers;
- (NSAttributedString *)attributedSubstringFromRange: (NSRange)theRange
{
static NSAttributedString *str = nil;
+ (void)theRange;
+
if (str == nil) {
str = [NSAttributedString new];
}
@@ -591,7 +601,7 @@ static NSUInteger textInputModifiers;
privateWorkingText = nil;
processingCompose = NO;
if (composeWin) {
- TkSendVirtualEvent(composeWin, "TkClearIMEMarkedText", NULL);
+ Tk_SendVirtualEvent(composeWin, "TkClearIMEMarkedText", NULL);
}
}
}
@@ -707,6 +717,10 @@ XGrabKeyboard(
{
keyboardGrabWinPtr = Tk_IdToWindow(display, grab_window);
TkWindow *captureWinPtr = (TkWindow *) TkpGetCapture();
+ (void)owner_events;
+ (void)pointer_mode;
+ (void)keyboard_mode;
+ (void)time;
if (keyboardGrabWinPtr && captureWinPtr) {
NSWindow *w = TkMacOSXGetNSWindowForDrawable(grab_window);
@@ -749,6 +763,9 @@ XUngrabKeyboard(
Display* display,
Time time)
{
+ (void)display;
+ (void)time;
+
if (modalSession) {
[NSApp endModalSession:modalSession];
modalSession = nil;
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index 9aca9e1..adc9906 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.c
@@ -3,17 +3,17 @@
*
* Routines to support keyboard events on the Macintosh.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2020 Marc Culler
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2020 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXPrivate.h"
-#include "tkMacOSXEvent.h"
+#include "tkMacOSXInt.h"
#include "tkMacOSXConstants.h"
#include "tkMacOSXKeysyms.h"
@@ -154,8 +154,6 @@ static int KeyDataToUnicode(UniChar *uniChars, int maxChars,
(void)notification;
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
-#else
- (void)notification;
#endif
keyboardChanged = YES;
UpdateKeymaps();
@@ -466,7 +464,7 @@ XkbKeycodeToKeysym(
KeySym
XKeycodeToKeysym(
TCL_UNUSED(Display *),
- KeyCode keycode,
+ unsigned int keycode,
int index)
{
return XkbKeycodeToKeysym(NULL, keycode, 0, index);
diff --git a/macosx/tkMacOSXKeysyms.h b/macosx/tkMacOSXKeysyms.h
index 0b528f3..1f6f260 100644
--- a/macosx/tkMacOSXKeysyms.h
+++ b/macosx/tkMacOSXKeysyms.h
@@ -4,11 +4,11 @@
* Contains data used for processing key events, some of which was
* moved from tkMacOSXKeyboard.c.
*
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2020 Marc Culler
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2020 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 09d91f0..346ee47 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -3,10 +3,10 @@
*
* This module implements the Mac-platform specific features of menus.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2012 Adrian Robert.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2012 Adrian Robert.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -91,9 +91,6 @@ static const struct {
#undef ACCEL
#undef sl
-static int gNoTkMenus = 0; /* This is used by Tk_MacOSXTurnOffMenus as
- * the flag that Tk is not to draw any
- * menus. */
static int inPostMenu = 0;
static SInt32 menuMarkColumnWidth = 0, menuIconTrailingEdgeMargin = 0;
static SInt32 menuTextLeadingEdgeMargin = 0, menuTextTrailingEdgeMargin = 0;
@@ -515,10 +512,6 @@ TKBackgroundLoop *backgroundLoop = nil;
- (void) tkSetMainMenu: (TKMenu *) menu
{
- if (gNoTkMenus) {
- return;
- }
-
TKMenu *applicationMenu = nil;
if (menu) {
@@ -716,8 +709,19 @@ TkpConfigureMenuEntry(
NSMenu *submenu = nil;
int imageWidth, imageHeight;
GC gc = (mePtr->textGC ? mePtr->textGC : mePtr->menuPtr->textGC);
- Tcl_Obj *fontPtr = (mePtr->fontPtr ? mePtr->fontPtr :
- mePtr->menuPtr->fontPtr);
+ Tcl_Obj *fontPtr = (mePtr->fontPtr ?
+ mePtr->fontPtr : mePtr->menuPtr->fontPtr);
+ static unsigned long defaultBg, defaultFg;
+ static int initialized = 0;
+
+ if (!initialized) {
+ TkColor *tkColPtr = TkpGetColor(NULL, DEF_MENU_BG_COLOR);
+ defaultBg = tkColPtr->color.pixel;
+ ckfree(tkColPtr);
+ tkColPtr = TkpGetColor(NULL, DEF_MENU_FG);
+ defaultFg = tkColPtr->color.pixel;
+ ckfree(tkColPtr);
+ }
if (mePtr->image) {
Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight);
@@ -736,14 +740,9 @@ TkpConfigureMenuEntry(
[menuItem setImage:image];
if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr &&
mePtr->labelLength) {
- Tcl_DString ds;
- Tcl_DStringInit(&ds);
- Tcl_UtfToUniCharDString(Tcl_GetString(mePtr->labelPtr),
- mePtr->labelLength, &ds);
- title = [[NSString alloc]
- initWithCharacters:(unichar *)Tcl_DStringValue(&ds)
- length:Tcl_DStringLength(&ds)>>1];
- Tcl_DStringFree(&ds);
+ title = [[[NSString alloc] initWithBytes:Tcl_GetString(mePtr->labelPtr)
+ length:mePtr->labelLength encoding:NSUTF8StringEncoding]
+ autorelease];
if ([title hasSuffix:@"..."]) {
title = [NSString stringWithFormat:@"%@%C",
[title substringToIndex:[title length] - 3], 0x2026];
@@ -833,7 +832,7 @@ TkpConfigureMenuEntry(
* have been added by the system. See [7185d26cf4].
*/
- for (int i = 0; i < menuRefPtr->menuPtr->numEntries; i++) {
+ for (TkSizeT i = 0; i < menuRefPtr->menuPtr->numEntries; i++) {
TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i];
NSMenuItem *item = (NSMenuItem *) submePtr->platformEntryData;
[item setEnabled:(submePtr->state != ENTRY_DISABLED)];
@@ -1150,8 +1149,8 @@ TkpSetMainMenubar(
if (winPtr->wmInfoPtr &&
winPtr->wmInfoPtr->menuPtr &&
- winPtr->wmInfoPtr->menuPtr->masterMenuPtr) {
- menubar = winPtr->wmInfoPtr->menuPtr->masterMenuPtr->tkwin;
+ winPtr->wmInfoPtr->menuPtr->mainMenuPtr) {
+ menubar = winPtr->wmInfoPtr->menuPtr->mainMenuPtr->tkwin;
}
/*
@@ -1205,15 +1204,15 @@ static void
CheckForSpecialMenu(
TkMenu *menuPtr) /* The menu we are checking */
{
- if (!menuPtr->masterMenuPtr->tkwin) {
+ if (!menuPtr->mainMenuPtr->tkwin) {
return;
}
for (TkMenuEntry *cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
if (cascadeEntryPtr->menuPtr->menuType == MENUBAR
- && cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin) {
- TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr;
+ && cascadeEntryPtr->menuPtr->mainMenuPtr->tkwin) {
+ TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->mainMenuPtr;
int i = 0;
Tcl_DString ds;
@@ -1223,7 +1222,7 @@ CheckForSpecialMenu(
Tcl_DStringAppend(&ds, specialMenus[i].name,
specialMenus[i].len);
if (strcmp(Tcl_DStringValue(&ds),
- Tk_PathName(menuPtr->masterMenuPtr->tkwin)) == 0) {
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin)) == 0) {
cascadeEntryPtr->entryFlags |= specialMenus[i].flag;
} else {
cascadeEntryPtr->entryFlags &= ~specialMenus[i].flag;
@@ -1382,7 +1381,7 @@ TkpComputeStandardMenuGeometry(
* Do nothing if this menu is a clone.
*/
- if (menuPtr->tkwin == NULL || menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->tkwin == NULL || menuPtr->mainMenuPtr != menuPtr) {
return;
}
@@ -1693,30 +1692,6 @@ TkMacOSXClearMenubarActive(void)
/*
*----------------------------------------------------------------------
*
- * Tk_MacOSXTurnOffMenus --
- *
- * Turns off all the menu drawing code. This is more than just disabling
- * the "menu" command, this means that Tk will NEVER touch the menubar.
- * It is needed in the Plugin, where Tk does not own the menubar.
- *
- * Results:
- * None.
- *
- * Side effects:
- * A flag is set which will disable all menu drawing.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_MacOSXTurnOffMenus(void)
-{
- gNoTkMenus = 1;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpMenuInit --
*
* Initializes Mac-specific menu data.
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index 6291596..0502029 100644
--- a/macosx/tkMacOSXMenubutton.c
+++ b/macosx/tkMacOSXMenubutton.c
@@ -4,11 +4,11 @@
* This file implements the Macintosh specific portion of the menubutton
* widget.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- * Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2007 Revar Desmera.
- * Copyright 2015 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 1996 Sun Microsystems, Inc.
+ * Copyright © 2001 Apple Computer, Inc.
+ * Copyright © 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2007 Revar Desmera.
+ * Copyright © 2015 Kevin Walzer/WordTech Communications LLC.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c
index 54105d2..31429d4 100644
--- a/macosx/tkMacOSXMenus.c
+++ b/macosx/tkMacOSXMenus.c
@@ -3,9 +3,9 @@
*
* These calls set up the default menus for Tk.
*
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1995-1996 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -199,6 +199,8 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
- (void) orderFrontStandardAboutPanel: (id) sender
{
+ (void)sender;
+
if (!_eventInterp || !Tcl_FindCommand(_eventInterp, "tkAboutDialog",
NULL, 0) || (GetCurrentEventKeyModifiers() & optionKey)) {
[super orderFrontStandardAboutPanel:nil];
@@ -231,6 +233,8 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
- (void) tkSource: (id) sender
{
+ (void)sender;
+
if (_eventInterp) {
if (Tcl_EvalEx(_eventInterp, "tk_getOpenFile -filetypes {"
"{{TCL Scripts} {.tcl} TEXT} {{Text Files} {} TEXT}}",
@@ -256,6 +260,8 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
- (void) tkDemo: (id) sender
{
+ (void)sender;
+
if (_eventInterp) {
Tcl_Obj *path = GetWidgetDemoPath(_eventInterp);
@@ -281,6 +287,8 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
- (BOOL) validateUserInterfaceItem: (id <NSValidatedUserInterfaceItem>) anItem
{
+ (void)anItem;
+
return YES;
}
@@ -322,19 +330,18 @@ static Tcl_Obj *
GetWidgetDemoPath(
Tcl_Interp *interp)
{
- Tcl_Obj *libpath, *result = NULL;
+ Tcl_Obj *result = NULL;
- libpath = Tcl_GetVar2Ex(interp, "tk_library", NULL, TCL_GLOBAL_ONLY);
- if (libpath) {
- Tcl_Obj *demo[2] = { Tcl_NewStringObj("demos", 5),
- Tcl_NewStringObj("widget", 6) };
+ if (Tcl_EvalEx(interp, "::tk::pkgconfig get demodir,runtime",
+ -1, TCL_EVAL_GLOBAL) == TCL_OK) {
+ Tcl_Obj *libpath, *demo[1] = { Tcl_NewStringObj("widget", 6) };
+ libpath = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(libpath);
- result = Tcl_FSJoinToPath(libpath, 2, demo);
+ result = Tcl_FSJoinToPath(libpath, 1, demo);
Tcl_DecrRefCount(libpath);
- } else {
- Tcl_ResetResult(interp);
}
+ Tcl_ResetResult(interp);
return result;
}
@@ -356,9 +363,9 @@ GetWidgetDemoPath(
void
TkMacOSXHandleMenuSelect(
- short theMenu,
- unsigned short theItem,
- int optionKeyPressed)
+ TCL_UNUSED(short),
+ TCL_UNUSED(unsigned short),
+ TCL_UNUSED(int))
{
Tcl_Panic("TkMacOSXHandleMenuSelect: Obsolete, no more Carbon!");
}
@@ -366,29 +373,6 @@ TkMacOSXHandleMenuSelect(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXInitMenus --
- *
- * This procedure initializes the Macintosh menu bar.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXInitMenus(
- Tcl_Interp *interp)
-{
- [NSApp _setupMenus];
-}
-
-/*
- *----------------------------------------------------------------------
- *
* GenerateEditEvent --
*
* Takes an edit menu item and posts the corasponding a virtual event to
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 43babbc..4790549 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -4,8 +4,8 @@
* This file implements functions that decode & handle mouse events on
* MacOS X.
*
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -13,7 +13,7 @@
#include "tkMacOSXPrivate.h"
#include "tkMacOSXWm.h"
-#include "tkMacOSXEvent.h"
+#include "tkMacOSXInt.h"
#include "tkMacOSXDebug.h"
#include "tkMacOSXConstants.h"
@@ -25,6 +25,13 @@ typedef struct {
Point local;
} MouseEventData;
+typedef struct {
+ uint64_t wheelTickPrev; /* For high resolution wheels. */
+ double vWheelAcc; /* For high resolution wheels (vertical). */
+ double hWheelAcc; /* For high resolution wheels (horizontal). */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
+
static Tk_Window captureWinPtr = NULL; /* Current capture window; may be
* NULL. */
@@ -56,7 +63,7 @@ enum {
NSRect viewFrame = [[eventWindow contentView] frame];
NSPoint location = [theEvent locationInWindow];
TkWindow *winPtr = NULL, *grabWinPtr;
- Tk_Window tkwin = None, capture, target;
+ Tk_Window tkwin = NULL, capture, target;
NSPoint local, global;
NSInteger button;
Bool inTitleBar = NO;
@@ -89,17 +96,20 @@ enum {
}
button = [theEvent buttonNumber] + Button1;
+ if ((button & -2) == Button2) {
+ button ^= 1; /* Swap buttons 2/3 */
+ }
switch (eventType) {
case NSRightMouseUp:
case NSOtherMouseUp:
- buttonState &= ~TkGetButtonMask(button);
+ buttonState &= ~Tk_GetButtonMask(button);
break;
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
case NSRightMouseDown:
case NSOtherMouseDown:
- buttonState |= TkGetButtonMask(button);
+ buttonState |= Tk_GetButtonMask(button);
break;
case NSMouseEntered:
if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] &&
@@ -154,7 +164,7 @@ enum {
* do not change the ignoredPresses count.
*/
- buttonState &= ~TkGetButtonMask(Button1);
+ buttonState &= ~Tk_GetButtonMask(Button1);
return theEvent;
}
if (inTitleBar) {
@@ -162,7 +172,7 @@ enum {
return theEvent;
}
validPresses++;
- buttonState |= TkGetButtonMask(Button1);
+ buttonState |= Tk_GetButtonMask(Button1);
}
if (eventType == NSLeftMouseUp) {
if (ignoredPresses > 0) {
@@ -171,7 +181,7 @@ enum {
validPresses--;
}
if (validPresses == 0) {
- buttonState &= ~TkGetButtonMask(Button1);
+ buttonState &= ~Tk_GetButtonMask(Button1);
}
}
@@ -180,7 +190,7 @@ enum {
* associated Tk window.
*/
- capture = TkMacOSXGetCapture();
+ capture = TkpGetCapture();
if (capture) {
winPtr = (TkWindow *) capture;
eventWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window);
@@ -316,8 +326,9 @@ enum {
Tk_UpdatePointer(target, global.x, global.y, state);
} else {
CGFloat delta;
- int coarseDelta;
XEvent xEvent;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* For scroll wheel events we need to send the XEvent here.
@@ -332,23 +343,43 @@ enum {
xEvent.xany.display = Tk_Display(target);
xEvent.xany.window = Tk_WindowId(target);
+#define WHEEL_DELTA 120
+#define WHEEL_DELAY 300000000
+ uint64_t wheelTick = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
+ Bool timeout = (wheelTick - tsdPtr->wheelTickPrev) >= WHEEL_DELAY;
+ if (timeout) {
+ tsdPtr->vWheelAcc = tsdPtr->hWheelAcc = 0;
+ }
+ tsdPtr->wheelTickPrev = wheelTick;
delta = [theEvent deltaY];
if (delta != 0.0) {
- coarseDelta = (delta > -1.0 && delta < 1.0) ?
- (signbit(delta) ? -1 : 1) : lround(delta);
- xEvent.xbutton.state = state;
- xEvent.xkey.keycode = coarseDelta;
- xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
- Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
+ delta = (tsdPtr->vWheelAcc += delta);
+ if (timeout && fabs(delta) < 1.0) {
+ delta = ((delta < 0.0) ? -1.0 : 1.0);
+ }
+ if (fabs(delta) >= 0.6) {
+ int intDelta = round(delta);
+ xEvent.xbutton.state = state;
+ xEvent.xkey.keycode = WHEEL_DELTA * intDelta;
+ tsdPtr->vWheelAcc -= intDelta;
+ xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
+ Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
+ }
}
delta = [theEvent deltaX];
if (delta != 0.0) {
- coarseDelta = (delta > -1.0 && delta < 1.0) ?
- (signbit(delta) ? -1 : 1) : lround(delta);
- xEvent.xbutton.state = state | ShiftMask;
- xEvent.xkey.keycode = coarseDelta;
- xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
- Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
+ delta = (tsdPtr->hWheelAcc += delta);
+ if (timeout && fabs(delta) < 1.0) {
+ delta = ((delta < 0.0) ? -1.0 : 1.0);
+ }
+ if (fabs(delta) >= 0.6) {
+ int intDelta = round(delta);
+ xEvent.xbutton.state = state | ShiftMask;
+ xEvent.xkey.keycode = WHEEL_DELTA * intDelta;
+ tsdPtr->hWheelAcc -= intDelta;
+ xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
+ Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
+ }
}
}
return theEvent;
@@ -413,10 +444,19 @@ ButtonModifiers2State(
unsigned int state;
/*
- * Tk on OSX supports at most 5 buttons.
+ * Tk on OSX supports at most 9 buttons.
*/
- state = (buttonState & 0x1F) * Button1Mask;
+ state = (buttonState & 0x079) * Button1Mask;
+ /* Handle swapped buttons 2/3 */
+ if (buttonState & 0x02) {
+ state |= Button3Mask;
+ }
+ if (buttonState & 0x04) {
+ state |= Button2Mask;
+ }
+ /* Handle buttons 8/9 */
+ state |= (buttonState & 0x180) * (Button8Mask >> 7);
if (keyModifiers & alphaLock) {
state |= LockMask;
@@ -476,6 +516,9 @@ XQueryPointer(
{
int getGlobal = (root_x_return && root_y_return);
int getLocal = (win_x_return && win_y_return && w != None);
+ (void)display;
+ (void)root_return;
+ (void)child_return;
if (getGlobal || getLocal) {
NSPoint global = [NSEvent mouseLocation];
@@ -624,7 +667,7 @@ GenerateButtonEvent(
int dummy;
TkDisplay *dispPtr;
-#if UNUSED
+#ifdef UNUSED
/*
* ButtonDown events will always occur in the front window. ButtonUp
@@ -636,7 +679,7 @@ GenerateButtonEvent(
if ((medPtr->activeNonFloating == NULL)
|| ((!(TkpIsWindowFloating(medPtr->whichWin))
&& (medPtr->activeNonFloating != medPtr->whichWin))
- && TkMacOSXGetCapture() == NULL)) {
+ && TkpGetCapture() == NULL)) {
return false;
}
#endif
@@ -726,7 +769,7 @@ TkpSetCapture(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetCapture --
+ * TkpGetCapture --
*
* Results:
* Returns the current grab window
@@ -738,7 +781,7 @@ TkpSetCapture(
*/
Tk_Window
-TkMacOSXGetCapture(void)
+TkpGetCapture(void)
{
return captureWinPtr;
}
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index 208d846..bc30949 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -4,19 +4,20 @@
* This file contains the implementation of a tcl event source
* for the AppKit event loop.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2015 Marc Culler.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2015 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXPrivate.h"
-#include "tkMacOSXEvent.h"
+#include "tkMacOSXInt.h"
#include "tkMacOSXConstants.h"
-
+#if TCL_MAJOR_VERSION < 9
+#undef Tcl_MacOSXNotifierAddRunLoopMode
#ifdef USE_TCL_STUBS
#ifdef __cplusplus
extern "C" {
@@ -24,7 +25,7 @@ extern "C" {
/* Little hack to eliminate the need for "tclInt.h" here:
Just copy a small portion of TclIntPlatStubs, just
enough to make it work. See [600b72bfbc] */
-typedef struct {
+typedef struct TclIntPlatStubs {
int magic;
void *hooks;
void (*dummy[19]) (void); /* dummy entries 0-18, not used */
@@ -34,13 +35,14 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#ifdef __cplusplus
}
#endif
-#define TclMacOSXNotifierAddRunLoopMode \
+#define Tcl_MacOSXNotifierAddRunLoopMode \
(tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */
#elif TCL_MINOR_VERSION < 7
extern void TclMacOSXNotifierAddRunLoopMode(const void *runLoopMode);
+# define Tcl_MacOSXNotifierAddRunLoopMode TclMacOSXNotifierAddRunLoopMode
#else
extern void Tcl_MacOSXNotifierAddRunLoopMode(const void *runLoopMode);
-# define TclMacOSXNotifierAddRunLoopMode Tcl_MacOSXNotifierAddRunLoopMode
+#endif
#endif
#import <objc/objc-auto.h>
@@ -181,7 +183,7 @@ void DebugPrintQueue(void)
* this block should be removed.
*/
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500
if ([theEvent type] == NSAppKitDefined) {
static Bool aWindowIsMoving = NO;
switch([theEvent subtype]) {
@@ -294,8 +296,8 @@ Tk_MacOSXSetupTkNotifier(void)
Tcl_CreateEventSource(TkMacOSXEventsSetupProc,
TkMacOSXEventsCheckProc, NULL);
TkCreateExitHandler(TkMacOSXNotifyExitHandler, NULL);
- TclMacOSXNotifierAddRunLoopMode(NSEventTrackingRunLoopMode);
- TclMacOSXNotifierAddRunLoopMode(NSModalPanelRunLoopMode);
+ Tcl_MacOSXNotifierAddRunLoopMode(NSEventTrackingRunLoopMode);
+ Tcl_MacOSXNotifierAddRunLoopMode(NSModalPanelRunLoopMode);
}
}
}
@@ -319,8 +321,9 @@ Tk_MacOSXSetupTkNotifier(void)
static void
TkMacOSXNotifyExitHandler(
- ClientData clientData) /* Not used. */
+ ClientData dummy) /* Not used. */
{
+ (void)dummy;
TSD_INIT();
Tcl_DeleteEventSource(TkMacOSXEventsSetupProc,
@@ -438,7 +441,7 @@ static Tcl_TimerToken ticker = NULL;
static void
Heartbeat(
- ClientData clientData)
+ TCL_UNUSED(ClientData))
{
if (ticker) {
@@ -450,10 +453,11 @@ static const Tcl_Time zeroBlockTime = { 0, 0 };
static void
TkMacOSXEventsSetupProc(
- ClientData clientData,
+ ClientData dummy,
int flags)
{
NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode];
+ (void)dummy;
/*
* runloopMode will be nil if we are in a Tcl event loop.
@@ -516,7 +520,7 @@ TkMacOSXEventsSetupProc(
*/
static void
TkMacOSXEventsCheckProc(
- ClientData clientData,
+ TCL_UNUSED(ClientData),
int flags)
{
NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode];
diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h
index 088d402..3f4ac44 100644
--- a/macosx/tkMacOSXPort.h
+++ b/macosx/tkMacOSXPort.h
@@ -35,16 +35,10 @@
#ifndef _TCL
# include <tcl.h>
#endif
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
+#if HAVE_SYS_TIME_H
# include <sys/time.h>
-# else
-# include <time.h>
-# endif
#endif
+#include <time.h>
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
@@ -124,26 +118,6 @@
#define REDO_KEYSYM_LOOKUP
/*
- * Defines for X functions that are used by Tk but are treated as
- * no-op functions on the Macintosh.
- */
-
-#undef XFlush
-#define XFlush(display) (0)
-#undef XFree
-#define XFree(data) (((data) != NULL) ? (ckfree(data),0) : 0)
-#undef XGrabServer
-#define XGrabServer(display) (0)
-#undef XNoOp
-#define XNoOp(display) (display->request++,0)
-#undef XUngrabServer
-#define XUngrabServer(display) (0)
-#undef XSynchronize
-#define XSynchronize(display, onoff) (display->request++,NULL)
-#undef XVisualIDFromVisual
-#define XVisualIDFromVisual(visual) (visual->visualid)
-
-/*
* The following functions are not used on the Mac, so we stub them out.
*/
@@ -153,17 +127,6 @@
#define TkpSync(display)
/*
- * TkMacOSXGetCapture is a legacy function used on the Mac. When fixing
- * [943d5ebe51], TkpGetCapture was added to the Windows port. Both
- * are actually the same feature and should bear the same name. However,
- * in order to avoid potential backwards incompatibilities, renaming
- * TkMacOSXGetCapture into TkpGetCapture in *PlatDecls.h shall not be
- * done in a patch release, therefore use a define here.
- */
-
-#define TkpGetCapture TkMacOSXGetCapture
-
-/*
* This macro stores a representation of the window handle in a string.
*/
@@ -191,6 +154,12 @@ MODULE_SCOPE int TkpPutRGBAImage(
unsigned int width, unsigned int height);
/*
+ * Inform tkCanvas.c that our XGetImage returns a 32pp pixmap packed as 0xAABBGGRR
+ */
+
+#define TK_XGETIMAGE_USES_ABGR32
+
+/*
* Used by xcolor.c
*/
diff --git a/macosx/tkMacOSXPrint.c b/macosx/tkMacOSXPrint.c
new file mode 100644
index 0000000..38cd1ca
--- /dev/null
+++ b/macosx/tkMacOSXPrint.c
@@ -0,0 +1,353 @@
+/*
+ * tkMacOSXPrint.c --
+ *
+ * This module implements native printing dialogs for macOS.
+ *
+ * Copyright © 2006 Apple Inc.
+ * Copyright © 2011-2021 Kevin Walzer/WordTech Communications LLC.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include <tcl.h>
+#include <tk.h>
+#include <tkInt.h>
+#include <Cocoa/Cocoa.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreServices/CoreServices.h>
+#include <ApplicationServices/ApplicationServices.h>
+#include <tkMacOSXInt.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+/* Forward declarations of functions and variables. */
+NSString * fileName = nil;
+CFStringRef urlFile = NULL;
+int StartPrint(ClientData clientData, Tcl_Interp * interp,
+ int objc, Tcl_Obj * const objv[]);
+OSStatus FinishPrint(NSString *file, int buttonValue);
+int MacPrint_Init(Tcl_Interp * interp);
+
+/* Delegate class for print dialogs. */
+@interface PrintDelegate: NSObject
+ - (id) init;
+ - (void) printPanelDidEnd: (NSPrintPanel *) printPanel
+ returnCode: (int) returnCode
+ contextInfo: (void *) contextInfo;
+@end
+
+@implementation PrintDelegate
+- (id) init {
+ self = [super init];
+ return self;
+}
+
+- (void) printPanelDidEnd: (NSPrintPanel *) printPanel
+ returnCode: (int) returnCode
+ contextInfo: (void *) contextInfo {
+ /*
+ * Pass returnCode to FinishPrint function to determine how to
+ * handle.
+ */
+ FinishPrint(fileName, returnCode);
+}
+@end
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * StartPrint --
+ *
+ * Launch native print dialog.
+ *
+ * Results:
+ * Configures values and starts print process.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+StartPrint(
+ ClientData clientData,
+ Tcl_Interp * interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ (void) clientData;
+ NSPrintInfo * printInfo = [NSPrintInfo sharedPrintInfo];
+ NSPrintPanel * printPanel = [NSPrintPanel printPanel];
+ int accepted;
+ PMPrintSession printSession;
+ PMPageFormat pageFormat;
+ PMPrintSettings printSettings;
+ OSStatus status = noErr;
+
+ /* Check for proper number of arguments. */
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "file");
+ return TCL_ERROR;
+ }
+
+ fileName = [NSString stringWithUTF8String: Tcl_GetString(objv[1])];
+ urlFile = (CFStringRef) fileName;
+ CFRetain(urlFile);
+
+ /* Initialize the delegate for the callback from the page panel. */
+ PrintDelegate * printDelegate = [[PrintDelegate alloc] init];
+
+ status = PMCreateSession( & printSession);
+ if (status != noErr) {
+ NSLog(@ "Error creating print session.");
+ return TCL_ERROR;
+ }
+
+ status = PMCreatePrintSettings( & printSettings);
+ if (status != noErr) {
+ NSLog(@ "Error creating print settings.");
+ return TCL_ERROR;
+ }
+
+ status = PMSessionDefaultPrintSettings(printSession, printSettings);
+ if (status != noErr) {
+ NSLog(@ "Error creating default print settings.");
+ return TCL_ERROR;
+ }
+
+ printSession = (PMPrintSession)[printInfo PMPrintSession];
+ pageFormat = (PMPageFormat)[printInfo PMPageFormat];
+ printSettings = (PMPrintSettings)[printInfo PMPrintSettings];
+
+ accepted = [printPanel runModalWithPrintInfo: printInfo];
+ [printDelegate printPanelDidEnd: printPanel
+ returnCode: accepted
+ contextInfo: printInfo];
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FinishPrint --
+ *
+ * Handles print process based on input from dialog.
+ *
+ * Results:
+ * Completes print process.
+ *
+ *----------------------------------------------------------------------
+ */
+
+OSStatus
+FinishPrint(
+ NSString *file,
+ int buttonValue)
+{
+ NSPrintInfo * printInfo = [NSPrintInfo sharedPrintInfo];
+ PMPrintSession printSession;
+ PMPageFormat pageFormat;
+ PMPrintSettings printSettings;
+ OSStatus status = noErr;
+ CFStringRef mimeType = NULL;
+
+ /*
+ * If value passed here is NSCancelButton, return noErr;
+ * otherwise printing will occur regardless of value.
+ */
+ if (buttonValue == NSModalResponseCancel) {
+ return noErr;
+ }
+
+ status = PMCreateSession( & printSession);
+ if (status != noErr) {
+ NSLog(@ "Error creating print session.");
+ return status;
+ }
+
+ status = PMCreatePrintSettings( & printSettings);
+ if (status != noErr) {
+ NSLog(@ "Error creating print settings.");
+ return status;
+ }
+
+ status = PMSessionDefaultPrintSettings(printSession, printSettings);
+ if (status != noErr) {
+ NSLog(@ "Error creating default print settings.");
+ return status;
+ }
+
+ printSession = (PMPrintSession)[printInfo PMPrintSession];
+ pageFormat = (PMPageFormat)[printInfo PMPageFormat];
+ printSettings = (PMPrintSettings)[printInfo PMPrintSettings];
+
+ /*Handle print operation.*/
+ if (buttonValue == NSModalResponseOK) {
+
+ if (urlFile == NULL) {
+ NSLog(@ "Could not get file to print.");
+ return noErr;
+ }
+
+ fileName = file;
+
+ CFURLRef printURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, urlFile, kCFURLPOSIXPathStyle, false);
+
+ PMPrinter currentPrinter;
+ PMDestinationType printDestination;
+
+ /*Get the intended destination.*/
+ status = PMSessionGetDestinationType(printSession, printSettings, & printDestination);
+
+ /*Destination is printer. Send file to printer.*/
+ if (status == noErr && printDestination == kPMDestinationPrinter) {
+
+ status = PMSessionGetCurrentPrinter(printSession, & currentPrinter);
+ if (status == noErr) {
+ CFArrayRef mimeTypes;
+ status = PMPrinterGetMimeTypes(currentPrinter, printSettings, & mimeTypes);
+ if (status == noErr && mimeTypes != NULL) {
+ mimeType = CFSTR("application/pdf");
+ if (CFArrayContainsValue(mimeTypes, CFRangeMake(0, CFArrayGetCount(mimeTypes)), mimeType)) {
+ status = PMPrinterPrintWithFile(currentPrinter, printSettings, pageFormat, mimeType, printURL);
+ CFRelease(urlFile);
+ return status;
+ }
+ }
+ }
+ }
+
+ /* Destination is file. Determine how to handle. */
+ if (status == noErr && printDestination == kPMDestinationFile) {
+ CFURLRef outputLocation = NULL;
+
+ status = PMSessionCopyDestinationLocation(printSession, printSettings, & outputLocation);
+ if (status == noErr) {
+ /*Get the source file and target destination, convert to strings.*/
+ CFStringRef sourceFile = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle);
+ CFStringRef savePath = CFURLCopyFileSystemPath(outputLocation, kCFURLPOSIXPathStyle);
+ NSString * sourcePath = (NSString * ) sourceFile;
+ NSString * finalPath = (NSString * ) savePath;
+ NSString * pathExtension = [finalPath pathExtension];
+ NSFileManager * fileManager = [NSFileManager defaultManager];
+ NSError * error = nil;
+
+ /*
+ * Is the target file a PDF? If so, copy print file
+ * to output location.
+ */
+ if ([pathExtension isEqualToString: @ "pdf"]) {
+
+ /*Make sure no file conflict exists.*/
+ if ([fileManager fileExistsAtPath: finalPath]) {
+ [fileManager removeItemAtPath: finalPath error: &error];
+ }
+ if ([fileManager fileExistsAtPath: sourcePath]) {
+ error = nil;
+ [fileManager copyItemAtPath: sourcePath toPath: finalPath error: & error];
+ }
+ return status;
+ }
+
+ /*
+ * Is the target file PostScript? If so, run print file
+ * through CUPS filter to convert back to PostScript.
+ */
+
+ if ([pathExtension isEqualToString: @ "ps"]) {
+ char source[5012];
+ char target[5012];
+ [sourcePath getCString: source maxLength: (sizeof source) encoding: NSUTF8StringEncoding];
+ [finalPath getCString: target maxLength: (sizeof target) encoding: NSUTF8StringEncoding];
+ /*Make sure no file conflict exists.*/
+ if ([fileManager fileExistsAtPath: finalPath]) {
+ [fileManager removeItemAtPath: finalPath error: &error];
+ }
+
+ /*
+ * Fork and start new process with command string. Thanks to Peter da Silva
+ * for assistance.
+ */
+ pid_t pid;
+ if ((pid = fork()) == -1) {
+ return -1;
+ } else if (pid == 0) {
+ /* Redirect output to file and silence debugging output.*/
+ dup2(open(target, O_RDWR | O_CREAT, 0777), 1);
+ dup2(open("/dev/null", O_WRONLY), 2);
+ execl("/usr/sbin/cupsfilter", "/usr/sbin/cupsfilter", "-m", "application/postscript", source, NULL);
+ exit(0);
+ }
+ return status;
+ }
+ }
+ }
+
+ /* Destination is preview. Open file in default application for PDF. */
+ if ((status == noErr) && (printDestination == kPMDestinationPreview)) {
+ CFStringRef urlpath = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle);
+ NSString * path = (NSString * ) urlpath;
+ NSURL * url = [NSURL fileURLWithPath: path];
+ NSWorkspace * ws = [NSWorkspace sharedWorkspace];
+ [ws openURL: url];
+ status = noErr;
+ return status;
+ }
+
+ /*
+ * If destination is not printer, file or preview,
+ * we do not support it. Display alert.
+ */
+
+ if (((status == noErr) && (printDestination != kPMDestinationPreview)) || ((status == noErr) && (printDestination != kPMDestinationFile)) || ((status == noErr) && (printDestination != kPMDestinationPrinter))) {
+
+ NSAlert * alert = [[[NSAlert alloc] init] autorelease];
+ [alert addButtonWithTitle: @ "OK"];
+
+ [alert setMessageText: @ "Unsupported Printing Operation"];
+ [alert setInformativeText: @ "This printing operation is not supported."];
+ [alert setAlertStyle: NSAlertStyleInformational];
+ [alert runModal];
+ return status;
+ }
+ }
+
+ /* Return because cancel button was clicked. */
+ if (buttonValue == NSModalResponseCancel) {
+ PMRelease(printSession);
+ return status;
+ }
+
+ return status;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MacPrint_Init--
+ *
+ * Initializes the printing module.
+ *
+ * Results:
+ * Printing module initialized.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int MacPrint_Init(Tcl_Interp * interp) {
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ Tcl_CreateObjCommand(interp, "::tk::print::_print", StartPrint, (ClientData) NULL, (Tcl_CmdDeleteProc * ) NULL);
+ [pool release];
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: objc
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index be2264f..0de2805 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -3,9 +3,9 @@
*
* Macros and declarations that are purely internal & private to TkAqua.
*
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2008-2009 Apple Inc.
- * Copyright (c) 2020 Marc Culler
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2008-2009 Apple Inc.
+ * Copyright © 2020 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -25,7 +25,9 @@
#endif
#define TextStyle MacTextStyle
+#define Cursor QDCursor
#import <ApplicationServices/ApplicationServices.h>
+#undef Cursor
#import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h>
#ifndef NO_CARBON_H
@@ -121,9 +123,10 @@
* Macro abstracting use of TkMacOSXGetNamedSymbol to init named symbols.
*/
+#define UNINITIALISED_SYMBOL ((void*)(-1L))
#define TkMacOSXInitNamedSymbol(module, ret, symbol, ...) \
- static ret (* symbol)(__VA_ARGS__) = (void*)(-1L); \
- if (symbol == (void*)(-1L)) { \
+ static ret (* symbol)(__VA_ARGS__) = UNINITIALISED_SYMBOL; \
+ if (symbol == UNINITIALISED_SYMBOL) { \
symbol = TkMacOSXGetNamedSymbol(STRINGIFY(module), \
STRINGIFY(symbol)); \
}
@@ -216,8 +219,8 @@ MODULE_SCOPE long tkMacOSXMacOSXVersion;
* Prototypes for TkMacOSXRegion.c.
*/
-MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(TkRegion r);
-MODULE_SCOPE void TkMacOSXSetWithNativeRegion(TkRegion r,
+MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(Region r);
+MODULE_SCOPE void TkMacOSXSetWithNativeRegion(Region r,
HIShapeRef rgn);
MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void);
MODULE_SCOPE HIMutableShapeRef TkMacOSXHIShapeCreateMutableWithRect(
@@ -259,13 +262,13 @@ MODULE_SCOPE void TkMacOSXRestoreDrawingContext(
MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel,
CGContextRef context);
#define TkMacOSXGetTkWindow(window) (TkWindow *)Tk_MacOSXGetTkWindow(window)
-#define TkMacOSXGetNSWindowForDrawable(drawable) ((NSWindow*)TkMacOSXDrawable(drawable))
-#define TkMacOSXGetNSViewForDrawable(macWin) (NSView *)Tk_MacOSXGetNSViewForDrawable((Drawable)(macWin))
+#define TkMacOSXGetNSWindowForDrawable(drawable) ((NSWindow *)Tk_MacOSXGetNSWindowForDrawable(drawable))
+#define TkMacOSXGetNSViewForDrawable(macWin) ((NSView *)Tk_MacOSXGetNSViewForDrawable((Drawable)(macWin)))
+#define TkMacOSXGetCGContextForDrawable(drawable) ((CGContextRef)Tk_MacOSXGetCGContextForDrawable(drawable))
MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds);
MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable);
MODULE_SCOPE void TkMacOSXInvalidateViewRegion(NSView *view,
HIShapeRef rgn);
-MODULE_SCOPE CGContextRef TkMacOSXGetCGContextForDrawable(Drawable drawable);
MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromTkImage(Display *display,
Tk_Image image, int width, int height);
MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromBitmap(Display *display,
@@ -294,6 +297,9 @@ MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view,
MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin);
MODULE_SCOPE void TkMacOSXDrawAllViews(ClientData clientData);
MODULE_SCOPE unsigned long TkMacOSXClearPixel(void);
+MODULE_SCOPE int MacSystrayInit(Tcl_Interp *);
+MODULE_SCOPE int MacPrint_Init(Tcl_Interp *);
+
#pragma mark Private Objective-C Classes
@@ -332,6 +338,7 @@ VISIBILITY_HIDDEN
int _macOSVersion; /* 10000 * major + 100*minor */
Bool _isDrawing;
Bool _needsToDraw;
+ Bool _isSigned;
#endif
}
@@ -339,6 +346,7 @@ VISIBILITY_HIDDEN
@property int macOSVersion;
@property Bool isDrawing;
@property Bool needsToDraw;
+@property Bool isSigned;
@end
@interface TKApplication(TKInit)
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index fbb41cb..b44073a 100644
--- a/macosx/tkMacOSXRegion.c
+++ b/macosx/tkMacOSXRegion.c
@@ -3,9 +3,9 @@
*
* Implements X window calls for manipulating regions
*
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1995-1996 Sun Microsystems, Inc.
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -27,7 +27,7 @@ static int totalRegionRetainCount = 0;
/*
*----------------------------------------------------------------------
*
- * TkCreateRegion --
+ * XCreateRegion --
*
* Implements the equivelent of the X window function XCreateRegion. See
* Xwindow documentation for more details.
@@ -41,10 +41,10 @@ static int totalRegionRetainCount = 0;
*----------------------------------------------------------------------
*/
-TkRegion
-TkCreateRegion(void)
+Region
+XCreateRegion(void)
{
- TkRegion region = (TkRegion) HIShapeCreateMutable();
+ Region region = (Region) HIShapeCreateMutable();
DebugLog("Created region: total regions = %d\n", ++totalRegions);
RetainRegion(region);
return region;
@@ -53,7 +53,7 @@ TkCreateRegion(void)
/*
*----------------------------------------------------------------------
*
- * TkDestroyRegion --
+ * XDestroyRegion --
*
* Implements the equivelent of the X window function XDestroyRegion. See
* Xwindow documentation for more details.
@@ -68,8 +68,8 @@ TkCreateRegion(void)
*/
int
-TkDestroyRegion(
- TkRegion r)
+XDestroyRegion(
+ Region r)
{
if (r) {
DebugLog("Destroyed region: total regions = %d\n", --totalRegions);
@@ -81,7 +81,7 @@ TkDestroyRegion(
/*
*----------------------------------------------------------------------
*
- * TkIntersectRegion --
+ * XIntersectRegion --
*
* Implements the equivalent of the X window function XIntersectRegion.
* See Xwindow documentation for more details.
@@ -96,10 +96,10 @@ TkDestroyRegion(
*/
int
-TkIntersectRegion(
- TkRegion sra,
- TkRegion srb,
- TkRegion dr_return)
+XIntersectRegion(
+ Region sra,
+ Region srb,
+ Region dr_return)
{
ChkErr(HIShapeIntersect, (HIShapeRef) sra, (HIShapeRef) srb,
(HIMutableShapeRef) dr_return);
@@ -109,7 +109,7 @@ TkIntersectRegion(
/*
*----------------------------------------------------------------------
*
- * TkSubtractRegion --
+ * XSubtractRegion --
*
* Implements the equivalent of the X window function XSubtractRegion.
* See X window documentation for more details.
@@ -124,10 +124,10 @@ TkIntersectRegion(
*/
int
-TkSubtractRegion(
- TkRegion sra,
- TkRegion srb,
- TkRegion dr_return)
+XSubtractRegion(
+ Region sra,
+ Region srb,
+ Region dr_return)
{
ChkErr(HIShapeDifference, (HIShapeRef) sra, (HIShapeRef) srb,
(HIMutableShapeRef) dr_return);
@@ -137,7 +137,7 @@ TkSubtractRegion(
/*
*----------------------------------------------------------------------
*
- * TkUnionRectWithRegion --
+ * XUnionRectWithRegion --
*
* Implements the equivelent of the X window function
* XUnionRectWithRegion. See Xwindow documentation for more details.
@@ -152,10 +152,10 @@ TkSubtractRegion(
*/
int
-TkUnionRectWithRegion(
+XUnionRectWithRegion(
XRectangle* rectangle,
- TkRegion src_region,
- TkRegion dest_region_return)
+ Region src_region,
+ Region dest_region_return)
{
const CGRect r = CGRectMake(rectangle->x, rectangle->y,
rectangle->width, rectangle->height);
@@ -191,7 +191,7 @@ TkUnionRectWithRegion(
static int
TkMacOSXIsEmptyRegion(
- TkRegion r)
+ Region r)
{
return HIShapeIsEmpty((HIMutableShapeRef) r) ? 1 : 0;
}
@@ -199,7 +199,7 @@ TkMacOSXIsEmptyRegion(
/*
*----------------------------------------------------------------------
*
- * TkRectInRegion --
+ * XRectInRegion --
*
* Implements the equivelent of the X window function XRectInRegion. See
* Xwindow documentation for more details.
@@ -215,8 +215,8 @@ TkMacOSXIsEmptyRegion(
*/
int
-TkRectInRegion(
- TkRegion region,
+XRectInRegion(
+ Region region,
int x,
int y,
unsigned int width,
@@ -235,7 +235,7 @@ TkRectInRegion(
/*
*----------------------------------------------------------------------
*
- * TkClipBox --
+ * XClipBox --
*
* Implements the equivelent of the X window function XClipBox. See
* Xwindow documentation for more details.
@@ -250,8 +250,8 @@ TkRectInRegion(
*/
int
-TkClipBox(
- TkRegion r,
+XClipBox(
+ Region r,
XRectangle *rect_return)
{
CGRect rect;
@@ -283,7 +283,7 @@ TkClipBox(
void
TkpBuildRegionFromAlphaData(
- TkRegion region, /* Region to update. */
+ Region region, /* Region to update. */
unsigned int x, /* Where in region to update. */
unsigned int y, /* Where in region to update. */
unsigned int width, /* Size of rectangle to update. */
@@ -324,7 +324,7 @@ TkpBuildRegionFromAlphaData(
rect.y = y + y1;
rect.width = end - x1;
rect.height = 1;
- TkUnionRectWithRegion(&rect, region, region);
+ XUnionRectWithRegion(&rect, region, region);
}
}
dataPtr += lineStride;
@@ -349,7 +349,7 @@ TkpBuildRegionFromAlphaData(
static void
RetainRegion(
- TkRegion r)
+ Region r)
{
CFRetain(r);
DebugLog("Retained region: total count is %d\n", ++totalRegionRetainCount);
@@ -373,7 +373,7 @@ RetainRegion(
static void
ReleaseRegion(
- TkRegion r)
+ Region r)
{
CFRelease(r);
DebugLog("Released region: total count is %d\n", --totalRegionRetainCount);
@@ -397,7 +397,7 @@ ReleaseRegion(
void
TkMacOSXSetEmptyRegion(
- TkRegion r)
+ Region r)
{
ChkErr(HIShapeSetEmpty, (HIMutableShapeRef) r);
}
@@ -420,7 +420,7 @@ TkMacOSXSetEmptyRegion(
HIShapeRef
TkMacOSXGetNativeRegion(
- TkRegion r)
+ Region r)
{
return (HIShapeRef) CFRetain(r);
}
@@ -443,7 +443,7 @@ TkMacOSXGetNativeRegion(
void
TkMacOSXSetWithNativeRegion(
- TkRegion r,
+ Region r,
HIShapeRef rgn)
{
ChkErr(TkMacOSXHIShapeSetWithShape, (HIMutableShapeRef) r, rgn);
@@ -467,7 +467,7 @@ TkMacOSXSetWithNativeRegion(
int
XOffsetRegion(
- void *r,
+ Region r,
int dx,
int dy)
{
@@ -557,9 +557,9 @@ TkMacOSHIShapeUnion(
static OSStatus
rectCounter(
- int msg,
+ TCL_UNUSED(int),
TCL_UNUSED(HIShapeRef),
- const CGRect *rect,
+ TCL_UNUSED(const CGRect *),
void *ref)
{
int *count = (int *)ref;
@@ -569,10 +569,10 @@ rectCounter(
static OSStatus
rectPrinter(
- int msg,
+ TCL_UNUSED(int),
TCL_UNUSED(HIShapeRef),
const CGRect *rect,
- void *ref)
+ TCL_UNUSED(void *))
{
if (rect) {
fprintf(stderr, " %s\n", NSStringFromRect(*rect).UTF8String);
diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c
index 5da13d4..c226aeb 100644
--- a/macosx/tkMacOSXScale.c
+++ b/macosx/tkMacOSXScale.c
@@ -4,10 +4,10 @@
* This file implements the Macintosh specific portion of the
* scale widget.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 by Scriptics Corporation.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2008-2009, Apple Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2008-2009 Apple Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -287,6 +287,7 @@ TkpDisplayScale(
SetControlVisibility(macScalePtr->scaleHandle, true, true);
HiliteControl(macScalePtr->scaleHandle, 0);
Draw1Control(macScalePtr->scaleHandle);
+
done:
scalePtr->flags &= ~REDRAW_ALL;
}
@@ -389,10 +390,12 @@ MacScaleEventProc(
fprintf(stderr,"MacScaleEventProc\n" );
#endif
- TkMacOSXWinBounds((TkWindow *) macScalePtr->info.tkwin, &bounds);
- where.h = eventPtr->xbutton.x + bounds.left;
- where.v = eventPtr->xbutton.y + bounds.top;
-#ifdef TK_MAC_DEBUG_SCALE
+ /*
+ * To call Macintosh control routines we must have the port set to the
+ * window containing the control. We will then test which part of the
+ * control was hit and act accordingly.
+ */
+
TkMacOSXDbgMsg("calling TestControl");
#endif
part = TestControl(macScalePtr->scaleHandle, where);
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index b6e3298..6ed53ee 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -4,11 +4,11 @@
* This file implements the Macintosh specific portion of the scrollbar
* widget.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2015 Kevin Walzer/WordTech Commununications LLC.
- * Copyright (c) 2018-2019 Marc Culler
+ * Copyright © 1996 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2015 Kevin Walzer/WordTech Commununications LLC.
+ * Copyright © 2018-2019 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -486,6 +486,7 @@ void
TkpConfigureScrollbar(
TkScrollbar *scrollPtr)
{
+ (void)scrollPtr;
/* empty */
}
@@ -661,7 +662,7 @@ UpdateControlValues(
*
* ScrollbarEvent --
*
- * This procedure is invoked in response to <ButtonPress>,
+ * This procedure is invoked in response to <Button>,
* <ButtonRelease>, <EnterNotify>, and <LeaveNotify> events. The
* Scrollbar appearance is modified for each event.
*
diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c
index a651bcd..5b97923 100644
--- a/macosx/tkMacOSXSend.c
+++ b/macosx/tkMacOSXSend.c
@@ -22,10 +22,10 @@
* may not get done for awhile. So this sketch is offered for the brave
* to attempt if they need the functionality...
*
- * Copyright (c) 1989-1994 The Regents of the University of California.
- * Copyright (c) 1994-1998 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1989-1994 The Regents of the University of California.
+ * Copyright © 1994-1998 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -281,9 +281,9 @@ Tk_SetAppName(
* We have found a unique name. Now add it to the registry.
*/
- riPtr = ckalloc(sizeof(RegisteredInterp));
+ riPtr = (RegisteredInterp *)ckalloc(sizeof(RegisteredInterp));
riPtr->interp = interp;
- riPtr->name = ckalloc(strlen(actualName) + 1);
+ riPtr->name = (char *)ckalloc(strlen(actualName) + 1);
riPtr->nextPtr = interpListPtr;
interpListPtr = riPtr;
strcpy(riPtr->name, actualName);
@@ -320,7 +320,7 @@ Tk_SetAppName(
int
Tk_SendObjCmd(
- ClientData clientData, /* Used only for deletion */
+ ClientData dummy, /* Not used */
Tcl_Interp *interp, /* The interp we are sending from */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* The arguments */
@@ -332,6 +332,7 @@ Tk_SendObjCmd(
RegisteredInterp *riPtr;
Tcl_Obj *listObjPtr;
int result = TCL_OK;
+ (void)dummy;
for (i = 1; i < (objc - 1); ) {
stringRep = Tcl_GetString(objv[i]);
@@ -466,6 +467,7 @@ TkGetInterpNames(
{
Tcl_Obj *listObjPtr;
RegisteredInterp *riPtr;
+ (void)tkwin;
listObjPtr = Tcl_NewListObj(0, NULL);
riPtr = interpListPtr;
@@ -498,10 +500,9 @@ TkGetInterpNames(
static int
SendInit(
- Tcl_Interp *interp) /* Interpreter to use for error reporting (no
- * errors are ever returned, but the
- * interpreter is needed anyway). */
+ Tcl_Interp *dummy) /* Not used */
{
+ (void)dummy;
return TCL_OK;
}
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index 59e3439..c9a46f5 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -3,9 +3,9 @@
*\
* This file allows the integration of Tk and the Cocoa NSServices API.
*
- * Copyright (c) 2010-2019 Kevin Walzer/WordTech Communications LLC.
- * Copyright (c) 2019 Marc Culler.
- * Copyright (c) 2010 Adrian Robert.
+ * Copyright © 2010-2019 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 2019 Marc Culler.
+ * Copyright © 2010 Adrian Robert.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -134,6 +134,7 @@ ServicesEventProc(
@end
/*
+
* Instantiate a TkService object and register it with the NSApplication.
* This is called exactly one time from TkpInit.
*/
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 2a6a04c..21e346a 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -3,9 +3,9 @@
*
* Implements subwindows for the macintosh version of Tk.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -845,15 +845,6 @@ TkMacOSXUpdateClipRgn(
TkMacOSXUpdateClipRgn(win2Ptr);
ChkErr(HIShapeIntersect,
win2Ptr->privatePtr->aboveVisRgn, rgn, rgn);
- } else if (tkMacOSXEmbedHandler != NULL) {
- TkRegion r = TkCreateRegion();
- HIShapeRef visRgn;
-
- tkMacOSXEmbedHandler->getClipProc((Tk_Window)winPtr, r);
- visRgn = TkMacOSXGetNativeRegion(r);
- ChkErr(HIShapeIntersect, visRgn, rgn, rgn);
- CFRelease(visRgn);
- TkDestroyRegion(r);
}
/*
@@ -937,7 +928,7 @@ TkMacOSXUpdateClipRgn(
*
* This function returns the Macintosh clipping region for the given
* window. The caller is responsible for disposing of the returned region
- * via TkDestroyRegion().
+ * via XDestroyRegion().
*
* Results:
* The region.
@@ -948,14 +939,14 @@ TkMacOSXUpdateClipRgn(
*----------------------------------------------------------------------
*/
-TkRegion
+Region
TkMacOSXVisableClipRgn(
TkWindow *winPtr)
{
if (winPtr->privatePtr->flags & TK_CLIP_INVALID) {
TkMacOSXUpdateClipRgn(winPtr);
}
- return (TkRegion) HIShapeCreateMutableCopy(winPtr->privatePtr->visRgn);
+ return (Region) HIShapeCreateMutableCopy(winPtr->privatePtr->visRgn);
}
/*
@@ -1050,7 +1041,8 @@ TkMacOSXInvalidateWindow(
*
* TkMacOSXGetNSWindowForDrawable --
*
- * This function returns the NSWindow for a given X drawable.
+ * This function returns the NSWindow for a given X drawable, if the
+ * drawable is a window. If the drawable is a pixmap it returns nil.
*
* Results:
* A NSWindow, or nil for off screen pixmaps.
@@ -1062,7 +1054,7 @@ TkMacOSXInvalidateWindow(
*/
void *
-TkMacOSXDrawable(
+Tk_MacOSXGetNSWindowForDrawable(
Drawable drawable)
{
MacDrawable *macWin = (MacDrawable *)drawable;
@@ -1090,30 +1082,6 @@ TkMacOSXDrawable(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetDrawablePort --
- *
- * This function only exists because it is listed in the stubs table.
- * It is useless.
- *
- * Results:
- * NULL.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void *
-TkMacOSXGetDrawablePort(
- TCL_UNUSED(Drawable))
-{
- return NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkMacOSXGetNSViewForDrawable/TkMacOSXGetRootControl --
*
* The function name TkMacOSXGetRootControl is being preserved only
@@ -1472,7 +1440,11 @@ Tk_FreePixmap(
if (data) {
ckfree(data);
}
- CFRelease(macPix->context);
+ /*
+ * Releasing the context here causes a crash in the 8.7 regression
+ * tests, but not in 8.6.
+ * CFRelease(macPix->context);
+ */
}
ckfree(macPix);
}
diff --git a/macosx/tkMacOSXSysTray.c b/macosx/tkMacOSXSysTray.c
new file mode 100644
index 0000000..c2e347f
--- /dev/null
+++ b/macosx/tkMacOSXSysTray.c
@@ -0,0 +1,497 @@
+/*
+ * tkMacOSXSysTray.c --
+ *
+ * tkMacOSXSysTray.c implements a "systray" Tcl command which allows
+ * one to change the system tray/taskbar icon of a Tk toplevel
+ * window and a "sysnotify" command to post system notifications.
+ * In macOS the icon appears on the right hand side of the menu bar.
+ *
+ * Copyright © 2020 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 2020 Jan Nijtmans.
+ * Copyright © 2020 Marc Culler.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include <tkInt.h>
+#include <tkMacOSXInt.h>
+#include "tkMacOSXPrivate.h"
+
+/*
+ * Class declaration for TkStatusItem.
+ */
+
+@interface TkStatusItem: NSObject {
+ NSStatusItem * statusItem;
+ NSStatusBar * statusBar;
+ NSImage * icon;
+ NSString * tooltip;
+ Tcl_Interp * interp;
+ Tcl_Obj * b1_callback;
+ Tcl_Obj * b3_callback;
+}
+
+- (id) init : (Tcl_Interp *) interp;
+- (void) setImagewithImage : (NSImage *) image;
+- (void) setTextwithString : (NSString *) string;
+- (void) setB1Callback : (Tcl_Obj *) callback;
+- (void) setB3Callback : (Tcl_Obj *) callback;
+- (void) clickOnStatusItem;
+- (void) dealloc;
+
+@end
+
+
+
+/*
+ * Class declaration for TkStatusItem. A TkStatusItem represents an icon posted
+ * on the status bar located on the right side of the MenuBar. Each interpreter
+ * may have at most one TkStatusItem. A pointer to the TkStatusItem belonging
+ * to an interpreter is stored as the clientData of the MacSystrayObjCmd instance
+ * in that interpreter. It will be NULL until the tk systray command is executed
+ * by the interpreter.
+ */
+
+@implementation TkStatusItem : NSObject
+
+- (id) init : (Tcl_Interp *) interpreter {
+ [super init];
+ statusBar = [NSStatusBar systemStatusBar];
+ statusItem = [[statusBar statusItemWithLength:NSVariableStatusItemLength] retain];
+ statusItem.button.target = self;
+ statusItem.button.action = @selector(clickOnStatusItem);
+ [statusItem.button sendActionOn : NSEventMaskLeftMouseUp | NSEventMaskRightMouseUp];
+ statusItem.visible = YES;
+ interp = interpreter;
+ b1_callback = NULL;
+ b3_callback = NULL;
+ return self;
+}
+
+- (void) setImagewithImage : (NSImage *) image
+{
+ icon = nil;
+ icon = image;
+ statusItem.button.image = icon;
+}
+
+- (void) setTextwithString : (NSString *) string
+{
+ tooltip = nil;
+ tooltip = string;
+ statusItem.button.toolTip = tooltip;
+}
+
+- (void) setB1Callback : (Tcl_Obj *) obj
+{
+ if (obj != NULL) {
+ Tcl_IncrRefCount(obj);
+ }
+ if (b1_callback != NULL) {
+ Tcl_DecrRefCount(b1_callback);
+ }
+ b1_callback = obj;
+}
+
+- (void) setB3Callback : (Tcl_Obj *) obj
+{
+ if (obj != NULL) {
+ Tcl_IncrRefCount(obj);
+ }
+ if (b3_callback != NULL) {
+ Tcl_DecrRefCount(b3_callback);
+ }
+ b3_callback = obj;
+}
+
+- (void) clickOnStatusItem
+{
+ NSEvent *event = [NSApp currentEvent];
+ if (([event type] == NSEventTypeLeftMouseUp) && (b1_callback != NULL)) {
+ int result = Tcl_EvalObjEx(interp, b1_callback, TCL_EVAL_GLOBAL);
+ if (result != TCL_OK) {
+ Tcl_BackgroundException(interp, result);
+ }
+ } else {
+ if (([event type] == NSEventTypeRightMouseUp) && (b3_callback != NULL)) {
+ int result = Tcl_EvalObjEx(interp, b3_callback, TCL_EVAL_GLOBAL);
+ if (result != TCL_OK) {
+ Tcl_BackgroundException(interp, result);
+ }
+ }
+ }
+}
+- (void) dealloc
+{
+ [statusBar removeStatusItem: statusItem];
+ if (b1_callback != NULL) {
+ Tcl_DecrRefCount(b1_callback);
+ }
+ if (b3_callback != NULL) {
+ Tcl_DecrRefCount(b3_callback);
+ }
+ [super dealloc];
+}
+
+@end
+
+/*
+ * Type used for the ClientData of a MacSystrayObjCmd instance.
+ */
+
+typedef TkStatusItem** StatusItemInfo;
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MacSystrayDestroy --
+ *
+ * Removes an intepreters icon from the status bar.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The icon is removed and memory is freed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+MacSystrayDestroy(
+ ClientData clientData,
+ TCL_UNUSED(Tcl_Interp *))
+{
+ StatusItemInfo info = (StatusItemInfo)clientData;
+ if (info) {
+ [*info release];
+ ckfree(info);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MacSystrayObjCmd --
+ *
+ * Main command for creating, displaying, and removing icons from the
+ * status bar.
+ *
+ * Results:
+ *
+ * A standard Tcl result.
+ *
+ * Side effects:
+ *
+ * Management of icon display in the status bar.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+MacSystrayObjCmd(
+ void *clientData,
+ Tcl_Interp * interp,
+ int objc,
+ Tcl_Obj *const *objv)
+{
+ Tk_Image tk_image;
+ int result, idx;
+ static const char *options[] =
+ {"create", "modify", "destroy", NULL};
+ typedef enum {TRAY_CREATE, TRAY_MODIFY, TRAY_DESTROY} optionsEnum;
+ static const char *modifyOptions[] =
+ {"image", "text", "b1_callback", "b3_callback", NULL};
+ typedef enum {TRAY_IMAGE, TRAY_TEXT, TRAY_B1_CALLBACK, TRAY_B3_CALLBACK
+ } modifyOptionsEnum;
+
+ if ([NSApp macOSVersion] < 101000) {
+ Tcl_AppendResult(interp,
+ "StatusItem icons not supported on macOS versions lower than 10.10",
+ NULL);
+ return TCL_OK;
+ }
+
+ StatusItemInfo info = (StatusItemInfo)clientData;
+ TkStatusItem *statusItem = *info;
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "create | modify | destroy");
+ return TCL_ERROR;
+ }
+
+ result = Tcl_GetIndexFromObjStruct(interp, objv[1], options,
+ sizeof(char *), "command", 0, &idx);
+
+ if (result != TCL_OK) {
+ return TCL_ERROR;
+ }
+ switch((optionsEnum)idx) {
+ case TRAY_CREATE: {
+
+ if (objc < 3 || objc > 6) {
+ Tcl_WrongNumArgs(interp, 1, objv, "create -image -text -button1 -button3");
+ return TCL_ERROR;
+ }
+
+ if (statusItem == NULL) {
+ statusItem = [[TkStatusItem alloc] init: interp];
+ *info = statusItem;
+ } else {
+ Tcl_AppendResult(interp, "Only one system tray icon supported per interpreter", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Create the icon.
+ */
+
+ int width, height;
+ Tk_Window tkwin = Tk_MainWindow(interp);
+ TkWindow *winPtr = (TkWindow *)tkwin;
+ Display *d = winPtr->display;
+ NSImage *icon;
+
+ tk_image = Tk_GetImage(interp, tkwin, Tcl_GetString(objv[2]), NULL, NULL);
+ if (tk_image == NULL) {
+ return TCL_ERROR;
+ }
+
+ Tk_SizeOfImage(tk_image, &width, &height);
+ if (width != 0 && height != 0) {
+ icon = TkMacOSXGetNSImageFromTkImage(d, tk_image,
+ width, height);
+ [statusItem setImagewithImage: icon];
+ Tk_FreeImage(tk_image);
+ }
+
+ /*
+ * Set the text for the tooltip.
+ */
+
+ NSString *tooltip = [NSString stringWithUTF8String: Tcl_GetString(objv[3])];
+ if (tooltip == nil) {
+ Tcl_AppendResult(interp, " unable to set tooltip for systray icon", NULL);
+ return TCL_ERROR;
+ }
+
+ [statusItem setTextwithString: tooltip];
+
+ /*
+ * Set the proc for the callback.
+ */
+
+ [statusItem setB1Callback : (objc > 4) ? objv[4] : NULL];
+ [statusItem setB3Callback : (objc > 5) ? objv[5] : NULL];
+ break;
+
+ }
+ case TRAY_MODIFY: {
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 1, objv, "modify object item");
+ return TCL_ERROR;
+ }
+
+ /*
+ * Modify the icon.
+ */
+
+ result = Tcl_GetIndexFromObjStruct(interp, objv[2], modifyOptions,
+ sizeof(char *), "option", 0, &idx);
+
+ if (result != TCL_OK) {
+ return TCL_ERROR;
+ }
+ switch ((modifyOptionsEnum)idx) {
+ case TRAY_IMAGE: {
+ Tk_Window tkwin = Tk_MainWindow(interp);
+ TkWindow *winPtr = (TkWindow *)tkwin;
+ Display *d = winPtr -> display;
+ NSImage *icon;
+ int width, height;
+
+ tk_image = Tk_GetImage(interp, tkwin, Tcl_GetString(objv[3]), NULL, NULL);
+ if (tk_image == NULL) {
+ Tcl_AppendResult(interp, " unable to obtain image for systray icon",
+ NULL);
+ return TCL_ERROR;
+ }
+
+ Tk_SizeOfImage(tk_image, &width, &height);
+ if (width != 0 && height != 0) {
+ icon = TkMacOSXGetNSImageFromTkImage(d, tk_image,
+ width, height);
+ [statusItem setImagewithImage: icon];
+ }
+ Tk_FreeImage(tk_image);
+ break;
+ }
+
+ /*
+ * Modify the text for the tooltip.
+ */
+
+ case TRAY_TEXT: {
+ NSString *tooltip = [NSString stringWithUTF8String:Tcl_GetString(objv[3])];
+ if (tooltip == nil) {
+ Tcl_AppendResult(interp, "unable to set tooltip for systray icon",
+ NULL);
+ return TCL_ERROR;
+ }
+
+ [statusItem setTextwithString: tooltip];
+ break;
+ }
+
+ /*
+ * Modify the proc for the callback.
+ */
+
+ case TRAY_B1_CALLBACK: {
+ [statusItem setB1Callback : objv[3]];
+ break;
+ }
+ case TRAY_B3_CALLBACK: {
+ [statusItem setB3Callback : objv[3]];
+ break;
+ }
+ }
+ break;
+ }
+
+ case TRAY_DESTROY: {
+ /*
+ * Set all properties to nil, and release statusItem.
+ */
+ [statusItem setImagewithImage: nil];
+ [statusItem setTextwithString: nil];
+ [statusItem setB1Callback : NULL];
+ [statusItem setB3Callback : NULL];
+ [statusItem release];
+ *info = NULL;
+ statusItem = NULL;
+ break;
+ }
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SysNotifyObjCmd --
+ *
+ * Create system notification.
+ *
+ * Results:
+ *
+ * A standard Tcl result.
+ *
+ * Side effects:
+ *
+ * System notifications are posted.
+ *
+ *-------------------------------z---------------------------------------
+ */
+
+static int SysNotifyObjCmd(
+ TCL_UNUSED(void *),
+ Tcl_Interp * interp,
+ int objc,
+ Tcl_Obj *const *objv)
+{
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "title message");
+ return TCL_ERROR;
+ }
+
+ if ([NSApp macOSVersion] < 101000) {
+ Tcl_AppendResult(interp,
+ "Notifications not supported on macOS versions lower than 10.10",
+ NULL);
+ return TCL_OK;
+ }
+
+ /*
+ * Using NSAppleScript API here allows us to use a single API rather
+ * than multiple, some deprecated, API's, and also allows notifications
+ * to work correctly without requiring Wish to be code-signed - an
+ * undocumented but apparently consistent requirement. And by calling
+ * NSAppleScript inline rather than shelling to out osascript,
+ * Wish shows correctly as the calling app rather than Script Editor.
+ */
+
+ NSString *title = [NSString stringWithUTF8String: Tcl_GetString(objv[1])];
+ NSString *message = [NSString stringWithUTF8String: Tcl_GetString(objv[2])];
+ NSMutableString *notify = [NSMutableString new];
+ [notify appendString: @"display notification "];
+ [notify appendString:@"\""];
+ [notify appendString:message];
+ [notify appendString:@"\""];
+ [notify appendString:@" with title \""];
+ [notify appendString:title];
+ [notify appendString:@"\""];
+ NSAppleScript *scpt = [[[NSAppleScript alloc] initWithSource:notify] autorelease];
+ NSDictionary *errorInfo;
+ NSAppleEventDescriptor *result = [scpt executeAndReturnError:&errorInfo];
+ NSString *info = [result stringValue];
+ const char* output = [info UTF8String];
+
+ Tcl_AppendResult(interp,
+ output,
+ NULL);
+
+ return TCL_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MacSystrayInit --
+ *
+ * Initialize this package and create script-level commands.
+ * This is called from TkpInit for each interpreter.
+ *
+ * Results:
+ *
+ * A standard Tcl result.
+ *
+ * Side effects:
+ *
+ * The tk systray and tk sysnotify commands are installed in an
+ * interpreter
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+MacSystrayInit(Tcl_Interp *interp)
+{
+
+ /*
+ * Initialize the TkStatusItem for this interpreter.
+ */
+
+ StatusItemInfo info = (StatusItemInfo) ckalloc(sizeof(StatusItemInfo));
+ *info = 0;
+
+ Tcl_CreateObjCommand(interp, "::tk::systray::_systray", MacSystrayObjCmd, info,
+ (Tcl_CmdDeleteProc *)MacSystrayDestroy);
+ Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", SysNotifyObjCmd, NULL, NULL);
+ return TCL_OK;
+}
+
+
+/*
+ * Local Variables:
+ * mode: objc
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 5d7e626..60167ca 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -4,9 +4,9 @@
* Contains commands for platform specific tests for
* the Macintosh platform.
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1996 Sun Microsystems, Inc.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -126,7 +126,7 @@ MenuBarHeightObjCmd(
if (height == 0) {
height = (int) [[NSApp mainMenu] menuBarHeight];
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(height));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(height));
return TCL_OK;
}
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 410c4b5..68d913e 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -4,10 +4,10 @@
* This file defines the routines for both creating and handling Window
* Manager class events for Tk.
*
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2015 Kevin Walzer/WordTech Communications LLC.
- * Copyright (c) 2015 Marc Culler.
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2015 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 2015 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -15,7 +15,7 @@
#include "tkMacOSXPrivate.h"
#include "tkMacOSXWm.h"
-#include "tkMacOSXEvent.h"
+#include "tkMacOSXInt.h"
#include "tkMacOSXDebug.h"
#include "tkMacOSXConstants.h"
@@ -1189,9 +1189,9 @@ static const char *const accentNames[] = {
static const char *defaultColor = NULL;
if (effectiveAppearanceName == NSAppearanceNameAqua) {
- TkSendVirtualEvent(tkwin, "LightAqua", NULL);
+ Tk_SendVirtualEvent(tkwin, "LightAqua", NULL);
} else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) {
- TkSendVirtualEvent(tkwin, "DarkAqua", NULL);
+ Tk_SendVirtualEvent(tkwin, "DarkAqua", NULL);
}
if ([NSApp macOSVersion] < 101500) {
@@ -1227,7 +1227,7 @@ static const char *const accentNames[] = {
snprintf(data, 256, "Appearance %s Accent %s Highlight %s",
effectiveAppearanceName.UTF8String, accentName,
highlightName);
- TkSendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, -1));
+ Tk_SendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, -1));
}
- (void)observeValueForKeyPath:(NSString *)keyPath
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 0f49e4b..c59950b 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -5,11 +5,11 @@
* application and the window manager. Among other things, it implements
* the "wm" command and passes geometry information to the window manager.
*
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2010 Kevin Walzer/WordTech Communications LLC.
- * Copyright (c) 2017-2019 Marc Culler.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2010 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 2017-2019 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -18,7 +18,7 @@
#include "tkMacOSXPrivate.h"
#include "tkScrollbar.h"
#include "tkMacOSXWm.h"
-#include "tkMacOSXEvent.h"
+#include "tkMacOSXInt.h"
#include "tkMacOSXDebug.h"
#include "tkMacOSXConstants.h"
@@ -183,7 +183,7 @@ static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
static const Tk_GeomMgr wmMgrType = {
"wm", /* name */
TopLevelReqProc, /* requestProc */
- NULL, /* lostSlaveProc */
+ NULL, /* lostContentProc */
};
/*
@@ -776,7 +776,7 @@ TkWmNewWindow(
*/
static Tk_RestrictAction
MapUnmapRestrictProc(
- ClientData arg,
+ TCL_UNUSED(void*),
XEvent *eventPtr)
{
return (eventPtr->type==MapNotify || eventPtr->type==UnmapNotify ?
@@ -1226,7 +1226,7 @@ Tk_WmObjCmd(
return TCL_ERROR;
}
if (objc == 2) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(wmTracing));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(wmTracing != 0));
return TCL_OK;
}
return Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing);
@@ -1362,10 +1362,10 @@ WmAspectCmd(
if (wmPtr->sizeHintsFlags & PAspect) {
Tcl_Obj *results[4];
- results[0] = Tcl_NewIntObj(wmPtr->minAspect.x);
- results[1] = Tcl_NewIntObj(wmPtr->minAspect.y);
- results[2] = Tcl_NewIntObj(wmPtr->maxAspect.x);
- results[3] = Tcl_NewIntObj(wmPtr->maxAspect.y);
+ results[0] = Tcl_NewWideIntObj(wmPtr->minAspect.x);
+ results[1] = Tcl_NewWideIntObj(wmPtr->minAspect.y);
+ results[2] = Tcl_NewWideIntObj(wmPtr->maxAspect.x);
+ results[3] = Tcl_NewWideIntObj(wmPtr->maxAspect.y);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
@@ -1568,20 +1568,20 @@ WmGetAttribute(
result = Tcl_NewBooleanObj([macWindow styleMask] & NSFullScreenWindowMask);
break;
case WMATT_MODIFIED:
- result = Tcl_NewBooleanObj([macWindow isDocumentEdited]);
+ result = Tcl_NewWideIntObj([macWindow isDocumentEdited] != 0);
break;
case WMATT_NOTIFY:
- result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal);
+ result = Tcl_NewWideIntObj(tkMacOSXWmAttrNotifyVal != 0);
break;
case WMATT_TITLEPATH:
result = Tcl_NewStringObj([[macWindow representedFilename] UTF8String],
-1);
break;
case WMATT_TOPMOST:
- result = Tcl_NewBooleanObj(wmPtr->flags & WM_TOPMOST);
+ result = Tcl_NewWideIntObj((wmPtr->flags & WM_TOPMOST) != 0);
break;
case WMATT_TRANSPARENT:
- result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT);
+ result = Tcl_NewWideIntObj((wmPtr->flags & WM_TRANSPARENT) != 0);
break;
case WMATT_TYPE:
result = Tcl_NewStringObj("unsupported", -1);
@@ -1764,7 +1764,7 @@ WmColormapwindowsCmd(
break;
}
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window)wmPtr->cmapList[i]));
+ Tk_NewWindowObj((Tk_Window)wmPtr->cmapList[i]));
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
@@ -2218,10 +2218,10 @@ WmGridCmd(
if (wmPtr->sizeHintsFlags & PBaseSize) {
Tcl_Obj *results[4];
- results[0] = Tcl_NewIntObj(wmPtr->reqGridWidth);
- results[1] = Tcl_NewIntObj(wmPtr->reqGridHeight);
- results[2] = Tcl_NewIntObj(wmPtr->widthInc);
- results[3] = Tcl_NewIntObj(wmPtr->heightInc);
+ results[0] = Tcl_NewWideIntObj(wmPtr->reqGridWidth);
+ results[1] = Tcl_NewWideIntObj(wmPtr->reqGridHeight);
+ results[2] = Tcl_NewWideIntObj(wmPtr->widthInc);
+ results[3] = Tcl_NewWideIntObj(wmPtr->heightInc);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
@@ -2452,13 +2452,13 @@ WmIconifyCmd(
return TCL_ERROR;
} else if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an icon for %s",
+ "can't iconify \"%s\": it is an icon for \"%s\"",
winPtr->pathName, Tk_PathName(wmPtr->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL);
return TCL_ERROR;
} else if (winPtr->flags & TK_EMBEDDED) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an embedded window",
+ "can't iconify \"%s\": it is an embedded window",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL);
return TCL_ERROR;
@@ -2727,8 +2727,8 @@ WmIconpositionCmd(
if (wmPtr->hints.flags & IconPositionHint) {
Tcl_Obj *results[2];
- results[0] = Tcl_NewIntObj(wmPtr->hints.icon_x);
- results[1] = Tcl_NewIntObj(wmPtr->hints.icon_y);
+ results[0] = Tcl_NewWideIntObj(wmPtr->hints.icon_x);
+ results[1] = Tcl_NewWideIntObj(wmPtr->hints.icon_y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
}
return TCL_OK;
@@ -2784,7 +2784,7 @@ WmIconwindowCmd(
if (objc == 3) {
if (wmPtr->icon != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(wmPtr->icon));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(wmPtr->icon));
}
return TCL_OK;
}
@@ -2964,8 +2964,8 @@ WmMaxsizeCmd(
Tcl_Obj *results[2];
GetMaxSize(winPtr, &width, &height);
- results[0] = Tcl_NewIntObj(width);
- results[1] = Tcl_NewIntObj(height);
+ results[0] = Tcl_NewWideIntObj(width);
+ results[1] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
@@ -3018,8 +3018,8 @@ WmMinsizeCmd(
Tcl_Obj *results[2];
GetMinSize(winPtr, &width, &height);
- results[0] = Tcl_NewIntObj(width);
- results[1] = Tcl_NewIntObj(height);
+ results[0] = Tcl_NewWideIntObj(width);
+ results[1] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
@@ -3071,7 +3071,7 @@ WmOverrideredirectCmd(
if (objc == 3) {
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- Tk_Attributes((Tk_Window)winPtr)->override_redirect));
+ Tk_Attributes((Tk_Window) winPtr)->override_redirect));
return TCL_OK;
}
@@ -3289,8 +3289,10 @@ WmResizableCmd(
if (objc == 3) {
Tcl_Obj *results[2];
- results[0] = Tcl_NewBooleanObj(!(wmPtr->flags & WM_WIDTH_NOT_RESIZABLE));
- results[1] = Tcl_NewBooleanObj(!(wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE));
+ results[0] = Tcl_NewWideIntObj(
+ (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) == 0);
+ results[1] = Tcl_NewWideIntObj(
+ (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) == 0);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
@@ -3440,7 +3442,7 @@ WmStackorderCmd(
resultObj = Tcl_NewObj();
for (windowPtr = windows; *windowPtr ; windowPtr++) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window)*windowPtr));
+ Tk_NewWindowObj((Tk_Window)*windowPtr));
}
Tcl_SetObjResult(interp, resultObj);
ckfree(windows);
@@ -3515,7 +3517,7 @@ WmStackorderCmd(
} else { /* OPT_ISBELOW */
result = index1 < index2;
}
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result != 0));
return TCL_OK;
}
}
@@ -3560,14 +3562,14 @@ WmStateCmd(
if (objc == 4) {
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't change state of %s: it is an icon for %s",
+ "can't change state of \"%s\": it is an icon for \"%s\"",
Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "ICON", NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't change state of %s: it is an embedded window",
+ "can't change state of \"%s\": it is an embedded window",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "EMBEDDED", NULL);
return TCL_ERROR;
@@ -3720,7 +3722,7 @@ WmTransientCmd(
Transient *transient;
if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?master?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?window?");
return TCL_ERROR;
}
if (objc == 3) {
@@ -3763,7 +3765,7 @@ WmTransientCmd(
if (wmPtr2 != NULL && wmPtr2->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't make \"%s\" a master: it is an icon for %s",
+ "can't make \"%s\" a container: it is an icon for %s",
Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
return TCL_ERROR;
@@ -3773,7 +3775,7 @@ WmTransientCmd(
w = (TkWindow *)w->wmInfoPtr->container) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "setting \"%s\" as master creates a transient/master cycle",
+ "can't set \"%s\" as container: would cause management loop",
Tk_PathName(containerPtr)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
return TCL_ERROR;
@@ -4636,27 +4638,6 @@ Tk_GetRootCoords(
otherPtr = TkpGetOtherWindow(winPtr);
if (otherPtr == NULL) {
- if (tkMacOSXEmbedHandler->getOffsetProc != NULL) {
- Point theOffset;
-
- /*
- * We do not require that the changes.x & changes.y for a
- * non-Tk container window be kept up to date. So we
- * first subtract off the possibly bogus values that have
- * been added on at the top of this pass through the
- * loop, and then call out to the getOffsetProc to give
- * us the correct offset.
- */
-
- x -= winPtr->changes.x + winPtr->changes.border_width;
- y -= winPtr->changes.y + winPtr->changes.border_width;
-
- tkMacOSXEmbedHandler->getOffsetProc((Tk_Window)winPtr,
- &theOffset);
-
- x += theOffset.h;
- y += theOffset.v;
- }
break;
}
@@ -5950,7 +5931,14 @@ WmWinTabbingId(
int objc, /* Number of arguments. */
Tcl_Obj * const objv[]) /* Argument objects. */
{
-#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101200)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
+ (void) interp;
+ (void) winPtr;
+ (void) objc;
+ (void) objv;
+ return TCL_OK;
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
Tcl_Obj *result = NULL;
NSString *idString;
NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window);
@@ -6029,6 +6017,13 @@ WmWinAppearance(
int objc, /* Number of arguments. */
Tcl_Obj * const objv[]) /* Argument objects. */
{
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1090
+ (void) interp;
+ (void) winPtr;
+ (void) objc;
+ (void) objv;
+ return TCL_OK;
+#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090
static const char *const appearanceStrings[] = {
"aqua", "darkaqua", "auto", NULL
@@ -6179,14 +6174,7 @@ TkMacOSXMakeRealWindowExist(
return;
}
- if (tkMacOSXEmbedHandler == NULL) {
- Tcl_Panic("TkMacOSXMakeRealWindowExist could not find container");
- }
- if (tkMacOSXEmbedHandler->containerExistProc &&
- tkMacOSXEmbedHandler->containerExistProc((Tk_Window)winPtr)
- != TCL_OK) {
- Tcl_Panic("ContainerExistProc could not make container");
- }
+ Tcl_Panic("TkMacOSXMakeRealWindowExist could not find container");
return;
/*
diff --git a/macosx/tkMacOSXWm.h b/macosx/tkMacOSXWm.h
index 19bf379..6b0ee69 100644
--- a/macosx/tkMacOSXWm.h
+++ b/macosx/tkMacOSXWm.h
@@ -3,8 +3,8 @@
*
* Declarations of Macintosh specific window manager structures.
*
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2001-2009 Apple Inc.
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -47,7 +47,6 @@ typedef struct Transient {
} Transient;
#define WITHDRAWN_BY_CONTAINER 0x1
-#define WITHDRAWN_BY_MASTER 0x1
/*
* A data structure of the following type holds window-manager-related
diff --git a/macosx/tkMacOSXXCursors.h b/macosx/tkMacOSXXCursors.h
index 1363bee..9beda5e 100644
--- a/macosx/tkMacOSXXCursors.h
+++ b/macosx/tkMacOSXXCursors.h
@@ -5,9 +5,9 @@
* emulate the X cursor set. All of these cursors were
* constructed and donated by Grant Neufeld. (gneufeld@ccs.carleton.ca)
*
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- * Copyright 2008-2009, Apple Inc.
- * Copyright (c) 2008-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 1995-1996 Sun Microsystems, Inc.
+ * Copyright © 2008-2009 Apple Inc.
+ * Copyright © 2008-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index aa1108e..208bb45 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -6,17 +6,17 @@
* their implementation just doesn't do anything. Other calls will
* eventually be moved into other files.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
- * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2014 Marc Culler.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2001-2009, Apple Inc.
+ * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2014 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXPrivate.h"
-#include "tkMacOSXEvent.h"
+#include "tkMacOSXInt.h"
#include <IOKit/IOKitLib.h>
#include <IOKit/hidsystem/IOHIDShared.h>
@@ -167,7 +167,7 @@ TkMacOSXZeroScreenTop()
/*
*----------------------------------------------------------------------
*
- * TkpOpenDisplay --
+ * TkpOpenDisplay/XkbOpenDisplay --
*
* Create the Display structure and fill it with device specific
* information.
@@ -186,11 +186,6 @@ TkpOpenDisplay(
const char *display_name)
{
Display *display;
- Screen *screen;
- int fd = 0;
- static NSRect maxBounds = {{0, 0}, {0, 0}};
- static char vendor[25] = "";
- NSArray *cgVers;
NSAutoreleasePool *pool = [NSAutoreleasePool new];
if (gMacDisplay != NULL) {
@@ -201,8 +196,49 @@ TkpOpenDisplay(
}
}
- display = (Display *)ckalloc(sizeof(Display));
- screen = (Screen *)ckalloc(sizeof(Screen));
+ display = XkbOpenDisplay((char *)display_name, NULL, NULL, NULL, NULL, NULL);
+
+ /*
+ * Initialize screen bits that may change
+ */
+
+ TkMacOSXDisplayChanged(display);
+
+ gMacDisplay = (TkDisplay *)ckalloc(sizeof(TkDisplay));
+
+ /*
+ * This is the quickest way to make sure that all the *Init flags get
+ * properly initialized
+ */
+
+ bzero(gMacDisplay, sizeof(TkDisplay));
+ gMacDisplay->display = display;
+ [pool drain];
+
+ /*
+ * Key map info must be available immediately, because of "send event".
+ */
+ TkpInitKeymapInfo(gMacDisplay);
+
+ return gMacDisplay;
+}
+
+Display *
+XkbOpenDisplay(
+ TCL_UNUSED(const char *),
+ int *ev_rtrn,
+ int *err_rtrn,
+ int *major_rtrn,
+ int *minor_rtrn,
+ int *reason)
+{
+ Display *display = (Display *)ckalloc(sizeof(Display));
+ Screen *screen = (Screen *)ckalloc(sizeof(Screen));
+ int fd = 0;
+ NSArray *cgVers;
+ static char vendor[25] = "";
+ static NSRect maxBounds = {{0, 0}, {0, 0}};
+
bzero(display, sizeof(Display));
bzero(screen, sizeof(Screen));
@@ -215,6 +251,24 @@ TkpOpenDisplay(
display->default_screen = 0;
display->display_name = (char *) macScreenName;
+ /*
+ * These screen bits never change
+ */
+ screen->root = ROOT_ID;
+ screen->display = display;
+ screen->black_pixel = 0x00000000;
+ screen->white_pixel = 0x00FFFFFF;
+ screen->ext_data = (XExtData *) &maxBounds;
+
+ screen->root_visual = (Visual *)ckalloc(sizeof(Visual));
+ screen->root_visual->visualid = 0;
+ screen->root_visual->c_class = TrueColor;
+ screen->root_visual->red_mask = 0x00FF0000;
+ screen->root_visual->green_mask = 0x0000FF00;
+ screen->root_visual->blue_mask = 0x000000FF;
+ screen->root_visual->bits_per_rgb = 24;
+ screen->root_visual->map_entries = 256;
+
cgVers = [[[NSBundle bundleWithIdentifier:@"com.apple.CoreGraphics"]
objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
componentsSeparatedByString:@"."];
@@ -245,47 +299,14 @@ TkpOpenDisplay(
display->release = major << 16 | minor << 8 | patch;
}
- /*
- * These screen bits never change
- */
- screen->root = ROOT_ID;
- screen->display = display;
- screen->black_pixel = 0x00000000;
- screen->white_pixel = 0x00FFFFFF;
- screen->ext_data = (XExtData *) &maxBounds;
-
- screen->root_visual = (Visual *)ckalloc(sizeof(Visual));
- screen->root_visual->visualid = 0;
- screen->root_visual->c_class = TrueColor;
- screen->root_visual->red_mask = 0x00FF0000;
- screen->root_visual->green_mask = 0x0000FF00;
- screen->root_visual->blue_mask = 0x000000FF;
- screen->root_visual->bits_per_rgb = 24;
- screen->root_visual->map_entries = 256;
-
- /*
- * Initialize screen bits that may change
- */
-
- TkMacOSXDisplayChanged(display);
- gMacDisplay = (TkDisplay *)ckalloc(sizeof(TkDisplay));
+ if (ev_rtrn) *ev_rtrn = 0;
+ if (err_rtrn) *err_rtrn = 0;
+ if (major_rtrn) *major_rtrn = 0;
+ if (minor_rtrn) *minor_rtrn = 0;
+ if (reason) *reason = 0;
- /*
- * This is the quickest way to make sure that all the *Init flags get
- * properly initialized
- */
-
- bzero(gMacDisplay, sizeof(TkDisplay));
- gMacDisplay->display = display;
- [pool drain];
-
- /*
- * Key map info must be available immediately, because of "send event".
- */
- TkpInitKeymapInfo(gMacDisplay);
-
- return gMacDisplay;
+ return display;
}
/*
@@ -523,6 +544,30 @@ XBell(
return Success;
}
+#if 0
+void
+XSetWMNormalHints(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(XSizeHints *))
+{
+ /*
+ * Do nothing. Shouldn't even be called.
+ */
+}
+
+XSizeHints *
+XAllocSizeHints(void)
+{
+ /*
+ * Always return NULL. Tk code checks to see if NULL is returned & does
+ * nothing if it is.
+ */
+
+ return NULL;
+}
+#endif
+
GContext
XGContextFromGC(
TCL_UNUSED(GC))
@@ -554,6 +599,31 @@ XClearWindow(
return Success;
}
+/*
+int
+XDrawPoint(
+ Display* display,
+ Drawable d,
+ GC gc,
+ int x,
+ int y)
+{
+ return Success;
+}
+
+int
+XDrawPoints(
+ Display* display,
+ Drawable d,
+ GC gc,
+ XPoint* points,
+ int npoints,
+ int mode)
+{
+ return Success;
+}
+*/
+
int
XWarpPointer(
TCL_UNUSED(Display *),
@@ -591,6 +661,94 @@ XQueryColor(
return Success;
}
+Bool
+XTranslateCoordinates(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int *),
+ TCL_UNUSED(int *),
+ TCL_UNUSED(Window *))
+{
+ return 0;
+}
+
+int
+XSetCommand(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(char **),
+ TCL_UNUSED(int))
+{
+ return Success;
+}
+
+int
+XGetWindowAttributes(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(XWindowAttributes *))
+{
+ return Success;
+}
+
+Status
+XGetWMColormapWindows(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Window **),
+ TCL_UNUSED(int *))
+{
+ return Success;
+}
+
+int
+XIconifyWindow(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(int))
+{
+ return Success;
+}
+
+XHostAddress *
+XListHosts(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(int *),
+ TCL_UNUSED(Bool *))
+{
+ return NULL;
+}
+
+int
+XLookupColor(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Colormap),
+ TCL_UNUSED(_Xconst char *),
+ TCL_UNUSED(XColor *),
+ TCL_UNUSED(XColor *))
+{
+ return Success;
+}
+
+int
+XNextEvent(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(XEvent *))
+{
+ return Success;
+}
+
+int
+XPutBackEvent(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(XEvent *))
+{
+ return Success;
+}
+
int
XQueryColors(
TCL_UNUSED(Display *),
@@ -653,6 +811,37 @@ XGetWindowProperty(
}
int
+XWindowEvent(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(long),
+ TCL_UNUSED(XEvent *))
+{
+ return Success;
+}
+
+int
+XWithdrawWindow(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(int))
+{
+ return Success;
+}
+
+int
+XmbLookupString(
+ TCL_UNUSED(XIC),
+ TCL_UNUSED(XKeyPressedEvent *),
+ TCL_UNUSED(char *),
+ TCL_UNUSED(int),
+ TCL_UNUSED(KeySym *),
+ TCL_UNUSED(Status *))
+{
+ return Success;
+}
+
+int
XRefreshKeyboardMapping(
TCL_UNUSED(XMappingEvent *))
{
@@ -688,36 +877,7 @@ XForceScreenSaver(
display->request++;
return Success;
}
-
-void
-Tk_FreeXId(
- TCL_UNUSED(Display *),
- TCL_UNUSED(XID))
-{
- /* no-op function needed for stubs implementation. */
-}
-
-int
-XSync(
- Display *display,
- TCL_UNUSED(Bool))
-{
- /*
- * The main use of XSync is by the update command, which alternates
- * between running an event loop to process all events without waiting and
- * calling XSync on all displays until no events are left. There is
- * nothing for the mac to do with respect to syncing its one display but
- * it can (and, during regression testing, frequently does) happen that
- * timer events fire during the event loop. Processing those here seems
- * to make the update command work in a way that is more consistent with
- * its behavior on other platforms.
- */
-
- while (Tcl_DoOneEvent(TCL_TIMER_EVENTS|TCL_DONT_WAIT)){}
- display->request++;
- return 0;
-}
-
+
int
XSetClipRectangles(
Display *d,
@@ -726,7 +886,7 @@ XSetClipRectangles(
int clip_y_origin,
XRectangle* rectangles,
int n,
- int ordering)
+ TCL_UNUSED(int))
{
TkRegion clipRgn = TkCreateRegion();
@@ -889,7 +1049,25 @@ XCreateIC(TCL_UNUSED(XIM), ...)
return (XIC) 0;
}
-#undef XVisualIDFromVisual
+int
+XDeleteProperty(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Atom))
+{
+ return Success;
+}
+
+int
+XGetInputFocus(
+ Display *display,
+ TCL_UNUSED(Window *),
+ TCL_UNUSED(int *))
+{
+ display->request++;
+ return Success;
+}
+
VisualID
XVisualIDFromVisual(
Visual *visual)
@@ -897,7 +1075,6 @@ XVisualIDFromVisual(
return visual->visualid;
}
-#undef XSynchronize
XAfterFunction
XSynchronize(
Display *display,
@@ -907,7 +1084,6 @@ XSynchronize(
return NULL;
}
-#undef XUngrabServer
int
XUngrabServer(
TCL_UNUSED(Display *))
@@ -915,7 +1091,14 @@ XUngrabServer(
return 0;
}
-#undef XNoOp
+int
+XFreeCursor(
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Cursor))
+{
+ return Success;
+}
+
int
XNoOp(
Display *display)
@@ -924,7 +1107,6 @@ XNoOp(
return 0;
}
-#undef XGrabServer
int
XGrabServer(
TCL_UNUSED(Display *))
@@ -932,7 +1114,6 @@ XGrabServer(
return 0;
}
-#undef XFree
int
XFree(
void *data)
@@ -942,7 +1123,7 @@ XFree(
}
return 0;
}
-#undef XFlush
+
int
XFlush(
TCL_UNUSED(Display *))
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 8379812..bc96b6b 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -3,12 +3,12 @@
*
* Tk theme engine for Mac OSX, using the Appearance Manager API.
*
- * Copyright (c) 2004 Joe English
- * Copyright (c) 2005 Neil Madden
- * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2008-2009, Apple Inc.
- * Copyright 2009 Kevin Walzer/WordTech Communications LLC.
- * Copyright 2019 Marc Culler
+ * Copyright © 2004 Joe English
+ * Copyright © 2005 Neil Madden
+ * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright © 2008-2009 Apple Inc.
+ * Copyright © 2009 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 2019 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -1747,9 +1747,9 @@ typedef struct {
static Ttk_ElementOptionSpec EntryElementOptions[] = {
{"-background", TK_OPTION_BORDER,
- Tk_Offset(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND},
+ offsetof(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND},
{"-fieldbackground", TK_OPTION_BORDER,
- Tk_Offset(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND},
+ offsetof(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND},
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
@@ -2116,10 +2116,10 @@ typedef struct {
} TrackElement;
static Ttk_ElementOptionSpec TrackElementOptions[] = {
- {"-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, fromObj), NULL},
- {"-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, toObj), NULL},
- {"-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, valueObj), NULL},
- {"-orient", TK_OPTION_STRING, Tk_Offset(TrackElement, orientObj), NULL},
+ {"-from", TK_OPTION_DOUBLE, offsetof(TrackElement, fromObj), NULL},
+ {"-to", TK_OPTION_DOUBLE, offsetof(TrackElement, toObj), NULL},
+ {"-value", TK_OPTION_DOUBLE, offsetof(TrackElement, valueObj), NULL},
+ {"-orient", TK_OPTION_STRING, offsetof(TrackElement, orientObj), NULL},
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void TrackElementSize(
@@ -2147,11 +2147,11 @@ static void TrackElementDraw(
{
TrackElementData *data = (TrackElementData *)clientData;
TrackElement *elem = (TrackElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
double from = 0, to = 100, value = 0, factor;
CGRect bounds;
- Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, elem->orientObj, &orientation);
Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from);
Tcl_GetDoubleFromObj(NULL, elem->toObj, &to);
Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value);
@@ -2258,15 +2258,15 @@ typedef struct {
static Ttk_ElementOptionSpec PbarElementOptions[] = {
{"-orient", TK_OPTION_STRING,
- Tk_Offset(PbarElement, orientObj), "horizontal"},
+ offsetof(PbarElement, orientObj), "horizontal"},
{"-value", TK_OPTION_DOUBLE,
- Tk_Offset(PbarElement, valueObj), "0"},
+ offsetof(PbarElement, valueObj), "0"},
{"-maximum", TK_OPTION_DOUBLE,
- Tk_Offset(PbarElement, maximumObj), "100"},
+ offsetof(PbarElement, maximumObj), "100"},
{"-phase", TK_OPTION_INT,
- Tk_Offset(PbarElement, phaseObj), "0"},
+ offsetof(PbarElement, phaseObj), "0"},
{"-mode", TK_OPTION_STRING,
- Tk_Offset(PbarElement, modeObj), "determinate"},
+ offsetof(PbarElement, modeObj), "determinate"},
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void PbarElementSize(
@@ -2292,17 +2292,17 @@ static void PbarElementDraw(
Ttk_State state)
{
PbarElement *pbar = (PbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL, phase = 0, kind;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
/*
* Using 1000 as the maximum should give better than 1 pixel
* resolution for most progress bars.
*/
- int ivalue, imaximum = 1000;
+ int kind, phase = 0, ivalue, imaximum = 1000;
CGRect bounds;
- Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, pbar->orientObj, &orientation);
kind = !strcmp("indeterminate", Tcl_GetString(pbar->modeObj)) ?
kThemeIndeterminateBar : kThemeProgressBar;
if (kind == kThemeIndeterminateBar) {
@@ -2379,7 +2379,7 @@ typedef struct
static Ttk_ElementOptionSpec ScrollbarElementOptions[] = {
{"-orient", TK_OPTION_STRING,
- Tk_Offset(ScrollbarElement, orientObj), "horizontal"},
+ offsetof(ScrollbarElement, orientObj), "horizontal"},
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void TroughElementSize(
@@ -2391,10 +2391,10 @@ static void TroughElementSize(
Ttk_Padding *paddingPtr)
{
ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
SInt32 thickness = 15;
- Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &thickness);
if (orientation == TTK_ORIENT_HORIZONTAL) {
*minHeight = thickness;
@@ -2432,13 +2432,13 @@ static void TroughElementDraw(
TCL_UNUSED(Ttk_State))
{
ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
CGRect bounds = BoxToRect(d, b);
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *troughColor;
CGFloat *rgba = TkMacOSXInDarkMode(tkwin) ? darkTrough : lightTrough;
- Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
if (orientation == TTK_ORIENT_HORIZONTAL) {
bounds = CGRectInset(bounds, 0, 1);
} else {
@@ -2474,9 +2474,9 @@ static void ThumbElementSize(
TCL_UNUSED(Ttk_Padding *))
{
ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
- Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
if (orientation == TTK_ORIENT_VERTICAL) {
*minHeight = 18;
*minWidth = 8;
@@ -2495,9 +2495,9 @@ static void ThumbElementDraw(
Ttk_State state)
{
ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
- Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
/*
* In order to make ttk scrollbars work correctly it is necessary to be
@@ -2897,7 +2897,7 @@ typedef struct {
static Ttk_ElementOptionSpec FieldElementOptions[] = {
{"-fieldbackground", TK_OPTION_BORDER,
- Tk_Offset(FieldElement, backgroundObj), "white"},
+ offsetof(FieldElement, backgroundObj), "white"},
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
diff --git a/tests/all.tcl b/tests/all.tcl
index 46721a2..99e6d0c 100644
--- a/tests/all.tcl
+++ b/tests/all.tcl
@@ -4,12 +4,12 @@
# tests. Execute it by invoking "source all.tcl" when running tktest
# in this directory.
#
-# Copyright © 1998-1999 by Scriptics Corporation.
+# Copyright © 1998-1999 Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require Tk ;# This is the Tk test suite; fail early if no Tk!
+package require tk ;# This is the Tk test suite; fail early if no Tk!
package require tcltest 2.2
tcltest::configure {*}$argv
tcltest::configure -testdir [file normalize [file dirname [info script]]]
diff --git a/tests/arc.tcl b/tests/arc.tcl
index 89b9f58..2887047 100644
--- a/tests/arc.tcl
+++ b/tests/arc.tcl
@@ -52,7 +52,7 @@ set outline black
.t.c addtag arc withtag all
.t.c addtag circle withtag [.t.c create oval 320 200 340 220 -fill MistyRose3]
-.t.c bind arc <Any-Enter> {
+.t.c bind arc <Enter> {
set prevFill [lindex [.t.c itemconf current -fill] 4]
set prevOutline [lindex [.t.c itemconf current -outline] 4]
if {($prevFill != "") || ($prevOutline == "")} {
@@ -62,7 +62,7 @@ set outline black
.t.c itemconf current -outline $outline2
}
}
-.t.c bind arc <Any-Leave> {.t.c itemconf current -fill $prevFill -outline $prevOutline}
+.t.c bind arc <Leave> {.t.c itemconf current -fill $prevFill -outline $prevOutline}
bind .t.c <Button-1> {markarea %x %y}
bind .t.c <B1-Motion> {strokearea %x %y}
@@ -89,7 +89,7 @@ bind .t.c <Control-f> {
puts stdout "Overlapping: [.t.c find overl $areaX1 $areaY1 $areaX2 $areaY2]"
}
-bind .t.c <3> {puts stdout "%x %y"}
+bind .t.c <Button-3> {puts stdout "%x %y"}
# The code below allows the circle to be move by shift-dragging.
diff --git a/tests/bell.test b/tests/bell.test
index bbafeac..4cf7596 100644
--- a/tests/bell.test
+++ b/tests/bell.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out Tk's "bell" command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1998-2000 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1998-2000 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/bgerror.test b/tests/bgerror.test
index fd9594a..bd38310 100644
--- a/tests/bgerror.test
+++ b/tests/bgerror.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test the bgerror command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/bind.test b/tests/bind.test
index f653f3e..58d5799 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -2,9 +2,9 @@
# commands plus the procedures in tkBind.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -13,6 +13,11 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
tk useinputmethods 0
+testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
+testConstraint needsTcl87 [package vsatisfies [package provide Tcl] 8.7-]
+testConstraint failsOnWindows [expr {![info exists ::env(CI)] || [tk windowingsystem] ne "win32"}]
+
+
toplevel .t -width 100 -height 50
wm geom .t +0+0
update idletasks
@@ -36,22 +41,12 @@ proc unsetBindings {} {
# move the mouse pointer away of the testing area
# otherwise some spurious events may pollute the tests
-# also, this will procure a known grab state at startup
-# for tests mixing grabs and pointer warps
-proc pointerAway {} {
- toplevel .top
- wm geometry .top 50x50-50-50
- update
- # On KDE/Plasma _with_the_Aurorae_theme_ (at least), setting up the toplevel
- # will not be finished right after the above 'update'. The WM still
- # needs some time before the window is fully ready. For me 50 ms is enough,
- # but let's wait more (it depends on computer performance).
- after 100 ; update
- event generate .top <Button-1> -warp 1
- controlPointerWarpTiming
- destroy .top
-}
-pointerAway
+toplevel .top
+wm geometry .top 50x50-50-50
+update
+event generate .top <Button-1> -warp 1
+controlPointerWarpTiming
+destroy .top
test bind-1.1 {bind command} -body {
bind
@@ -307,9 +302,9 @@ test bind-5.1 {Tk_CreateBindingTable procedure} -body {
test bind-6.1 {Tk_DeleteBindTable procedure} -body {
canvas .t.c
- .t.c bind foo <1> {string 1}
+ .t.c bind foo <Button-1> {string 1}
.t.c create rectangle 0 0 100 100
- .t.c bind 1 <2> {string 2}
+ .t.c bind 1 <Button-2> {string 2}
destroy .t.c
} -cleanup {
destroy .t.c
@@ -322,17 +317,17 @@ test bind-7.1 {Tk_CreateBinding procedure: bad binding} -body {
} -returnCodes error -result {no event type or button # or keysym}
test bind-7.3 {Tk_CreateBinding procedure: append} -body {
canvas .t.c
- .t.c bind foo <1> "button 1"
- .t.c bind foo <1> "+more button 1"
- .t.c bind foo <1>
+ .t.c bind foo <Button-1> "button 1"
+ .t.c bind foo <Button-1> "+more button 1"
+ .t.c bind foo <Button-1>
} -cleanup {
destroy .t.c
} -result {button 1
more button 1}
test bind-7.4 {Tk_CreateBinding procedure: append to non-existing} -body {
canvas .t.c
- .t.c bind foo <1> "+button 1"
- .t.c bind foo <1>
+ .t.c bind foo <Button-1> "+button 1"
+ .t.c bind foo <Button-1>
} -cleanup {
destroy .t.c
} -result {button 1}
@@ -366,10 +361,10 @@ test bind-9.3 {Tk_DeleteBinding procedure} -setup {
set result {}
} -body {
frame .t.f -class Test -width 150 -height 100
- foreach i {<1> <Meta-1> <Control-1> <Double-Alt-1>} {
+ foreach i {<Button-1> <Meta-Button-1> <Control-Button-1> <Double-Alt-Button-1>} {
bind .t.f $i "binding for $i"
}
- foreach i {<Control-1> <Double-Alt-1> <1> <Meta-1>} {
+ foreach i {<Control-Button-1> <Double-Alt-Button-1> <Button-1> <Meta-Button-1>} {
bind .t.f $i {}
lappend result [lsort [bind .t.f]]
}
@@ -394,16 +389,16 @@ test bind-10.2 {Tk_GetBinding procedure} -body {
test bind-11.1 {Tk_GetAllBindings procedure} -body {
frame .t.f
- foreach i "! a \\\{ ~ <Delete> <space> <<Paste>> <Tab> <Linefeed> <less> <Meta-a> <Acircumflex>" {
+ foreach i "! a \\\{ ~ <Delete> <space> <<Paste>> <Tab> <Linefeed> <Key-<> <Meta-a> <Â>" {
bind .t.f $i Test
}
lsort [bind .t.f]
} -cleanup {
destroy .t.f
-} -result {! <<Paste>> <Key-Acircumflex> <Key-Delete> <Key-Linefeed> <Key-Tab> <Key-less> <Key-space> <Meta-Key-a> a \{ ~}
+} -result "! <<Paste>> <Key-<> <Key-Delete> <Key-Linefeed> <Key-Tab> <Key-space> <Key-Â> <Meta-Key-a> a \\\{ ~"
test bind-11.2 {Tk_GetAllBindings procedure} -body {
frame .t.f
- foreach i "<Double-1> <Triple-1> <Meta-Control-a> <Double-Alt-Enter> <1>" {
+ foreach i "<Double-Button-1> <Triple-Button-1> <Meta-Control-a> <Double-Alt-Enter> <Button-1>" {
bind .t.f $i Test
}
lsort [bind .t.f]
@@ -412,7 +407,7 @@ test bind-11.2 {Tk_GetAllBindings procedure} -body {
} -result {<Button-1> <Control-Meta-Key-a> <Double-Alt-Enter> <Double-Button-1> <Triple-Button-1>}
test bind-11.3 {Tk_GetAllBindings procedure} -body {
frame .t.f
- foreach i "<Double-Triple-1> abcd a<Leave>b" {
+ foreach i "<Double-Triple-Button-1> abcd a<Leave>b" {
bind .t.f $i Test
}
lsort [bind .t.f]
@@ -427,7 +422,7 @@ test bind-12.1 {Tk_DeleteAllBindings procedure} -body {
} -result {}
test bind-12.2 {Tk_DeleteAllBindings procedure} -body {
frame .t.f -class Test -width 150 -height 100
- foreach i "a b c <Meta-1> <Alt-a> <Control-a>" {
+ foreach i "a b c <Meta-Button-1> <Alt-a> <Control-a>" {
bind .t.f $i x
}
destroy .t.f
@@ -440,23 +435,23 @@ test bind-13.1 {Tk_BindEvent procedure} -setup {
update
set x {}
} -body {
- bind Test <KeyPress> {lappend x "%W %K Test KeyPress"}
- bind all <KeyPress> {lappend x "%W %K all KeyPress"}
+ bind Test <Key> {lappend x "%W %K Test Key"}
+ bind all <Key> {lappend x "%W %K all Key"}
bind Test : {lappend x "%W %K Test :"}
bind all _ {lappend x "%W %K all _"}
bind .t.f : {lappend x "%W %K .t.f :"}
- event generate .t.f <Key-colon>
- event generate .t.f <Key-plus>
- event generate .t.f <Key-underscore>
+ event generate .t.f <:>
+ event generate .t.f <+>
+ event generate .t.f <_>
return $x
} -cleanup {
destroy .t.f
- bind all <KeyPress> {}
- bind Test <KeyPress> {}
+ bind all <Key> {}
+ bind Test <Key> {}
bind all _ {}
bind Test : {}
-} -result {{.t.f colon .t.f :} {.t.f colon Test :} {.t.f colon all KeyPress} {.t.f plus Test KeyPress} {.t.f plus all KeyPress} {.t.f underscore Test KeyPress} {.t.f underscore all _}}
+} -result {{.t.f : .t.f :} {.t.f : Test :} {.t.f : all Key} {.t.f + Test Key} {.t.f + all Key} {.t.f _ Test Key} {.t.f _ all _}}
test bind-13.2 {Tk_BindEvent procedure} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -465,17 +460,17 @@ test bind-13.2 {Tk_BindEvent procedure} -setup {
update
set x {}
} -body {
- bind Test <KeyPress> {lappend x "%W %K Test press any"; break}
- bind all <KeyPress> {continue; lappend x "%W %K all press any"}
+ bind Test <Key> {lappend x "%W %K Test press any"; break}
+ bind all <Key> {continue; lappend x "%W %K all press any"}
bind .t.f : {lappend x "%W %K .t.f pressed colon"}
- event generate .t.f <Key-colon>
+ event generate .t.f <:>
return $x
} -cleanup {
destroy .t.f
- bind all <KeyPress> {}
- bind Test <KeyPress> {}
-} -result {{.t.f colon .t.f pressed colon} {.t.f colon Test press any}}
+ bind all <Key> {}
+ bind Test <Key> {}
+} -result {{.t.f : .t.f pressed colon} {.t.f : Test press any}}
test bind-13.3 {Tk_BindEvent procedure} -setup {
proc bgerror args {}
@@ -485,23 +480,23 @@ test bind-13.3 {Tk_BindEvent procedure} -setup {
update
set x {}
} -body {
- bind Test <KeyPress> {lappend x "%W %K Test press any"; error Test}
+ bind Test <Key> {lappend x "%W %K Test press any"; error Test}
bind .t.f : {lappend x "%W %K .t.f pressed colon"}
- event generate .t.f <Key-colon>
+ event generate .t.f <:>
update
list $x $errorInfo
} -cleanup {
destroy .t.f
- bind Test <KeyPress> {}
+ bind Test <Key> {}
rename bgerror {}
-} -result {{{.t.f colon .t.f pressed colon} {.t.f colon Test press any}} {Test
+} -result {{{.t.f : .t.f pressed colon} {.t.f : Test press any}} {Test
while executing
"error Test"
(command bound to event)}}
test bind-13.4 {Tk_BindEvent procedure} -setup {
proc foo {} {
set x 44
- event generate .t.f <Key-colon>
+ event generate .t.f <:>
}
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -516,7 +511,7 @@ test bind-13.4 {Tk_BindEvent procedure} -setup {
} -cleanup {
destroy .t.f
bind Test : {}
-} -result {{.t.f colon .t.f} {.t.f colon Test}}
+} -result {{.t.f : .t.f} {.t.f : Test}}
test bind-13.5 {Tk_BindEvent procedure} -body {
bind all <Destroy> {lappend x "%W destroyed"}
@@ -544,7 +539,7 @@ test bind-13.7 {Tk_BindEvent procedure} -setup {
bind .t.f : {lappend x "%W (.t.f binding)"}
bind Test : {lappend x "%W (Test binding)"}
bind all : {bind .t.f : {}; lappend x "%W (all binding)"}
- event generate .t.f <Key-colon>
+ event generate .t.f <:>
return $x
} -cleanup {
bind Test : {}
@@ -561,7 +556,7 @@ test bind-13.8 {Tk_BindEvent procedure} -setup {
bind .t.f : {lappend x "%W (.t.f binding)"}
bind Test : {lappend x "%W (Test binding)"}
bind all : {destroy .t.f; lappend x "%W (all binding)"}
- event generate .t.f <Key-colon>
+ event generate .t.f <:>
return $x
} -cleanup {
bind Test : {}
@@ -576,14 +571,14 @@ test bind-13.9 {Tk_BindEvent procedure} -setup {
update
set x {}
} -body {
- bind .t.f <1> {lappend x "%W z (.t.f <1> binding)"}
- bind .t.f <ButtonPress> {lappend x "%W z (.t.f <ButtonPress> binding)"}
+ bind .t.f <Button-1> {lappend x "%W z (.t.f <Button-1> binding)"}
+ bind .t.f <Button> {lappend x "%W z (.t.f <Button> binding)"}
event generate .t.f <Button-1>
event generate .t.f <Button-2>
return $x
} -cleanup {
destroy .t.f
-} -result {{.t.f z (.t.f <1> binding)} {.t.f z (.t.f <ButtonPress> binding)}}
+} -result {{.t.f z (.t.f <Button-1> binding)} {.t.f z (.t.f <Button> binding)}}
test bind-13.10 {Tk_BindEvent procedure: ignore NotifyInferior} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -626,9 +621,9 @@ test bind-13.12 {Tk_BindEvent procedure: collapse repeating modifiers} -setup {
} -body {
bind .t.f <Key> "lappend x %K%#"
bind .t.f <KeyRelease> "lappend x %K%#"
- event generate .t.f <Key-Shift_L> -serial 100 -when tail
+ event generate .t.f <Shift_L> -serial 100 -when tail
event generate .t.f <KeyRelease-Shift_L> -serial 101 -when tail
- event generate .t.f <Key-Shift_L> -serial 102 -when tail
+ event generate .t.f <Shift_L> -serial 102 -when tail
event generate .t.f <KeyRelease-Shift_L> -serial 103 -when tail
update
} -cleanup {
@@ -643,12 +638,12 @@ test bind-13.13 {Tk_BindEvent procedure: valid key detail} -setup {
} -body {
bind .t.f <Key> "lappend x Key%K"
bind .t.f <KeyRelease> "lappend x Release%K"
- event generate .t.f <Key> -keysym colon
- event generate .t.f <KeyRelease> -keysym colon
+ event generate .t.f <Key> -keysym :
+ event generate .t.f <KeyRelease> -keysym :
return $x
} -cleanup {
destroy .t.f
-} -result {Keycolon Releasecolon}
+} -result {Key: Release:}
test bind-13.14 {Tk_BindEvent procedure: invalid key detail} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -946,12 +941,12 @@ test bind-13.33 {Tk_BindEvent procedure: many C bindings cause realloc} -setup {
} -body {
bindtags .t.f {a b c d e f g h i j k l m n o p}
foreach p [bindtags .t.f] {
- bind $p <1> "lappend x $p"
+ bind $p <Button-1> "lappend x $p"
}
- event generate .t.f <1>
+ event generate .t.f <Button-1>
return $x
} -cleanup {
- foreach p [bindtags .t.f] {bind $p <1> {}}
+ foreach p [bindtags .t.f] {bind $p <Button-1> {}}
destroy .t.f
} -result {a b c d e f g h i j k l m n o p}
test bind-13.34 {Tk_BindEvent procedure: multiple tags} -setup {
@@ -976,12 +971,12 @@ test bind-13.35 {Tk_BindEvent procedure: execute binding} -setup {
update
set x {}
} -body {
- bind .t.f <1> {lappend x 1}
- event generate .t.f <1>
+ bind .t.f <Button-1> {lappend x 1}
+ event generate .t.f <Button-1>
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-13.38 {Tk_BindEvent procedure: binding gets to run} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -989,13 +984,13 @@ test bind-13.38 {Tk_BindEvent procedure: binding gets to run} -setup {
update
set x {}
} -body {
- bind Test <1> {lappend x Test}
- bind .t.f <1> {lappend x .t.f}
- event generate .t.f <1>
+ bind Test <Button-1> {lappend x Test}
+ bind .t.f <Button-1> {lappend x .t.f}
+ event generate .t.f <Button-1>
return $x
} -cleanup {
destroy .t.f
- bind Test <1> {}
+ bind Test <Button-1> {}
} -result {.t.f Test}
test bind-13.41 {Tk_BindEvent procedure: continue in script} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -1065,7 +1060,7 @@ test bind-15.1 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.2 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1084,7 +1079,7 @@ test bind-15.2 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.3 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1099,14 +1094,14 @@ test bind-15.3 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.4 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-1>
event generate .t.f <ButtonRelease-1>
@@ -1115,7 +1110,7 @@ test bind-15.4 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.5 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1131,41 +1126,41 @@ test bind-15.5 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.6 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-1>
- event generate .t.f <Key-a>
+ event generate .t.f <a>
event generate .t.f <ButtonRelease-1>
event generate .t.f <Button-1>
event generate .t.f <ButtonRelease-1>
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.7 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-1>
- event generate .t.f <Key-Shift_L>
+ event generate .t.f <Shift_L>
event generate .t.f <ButtonRelease-1>
event generate .t.f <Button-1>
event generate .t.f <ButtonRelease-1>
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.8 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1174,13 +1169,13 @@ test bind-15.8 {MatchPatterns procedure, ignoring type mismatches} -setup {
} -body {
bind .t.f ab {set x 1}
set x 0
- event generate .t.f <Key-a>
- event generate .t.f <Key-c>
- event generate .t.f <Key-b>
+ event generate .t.f <a>
+ event generate .t.f <c>
+ event generate .t.f <b>
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.9 {MatchPatterns procedure, modifier checks} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1189,11 +1184,11 @@ test bind-15.9 {MatchPatterns procedure, modifier checks} -setup {
} -body {
bind .t.f <M1-M2-Key> {set x 1}
set x 0
- event generate .t.f <Key-a> -state 0x18
+ event generate .t.f <a> -state 0x18
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.10 {MatchPatterns procedure, modifier checks} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1202,11 +1197,11 @@ test bind-15.10 {MatchPatterns procedure, modifier checks} -setup {
} -body {
bind .t.f <M1-M2-Key> {set x 1}
set x 0
- event generate .t.f <Key-a> -state 0xfc
+ event generate .t.f <a> -state 0xfc
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.11 {MatchPatterns procedure, modifier checks} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1215,11 +1210,11 @@ test bind-15.11 {MatchPatterns procedure, modifier checks} -setup {
} -body {
bind .t.f <M1-M2-Key> {set x 1}
set x 0
- event generate .t.f <Key-a> -state 0x8
+ event generate .t.f <a> -state 0x8
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.12 {MatchPatterns procedure, ignore modifier presses and releases} -constraints {
nonPortable
} -setup {
@@ -1232,13 +1227,13 @@ test bind-15.12 {MatchPatterns procedure, ignore modifier presses and releases}
# differently on some platforms.
bind .t.f aB {set x 1}
set x 0
- event generate .t.f <Key-a>
- event generate .t.f <Key-Shift_L>
- event generate .t.f <Key-b> -state 1
+ event generate .t.f <a>
+ event generate .t.f <Shift_L>
+ event generate .t.f <b> -state 1
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.13 {MatchPatterns procedure, checking detail} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1247,19 +1242,19 @@ test bind-15.13 {MatchPatterns procedure, checking detail} -setup {
} -body {
bind .t.f ab {set x 1}
set x 0
- event generate .t.f <Key-a>
- event generate .t.f <Key-c>
+ event generate .t.f <a>
+ event generate .t.f <c>
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.14 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-2>
event generate .t.f <ButtonRelease-2>
@@ -1269,14 +1264,14 @@ test bind-15.14 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.15 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-2>
event generate .t.f <ButtonRelease-2>
@@ -1286,14 +1281,14 @@ test bind-15.15 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.16 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-2>
event generate .t.f <ButtonRelease-2>
@@ -1303,14 +1298,14 @@ test bind-15.16 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.17 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-2>
event generate .t.f <ButtonRelease-2>
@@ -1320,14 +1315,14 @@ test bind-15.17 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.18 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-2>
event generate .t.f <ButtonRelease-2>
@@ -1337,14 +1332,14 @@ test bind-15.18 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.19 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-2>
event generate .t.f <ButtonRelease-2>
@@ -1354,14 +1349,14 @@ test bind-15.19 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.20 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-2>
event generate .t.f <ButtonRelease-2>
@@ -1371,14 +1366,14 @@ test bind-15.20 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.21 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-2>
event generate .t.f <ButtonRelease-2>
@@ -1388,14 +1383,14 @@ test bind-15.21 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.22 {MatchPatterns procedure, time wrap-around} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-1> -time -100
event generate .t.f <Button-1> -time 200
@@ -1403,14 +1398,14 @@ test bind-15.22 {MatchPatterns procedure, time wrap-around} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.23 {MatchPatterns procedure, time wrap-around} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
focus -force .t.f
update
} -body {
- bind .t.f <Double-1> {set x 1}
+ bind .t.f <Double-Button-1> {set x 1}
set x 0
event generate .t.f <Button-1> -time -100
event generate .t.f <Button-1> -time 500
@@ -1418,7 +1413,7 @@ test bind-15.23 {MatchPatterns procedure, time wrap-around} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.24 {MatchPatterns procedure, virtual event} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1485,14 +1480,14 @@ test bind-15.27 {MatchPatterns procedure, conflict resolution} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <KeyPress> {set x 0}
+ bind .t.f <Key> {set x 0}
bind .t.f 1 {set x 1}
set x none
event generate .t.f <Key-1>
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.28 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1500,14 +1495,14 @@ test bind-15.28 {MatchPatterns procedure, conflict resolution} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <KeyPress> {set x 0}
+ bind .t.f <Key> {set x 0}
bind .t.f 1 {set x 1}
set x none
event generate .t.f <Key-2>
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.29 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1515,7 +1510,7 @@ test bind-15.29 {MatchPatterns procedure, conflict resolution} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <KeyPress> {lappend x 0}
+ bind .t.f <Key> {lappend x 0}
bind .t.f 1 {lappend x 1}
bind .t.f 21 {lappend x 2}
set x none
@@ -1532,15 +1527,15 @@ test bind-15.30 {MatchPatterns procedure, conflict resolution} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <ButtonPress> {set x 0}
- bind .t.f <1> {set x 1}
+ bind .t.f <Button> {set x 0}
+ bind .t.f <Button-1> {set x 1}
set x none
event generate .t.f <Button-1>
event generate .t.f <ButtonRelease-1>
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.31 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1550,11 +1545,11 @@ test bind-15.31 {MatchPatterns procedure, conflict resolution} -setup {
} -body {
bind .t.f <M1-Key> {set x 0}
bind .t.f <M2-Key> {set x 1}
- event generate .t.f <Key-a> -state 0x18
+ event generate .t.f <a> -state 0x18
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.32 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1564,11 +1559,11 @@ test bind-15.32 {MatchPatterns procedure, conflict resolution} -setup {
bind .t.f <M2-Key> {set x 0}
bind .t.f <M1-Key> {set x 1}
set x none
- event generate .t.f <Key-a> -state 0x18
+ event generate .t.f <a> -state 0x18
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.33 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1576,9 +1571,9 @@ test bind-15.33 {MatchPatterns procedure, conflict resolution} -setup {
update
set x {}
} -body {
- bind .t.f <1> {lappend x single}
- bind Test <1> {lappend x single(Test)}
- bind Test <Double-1> {lappend x double(Test)}
+ bind .t.f <Button-1> {lappend x single}
+ bind Test <Button-1> {lappend x single(Test)}
+ bind Test <Double-Button-1> {lappend x double(Test)}
event generate .t.f <Button-1>
event generate .t.f <Button-1>
event generate .t.f <Button-1>
@@ -1586,8 +1581,8 @@ test bind-15.33 {MatchPatterns procedure, conflict resolution} -setup {
set x
} -cleanup {
destroy .t.f
- bind Test <1> {}
- bind Test <Double-1> {}
+ bind Test <Button-1> {}
+ bind Test <Double-Button-1> {}
} -result {single single(Test) single double(Test) single double(Test)}
@@ -1616,7 +1611,7 @@ test bind-16.2 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1234}
+} -result 1234
test bind-16.3 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1643,7 +1638,7 @@ test bind-16.4 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {3}
+} -result 3
test bind-16.5 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1656,7 +1651,7 @@ test bind-16.5 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {47}
+} -result 47
test bind-16.6 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1760,7 +1755,7 @@ test bind-16.13 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.14 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1799,7 +1794,7 @@ test bind-16.16 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {146}
+} -result 146
test bind-16.17 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1865,7 +1860,7 @@ test bind-16.21 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.22 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1878,7 +1873,7 @@ test bind-16.22 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.23 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1891,7 +1886,7 @@ test bind-16.23 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.24 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1924,14 +1919,14 @@ test bind-16.26 {ExpandPercents procedure} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <1> {set x "%s"}
+ bind .t.f <Button-1> {set x "%s"}
set x none
event generate .t.f <Button-1> -state 1402
event generate .t.f <ButtonRelease-1>
set x
} -cleanup {
destroy .t.f
-} -result {1402}
+} -result 1402
test bind-16.27 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1944,7 +1939,7 @@ test bind-16.27 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1023}
+} -result 1023
test bind-16.28 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1997,7 +1992,7 @@ test bind-16.31 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {4294}
+} -result 4294
test bind-16.32 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2048,22 +2043,22 @@ test bind-16.35 {ExpandPercents procedure} -constraints {
set x {}
} -body {
bind .t.f <Key> {lappend x "%A"}
- event generate .t.f <Key-a>
- event generate .t.f <Key-A> -state 1
- event generate .t.f <Key-Tab>
- event generate .t.f <Key-Return>
- event generate .t.f <Key-F1>
- event generate .t.f <Key-Shift_L>
- event generate .t.f <Key-space>
- event generate .t.f <Key-dollar> -state 1
- event generate .t.f <Key-braceleft> -state 1
- event generate .t.f <Key-Multi_key>
- event generate .t.f <Key-e>
- event generate .t.f <Key-apostrophe>
+ event generate .t.f <a>
+ event generate .t.f <A> -state 1
+ event generate .t.f <Tab>
+ event generate .t.f <Return>
+ event generate .t.f <F1>
+ event generate .t.f <Shift_L>
+ event generate .t.f <space>
+ event generate .t.f <dollar> -state 1
+ event generate .t.f <braceleft> -state 1
+ event generate .t.f <Multi_key>
+ event generate .t.f <e>
+ event generate .t.f <apostrophe>
set x
} -cleanup {
destroy .t.f
-} -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} \u00e9}
+} -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} é}
test bind-16.36 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2076,7 +2071,7 @@ test bind-16.36 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {24}
+} -result 24
test bind-16.37 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2089,7 +2084,7 @@ test bind-16.37 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.38 {ExpandPercents procedure} -constraints {
nonPortable
} -setup {
@@ -2100,14 +2095,14 @@ test bind-16.38 {ExpandPercents procedure} -constraints {
set x {}
} -body {
bind .t.f <Key> {lappend x %K}
- event generate .t.f <Key-a>
- event generate .t.f <Key-A> -state 1
- event generate .t.f <Key-Tab>
- event generate .t.f <Key-F1>
- event generate .t.f <Key-Shift_L>
- event generate .t.f <Key-space>
- event generate .t.f <Key-dollar> -state 1
- event generate .t.f <Key-braceleft> -state 1
+ event generate .t.f <a>
+ event generate .t.f <A> -state 1
+ event generate .t.f <Tab>
+ event generate .t.f <F1>
+ event generate .t.f <Shift_L>
+ event generate .t.f <space>
+ event generate .t.f <dollar> -state 1
+ event generate .t.f <braceleft> -state 1
set x
} -cleanup {
destroy .t.f
@@ -2120,11 +2115,11 @@ test bind-16.39 {ExpandPercents procedure} -setup {
} -body {
bind .t.f <Key> {set x "%N"}
set x none
- event generate .t.f <Key-space>
+ event generate .t.f <space>
set x
} -cleanup {
destroy .t.f
-} -result {32}
+} -result 32
test bind-16.40 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2133,7 +2128,7 @@ test bind-16.40 {ExpandPercents procedure} -setup {
} -body {
bind .t.f <Key> {set x "%S"}
set x none
- event generate .t.f <Key-space> -subwindow .t
+ event generate .t.f <space> -subwindow .t
set x
} -cleanup {
destroy .t.f
@@ -2150,7 +2145,7 @@ test bind-16.41 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {2}
+} -result 2
test bind-16.42 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2206,7 +2201,7 @@ test bind-16.45 {ExpandPercents procedure} -setup {
bind Entry <Key> {set y "%M"}
bind all <Key> {set z "%M"}
set x none; set y none; set z none
- event gen .t.e <Key-a>
+ event gen .t.e <a>
list $x $y $z
} -cleanup {
destroy .t.e
@@ -2227,7 +2222,7 @@ test bind-16.46 {ExpandPercents procedure} -setup {
bind Entry <Key> {set y "%M"}
bind .t.e <Key> {set x "%M"}
set x none; set y none; set z none
- event gen .t.e <Key-a>
+ event gen .t.e <a>
list $x $y $z
} -cleanup {
destroy .t.e
@@ -2235,6 +2230,19 @@ test bind-16.46 {ExpandPercents procedure} -setup {
bind all <Key> $savedBind(All)
unset savedBind
} -result {0 1 2}
+test bind-16.47 {ExpandPercents procedure} -constraints {aquaOrWin32 needsTcl87 failsOnWindows} -setup {
+ frame .t.f -class Test -width 150 -height 100
+ pack .t.f
+ focus -force .t.f
+ update
+} -body {
+ bind .t.f <Key> {set x "%K"}
+ set x none
+ event generate .t.f <Key> -keysym €
+ set x
+} -cleanup {
+ destroy .t.f
+} -result €
test bind-17.1 {event command} -body {
event
@@ -2251,7 +2259,7 @@ test bind-17.4 {event command: add 1} -body {
event info <<Paste>>
} -cleanup {
event delete <<Paste>> <Control-v>
-} -result {<Control-Key-v>}
+} -result <Control-Key-v>
test bind-17.5 {event command: add 2} -body {
event delete <<Paste>>
event add <<Paste>> <Control-v> <Button-2>
@@ -2261,13 +2269,13 @@ test bind-17.5 {event command: add 2} -body {
} -result {<Button-2> <Control-Key-v>}
test bind-17.6 {event command: add with error} -body {
- event add <<Paste>> <Control-v> <Button-2> abc <xyz> <1>
+ event add <<Paste>> <Control-v> <Button-2> abc <xyz> <Button-1>
} -cleanup {
event delete <<Paste>>
} -returnCodes error -result {bad event type or keysym "xyz"}
test bind-17.7 {event command: add with error} -body {
event delete <<Paste>>
- catch {event add <<Paste>> <Control-v> <Button-2> abc <xyz> <1>}
+ catch {event add <<Paste>> <Control-v> <Button-2> abc <xyz> <Button-1>}
lsort [event info <<Paste>>]
} -cleanup {
event delete <<Paste>>
@@ -2278,12 +2286,12 @@ test bind-17.8 {event command: delete} -body {
} -returnCodes error -result {wrong # args: should be "event delete virtual ?sequence ...?"}
test bind-17.9 {event command: delete many} -body {
event delete <<Paste>>
- event add <<Paste>> <3> <1> <2> t
- event delete <<Paste>> <1> <2>
+ event add <<Paste>> <Button-3> <Button-1> <Button-2> t
+ event delete <<Paste>> <Button-1> <Button-2>
lsort [event info <<Paste>>]
} -cleanup {
event delete <<Paste>>
- event delete <<Paste>> <3> t
+ event delete <<Paste>> <Button-3> t
} -result {<Button-3> t}
test bind-17.10 {event command: delete all} -body {
event add <<Paste>> a b
@@ -2331,12 +2339,12 @@ test bind-17.16 {event command: generate} -setup {
update
set x {}
} -body {
- bind .t.f <1> "lappend x 1"
- event generate .t.f <1>
+ bind .t.f <Button-1> "lappend x 1"
+ event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-17.17 {event command: generate} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2364,7 +2372,7 @@ test bind-18.3 {CreateVirtualEvent procedure: new physical} -body {
event info <<xyz>>
} -cleanup {
event delete <<xyz>>
-} -result {<Control-Key-v>}
+} -result <Control-Key-v>
test bind-18.4 {CreateVirtualEvent procedure: duplicate physical} -body {
event delete <<xyz>>
event add <<xyz>> <Control-v>
@@ -2372,7 +2380,7 @@ test bind-18.4 {CreateVirtualEvent procedure: duplicate physical} -body {
event info <<xyz>>
} -cleanup {
event delete <<xyz>>
-} -result {<Control-Key-v>}
+} -result <Control-Key-v>
test bind-18.5 {CreateVirtualEvent procedure: existing physical} -body {
foreach p [event info] {event delete $p}
event add <<xyz>> <Control-v>
@@ -2421,7 +2429,7 @@ test bind-19.4 {DeleteVirtualEvent procedure: delete 1, not owned} -setup {
event add <<xyz>> <Control-v>
event delete <<xyz>> <Button-1>
event info <<xyz>>
-} -result {<Control-Key-v>}
+} -result <Control-Key-v>
test bind-19.5 {DeleteVirtualEvent procedure: delete 1, badly formed} -body {
event add <<xyz>> <Control-v>
event delete <<xyz>> <xyz>
@@ -2478,7 +2486,7 @@ test bind-19.11 {DeleteVirtualEvent procedure: owned by 1, only} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {101}
+} -result 101
test bind-19.12 {DeleteVirtualEvent procedure: owned by 1, first in chain} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2699,11 +2707,11 @@ test bind-20.2 {GetVirtualEvent procedure: non-existent event} -body {
test bind-20.3 {GetVirtualEvent procedure: owns 1} -setup {
event delete <<xyz>>
} -body {
- event add <<xyz>> <Control-Key-v>
+ event add <<xyz>> <Control-v>
event info <<xyz>>
} -cleanup {
event delete <<xyz>>
-} -result {<Control-Key-v>}
+} -result <Control-Key-v>
test bind-20.4 {GetVirtualEvent procedure: owns many} -setup {
event delete <<xyz>>
} -body {
@@ -2724,13 +2732,13 @@ test bind-21.2 {GetAllVirtualEvents procedure: 1 event} -body {
event info
} -cleanup {
event delete <<xyz>>
-} -result {<<xyz>>}
+} -result <<xyz>>
test bind-21.3 {GetAllVirtualEvents procedure: many events} -body {
foreach p [event info] {event delete $p}
event add <<xyz>> <Control-v>
event add <<xyz>> <Button-2>
event add <<abc>> <Control-v>
- event add <<def>> <Key-F6>
+ event add <<def>> <F6>
lsort [event info]
} -cleanup {
event delete <<xyz>>
@@ -2799,7 +2807,7 @@ test bind-22.10 {HandleEventGenerate} -setup {
set x {}
} -body {
bind .t.f <Key> {set x "%s %K"}
- event generate .t.f <Control-Key-space>
+ event generate .t.f <Control-space>
set x
} -cleanup {
destroy .t.f
@@ -2816,7 +2824,7 @@ test bind-22.11 {HandleEventGenerate} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.12 {HandleEventGenerate} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2829,7 +2837,7 @@ test bind-22.12 {HandleEventGenerate} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {4}
+} -result 4
test bind-22.13 {HandleEventGenerate} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2843,7 +2851,7 @@ test bind-22.13 {HandleEventGenerate} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.14 {HandleEventGenerate} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2999,7 +3007,7 @@ test bind-22.25 {HandleEventGenerate: options <Configure> -borderwidth 2i} -setu
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.26 {HandleEventGenerate: options <Key> -borderwidth 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3093,7 +3101,7 @@ test bind-22.32 {HandleEventGenerate: options <Expose> -count 20} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {20}
+} -result 20
test bind-22.33 {HandleEventGenerate: options <Key> -count 20} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3201,7 +3209,7 @@ test bind-22.39 {HandleEventGenerate: options <Enter> -focus 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.40 {HandleEventGenerate: options <Key> -focus 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3241,7 +3249,7 @@ test bind-22.42 {HandleEventGenerate: options <Expose> -height 2i} -setup {
expr {$x eq [winfo pixels .t.f 2i]}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.43 {HandleEventGenerate: options <Configure> -height 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3255,7 +3263,7 @@ test bind-22.43 {HandleEventGenerate: options <Configure> -height 2i} -setup {
expr {$x eq [winfo pixels .t.f 2i]}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.44 {HandleEventGenerate: options <Key> -height 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3295,7 +3303,7 @@ test bind-22.46 {HandleEventGenerate: options <Key> -keycode 20} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {20}
+} -result 20
test bind-22.47 {HandleEventGenerate: options <Button> -keycode 20} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3428,7 +3436,7 @@ test bind-22.56 {HandleEventGenerate: options <Map> -override 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.57 {HandleEventGenerate: options <Reparent> -override 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3442,7 +3450,7 @@ test bind-22.57 {HandleEventGenerate: options <Reparent> -override 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.58 {HandleEventGenerate: options <Configure> -override 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3456,7 +3464,7 @@ test bind-22.58 {HandleEventGenerate: options <Configure> -override 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.59 {HandleEventGenerate: options <Key> -override 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3536,7 +3544,7 @@ test bind-22.64 {HandleEventGenerate: options <Key> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.65 {HandleEventGenerate: options <Key> -root xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3563,7 +3571,7 @@ test bind-22.66 {HandleEventGenerate: options <Key> -root [winfo id .t]} -setup
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.67 {HandleEventGenerate: options <Button> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3577,7 +3585,7 @@ test bind-22.67 {HandleEventGenerate: options <Button> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.68 {HandleEventGenerate: options <ButtonRelease> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3591,7 +3599,7 @@ test bind-22.68 {HandleEventGenerate: options <ButtonRelease> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.69 {HandleEventGenerate: options <Motion> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3605,7 +3613,7 @@ test bind-22.69 {HandleEventGenerate: options <Motion> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.70 {HandleEventGenerate: options <<Paste>> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3619,7 +3627,7 @@ test bind-22.70 {HandleEventGenerate: options <<Paste>> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.71 {HandleEventGenerate: options <Enter> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3633,7 +3641,7 @@ test bind-22.71 {HandleEventGenerate: options <Enter> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.72 {HandleEventGenerate: options <Configure> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3673,7 +3681,7 @@ test bind-22.74 {HandleEventGenerate: options <Key> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.75 {HandleEventGenerate: options <Button> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3687,7 +3695,7 @@ test bind-22.75 {HandleEventGenerate: options <Button> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.76 {HandleEventGenerate: options <ButtonRelease> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3701,7 +3709,7 @@ test bind-22.76 {HandleEventGenerate: options <ButtonRelease> -rootx 2i} -setup
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.77 {HandleEventGenerate: options <Motion> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3715,7 +3723,7 @@ test bind-22.77 {HandleEventGenerate: options <Motion> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.78 {HandleEventGenerate: options <<Paste>> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3729,7 +3737,7 @@ test bind-22.78 {HandleEventGenerate: options <<Paste>> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.79 {HandleEventGenerate: options <Enter> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3743,7 +3751,7 @@ test bind-22.79 {HandleEventGenerate: options <Enter> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.80 {HandleEventGenerate: options <Configure> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3783,7 +3791,7 @@ test bind-22.82 {HandleEventGenerate: options <Key> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.83 {HandleEventGenerate: options <Button> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3797,7 +3805,7 @@ test bind-22.83 {HandleEventGenerate: options <Button> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.84 {HandleEventGenerate: options <ButtonRelease> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3811,7 +3819,7 @@ test bind-22.84 {HandleEventGenerate: options <ButtonRelease> -rooty 2i} -setup
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.85 {HandleEventGenerate: options <Motion> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3825,7 +3833,7 @@ test bind-22.85 {HandleEventGenerate: options <Motion> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.86 {HandleEventGenerate: options <<Paste>> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3839,7 +3847,7 @@ test bind-22.86 {HandleEventGenerate: options <<Paste>> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.87 {HandleEventGenerate: options <Enter> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3853,7 +3861,7 @@ test bind-22.87 {HandleEventGenerate: options <Enter> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.88 {HandleEventGenerate: options <Configure> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3893,7 +3901,7 @@ test bind-22.90 {HandleEventGenerate: options <Key> -sendevent 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.91 {HandleEventGenerate: options <Key> -sendevent yes} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3907,7 +3915,7 @@ test bind-22.91 {HandleEventGenerate: options <Key> -sendevent yes} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.92 {HandleEventGenerate: options <Key> -sendevent 43} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3921,7 +3929,7 @@ test bind-22.92 {HandleEventGenerate: options <Key> -sendevent 43} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.93 {HandleEventGenerate: options <Key> -serial xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3948,7 +3956,7 @@ test bind-22.94 {HandleEventGenerate: options <Key> -serial 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.95 {HandleEventGenerate: options <Key> -state xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3975,7 +3983,7 @@ test bind-22.96 {HandleEventGenerate: options <Key> -state 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.97 {HandleEventGenerate: options <Button> -state 1025} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3989,7 +3997,7 @@ test bind-22.97 {HandleEventGenerate: options <Button> -state 1025} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1025}
+} -result 1025
test bind-22.98 {HandleEventGenerate: options <ButtonRelease> -state 1025} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4003,7 +4011,7 @@ test bind-22.98 {HandleEventGenerate: options <ButtonRelease> -state 1025} -setu
return $x
} -cleanup {
destroy .t.f
-} -result {1025}
+} -result 1025
test bind-22.99 {HandleEventGenerate: options <Motion> -state 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4017,7 +4025,7 @@ test bind-22.99 {HandleEventGenerate: options <Motion> -state 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.100 {HandleEventGenerate: options <<Paste>> -state 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4031,7 +4039,7 @@ test bind-22.100 {HandleEventGenerate: options <<Paste>> -state 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.101 {HandleEventGenerate: options <Enter> -state 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4045,7 +4053,7 @@ test bind-22.101 {HandleEventGenerate: options <Enter> -state 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.102 {HandleEventGenerate: options <Visibility> -state xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4112,7 +4120,7 @@ test bind-22.106 {HandleEventGenerate: options <Key> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.107 {HandleEventGenerate: options <Key> -subwindow xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4139,7 +4147,7 @@ test bind-22.108 {HandleEventGenerate: options <Key> -subwindow [winfo id .t]} -
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.109 {HandleEventGenerate: options <Button> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4153,7 +4161,7 @@ test bind-22.109 {HandleEventGenerate: options <Button> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.110 {HandleEventGenerate: options <ButtonRelease> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4167,7 +4175,7 @@ test bind-22.110 {HandleEventGenerate: options <ButtonRelease> -subwindow .t} -s
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.111 {HandleEventGenerate: options <Motion> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4181,7 +4189,7 @@ test bind-22.111 {HandleEventGenerate: options <Motion> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.112 {HandleEventGenerate: options <<Paste>> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4195,7 +4203,7 @@ test bind-22.112 {HandleEventGenerate: options <<Paste>> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.113 {HandleEventGenerate: options <Enter> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4209,7 +4217,7 @@ test bind-22.113 {HandleEventGenerate: options <Enter> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.114 {HandleEventGenerate: options <Configure> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4249,7 +4257,7 @@ test bind-22.116 {HandleEventGenerate: options <Key> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.117 {HandleEventGenerate: options <Button> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4263,7 +4271,7 @@ test bind-22.117 {HandleEventGenerate: options <Button> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.118 {HandleEventGenerate: options <ButtonRelease> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4277,7 +4285,7 @@ test bind-22.118 {HandleEventGenerate: options <ButtonRelease> -time 100} -setup
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.119 {HandleEventGenerate: options <Motion> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4291,7 +4299,7 @@ test bind-22.119 {HandleEventGenerate: options <Motion> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.120 {HandleEventGenerate: options <<Paste>> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4305,7 +4313,7 @@ test bind-22.120 {HandleEventGenerate: options <<Paste>> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.121 {HandleEventGenerate: options <Enter> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4319,7 +4327,7 @@ test bind-22.121 {HandleEventGenerate: options <Enter> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.122 {HandleEventGenerate: options <Property> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4333,7 +4341,7 @@ test bind-22.122 {HandleEventGenerate: options <Property> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.123 {HandleEventGenerate: options <Configure> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4373,7 +4381,7 @@ test bind-22.125 {HandleEventGenerate: options <Expose> -width 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.126 {HandleEventGenerate: options <Configure> -width 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4387,7 +4395,7 @@ test bind-22.126 {HandleEventGenerate: options <Configure> -width 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.127 {HandleEventGenerate: options <Key> -width 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4578,7 +4586,7 @@ test bind-22.140 {HandleEventGenerate: options <Key> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.141 {HandleEventGenerate: options <Button> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4592,7 +4600,7 @@ test bind-22.141 {HandleEventGenerate: options <Button> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.142 {HandleEventGenerate: options <ButtonRelease> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4606,7 +4614,7 @@ test bind-22.142 {HandleEventGenerate: options <ButtonRelease> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.143 {HandleEventGenerate: options <Motion> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4620,7 +4628,7 @@ test bind-22.143 {HandleEventGenerate: options <Motion> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.144 {HandleEventGenerate: options <<Paste>> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4634,7 +4642,7 @@ test bind-22.144 {HandleEventGenerate: options <<Paste>> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.145 {HandleEventGenerate: options <Enter> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4648,7 +4656,7 @@ test bind-22.145 {HandleEventGenerate: options <Enter> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.146 {HandleEventGenerate: options <Expose> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4662,7 +4670,7 @@ test bind-22.146 {HandleEventGenerate: options <Expose> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.147 {HandleEventGenerate: options <Configure> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4676,7 +4684,7 @@ test bind-22.147 {HandleEventGenerate: options <Configure> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.148 {HandleEventGenerate: options <Gravity> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4690,7 +4698,7 @@ test bind-22.148 {HandleEventGenerate: options <Gravity> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.149 {HandleEventGenerate: options <Reparent> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4704,7 +4712,7 @@ test bind-22.149 {HandleEventGenerate: options <Reparent> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.150 {HandleEventGenerate: options <Map> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4744,7 +4752,7 @@ test bind-22.152 {HandleEventGenerate: options <Key> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.153 {HandleEventGenerate: options <Button> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4758,7 +4766,7 @@ test bind-22.153 {HandleEventGenerate: options <Button> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.154 {HandleEventGenerate: options <ButtonRelease> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4772,7 +4780,7 @@ test bind-22.154 {HandleEventGenerate: options <ButtonRelease> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.155 {HandleEventGenerate: options <Motion> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4786,7 +4794,7 @@ test bind-22.155 {HandleEventGenerate: options <Motion> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.156 {HandleEventGenerate: options <<Paste>> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4800,7 +4808,7 @@ test bind-22.156 {HandleEventGenerate: options <<Paste>> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.157 {HandleEventGenerate: options <Enter> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4814,7 +4822,7 @@ test bind-22.157 {HandleEventGenerate: options <Enter> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.158 {HandleEventGenerate: options <Expose> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4828,7 +4836,7 @@ test bind-22.158 {HandleEventGenerate: options <Expose> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.159 {HandleEventGenerate: options <Configure> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4842,7 +4850,7 @@ test bind-22.159 {HandleEventGenerate: options <Configure> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.160 {HandleEventGenerate: options <Gravity> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4856,7 +4864,7 @@ test bind-22.160 {HandleEventGenerate: options <Gravity> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.161 {HandleEventGenerate: options <Reparent> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4870,7 +4878,7 @@ test bind-22.161 {HandleEventGenerate: options <Reparent> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.162 {HandleEventGenerate: options <Map> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4943,10 +4951,10 @@ test bind-24.5 {FindSequence procedure, multiple bindings} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <1> {lappend x single}
- bind .t.f <Double-1> {lappend x double}
- bind .t.f <Triple-1> {lappend x triple}
- bind .t.f <Quadruple-1> {lappend x quadruple}
+ bind .t.f <Button-1> {lappend x single}
+ bind .t.f <Double-Button-1> {lappend x double}
+ bind .t.f <Triple-Button-1> {lappend x triple}
+ bind .t.f <Quadruple-Button-1> {lappend x quadruple}
set x press
event generate .t.f <Button-1>
event generate .t.f <ButtonRelease-1>
@@ -5101,7 +5109,7 @@ test bind-25.2 {ParseEventDescription procedure: misinterpreted modifier} -setup
button .b
} -body {
bind .b <Control-M> a
- bind .b <M-M> b
+ bind .b <Meta-M> b
lsort [bind .b]
} -cleanup {
destroy .b
@@ -5121,7 +5129,7 @@ test bind-25.4 {ParseEventDescription} -setup {
bind .t.f
} -cleanup {
destroy .t.f
-} -result {<<Shift-Paste>>}
+} -result <<Shift-Paste>>
# Assorted error cases in event sequence parsing
test bind-25.5 {ParseEventDescription procedure error cases} -body {
@@ -5205,7 +5213,7 @@ test bind-25.21 {modifier names} -setup {
test bind-25.22 {modifier names} -setup {
frame .t.f -class Test -width 150 -height 100
} -body {
- bind .t.f <M-a> foo
+ bind .t.f <Meta-a> foo
bind .t.f
} -cleanup {
destroy .t.f
@@ -5454,6 +5462,42 @@ test bind-25.49 {modifier names} -setup {
destroy .t.f
} -result <Extended-Key-Return>
+test bind-25.50 {modifier names} -setup {
+ frame .t.f -class Test -width 150 -height 100
+} -body {
+ bind .t.f <Button6-a> foo
+ bind .t.f
+} -cleanup {
+ destroy .t.f
+} -result <B6-Key-a>
+
+test bind-25.51 {modifier names} -setup {
+ frame .t.f -class Test -width 150 -height 100
+} -body {
+ bind .t.f <Button7-a> foo
+ bind .t.f
+} -cleanup {
+ destroy .t.f
+} -result <B7-Key-a>
+
+test bind-25.52 {modifier names} -setup {
+ frame .t.f -class Test -width 150 -height 100
+} -body {
+ bind .t.f <Button8-a> foo
+ bind .t.f
+} -cleanup {
+ destroy .t.f
+} -result <B8-Key-a>
+
+test bind-25.53 {modifier names} -setup {
+ frame .t.f -class Test -width 150 -height 100
+} -body {
+ bind .t.f <Button9-a> foo
+ bind .t.f
+} -cleanup {
+ destroy .t.f
+} -result <B9-Key-a>
+
test bind-26.1 {event names} -setup {
@@ -5514,20 +5558,6 @@ test bind-26.5 {event names: Button} -setup {
destroy .t.f
} -result {{event Button} <Button>}
-test bind-26.6 {event names: ButtonPress} -setup {
- frame .t.f -class Test -width 150 -height 100
- pack .t.f
- focus -force .t.f
- update
-} -body {
- bind .t.f <ButtonPress> "set x {event ButtonPress}"
- set x xyzzy
- event generate .t.f <ButtonPress>
- list $x [bind .t.f]
-} -cleanup {
- destroy .t.f
-} -result {{event ButtonPress} <Button>}
-
test bind-26.7 {event names: ButtonRelease} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -5612,20 +5642,6 @@ test bind-26.12 {event names: Key} -setup {
destroy .t.f
} -result {{event Key} <Key>}
-test bind-26.13 {event names: KeyPress} -setup {
- frame .t.f -class Test -width 150 -height 100
- pack .t.f
- focus -force .t.f
- update
-} -body {
- bind .t.f <KeyPress> "set x {event KeyPress}"
- set x xyzzy
- event generate .t.f <KeyPress>
- list $x [bind .t.f]
-} -cleanup {
- destroy .t.f
-} -result {{event KeyPress} <Key>}
-
test bind-26.14 {event names: KeyRelease} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -5787,8 +5803,8 @@ test bind-27.1 {button names} -body {
bind .t <Expose-1> foo
} -returnCodes error -result {specified button "1" for non-button event}
test bind-27.2 {button names} -body {
- bind .t <Button-6> foo
-} -returnCodes error -result {bad button number "6"}
+ bind .t <Button-10> foo
+} -returnCodes error -result {bad button number "10"}
test bind-27.3 {button names} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -5859,6 +5875,62 @@ test bind-27.7 {button names} -setup {
} -cleanup {
destroy .t.f
} -result {<Button-5> {button 5}}
+test bind-27.8 {button names} -setup {
+ frame .t.f -class Test -width 150 -height 100
+ pack .t.f
+ focus -force .t.f
+ update
+} -body {
+ bind .t.f <Button-6> {lappend x "button 6"}
+ set x [bind .t.f]
+ event generate .t.f <Button-6>
+ event generate .t.f <ButtonRelease-6>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {<Button-6> {button 6}}
+test bind-27.9 {button names} -setup {
+ frame .t.f -class Test -width 150 -height 100
+ pack .t.f
+ focus -force .t.f
+ update
+} -body {
+ bind .t.f <Button-7> {lappend x "button 7"}
+ set x [bind .t.f]
+ event generate .t.f <Button-7>
+ event generate .t.f <ButtonRelease-7>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {<Button-7> {button 7}}
+test bind-27.10 {button names} -setup {
+ frame .t.f -class Test -width 150 -height 100
+ pack .t.f
+ focus -force .t.f
+ update
+} -body {
+ bind .t.f <Button-8> {lappend x "button 8"}
+ set x [bind .t.f]
+ event generate .t.f <Button-8>
+ event generate .t.f <ButtonRelease-8>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {<Button-8> {button 8}}
+test bind-27.11 {button names} -setup {
+ frame .t.f -class Test -width 150 -height 100
+ pack .t.f
+ focus -force .t.f
+ update
+} -body {
+ bind .t.f <Button-9> {lappend x "button 9"}
+ set x [bind .t.f]
+ event generate .t.f <Button-9>
+ event generate .t.f <ButtonRelease-9>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {<Button-9> {button 9}}
test bind-28.1 {keysym names} -body {
bind .t <Expose-a> foo
@@ -5867,7 +5939,7 @@ test bind-28.2 {keysym names} -body {
bind .t <Gorp> foo
} -returnCodes error -result {bad event type or keysym "Gorp"}
test bind-28.3 {keysym names} -body {
- bind .t <Key-Stupid> foo
+ bind .t <Stupid> foo
} -returnCodes error -result {bad event type or keysym "Stupid"}
test bind-28.4 {keysym names} -body {
frame .t.f -class Test -width 150 -height 100
@@ -5883,10 +5955,10 @@ test bind-28.5 {keysym names} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <Key-colon> "lappend x \"keysym received\""
- bind .t.f <Key-underscore> "lappend x {bad binding match}"
+ bind .t.f <:> "lappend x \"keysym received\""
+ bind .t.f <_> "lappend x {bad binding match}"
set x [lsort [bind .t.f]]
- event generate .t.f <Key-colon> ;# -state 0
+ event generate .t.f <:> ;# -state 0
set x
} -cleanup {
destroy .t.f
@@ -5897,10 +5969,10 @@ test bind-28.6 {keysym names} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <Key-Return> "lappend x \"keysym Return\""
- bind .t.f <Key-x> "lappend x {bad binding match}"
+ bind .t.f <Return> "lappend x \"keysym Return\""
+ bind .t.f <x> "lappend x {bad binding match}"
set x [lsort [bind .t.f]]
- event generate .t.f <Key-Return> -state 0
+ event generate .t.f <Return> -state 0
set x
} -cleanup {
destroy .t.f
@@ -5911,10 +5983,10 @@ test bind-28.7 {keysym names} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <Key-X> "lappend x \"keysym X\""
- bind .t.f <Key-x> "lappend x {bad binding match}"
+ bind .t.f <X> "lappend x \"keysym X\""
+ bind .t.f <x> "lappend x {bad binding match}"
set x [lsort [bind .t.f]]
- event generate .t.f <Key-X> -state 1
+ event generate .t.f <X> -state 1
set x
} -cleanup {
destroy .t.f
@@ -5925,42 +5997,63 @@ test bind-28.8 {keysym names} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <Key-X> "lappend x \"keysym X\""
- bind .t.f <Key-x> "lappend x {bad binding match}"
+ bind .t.f <X> "lappend x \"keysym X\""
+ bind .t.f <x> "lappend x {bad binding match}"
set x [lsort [bind .t.f]]
- event generate .t.f <Key-X> -state 1
+ event generate .t.f <X> -state 1
set x
} -cleanup {
destroy .t.f
} -result {X x {keysym X}}
-test bind-28.9 {keysym names, Eth -> ETH} -body {
+test bind-28.9 {keysym names, Ð} -body {
frame .t.f -class Test -width 150 -height 100
- bind .t.f <Eth> foo
+ bind .t.f <Ð> foo
bind .t.f
} -cleanup {
destroy .t.f
-} -result {<Key-ETH>}
-test bind-28.10 {keysym names, Ooblique -> Oslash} -body {
+} -result <Key-Ð>
+test bind-28.10 {keysym names, Ø} -constraints nodeprecated -body {
frame .t.f -class Test -width 150 -height 100
- bind .t.f <Ooblique> foo
+ bind .t.f <Ø> foo
bind .t.f
} -cleanup {
destroy .t.f
-} -result {<Key-Oslash>}
+} -result <Key-Ø>
test bind-28.11 {keysym names, gcedilla} -body {
frame .t.f -class Test -width 150 -height 100
bind .t.f <gcedilla> foo
bind .t.f
} -cleanup {
destroy .t.f
-} -result {<Key-gcedilla>}
+} -result <Key-gcedilla>
test bind-28.12 {keysym names, Greek_IOTAdiaeresis -> Greek_IOTAdieresis} -body {
frame .t.f -class Test -width 150 -height 100
bind .t.f <Greek_IOTAdiaeresis> foo
bind .t.f
} -cleanup {
destroy .t.f
-} -result {<Key-Greek_IOTAdieresis>}
+} -result <Key-Greek_IOTAdieresis>
+test bind-28.13 {keysym names, Unicode} -body {
+ frame .t.f -class Test -width 150 -height 100
+ bind .t.f <€> foo
+ bind .t.f
+} -cleanup {
+ destroy .t.f
+} -result "<Key-€>"
+test bind-28.14 {keysym names, Emoji} -body {
+ frame .t.f -class Test -width 150 -height 100
+ bind .t.f <\U1F44D> foo
+ bind .t.f
+} -cleanup {
+ destroy .t.f
+} -result "<Key-\U1F44D>"
+test bind-28.15 {keysym names, Emoji} -constraints needsTcl87 -body {
+ frame .t.f -class Test -width 150 -height 100
+ bind .t.f <👍> foo
+ bind .t.f
+} -cleanup {
+ destroy .t.f
+} -result "<Key-👍>"
test bind-29.1 {Tcl_BackgroundError procedure} -setup {
@@ -6041,7 +6134,7 @@ test bind-30.2 {MouseWheel events} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {120}
+} -result 120
test bind-30.3 {MouseWheel events} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -6152,6 +6245,8 @@ test bind-31.7 {virtual event user_data field - unshared, asynch} -setup {
} -result {{} {} {TestUserData >b<}}
test bind-32.1 {-warp, window was destroyed before the idle callback DoWarp} -setup {
+ # note: this test is now essentially useless
+ # since DoWarp no longer exist, not even as an idle callback
frame .t.f
pack .t.f
focus -force .t.f
@@ -6171,7 +6266,7 @@ test bind-32.2 {detection of double click should not fail} -setup {
update
set x {}
} -body {
- event generate .t.f <ButtonPress-1>
+ event generate .t.f <Button-1>
event generate .t.f <ButtonRelease-1>
# Simulate a lot of intervening exposure events. The old implementation
# that used an event ring overflowed, and the double click was not detected.
@@ -6179,7 +6274,7 @@ test bind-32.2 {detection of double click should not fail} -setup {
for {set i 0} {$i < 1000} {incr i} {
event generate .t.f <Expose>
}
- event generate .t.f <ButtonPress-1>
+ event generate .t.f <Button-1>
event generate .t.f <ButtonRelease-1>
set x
} -cleanup {
@@ -6191,10 +6286,10 @@ test bind-32.3 {should trigger best match of modifier states} -setup {
update
set x {}
} -body {
- bind .t.f <Alt-Control-Key-A> { lappend x "Alt-Control" }
- bind .t.f <Shift-Control-Key-A> { lappend x "Shift-Control" }
- bind .t.f <Shift-Key-A> { lappend x "Shift" }
- event generate .t.f <Alt-Control-Key-A>
+ bind .t.f <Alt-Control-A> { lappend x "Alt-Control" }
+ bind .t.f <Shift-Control-A> { lappend x "Shift-Control" }
+ bind .t.f <Shift-A> { lappend x "Shift" }
+ event generate .t.f <Alt-Control-A>
set x
} -cleanup {
destroy .t.f
@@ -6205,10 +6300,10 @@ test bind-32.4 {should not trigger Double-1} -setup {
update
set x {}
} -body {
- bind .t.f <Double-1> { set x "Double" }
- event generate .t.f <1> -time current
+ bind .t.f <Double-Button-1> { set x "Double" }
+ event generate .t.f <Button-1> -time current
after 1000
- event generate .t.f <1> -time current
+ event generate .t.f <Button-1> -time current
set x
} -cleanup {
destroy .t.f
@@ -6219,10 +6314,10 @@ test bind-32.5 {should trigger Quadruple-1} -setup {
update
set x {}
} -body {
- bind .t.f <Quadruple-1> { set x "Quadruple" }
- bind .t.f <Triple-1> { set x "Triple" }
- bind .t.f <Double-1> { set x "Double" }
- bind .t.f <1> { set x "Single" }
+ bind .t.f <Quadruple-Button-1> { set x "Quadruple" }
+ bind .t.f <Triple-Button-1> { set x "Triple" }
+ bind .t.f <Double-Button-1> { set x "Double" }
+ bind .t.f <Button-1> { set x "Single" }
# Old implementation triggered "Double", but new implementation
# triggers "Quadruple", the latter behavior conforms to other toolkits.
event generate .t.f <Button-1> -time 0
@@ -6252,10 +6347,10 @@ test bind-32.7 {test sequences} -setup {
update
set x {}
} -body {
- bind .t.f <Double-1> { lappend x "Double" }
- bind .t.f <1><1><a> { lappend x "11" }
- event generate .t.f <1>
- event generate .t.f <1>
+ bind .t.f <Double-Button-1> { lappend x "Double" }
+ bind .t.f <Button-1><Button-1><a> { lappend x "11" }
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
event generate .t.f <a>
set x
} -cleanup {
@@ -6267,12 +6362,12 @@ test bind-32.8 {test sequences} -setup {
update
set x {}
} -body {
- bind .t.f <a><1><Double-1><1><a> { lappend x "Double" }
+ bind .t.f <a><Button-1><Double-Button-1><Button-1><a> { lappend x "Double" }
event generate .t.f <a>
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
event generate .t.f <a>
set x
} -cleanup {
@@ -6284,8 +6379,8 @@ test bind-32.9 {trigger events for modifier keys} -setup {
update
set x {}
} -body {
- bind .t.f <Any-Key> { set x "Key" }
- event generate .t.f <KeyPress> -keysym Caps_Lock
+ bind .t.f <Key> { set x "Key" }
+ event generate .t.f <Key> -keysym Caps_Lock
set x
} -cleanup {
destroy .t.f
@@ -6294,14 +6389,14 @@ test bind-32.10 {reset key state when destroying window} -setup {
set x {}
} -body {
pack [frame .t.f]; update; focus -force .t.f
- bind .t.f <Key-A> { set x "A" }
- event generate .t.f <KeyPress-A>
- event generate .t.f <KeyPress-A>
+ bind .t.f <A> { set x "A" }
+ event generate .t.f <A>
+ event generate .t.f <A>
destroy .t.f; update
pack [frame .t.f]; update; focus -force .t.f
- bind .t.f <Key-A> { set x "A" }
- bind .t.f <Double-Key-A> { set x "AA" }
- event generate .t.f <KeyPress-A>
+ bind .t.f <A> { set x "A" }
+ bind .t.f <Double-A> { set x "AA" }
+ event generate .t.f <A>
destroy .t.f
set x
} -result {A}
@@ -6315,7 +6410,7 @@ test bind-32.11 {match detailed virtual} -setup {
bind Test <<TestControlButton1>> { set x "Control-Button-1" }
bind Test <Button-1> { set x "Button-1" }
bind .t.f <Button-1> { set x "Button-1" }
- event generate .t.f <Control-ButtonPress-1>
+ event generate .t.f <Control-Button-1>
set x
} -cleanup {
destroy .t.f
@@ -6331,25 +6426,25 @@ test bind-32.12 {don't detect repetition when window has changed} -setup {
} -body {
bind .t.f <Button-1> { set x "1" }
bind .t.f <Double-Button-1> { set x "11" }
- event generate .t.f <ButtonPress-1>
- event generate .t.g <ButtonPress-1>
- event generate .t.f <ButtonPress-1>
+ event generate .t.f <Button-1>
+ event generate .t.g <Button-1>
+ event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
destroy .t.g
-} -result {1}
+} -result 1
test bind-32.13 {don't detect repetition when window has changed} -setup {
pack [frame .t.f]
pack [frame .t.g]
update
set x {}
} -body {
- bind .t.f <Key-A> { set x "A" }
- bind .t.f <Double-Key-A> { set x "AA" }
- focus -force .t.f; event generate .t.f <KeyPress-A>
- focus -force .t.g; event generate .t.g <KeyPress-A>
- focus -force .t.f; event generate .t.f <KeyPress-A>
+ bind .t.f <A> { set x "A" }
+ bind .t.f <Double-A> { set x "AA" }
+ focus -force .t.f; event generate .t.f <A>
+ focus -force .t.g; event generate .t.g <A>
+ focus -force .t.f; event generate .t.f <A>
set x
} -cleanup {
destroy .t.f
@@ -6361,31 +6456,31 @@ test bind-32.14 {don't detect repetition when window has changed} -setup {
update
set x {}
} -body {
- bind .t.f <ButtonPress-1> { set x "1" }
- bind .t.f <Double-ButtonPress-1> { set x "11" }
- focus -force .t.f; event generate .t.f <ButtonPress-1>
- focus -force .t.g; event generate .t.g <ButtonPress-1>
- focus -force .t.f; event generate .t.f <ButtonPress-1>
+ bind .t.f <Button-1> { set x "1" }
+ bind .t.f <Double-Button-1> { set x "11" }
+ focus -force .t.f; event generate .t.f <Button-1>
+ focus -force .t.g; event generate .t.g <Button-1>
+ focus -force .t.f; event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
destroy .t.g
-} -result {1}
+} -result 1
test bind-32.15 {reset button state when destroying window} -setup {
set x {}
} -body {
pack [frame .t.f]; update; focus -force .t.f
- bind .t.f <ButtonPress-1> { set x "1" }
- event generate .t.f <ButtonPress-1>
- event generate .t.f <ButtonPress-1>
+ bind .t.f <Button-1> { set x "1" }
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
destroy .t.f; update
pack [frame .t.f]; update; focus -force .t.f
- bind .t.f <ButtonPress-1> { set x "1" }
- bind .t.f <Double-ButtonPress-1> { set x "11" }
- event generate .t.f <ButtonPress-1>
+ bind .t.f <Button-1> { set x "1" }
+ bind .t.f <Double-Button-1> { set x "11" }
+ event generate .t.f <Button-1>
destroy .t.f
set x
-} -result {1}
+} -result 1
test bind-33.1 {prefer longest match} -setup {
pack [frame .t.f]
@@ -6393,141 +6488,133 @@ test bind-33.1 {prefer longest match} -setup {
update
set x {}
} -body {
- bind .t.f <a><1><1> { lappend x "a11" }
- bind .t.f <Double-1> { lappend x "Double" }
+ bind .t.f <a><Button-1><Button-1> { lappend x "a11" }
+ bind .t.f <Double-Button-1> { lappend x "Double" }
event generate .t.f <a>
- event generate .t.f <1>
- event generate .t.f <1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
} -result {a11}
-test bind-33.2 {should prefer most specific event} -setup {
+test bind-33.2 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <Double-1> { lappend x "Double" }
- bind .t.f <1><1> { lappend x "11" }
- event generate .t.f <1>
- event generate .t.f <1>
+ bind .t.f <Double-Button-1> { lappend x "Double" }
+ bind .t.f <Button-1><Button-1> { lappend x "11" }
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
- # This test case shows that old implementation has an issue, because
- # it is expected that <Double-1> is matching, this binding
- # is more specific. But new implementation will be conform to old,
- # and so "11" is the expected result.
-} -result {11}
-test bind-33.3 {should prefer most specific event} -setup {
+} -result {Double}
+test bind-33.3 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <a><Double-1><a> { lappend x "Double" }
- bind .t.f <a><1><1><a> { lappend x "11" }
+ bind .t.f <a><Double-Button-1><a> { lappend x "Double" }
+ bind .t.f <a><Button-1><Button-1><a> { lappend x "11" }
event generate .t.f <a>
- event generate .t.f <1>
- event generate .t.f <1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
event generate .t.f <a>
set x
} -cleanup {
destroy .t.f
- # Also this test case shows that old implementation has an issue, it is
- # expected that <a><Double-1><a> is matching, because <Double-1> is more
- # specific than <1><1>. But new implementation will be conform to old,
- # and so "11" is the expected result.
-} -result {11}
+} -result {Double}
test bind-33.4 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <1><1> { lappend x "11" }
- bind .t.f <Double-1> { lappend x "Double" }
- event generate .t.f <1> -time 0
- event generate .t.f <1> -time 1000
+ bind .t.f <Button-1><Button-1> { lappend x "11" }
+ bind .t.f <Double-Button-1> { lappend x "Double" }
+ event generate .t.f <Button-1> -time 0
+ event generate .t.f <Button-1> -time 1000
set x
} -cleanup {
destroy .t.f
-} -result {11}
+} -result 11
test bind-33.5 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <1><1> { lappend x "11" }
- bind .t.f <Double-ButtonPress> { lappend x "Double" }
- event generate .t.f <1>
- event generate .t.f <1>
+ bind .t.f <Button-1><Button-1> { lappend x "11" }
+ bind .t.f <Double-Button> { lappend x "Double" }
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
-} -result {11}
+} -result 11
test bind-33.6 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <a><1><1><1><1><a> { lappend x "1111" }
- bind .t.f <a><ButtonPress><Double-ButtonPress><ButtonPress><a> { lappend x "Any-Double-Any" }
+ bind .t.f <a><Button-1><Button-1><Button-1><Button-1><a> { lappend x "1111" }
+ bind .t.f <a><Button><Double-Button><Button><a> { lappend x "Any-Double-Any" }
event generate .t.f <a>
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
event generate .t.f <a>
set x
} -cleanup {
destroy .t.f
-} -result {1111}
+} -result 1111
test bind-33.7 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <ButtonPress-1><a> { lappend x "1" }
- bind .t.f <ButtonPress><a> { lappend x "Any" }
- event generate .t.f <1>
+ bind .t.f <Button-1><a> { lappend x "1" }
+ bind .t.f <Button><a> { lappend x "Any" }
+ event generate .t.f <Button-1>
event generate .t.f <a>
set x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-33.8 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <Double-ButtonPress-1><a> { lappend x "1" }
- bind .t.f <ButtonPress><ButtonPress><a> { lappend x "Any" }
- event generate .t.f <1>
- event generate .t.f <1>
+ bind .t.f <Double-Button-1><a> { lappend x "1" }
+ bind .t.f <Button><Button><a> { lappend x "Any" }
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
event generate .t.f <a>
set x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-33.9 {prefer last in case of homogeneous equal patterns} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <1><2><2><Double-1> { lappend x "first" }
- bind .t.f <1><Double-2><1><1> { lappend x "last" }
- event generate .t.f <1>
- event generate .t.f <2>
- event generate .t.f <2>
- event generate .t.f <1>
- event generate .t.f <1>
+ bind .t.f <Button-1><Button-2><Button-2><Double-Button-1> { lappend x "first" }
+ bind .t.f <Button-1><Double-Button-2><Button-1><Button-1> { lappend x "last" }
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-2>
+ event generate .t.f <Button-2>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
@@ -6538,13 +6625,13 @@ test bind-33.10 {prefer last in case of homogeneous equal patterns} -setup {
update
set x {}
} -body {
- bind .t.f <1><Double-2><1><1> { lappend x "first" }
- bind .t.f <1><2><2><Double-1> { lappend x "last" }
- event generate .t.f <1>
- event generate .t.f <2>
- event generate .t.f <2>
- event generate .t.f <1>
- event generate .t.f <1>
+ bind .t.f <Button-1><Double-Button-2><Button-1><Button-1> { lappend x "first" }
+ bind .t.f <Button-1><Button-2><Button-2><Double-Button-1> { lappend x "last" }
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-2>
+ event generate .t.f <Button-2>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
@@ -6555,35 +6642,31 @@ test bind-33.11 {should prefer most specific} -setup {
update
set x {}
} -body {
- bind .t.f <2><Double-1><Double-2><Double-1><2><2> { lappend x "first" }
- bind .t.f <2><1><1><2><2><Double-1><Double-2> { lappend x "last" }
- event generate .t.f <2>
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <2>
- event generate .t.f <2>
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <2>
- event generate .t.f <2>
+ bind .t.f <Button-2><Double-Button-1><Double-Button-2><Double-Button-1><Button-2><Button-2> { lappend x "first" }
+ bind .t.f <Button-2><Button-1><Button-1><Button-2><Button-2><Double-Button-1><Double-Button-2> { lappend x "last" }
+ event generate .t.f <Button-2>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-2>
+ event generate .t.f <Button-2>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-2>
+ event generate .t.f <Button-2>
set x
} -cleanup {
destroy .t.f
- # This test case shows that old implementation has an issue, because
- # it is expected that first one is matching, this binding
- # is more specific. But new implementation will be conform to old,
- # and so "last" is the expected result.
-} -result {last}
+} -result {first}
test bind-33.12 {prefer last in case of homogeneous equal patterns} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <Control-1><1> { lappend x "first" }
- bind .t.f <1><Control-1> { lappend x "last" }
- event generate .t.f <Control-1>
- event generate .t.f <Control-1>
+ bind .t.f <Control-Button-1><Button-1> { lappend x "first" }
+ bind .t.f <Button-1><Control-Button-1> { lappend x "last" }
+ event generate .t.f <Control-Button-1>
+ event generate .t.f <Control-Button-1>
set x
} -cleanup {
destroy .t.f
@@ -6594,10 +6677,10 @@ test bind-33.13 {prefer last in case of homogeneous equal patterns} -setup {
update
set x {}
} -body {
- bind .t.f <1><Control-1> { lappend x "first" }
- bind .t.f <Control-1><1> { lappend x "last" }
- event generate .t.f <Control-1>
- event generate .t.f <Control-1>
+ bind .t.f <Button-1><Control-1> { lappend x "first" }
+ bind .t.f <Control-1><Button-1> { lappend x "last" }
+ event generate .t.f <Control-Button-1>
+ event generate .t.f <Control-Button-1>
set x
} -cleanup {
destroy .t.f
@@ -6611,12 +6694,12 @@ test bind-33.14 {prefer last in case of homogeneous equal patterns} -setup {
update
set x {}
} -body {
- bind .t.f <1><ButtonPress><1><ButtonPress> { lappend x "first" }
- bind .t.f <ButtonPress><1><ButtonPress><1> { lappend x "last" }
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <1>
+ bind .t.f <Button-1><Button><Button-1><Button> { lappend x "first" }
+ bind .t.f <Button><Button-1><Button><Button-1> { lappend x "last" }
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
@@ -6627,12 +6710,12 @@ test bind-33.15 {prefer last in case of homogeneous equal patterns} -setup {
update
set x {}
} -body {
- bind .t.f <ButtonPress><1><ButtonPress><1> { lappend x "first" }
- bind .t.f <1><ButtonPress><1><ButtonPress> { lappend x "last" }
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <1>
- event generate .t.f <1>
+ bind .t.f <Button><Button-1><Button><Button-1> { lappend x "first" }
+ bind .t.f <Button-1><Button><Button-1><Button> { lappend x "last" }
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Button-1>
set x
} -cleanup {
destroy .t.f
@@ -6698,7 +6781,7 @@ test bind-33.19 {simulate use of the keyboard to trigger a pattern sequence with
set x {}
} -body {
bind .t.f <Escape><Control-c> { lappend x "Esc_Control-c" }
- bind .t.f <Escape><KeyPress><KeyPress><Control-c> { lappend x "Esc_Key(2)_Control-c" }
+ bind .t.f <Escape><Key><Key><Control-c> { lappend x "Esc_Key(2)_Control-c" }
event generate .t.f <Escape>
event generate .t.f <Alt_L>
event generate .t.f <Control_L>
@@ -6769,7 +6852,7 @@ test bind-34.1 {-warp works relatively to a window} -setup {
set res
} -cleanup {
destroy .top
-} -result {1}
+} -result 1
test bind-34.2 {-warp works relatively to the screen} -setup {
} -body {
# Contrary to bind-34.1, we're directly checking screen coordinates
@@ -6824,7 +6907,7 @@ proc testKey {window event type mods} {
global keyInfo numericKeysym
set keyInfo {}
set numericKeysym {}
- bind $window <KeyPress> {
+ bind $window <Key> {
set keyInfo [format "%K,0x%%X,0x%%X,%A" %N %k]
set numericKeysym %N
}
@@ -6898,8 +6981,8 @@ test bind-35.1 {Key events agree for entry widgets} -constraints {aqua} -setup {
test bind-35.2 {Can bind to function keys} -constraints {aqua} -body {
global keyInfo numericKeysym
- bind . <KeyPress> {}
- bind . <KeyPress> {
+ bind . <Key> {}
+ bind . <Key> {
lappend keyInfo %K
set numericKeysym %N
}
@@ -6917,7 +7000,7 @@ test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup {
} -body {
global keyInfo numericalKeysym
set result {}
- bind . <KeyPress> {
+ bind . <Key> {
set keyInfo [format "%K,0x%%X,0x%%X,%A" %N %k]
set numericalKeysym [format "0x%x" %N]
}
@@ -6950,7 +7033,8 @@ test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup {
} -result pass
test bind-36.1 {pointer warp with grab on toplevel, bug [e3888d5820]} -setup {
- pointerAway
+ event generate {} <Motion> -warp 1 -x 50 -y 50
+ controlPointerWarpTiming
toplevel .top
grab release .top
wm geometry .top 200x200+300+300
@@ -6964,17 +7048,13 @@ test bind-36.1 {pointer warp with grab on toplevel, bug [e3888d5820]} -setup {
# but let's wait more (it depends on computer performance).
after 100 ; update
} -body {
- grab .top ; # this will queue events
- after 50
- update
+ grab .top
event generate .top.l <Motion> -warp 1 -x 10 -y 10
controlPointerWarpTiming
foreach {x1 y1} [winfo pointerxy .top.l] {}
event generate {} <Motion> -warp 1 -x 50 -y 50
controlPointerWarpTiming
- grab release .top ; # this will queue events
- after 50
- update
+ grab release .top
event generate .top.l <Motion> -warp 1 -x 10 -y 10
controlPointerWarpTiming
foreach {x2 y2} [winfo pointerxy .top.l] {}
@@ -6985,7 +7065,7 @@ test bind-36.1 {pointer warp with grab on toplevel, bug [e3888d5820]} -setup {
} -cleanup {
destroy .top
unset x1 y1 x2 y2
-} -result {1}
+} -result 1
# cleanup
cleanupTests
diff --git a/tests/bitmap.test b/tests/bitmap.test
index 6996f88..02c0f40 100644
--- a/tests/bitmap.test
+++ b/tests/bitmap.test
@@ -2,8 +2,8 @@
# tkBitmap.c. It is organized in the standard white-box fashion for
# Tcl tests.
#
-# Copyright (c) 1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/border.test b/tests/border.test
index e13d52a..96ebdcf 100644
--- a/tests/border.test
+++ b/tests/border.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out the procedures in the file
# tkBorder.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -127,6 +127,7 @@ test border-2.2 {Tk_Free3DBorder - unlinking from list} -constraints {
destroy .b .t2 .t3 .t
} -result {{{4 1} {3 0} {2 0} {1 0}} {{4 1} {2 0} {1 0}} {{4 1} {2 0}} {{2 0}} {}}
+
test border-3.1 {FreeBorderObjProc} -constraints {
testborder
} -setup {
diff --git a/tests/busy.test b/tests/busy.test
index 98d83a8..e4f5165 100644
--- a/tests/busy.test
+++ b/tests/busy.test
@@ -4,7 +4,7 @@
# commands. Sourcing this file runs the tests and generates output for errors.
# No output means no errors were found.
#
-# Copyright (c) 1998-2000 by Jos Decoster. All rights reserved.
+# Copyright © 1998-2000 Jos Decoster. All rights reserved.
package require tcltest 2.2
tcltest::configure {*}$argv
@@ -17,59 +17,65 @@ namespace import -force tcltest::test
test busy-1.1 {Tk_BusyObjCmd} -returnCodes error -body {
tk busy
-} -result {wrong # args: should be "tk busy options ?arg arg ...?"}
+} -result {wrong # args: should be "tk busy options ?arg ...?"}
test busy-2.1 {tk busy hold} -returnCodes error -body {
tk busy hold
-} -result {wrong # args: should be "tk busy hold window ?option value ...?"}
+} -result {wrong # args: should be "tk busy hold window ?-option value ...?"}
test busy-2.2 {tk busy hold root window} -body {
- tk busy hold .
+ set res [tk busy hold .]
update
+ set res
} -cleanup {
tk busy forget .
-} -result {}
+} -result {._Busy}
test busy-2.3 {tk busy hold root window with shortcut} -body {
- tk busy .
+ set res [tk busy .]
update
+ set res
} -cleanup {
tk busy forget .
-} -result {}
+} -result {._Busy}
test busy-2.4 {tk busy hold nested window} -setup {
pack [frame .f]
} -body {
- tk busy hold .f
+ set res [tk busy hold .f]
update
+ set res
} -cleanup {
tk busy forget .f
destroy .f
-} -result {}
+} -result {.f_Busy}
test busy-2.5 {tk busy hold nested window with shortcut} -setup {
pack [frame .f]
} -body {
- tk busy .f
+ set res [tk busy .f]
update
+ set res
} -cleanup {
tk busy forget .f
destroy .f
-} -result {}
+} -result {.f_Busy}
test busy-2.6 {tk busy hold toplevel window} -setup {
toplevel .f
} -body {
- tk busy hold .f
+ set res [tk busy hold .f]
update
+ set res
} -cleanup {
tk busy forget .f
destroy .f
-} -result {}
+} -result {.f._Busy}
test busy-2.7 {tk busy hold toplevel window with shortcut} -setup {
toplevel .f
} -body {
- tk busy .f
+ set res [tk busy .f]
update
+ set res
} -cleanup {
tk busy forget .f
destroy .f
-} -result {}
+} -result {.f._Busy}
test busy-2.8 {tk busy hold non existing window} -body {
tk busy hold .f
update
@@ -79,17 +85,19 @@ test busy-2.9 {tk busy hold (shortcut) non existing window} -body {
update
} -returnCodes {error} -result {bad window path name ".f"}
test busy-2.10 {tk busy hold root window with cursor} -body {
- tk busy hold . -cursor arrow
+ set res [tk busy hold . -cursor arrow]
update
+ set res
} -cleanup {
tk busy forget .
-} -result {}
+} -result {._Busy}
test busy-2.11 {tk busy hold (shortcut) root window, cursor} -body {
- tk busy . -cursor arrow
+ set res [tk busy . -cursor arrow]
update
+ set res
} -cleanup {
tk busy forget .
-} -result {}
+} -result {._Busy}
test busy-2.12 {tk busy hold root window, invalid cursor} -body {
tk busy hold . -cursor nonExistingCursor
update
@@ -174,7 +182,7 @@ test busy-3.7 {tk busy cget unix} -setup {
test busy-4.1 {tk busy configure no window} -returnCodes error -body {
tk busy configure
-} -result {wrong # args: should be "tk busy configure window ?option? ?value ...?"}
+} -result {wrong # args: should be "tk busy configure window ?-option value ...?"}
test busy-4.2 {tk busy configure invalid window} -body {
tk busy configure .f
@@ -342,14 +350,14 @@ test busy-6.1 {tk busy status} -returnCodes error -body {
} -result {wrong # args: should be "tk busy status window"}
test busy-6.2 {tk busy status non existing window} -body {
tk busy status .f
-} -result {0}
+} -result 0
test busy-6.3 {tk busy status non busy window} -setup {
pack [frame .f]
} -body {
tk busy status .f
} -cleanup {
destroy .f
-} -result {0}
+} -result 0
test busy-6.4 {tk busy status busy window} -setup {
pack [frame .f]
tk busy hold .f
@@ -359,7 +367,7 @@ test busy-6.4 {tk busy status busy window} -setup {
} -cleanup {
tk busy forget .f
destroy .f
-} -result {1}
+} -result 1
test busy-6.5 {tk busy status forgotten busy window} -setup {
pack [frame .f]
tk busy hold .f
@@ -369,7 +377,7 @@ test busy-6.5 {tk busy status forgotten busy window} -setup {
tk busy status .f
} -cleanup {
destroy .f
-} -result {0}
+} -result 0
test busy-7.1 {tk busy current no busy} -body {
tk busy current
@@ -473,5 +481,29 @@ test busy-7.9 {tk busy current 2 busy with non matching filter after forget} -se
destroy .f1 .f2
} -result {}
+test busy-8.1 {tk busy busywindow with a busy toplevel} -body {
+ toplevel .top
+ tk busy .top
+ tk busy busywindow .top
+} -cleanup {
+ tk busy forget .top
+ destroy .top
+} -result {.top._Busy}
+test busy-8.2 {tk busy busywindow with a busy widget} -body {
+ pack [frame .f]
+ tk busy .f
+ tk busy busywindow .f
+} -cleanup {
+ tk busy forget .f
+ destroy .f
+} -result {.f_Busy}
+test busy-8.3 {tk busy busywindow with a nonexisting widget} -body {
+ tk busy .
+ tk busy busywindow .nonExistingWidget
+} -cleanup {
+ tk busy forget .
+} -result {}
+
+
::tcltest::cleanupTests
return
diff --git a/tests/button.test b/tests/button.test
index f3292b31..25df606 100644
--- a/tests/button.test
+++ b/tests/button.test
@@ -2,9 +2,9 @@
# radiobuttons in Tk (i.e., all the widgets defined in tkButton.c). It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -334,7 +334,7 @@ test button-1.33 {configuration option: "bd" for label} -setup {
.l cget -bd
} -cleanup {
destroy .l
-} -result {4}
+} -result 4
test button-1.34 {configuration option: "bd" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -353,7 +353,7 @@ test button-1.35 {configuration option: "bd" for button} -setup {
.b cget -bd
} -cleanup {
destroy .b
-} -result {4}
+} -result 4
test button-1.36 {configuration option: "bd" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -372,7 +372,7 @@ test button-1.37 {configuration option: "bd" for checkbutton} -setup {
.c cget -bd
} -cleanup {
destroy .c
-} -result {4}
+} -result 4
test button-1.38 {configuration option: "bd" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -391,7 +391,7 @@ test button-1.39 {configuration option: "bd" for radiobutton} -setup {
.r cget -bd
} -cleanup {
destroy .r
-} -result {4}
+} -result 4
test button-1.40 {configuration option: "bd" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -1165,7 +1165,7 @@ test button-1.119 {configuration option: "height" for label} -setup {
.l cget -height
} -cleanup {
destroy .l
-} -result {18}
+} -result 18
test button-1.120 {configuration option: "height" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -1184,7 +1184,7 @@ test button-1.121 {configuration option: "height" for button} -setup {
.b cget -height
} -cleanup {
destroy .b
-} -result {18}
+} -result 18
test button-1.122 {configuration option: "height" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -1203,7 +1203,7 @@ test button-1.123 {configuration option: "height" for checkbutton} -setup {
.c cget -height
} -cleanup {
destroy .c
-} -result {18}
+} -result 18
test button-1.124 {configuration option: "height" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -1222,7 +1222,7 @@ test button-1.125 {configuration option: "height" for radiobutton} -setup {
.r cget -height
} -cleanup {
destroy .r
-} -result {18}
+} -result 18
test button-1.126 {configuration option: "height" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -1566,7 +1566,7 @@ test button-1.159 {configuration option: "indicatoron" for checkbutton} -setup {
.c cget -indicatoron
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-1.160 {configuration option: "indicatoron" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -1585,7 +1585,7 @@ test button-1.161 {configuration option: "indicatoron" for radiobutton} -setup {
.r cget -indicatoron
} -cleanup {
destroy .r
-} -result {1}
+} -result 1
test button-1.162 {configuration option: "indicatoron" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -1955,7 +1955,7 @@ test button-1.199 {configuration option: "repeatdelay" for button} -setup {
.b cget -repeatdelay
} -cleanup {
destroy .b
-} -result {100}
+} -result 100
test button-1.200 {configuration option: "repeatdelay" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -1975,7 +1975,7 @@ test button-1.201 {configuration option: "repeatinterval" for button} -setup {
.b cget -repeatinterval
} -cleanup {
destroy .b
-} -result {100}
+} -result 100
test button-1.202 {configuration option: "repeatinterval" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -2405,7 +2405,7 @@ test button-1.243 {configuration option: "underline" for label} -setup {
.l cget -underline
} -cleanup {
destroy .l
-} -result {5}
+} -result 5
test button-1.244 {configuration option: "underline" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -2424,7 +2424,7 @@ test button-1.245 {configuration option: "underline" for button} -setup {
.b cget -underline
} -cleanup {
destroy .b
-} -result {5}
+} -result 5
test button-1.246 {configuration option: "underline" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -2443,7 +2443,7 @@ test button-1.247 {configuration option: "underline" for checkbutton} -setup {
.c cget -underline
} -cleanup {
destroy .c
-} -result {5}
+} -result 5
test button-1.248 {configuration option: "underline" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -2462,7 +2462,7 @@ test button-1.249 {configuration option: "underline" for radiobutton} -setup {
.r cget -underline
} -cleanup {
destroy .r
-} -result {5}
+} -result 5
test button-1.250 {configuration option: "underline" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -2514,7 +2514,7 @@ test button-1.254 {configuration option: "width" for label} -setup {
.l cget -width
} -cleanup {
destroy .l
-} -result {402}
+} -result 402
test button-1.255 {configuration option: "width" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -2533,7 +2533,7 @@ test button-1.256 {configuration option: "width" for button} -setup {
.b cget -width
} -cleanup {
destroy .b
-} -result {402}
+} -result 402
test button-1.257 {configuration option: "width" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -2552,7 +2552,7 @@ test button-1.258 {configuration option: "width" for checkbutton} -setup {
.c cget -width
} -cleanup {
destroy .c
-} -result {402}
+} -result 402
test button-1.259 {configuration option: "width" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -2571,7 +2571,7 @@ test button-1.260 {configuration option: "width" for radiobutton} -setup {
.r cget -width
} -cleanup {
destroy .r
-} -result {402}
+} -result 402
test button-1.261 {configuration option: "width" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -2591,7 +2591,7 @@ test button-1.262 {configuration option: "wraplength" for label} -setup {
.l cget -wraplength
} -cleanup {
destroy .l
-} -result {100}
+} -result 100
test button-1.263 {configuration option: "wraplength" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -2610,7 +2610,7 @@ test button-1.264 {configuration option: "wraplength" for button} -setup {
.b cget -wraplength
} -cleanup {
destroy .b
-} -result {100}
+} -result 100
test button-1.265 {configuration option: "wraplength" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -2629,7 +2629,7 @@ test button-1.266 {configuration option: "wraplength" for checkbutton} -setup {
.c cget -wraplength
} -cleanup {
destroy .c
-} -result {100}
+} -result 100
test button-1.267 {configuration option: "wraplength" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -2648,7 +2648,7 @@ test button-1.268 {configuration option: "wraplength" for radiobutton} -setup {
.r cget -wraplength
} -cleanup {
destroy .r
-} -result {100}
+} -result 100
test button-1.269 {configuration option: "wraplength" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -2834,13 +2834,13 @@ test button-3.13 {ButtonWidgetCmd procedure, "configure" option} -body {
lindex [.b configure -highlightthickness] 4
} -cleanup {
destroy .b
-} -result {3}
+} -result 3
test button-3.14 {ButtonWidgetCmd procedure, "configure" option} -body {
checkbutton .c
llength [.c configure]
} -cleanup {
destroy .c
-} -result {41}
+} -result 41
test button-3.15 {ButtonWidgetCmd procedure, "configure" option} -body {
button .b
.b configure -gorp
@@ -2889,7 +2889,7 @@ test button-3.21 {ButtonWidgetCmd procedure, "deselect" option} -body {
return $checkvar
} -cleanup {
destroy .c
-} -result {0}
+} -result 0
test button-3.22 {ButtonWidgetCmd procedure, "deselect" option} -body {
radiobutton .r -variable radiovar -value red
set radiovar green
@@ -3249,7 +3249,7 @@ test button-5.4 {ConfigureButton - variable trace} -body { ;# ex 6.2a
return $y
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-5.5 {ConfigureButton - image handling} -constraints {
testImageType
@@ -3282,7 +3282,7 @@ test button-5.7 {ConfigureButton - setting selected state from variable} -body {
return $y
} -cleanup {
destroy .c
-} -result {0}
+} -result 0
test button-5.8 {ConfigureButton - setting selected state from variable} -setup {
unset -nocomplain x
} -body {
@@ -3487,7 +3487,7 @@ test button-5.25 {ConfigureButton - computing geometry} -setup {
expr {$old == $new}
} -cleanup {
destroy .b
-} -result {0}
+} -result 0
test button-6.1 {ButtonEventProc procedure} -body {
button .b -text "Test Button" -command {
@@ -3554,7 +3554,7 @@ test button-8.3 {TkInvokeButton procedure} -setup {
} -cleanup {
destroy .c
trace vdelete x w bogusTrace
-} -result {1}
+} -result 1
test button-8.4 {TkInvokeButton procedure} -setup {
set x 1
} -body {
@@ -3575,7 +3575,7 @@ test button-8.5 {TkInvokeButton procedure} -setup {
} -cleanup {
destroy .c
trace vdelete x w bogusTrace
-} -result {0}
+} -result 0
test button-8.6 {TkInvokeButton procedure} -setup {
set x 0
@@ -3665,7 +3665,7 @@ test button-9.2 {ButtonVarProc procedure} -body {
return $x
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-9.3 {ButtonVarProc procedure} -setup {
set x 1
} -body {
@@ -3675,7 +3675,7 @@ test button-9.3 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-9.4 {ButtonVarProc procedure} -setup {
set x 0
} -body {
@@ -3685,7 +3685,7 @@ test button-9.4 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {0}
+} -result 0
test button-9.5 {ButtonVarProc procedure} -setup {
set x 1
} -body {
@@ -3695,7 +3695,7 @@ test button-9.5 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {0}
+} -result 0
test button-9.6 {ButtonVarProc procedure} -setup {
set x 0
} -body {
@@ -3705,7 +3705,7 @@ test button-9.6 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-9.7 {ButtonVarProc procedure} -setup {
set x 1
} -body {
@@ -3715,7 +3715,7 @@ test button-9.7 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-9.8 {ButtonVarProc procedure, can't read variable} -setup {
# This test does nothing but produce a core dump if there's a prbblem.
unset -nocomplain a
@@ -3751,7 +3751,7 @@ test button-10.2 {ButtonTextVarProc procedure} -setup {
expr {$old == $new}
} -cleanup {
destroy .b
-} -result {0}
+} -result 0
test button-11.1 {ButtonImageProc procedure} -constraints {
testImageType
@@ -3780,7 +3780,7 @@ test button-12.1 {button widget vs hidden commands} -body {
expr {$res1 == $res2}
} -cleanup {
destroy .b
-} -result {1}
+} -result 1
test button-13.1 {size behavior: label} -setup {
label .a -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
diff --git a/tests/canvImg.test b/tests/canvImg.test
index 27c00d6..db72219 100644
--- a/tests/canvImg.test
+++ b/tests/canvImg.test
@@ -2,9 +2,9 @@
# which implement canvas "image" items. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/canvMoveto.test b/tests/canvMoveto.test
index a6cf849..187a56d 100644
--- a/tests/canvMoveto.test
+++ b/tests/canvMoveto.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the canvas "moveto" command. It is
# derived from canvRect.test.
#
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2004 Neil McKay.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 2004 Neil McKay.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/canvPs.test b/tests/canvPs.test
index eb09af9..ffebd21 100644
--- a/tests/canvPs.test
+++ b/tests/canvPs.test
@@ -2,8 +2,8 @@
# for canvases to files and channels. It exercises the procedure
# TkCanvPostscriptCmd in generic/tkCanvPs.c
#
-# Copyright (c) 1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -158,7 +158,7 @@ test canvPs-3.1 {test ps generation with an embedded window} -constraints {
destroy .c
imageCleanup
removeFile bar.ps
-} -result {1}
+} -result 1
test canvPs-3.2 {test ps generation with an embedded window not mapped} -setup {
set bar [makeFile {} bar.ps]
file delete $bar
@@ -172,7 +172,7 @@ test canvPs-3.2 {test ps generation with an embedded window not mapped} -setup {
} -cleanup {
destroy .c
removeFile bar.ps
-} -result {1}
+} -result 1
test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} -body {
diff --git a/tests/canvRect.test b/tests/canvRect.test
index ec59e8b..33e5d18 100644
--- a/tests/canvRect.test
+++ b/tests/canvRect.test
@@ -2,8 +2,8 @@
# which implement canvas "rectangle" and "oval" items. It is organized
# in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/canvText.test b/tests/canvText.test
index 4898eb8..f6b5e4b 100644
--- a/tests/canvText.test
+++ b/tests/canvText.test
@@ -2,8 +2,8 @@
# which implement canvas "text" items. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -253,7 +253,7 @@ test canvText-4.6 {ConfigureText procedure: adjust cursor} -setup {
.c index test insert
} -cleanup {
.c delete test
-} -result {4}
+} -result 4
test canvText-5.1 {ConfigureText procedure: adjust cursor} -body {
@@ -576,7 +576,7 @@ test canvText-8.8 {TextInsert procedure: inserting before cursor} -setup {
.c icursor test 3
.c insert test 2 "xyz"
.c index test insert
-} -result {6}
+} -result 6
test canvText-8.9 {TextInsert procedure: inserting after cursor} -setup {
.c create text 20 20 -tag test
focus .c
@@ -586,7 +586,7 @@ test canvText-8.9 {TextInsert procedure: inserting after cursor} -setup {
.c icursor test 3
.c insert test 4 "xyz"
.c index test insert
-} -result {3}
+} -result 3
# Item used in 9.* tests
.c create text 20 20 -tag test
@@ -676,19 +676,19 @@ test canvText-9.13 {TextInsert procedure: move cursor} -body {
.c icursor test 6
.c dchars test 2 4
.c index test insert
-} -result {3}
+} -result 3
test canvText-9.14 {TextInsert procedure: keep cursor >= first} -body {
.c itemconfig test -text "abcdefghijk"
.c icursor test 6
.c dchars test 2 10
.c index test insert
-} -result {2}
+} -result 2
test canvText-9.15 {TextInsert procedure: cursor doesn't move} -body {
.c itemconfig test -text "abcdefghijk"
.c icursor test 5
.c dchars test 7 9
.c index test insert
-} -result {5}
+} -result 5
.c delete test
@@ -698,7 +698,7 @@ test canvText-10.1 {TextToPoint procedure} -body {
.c index test @0,0
} -cleanup {
.c delete test
-} -result {0}
+} -result 0
test canvText-11.1 {TextToArea procedure} -setup {
@@ -837,7 +837,7 @@ test canvText-15.1 {SetTextCursor procedure} -setup {
.c index test insert
} -cleanup {
.c delete test
-} -result {3}
+} -result 3
test canvText-16.1 {GetSelText procedure} -setup {
.c create text 0 0 -tag test
diff --git a/tests/canvWind.test b/tests/canvWind.test
index 436ee2c..cef0cb8 100644
--- a/tests/canvWind.test
+++ b/tests/canvWind.test
@@ -2,8 +2,8 @@
# which implement canvas "window" items. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/canvas.test b/tests/canvas.test
index d91d872..ea71193 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -2,9 +2,9 @@
# implements generic code for canvases. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1995-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 Ajuba Solutions.
-# Copyright (c) 2008 Donal K. Fellows
+# Copyright © 1995-1996 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Ajuba Solutions.
+# Copyright © 2008 Donal K. Fellows
# All rights reserved.
package require tcltest 2.2
@@ -37,14 +37,14 @@ test canvas-1.4 {configuration options: bad value for "bg"} -body {
test canvas-1.5 {configuration options: good value for "bd"} -body {
.c configure -bd 4
.c cget -bd
-} -result {4}
+} -result 4
test canvas-1.6 {configuration options: bad value for "bd"} -body {
.c configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test canvas-1.7 {configuration options: good value for "borderwidth"} -body {
.c configure -borderwidth 1.3
.c cget -borderwidth
-} -result {1}
+} -result 1
test canvas-1.8 {configuration options: bad value for "borderwidth"} -body {
.c configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -58,7 +58,7 @@ test canvas-1.10 {configuration options: bad value for "closeenough"} -body {
test canvas-1.11 {configuration options: good value for "confine"} -body {
.c configure -confine true
.c cget -confine
-} -result {1}
+} -result 1
test canvas-1.12 {configuration options: bad value for "confine"} -body {
.c configure -confine silly
} -returnCodes error -result {expected boolean value but got "silly"}
@@ -72,7 +72,7 @@ test canvas-1.14 {configuration options: bad value for "cursor"} -body {
test canvas-1.15 {configuration options: good value for "height"} -body {
.c configure -height 2.1
.c cget -height
-} -result {2}
+} -result 2
test canvas-1.16 {configuration options: bad value for "height"} -body {
.c configure -height x42
} -returnCodes error -result {bad screen distance "x42"}
@@ -93,7 +93,7 @@ test canvas-1.20 {configuration options: bad value for "highlightcolor"} -body {
test canvas-1.21 {configuration options: good value for "highlightthickness"} -body {
.c configure -highlightthickness 18
.c cget -highlightthickness
-} -result {18}
+} -result 18
test canvas-1.22 {configuration options: bad value for "highlightthickness"} -body {
.c configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -107,28 +107,28 @@ test canvas-1.24 {configuration options: bad value for "insertbackground"} -body
test canvas-1.25 {configuration options: good value for "insertborderwidth"} -body {
.c configure -insertborderwidth 1.3
.c cget -insertborderwidth
-} -result {1}
+} -result 1
test canvas-1.26 {configuration options: bad value for "insertborderwidth"} -body {
.c configure -insertborderwidth 2.6x
} -returnCodes error -result {bad screen distance "2.6x"}
test canvas-1.27 {configuration options: good value for "insertofftime"} -body {
.c configure -insertofftime 100
.c cget -insertofftime
-} -result {100}
+} -result 100
test canvas-1.28 {configuration options: bad value for "insertofftime"} -body {
.c configure -insertofftime 3.2
} -returnCodes error -result {expected integer but got "3.2"}
test canvas-1.29 {configuration options: good value for "insertontime"} -body {
.c configure -insertontime 100
.c cget -insertontime
-} -result {100}
+} -result 100
test canvas-1.30 {configuration options: bad value for "insertontime"} -body {
.c configure -insertontime 3.2
} -returnCodes error -result {expected integer but got "3.2"}
test canvas-1.31 {configuration options: good value for "insertwidth"} -body {
.c configure -insertwidth 1.3
.c cget -insertwidth
-} -result {1}
+} -result 1
test canvas-1.32 {configuration options: bad value for "insertwidth"} -body {
.c configure -insertwidth 6x
} -returnCodes error -result {bad screen distance "6x"}
@@ -149,7 +149,7 @@ test canvas-1.36 {configuration options: bad value for "selectbackground"} -body
test canvas-1.37 {configuration options: good value for "selectborderwidth"} -body {
.c configure -selectborderwidth 1.3
.c cget -selectborderwidth
-} -result {1}
+} -result 1
test canvas-1.38 {configuration options: bad value for "selectborderwidth"} -body {
.c configure -selectborderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -167,7 +167,7 @@ test canvas-1.41 {configuration options: good value for "takefocus"} -body {
test canvas-1.42 {configuration options: good value for "width"} -body {
.c configure -width 402
.c cget -width
-} -result {402}
+} -result 402
test canvas-1.43 {configuration options: bad value for "width"} -body {
.c configure -width xyz
} -returnCodes error -result {bad screen distance "xyz"}
@@ -227,6 +227,16 @@ test canvas-2.4 {CanvasWidgetCmd, xview option} -constraints nonPortable -body {
update
lappend x [.c xview]
} -result {{0.6 0.9} {0.66 0.96}}
+test canvas-2.5 {CanvasWidgetCmd, raise/lower option, no error on non-existing tags} -setup {
+ .c create line 0 0 10 10 -tags aline
+} -body {
+ .c raise aline noline
+ .c raise bline aline
+ .c lower aline noline
+ .c lower bline aline
+} -cleanup {
+ .c delete aline
+} -result {}
catch {destroy .c}
# Canvas used in 3.* test cases
@@ -340,8 +350,26 @@ test canvas-8.1 {canvas arc bbox} -setup {
set coordBox [.c bbox arc2]
.c create arc 300 10 500 210 -start 10 -extent 50 -style pieslice -tags arc3
set pieBox [.c bbox arc3]
- list $arcBox $coordBox $pieBox
-} -result {{48 21 100 94} {248 21 300 94} {398 21 500 112}}
+ .c create arc 100 200 300 200 -height [expr {(1-0.5*sqrt(3))*200}] -style arc -tags arc4
+ set arcSegBox [.c bbox arc4]
+ list $arcBox $coordBox $pieBox $arcSegBox
+} -result {{48 21 100 94} {248 21 300 94} {398 21 500 112} {98 171 302 202}}
+test canvas-8.2 {canvas very small arc} -setup {
+ catch {destroy .c}
+ canvas .c
+} -body {
+ # no Inf or NaN must be generated even for very small arcs
+ .c create arc 0 100 0 100 -height 100 -style arc -outline "" -tags arc1
+ set arcBox [.c bbox arc1]
+ .c create arc 0 100 0 100 -height 100 -style arc -outline blue -tags arc2
+ set outlinedArcBox [.c bbox arc2]
+ set coords [.c coords arc1]
+ set start [.c itemcget arc1 -start]
+ set extent [.c itemcget arc1 -extent]
+ set width [.c itemcget arc1 -width]
+ set height [.c itemcget arc1 -height]
+ list $arcBox $outlinedArcBox $coords $start $extent $width $height
+} -result {{-1 99 1 101} {-2 98 2 102} {0.0 100.0 0.0 100.0} 0.0 0.0 1.0 0.0}
test canvas-9.1 {canvas id creation and deletion} -setup {
catch {destroy .c}
@@ -572,7 +600,7 @@ test canvas-13.1 {canvas delete during event, SF bug-228024} -body {
set ::x {}
# do this many times to improve chances of triggering the crash
for {set i 0} {$i < 30} {incr i} {
- event generate .c <1> -x 100 -y 100
+ event generate .c <Button-1> -x 100 -y 100
event generate .c <ButtonRelease-1> -x 100 -y 100
}
return $::x
@@ -729,7 +757,7 @@ test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setu
} -body {
set id [.c create rect 0 0 1cm 1cm]
expr {[lindex [.c coords $id] 2]>1}
-} -result {1}
+} -result 1
test canvas-15.20 {bug [237971ce]} -setup {
destroy .c
canvas .c
@@ -1008,6 +1036,277 @@ test canvas-20.3 {tag deletion - all tags match} -setup {
destroy .c
} -result {{tagA tagA tagA tagA tagA tagA} {}}
+destroy .c
+test canvas-21.1 {canvas rotate} -setup {
+ pack [canvas .c]
+} -body {
+ .c create line 50 50 50 100 100 100
+ .c rotate all 75 75 90
+ lmap c [.c coords all] {format %.2f $c}
+} -cleanup {
+ destroy .c
+} -result {50.00 100.00 100.00 100.00 100.00 50.00}
+test canvas-21.2 {canvas rotate} -setup {
+ pack [canvas .c]
+} -body {
+ .c create line 50 50 50 100 100 100
+ .c rotate all 75 75 -10
+ lmap c [.c coords all] {format %.2f $c}
+} -cleanup {
+ destroy .c
+} -result {54.72 46.04 46.04 95.28 95.28 103.96}
+test canvas-21.3 {canvas rotate: syntax} -setup {
+ pack [canvas .c]
+} -body {
+ .c rotate all 75 75
+} -returnCodes error -cleanup {
+ destroy .c
+} -result {wrong # args: should be ".c rotate tagOrId x y angle"}
+test canvas-21.4 {canvas rotate: syntax} -setup {
+ pack [canvas .c]
+} -body {
+ .c rotate all 75 75 123 123
+} -returnCodes error -cleanup {
+ destroy .c
+} -result {wrong # args: should be ".c rotate tagOrId x y angle"}
+test canvas-21.5 {canvas rotate: syntax} -setup {
+ pack [canvas .c]
+} -body {
+ .c rotate {!} 1 1 1
+} -returnCodes error -cleanup {
+ destroy .c
+} -result {missing tag in tag search expression}
+test canvas-21.6 {canvas rotate: syntax} -setup {
+ pack [canvas .c]
+} -body {
+ .c rotate all x 1 1
+} -returnCodes error -cleanup {
+ destroy .c
+} -result {bad screen distance "x"}
+test canvas-21.7 {canvas rotate: syntax} -setup {
+ pack [canvas .c]
+} -body {
+ .c rotate all 1 x 1
+} -returnCodes error -cleanup {
+ destroy .c
+} -result {bad screen distance "x"}
+test canvas-21.8 {canvas rotate: syntax} -setup {
+ pack [canvas .c]
+} -body {
+ .c rotate all 1 1 x
+} -returnCodes error -cleanup {
+ destroy .c
+} -result {expected floating-point number but got "x"}
+test canvas-21.9 {canvas rotate: nothing to rotate} -setup {
+ pack [canvas .c]
+} -body {
+ .c rotate all 75 75 10
+} -cleanup {
+ destroy .c
+} -result {}
+test canvas-21.10 {canvas rotate: multiple things to rotate} -setup {
+ pack [canvas .c]
+} -body {
+ .c create line 50 50 50 100 -tag a
+ .c create line 50 50 100 50 -tag b
+ .c rotate all 75 75 45
+ list [lmap c [.c coords a] {format %.2f $c}] [lmap c [.c coords b] {format %.2f $c}]
+} -cleanup {
+ destroy .c
+} -result {{39.64 75.00 75.00 110.36} {39.64 75.00 75.00 39.64}}
+
+test canvas-22.1 {canvas rotate: arc item rotation behaviour} -setup {
+ pack [canvas .c]
+} -body {
+ .c create arc 50 50 75 75 -start 45 -extent 90
+ .c rotate all 100 100 90
+ list [lmap c [.c coords all] {format %.2f $c}] \
+ [lmap o {-start -extent} {.c itemcget all $o}] \
+ [.c bbox all]
+} -cleanup {
+ destroy .c
+} -result {{50.00 125.00 75.00 150.00} {45.0 90.0} {52 123 73 140}}
+test canvas-22.2 {canvas rotate: bitmap item rotation behaviour} -setup {
+ pack [canvas .c]
+} -body {
+ .c create bitmap 50 50 -bitmap info -anchor se
+ .c rotate all 100 100 90
+ list [lmap c [.c coords all] {format %.2f $c}] \
+ [lmap o {-bitmap -anchor} {.c itemcget all $o}] \
+ [.c bbox all]
+} -cleanup {
+ destroy .c
+} -result {{50.00 150.00} {info se} {42 129 50 150}}
+test canvas-22.3 {canvas rotate: image item rotation behaviour} -setup {
+ pack [canvas .c]
+ image create photo dummy -width 50 -height 50
+} -body {
+ .c create image 50 50 -image dummy -anchor se
+ .c rotate all 100 100 90
+ list [lmap c [.c coords all] {format %.2f $c}] \
+ [lmap o {-image -anchor} {.c itemcget all $o}] \
+ [.c bbox all]
+} -cleanup {
+ destroy .c
+ image delete dummy
+} -result {{50.00 150.00} {dummy se} {0 100 50 150}}
+test canvas-22.4 {canvas rotate: line item rotation behaviour} -setup {
+ pack [canvas .c]
+} -body {
+ .c create line 50 50 75 50 50 75 75 75
+ .c rotate all 100 100 90
+ list [lmap c [.c coords all] {format %.2f $c}] \
+ [lmap o {} {.c itemcget all $o}] \
+ [.c bbox all]
+} -cleanup {
+ destroy .c
+} -result {{50.00 150.00 50.00 125.00 75.00 150.00 75.00 125.00} {} {48 123 77 152}}
+test canvas-22.5 {canvas rotate: oval item rotation behaviour} -setup {
+ pack [canvas .c]
+} -body {
+ .c create oval 50 50 65 85
+ .c rotate all 100 100 90
+ list [lmap c [.c coords all] {format %.2f $c}] \
+ [lmap o {} {.c itemcget all $o}] \
+ [.c bbox all]
+} -cleanup {
+ destroy .c
+} -result {{60.00 125.00 75.00 160.00} {} {59 124 76 161}}
+test canvas-22.6 {canvas rotate: polygon item rotation behaviour} -setup {
+ pack [canvas .c]
+} -body {
+ .c create polygon 50 50 75 50 50 75 75 75
+ .c rotate all 100 100 90
+ list [lmap c [.c coords all] {format %.2f $c}] \
+ [lmap o {} {.c itemcget all $o}] \
+ [.c bbox all]
+} -cleanup {
+ destroy .c
+} -result {{50.00 150.00 50.00 125.00 75.00 150.00 75.00 125.00} {} {48 123 77 152}}
+test canvas-22.7 {canvas rotate: rectangle item rotation behaviour} -setup {
+ pack [canvas .c]
+} -body {
+ .c create rectangle 50 50 75 75
+ .c rotate all 100 100 90
+ list [lmap c [.c coords all] {format %.2f $c}] \
+ [lmap o {} {.c itemcget all $o}] \
+ [.c bbox all]
+} -cleanup {
+ destroy .c
+} -result {{50.00 125.00 75.00 150.00} {} {49 124 76 151}}
+test canvas-22.8 {canvas rotate: text item rotation behaviour} -setup {
+ pack [canvas .c]
+} -body {
+ .c create text 50 50 -text foo -angle 45
+ .c rotate all 100 100 90
+ list [lmap c [.c coords all] {format %.2f $c}] \
+ [lmap o {-text -angle} {.c itemcget all $o}]
+ # [.c bbox all]
+ # No testing of text bounding box; fonts too variable!
+} -cleanup {
+ destroy .c
+} -result {{50.00 150.00} {foo 45.0}}
+test canvas-22.9 {canvas rotate: window item rotation behaviour} -setup {
+ pack [canvas .c]
+} -body {
+ .c create window 50 50 -window [frame .c.f -width 25 -height 25] \
+ -anchor se
+ .c rotate all 100 100 90
+ list [lmap c [.c coords all] {format %.2f $c}] \
+ [lmap o {} {.c itemcget all $o}] \
+ [.c bbox all]
+} -cleanup {
+ destroy .c
+} -result {{50.00 150.00} {} {25 125 50 150}}
+
+# Procedure used in test cases 23.1 23.2 23.3
+proc matchPixels {pixels expected} {
+ set matched 1
+ foreach pline $pixels eline $expected {
+ foreach ppixel $pline epixel $eline {
+ if {$ppixel != $epixel} {
+ set matched 0
+ break
+ }
+ }
+ }
+ return $matched
+}
+
+test canvas-23.1 {canvas image} -setup {
+ canvas .c
+ image create photo testimage
+} -body {
+ .c configure -background #c0c0c0 -scrollregion {0 0 9 9}
+ .c create rectangle 0 0 0 9 -fill #000080 -outline #000080
+ .c image testimage
+ matchPixels [testimage data] { \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}}
+} -cleanup {
+ destroy .c
+ image delete testimage
+} -result 1
+
+test canvas-23.2 {canvas image with subsample} -setup {
+ canvas .c
+ image create photo testimage
+} -body {
+ .c configure -background #c0c0c0 -scrollregion {0 0 9 9}
+ .c create rectangle 0 0 1 9 -fill #008000 -outline #008000
+ .c image testimage 2
+ matchPixels [testimage data] { \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}}
+} -cleanup {
+ destroy .c
+ image delete testimage
+} -result 1
+
+test canvas-23.3 {canvas image with subsample and zoom} -setup {
+ canvas .c
+ image create photo testimage
+} -body {
+ .c configure -background #c0c0c0 -scrollregion {0 0 9 9}
+ .c create rectangle 0 0 9 0 -fill #800000 -outline #800000
+ .c image testimage 1 2
+ matchPixels [testimage data] { \
+ {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \
+ {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}}
+} -cleanup {
+ destroy .c
+ image delete testimage
+} -result 1
+
# cleanup
imageCleanup
cleanupTests
diff --git a/tests/choosedir.test b/tests/choosedir.test
index f67a721..7e66756 100644
--- a/tests/choosedir.test
+++ b/tests/choosedir.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out Tk's "tk_chooseDir" and
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -26,7 +26,7 @@ proc ToEnterDirsByKey {parent dirs} {
proc PressButton {btn} {
event generate $btn <Enter>
- event generate $btn <1> -x 5 -y 5
+ event generate $btn <Button-1> -x 5 -y 5
event generate $btn <ButtonRelease-1> -x 5 -y 5
}
@@ -68,7 +68,7 @@ proc SendButtonPress {parent btn type} {
event generate $w <Enter>
focus $w
event generate $button <Enter>
- event generate $w <KeyPress> -keysym Return
+ event generate $w <Key> -keysym Return
}
}
diff --git a/tests/clipboard.test b/tests/clipboard.test
index 7c1a506..aa8f148 100644
--- a/tests/clipboard.test
+++ b/tests/clipboard.test
@@ -2,8 +2,8 @@
# especially the "clipboard" command. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
#
diff --git a/tests/clrpick.test b/tests/clrpick.test
index 747a1c4..84b883e 100644
--- a/tests/clrpick.test
+++ b/tests/clrpick.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out Tk's "tk_chooseColor" command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -99,7 +99,7 @@ proc ToChooseColorByKey {parent r g b} {
proc PressButton {btn} {
event generate $btn <Enter>
- event generate $btn <1> -x 5 -y 5
+ event generate $btn <Button-1> -x 5 -y 5
event generate $btn <ButtonRelease-1> -x 5 -y 5
}
@@ -139,7 +139,7 @@ proc SendButtonPress {parent btn type} {
event generate $w <Enter>
focus $w
event generate $button <Enter>
- event generate $w <KeyPress> -keysym Return
+ event generate $w <Key> -keysym Return
}
}
diff --git a/tests/cmds.test b/tests/cmds.test
index caf5afe..3ccd587 100644
--- a/tests/cmds.test
+++ b/tests/cmds.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test the procedures in the file
# tkCmds.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/color.test b/tests/color.test
index 1e99a7d..798e6b9 100644
--- a/tests/color.test
+++ b/tests/color.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out the procedures in the file
# tkColor.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1995-1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995-1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/config.test b/tests/config.test
index 9fd048a..ff06a22 100644
--- a/tests/config.test
+++ b/tests/config.test
@@ -2,8 +2,8 @@
# which comprise the new new option configuration system. It is
# organized in the standard "white-box" fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -235,7 +235,7 @@ test config-4.2 {DoObjConfig - boolean} -constraints testobjconfig -setup {
.foo cget -boolean
} -cleanup {
killTables
-} -returnCodes ok -result {0}
+} -returnCodes ok -result 0
test config-4.3 {DoObjConfig - boolean} -constraints testobjconfig -setup {
catch {rename .foo {}}
} -body {
@@ -259,7 +259,7 @@ test config-4.5 {DoObjConfig - boolean} -constraints testobjconfig -setup {
.foo cget -boolean
} -cleanup {
killTables
-} -returnCodes ok -result {1}
+} -returnCodes ok -result 1
test config-4.6 {DoObjConfig - boolean} -constraints testobjconfig -setup {
catch {rename .foo {}}
} -body {
@@ -287,7 +287,7 @@ test config-4.8 {DoObjConfig - boolean internal value} -constraints {
.foo cget -boolean
} -cleanup {
killTables
-} -result {0}
+} -result 0
test config-4.9 {DoObjConfig - integer} -constraints testobjconfig -setup {
catch {rename .foo {}}
@@ -303,7 +303,7 @@ test config-4.10 {DoObjConfig - integer} -constraints testobjconfig -setup {
.foo cget -integer
} -cleanup {
killTables
-} -returnCodes ok -result {3}
+} -returnCodes ok -result 3
test config-4.11 {DoObjConfig - integer} -constraints testobjconfig -setup {
catch {rename .foo {}}
} -body {
@@ -333,7 +333,7 @@ test config-4.13 {DoObjConfig - integer internal value} -constraints {
.foo cget -integer
} -cleanup {
killTables
-} -result {421}
+} -result 421
test config-4.14 {DoObjConfig - double} -constraints testobjconfig -setup {
catch {rename .foo {}}
@@ -472,7 +472,7 @@ test config-4.30 {DoObjConfig - new string table} -constraints {
.foo configure -stringtable three
} -cleanup {
killTables
-} -returnCodes ok -result {16}
+} -returnCodes ok -result 16
test config-4.31 {DoObjConfig - new string table} -constraints {
testobjconfig
} -body {
@@ -564,7 +564,7 @@ test config-4.42 {DoObjConfig - getting rid of old color} -constraints {
.foo configure -color #444444
} -cleanup {
killTables
-} -returnCodes ok -result {32}
+} -returnCodes ok -result 32
test config-4.43 {DoObjConfig - getting rid of old color} -constraints {
testobjconfig
} -body {
@@ -607,7 +607,7 @@ test config-4.47 {DoObjConfig - new font} -constraints testobjconfig -setup {
.foo configure -font {Helvetica 72}
} -cleanup {
killTables
-} -returnCodes ok -result {64}
+} -returnCodes ok -result 64
test config-4.48 {DoObjConfig - new font} -constraints testobjconfig -setup {
catch {rename .foo {}}
} -body {
@@ -668,7 +668,7 @@ test config-4.55 {DoObjConfig - new bitmap} -constraints testobjconfig -body {
.foo configure -bitmap gray50
} -cleanup {
killTables
-} -returnCodes ok -result {128}
+} -returnCodes ok -result 128
test config-4.56 {DoObjConfig - new bitmap} -constraints testobjconfig -body {
testobjconfig alltypes .foo -bitmap gray75
.foo configure -bitmap gray50
@@ -751,7 +751,7 @@ test config-4.67 {DoObjConfig - getting rid of old border} -constraints {
.foo configure -border #444444
} -cleanup {
killTables
-} -returnCodes ok -result {256}
+} -returnCodes ok -result 256
test config-4.68 {DoObjConfig - getting rid of old border} -constraints {
testobjconfig
} -body {
@@ -793,7 +793,7 @@ test config-4.73 {DoObjConfig - new relief} -constraints testobjconfig -body {
.foo configure -relief flat
} -cleanup {
killTables
-} -returnCodes ok -result {512}
+} -returnCodes ok -result 512
test config-4.74 {DoObjConfig - new relief} -constraints testobjconfig -body {
testobjconfig alltypes .foo -relief raised
.foo configure -relief flat
@@ -838,7 +838,7 @@ test config-4.80 {DoObjConfig - new cursor} -constraints testobjconfig -body {
.foo configure -cursor arrow
} -cleanup {
killTables
-} -returnCodes ok -result {1024}
+} -returnCodes ok -result 1024
test config-4.81 {DoObjConfig - new cursor} -constraints testobjconfig -body {
testobjconfig alltypes .foo -cursor xterm
.foo configure -cursor arrow
@@ -878,7 +878,7 @@ test config-4.86 {DoObjConfig - new justify} -constraints testobjconfig -body {
.foo configure -justify right
} -cleanup {
killTables
-} -returnCodes ok -result {2048}
+} -returnCodes ok -result 2048
test config-4.87 {DoObjConfig - new justify} -constraints testobjconfig -body {
testobjconfig alltypes .foo -justify left
.foo configure -justify right
@@ -918,7 +918,7 @@ test config-4.92 {DoObjConfig - new anchor} -constraints testobjconfig -body {
.foo configure -anchor n
} -cleanup {
killTables
-} -returnCodes ok -result {4096}
+} -returnCodes ok -result 4096
test config-4.93 {DoObjConfig - new anchor} -constraints testobjconfig -body {
testobjconfig alltypes .foo -anchor e
.foo configure -anchor n
@@ -946,7 +946,7 @@ test config-4.96 {DoObjConfig - pixel} -constraints testobjconfig -body {
.foo cget -pixel
} -cleanup {
killTables
-} -returnCodes ok -result {42}
+} -returnCodes ok -result 42
test config-4.97 {DoObjConfig - invalid pixel} -constraints testobjconfig -body {
testobjconfig alltypes .foo -pixel foo
} -cleanup {
@@ -957,7 +957,7 @@ test config-4.98 {DoObjConfig - new pixel} -constraints testobjconfig -body {
.foo configure -pixel 3c
} -cleanup {
killTables
-} -returnCodes ok -result {8192}
+} -returnCodes ok -result 8192
test config-4.99 {DoObjConfig - new pixel} -constraints testobjconfig -body {
testobjconfig alltypes .foo -pixel 42m
.foo configure -pixel 3c
@@ -976,7 +976,7 @@ test config-4.100 {DoObjConfig - pixel internal value} -constraints {
expr {$screenW eq $result}
} -cleanup {
killTables
-} -result {1}
+} -result 1
test config-4.101 {DoObjConfig - window} -constraints testobjconfig -body {
toplevel .bar
@@ -1017,7 +1017,7 @@ test config-4.106 {DoObjConfig - new window} -constraints testobjconfig -body {
.foo configure -window .blamph
} -cleanup {
killTables
-} -returnCodes ok -result {0}
+} -returnCodes ok -result 0
test config-4.107 {DoObjConfig - new window} -constraints testobjconfig -body {
toplevel .bar
toplevel .blamph
@@ -1258,7 +1258,7 @@ test config-7.11 {Tk_SetOptions - synonym name in error message} -constraints {
".a configure -synonym bogus"}
test config-7.12 {Tk_SetOptions - returning mask} -constraints testobjconfig -body {
format %x [.a configure -color red -int 7 -relief raised -double 3.14159]
-} -result {226}
+} -result 226
test config-7.13 {Tk_SetOptions - error in DoObjConfig with custom option} -constraints {
testobjconfig
} -body {
@@ -1304,7 +1304,7 @@ test config-8.3 {Tk_RestoreSavedOptions - freeing object memory} -constraints {
.a csave -color green -color black -color blue -color #ffff00 -color #ff00ff
} -cleanup {
killTables
-} -result {32}
+} -result 32
test config-8.4 {Tk_RestoreSavedOptions - boolean internal form} -constraints {
testobjconfig
} -body {
@@ -1321,7 +1321,7 @@ test config-8.5 {Tk_RestoreSavedOptions - boolean internal form} -constraints {
.a cget -boolean
} -cleanup {
killTables
-} -result {1}
+} -result 1
test config-8.6 {Tk_RestoreSavedOptions - integer internal form} -constraints {
testobjconfig
} -body {
@@ -1338,7 +1338,7 @@ test config-8.7 {Tk_RestoreSavedOptions - integer internal form} -constraints {
.a cget -integer
} -cleanup {
killTables
-} -result {148962237}
+} -result 148962237
test config-8.8 {Tk_RestoreSavedOptions - double internal form} -constraints {
testobjconfig
} -body {
@@ -1620,11 +1620,11 @@ if {[testConstraint testobjconfig]} {
test config-12.1 {GetObjectForOption - boolean} -constraints testobjconfig -body {
.a configure -boolean 0
.a cget -boolean
-} -result {0}
+} -result 0
test config-12.2 {GetObjectForOption - integer} -constraints testobjconfig -body {
.a configure -integer 1247
.a cget -integer
-} -result {1247}
+} -result 1247
test config-12.3 {GetObjectForOption - double} -constraints testobjconfig -body {
.a configure -double -88.82
.a cget -double
@@ -1680,7 +1680,7 @@ test config-12.13 {GetObjectForOption - anchor} -constraints testobjconfig -body
test config-12.14 {GetObjectForOption - pixels} -constraints testobjconfig -body {
.a configure -pixel 193.2
.a cget -pixel
-} -result {193}
+} -result 193
test config-12.15 {GetObjectForOption - window} -constraints testobjconfig -body {
.a configure -window .a
.a cget -window
diff --git a/tests/constraints.tcl b/tests/constraints.tcl
index 65609d6..66ac1eb 100644
--- a/tests/constraints.tcl
+++ b/tests/constraints.tcl
@@ -5,7 +5,7 @@ if {[namespace exists tk::test]} {
return
}
-package require Tk
+package require tk
tk appname tktest
wm title . tktest
# If the main window isn't already mapped (e.g. because the tests are
diff --git a/tests/cursor.test b/tests/cursor.test
index 8d7ebb0..f84232c 100644
--- a/tests/cursor.test
+++ b/tests/cursor.test
@@ -2,8 +2,8 @@
# tkCursor.c. It is organized in the standard white-box fashion for
# Tcl tests.
#
-# Copyright (c) 1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/dialog.test b/tests/dialog.test
index 78b6620..692d928 100644
--- a/tests/dialog.test
+++ b/tests/dialog.test
@@ -25,7 +25,7 @@ test dialog-2.1 {tk_dialog operation} -setup {
update
}
event generate $btn <Enter>
- event generate $btn <1> -x 5 -y 5
+ event generate $btn <Button-1> -x 5 -y 5
event generate $btn <ButtonRelease-1> -x 5 -y 5
}
} -body {
@@ -36,12 +36,12 @@ test dialog-2.1 {tk_dialog operation} -setup {
return $res
} -cleanup {
destroy .d
-} -result {0}
+} -result 0
test dialog-2.2 {tk_dialog operation} -setup {
proc HitReturn {w} {
event generate $w <Enter>
focus -force $w
- event generate $w <KeyPress> -keysym Return
+ event generate $w <Key> -keysym Return
}
} -body {
set x [after 5000 [list set tk::Priv(button) "no response"]]
@@ -51,7 +51,7 @@ test dialog-2.2 {tk_dialog operation} -setup {
return $res
} -cleanup {
destroy .d
-} -result {1}
+} -result 1
test dialog-2.3 {tk_dialog operation} -body {
set x [after 5000 [list set tk::Priv(button) "no response"]]
after 100 destroy .d
@@ -60,7 +60,7 @@ test dialog-2.3 {tk_dialog operation} -body {
return $res
} -cleanup {
destroy .b
-} -result {-1}
+} -result -1
cleanupTests
return
diff --git a/tests/earth.gif b/tests/earth.gif
index 2c229eb..d667244 100644
--- a/tests/earth.gif
+++ b/tests/earth.gif
Binary files differ
diff --git a/tests/embed.test b/tests/embed.test
index 1fe73ef..92b8be9 100644
--- a/tests/embed.test
+++ b/tests/embed.test
@@ -1,7 +1,7 @@
# This file is a Tcl script to test out embedded Windows.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/entry.test b/tests/entry.test
index d67980a..d3b7eef 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test entry widgets in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -632,6 +632,23 @@ test entry-1.58 {configuration option: "xscrollcommand" for entry} -setup {
destroy .e
} -result {Some command}
+test entry-1.59 {configuration option: "-placeholder"} -setup {
+ pack [entry .e]
+} -body {
+ .e configure -placeholder {Some text}
+ .e cget -placeholder
+} -cleanup {
+ destroy .e
+} -result {Some text}
+
+test entry-1.60 {configuration option: "-placeholderforeground"} -setup {
+ pack [entry .e]
+} -body {
+ .e configure -placeholder {Some text} -placeholderforeground red
+ .e cget -placeholderforeground
+} -cleanup {
+ destroy .e
+} -result {red}
test entry-2.1 {Tk_EntryCmd procedure} -body {
@@ -736,7 +753,7 @@ test entry-3.7 {EntryWidgetCmd procedure, "bbox" widget command} -constraints {
update
} -body {
# Tcl_UtfAtIndex(): utf at end
- .e insert 0 "ab\u4e4e"
+ .e insert 0 "ab乎"
.e bbox end
} -cleanup {
destroy .e
@@ -749,7 +766,7 @@ test entry-3.8 {EntryWidgetCmd procedure, "bbox" widget command} -constraints {
update
} -body {
# Tcl_UtfAtIndex(): utf before index
- .e insert 0 "ab\u4e4ec"
+ .e insert 0 "ab乎c"
.e bbox 3
} -cleanup {
destroy .e
@@ -771,7 +788,7 @@ test entry-3.10 {EntryWidgetCmd procedure, "bbox" widget command} -constraints {
pack .e ; update idletasks
update
} -body {
- .e insert 0 "abcdefghij\u4e4eklmnop"
+ .e insert 0 "abcdefghij乎klmnop"
list [.e bbox 0] [.e bbox 1] [.e bbox 10] [.e bbox end]
} -cleanup {
destroy .e
@@ -813,7 +830,7 @@ test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup {
llength [.e configure]
} -cleanup {
destroy .e
-} -result 36
+} -result 38
test entry-3.16 {EntryWidgetCmd procedure, "configure" widget command} -setup {
entry .e
} -body {
@@ -885,20 +902,20 @@ test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -setup {
set x {}
} -body {
# UTF
- .e insert end "01234\u4e4e67890"
+ .e insert end "01234乎67890"
.e delete 6
lappend x [.e get]
.e delete 0 end
- .e insert end "012345\u4e4e7890"
+ .e insert end "012345乎7890"
.e delete 6
lappend x [.e get]
.e delete 0 end
- .e insert end "0123456\u4e4e890"
+ .e insert end "0123456乎890"
.e delete 6
lappend x [.e get]
} -cleanup {
destroy .e
-} -result [list "01234\u4e4e7890" "0123457890" "012345\u4e4e890"]
+} -result [list "01234乎7890" "0123457890" "012345乎890"]
test entry-3.25 {EntryWidgetCmd procedure, "delete" widget command} -setup {
entry .e
pack .e ; update idletasks
@@ -1002,7 +1019,7 @@ test entry-3.35 {EntryWidgetCmd procedure, "index" widget command} -setup {
update
} -body {
# UTF
- .e insert 0 abc\u4e4e\u0153def
+ .e insert 0 abc乎œdef
list [.e index 3] [.e index 4] [.e index end]
} -cleanup {
destroy .e
@@ -1423,7 +1440,7 @@ test entry-3.71 {EntryWidgetCmd procedure, "xview" widget command} -setup {
.e xview scroll 24
} -cleanup {
destroy .e
-} -returnCodes error -result {wrong # args: should be ".e xview scroll number units|pages"}
+} -returnCodes error -result {wrong # args: should be ".e xview scroll number pages|units"}
test entry-3.72 {EntryWidgetCmd procedure, "xview" widget command} -setup {
entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e ; update idletasks
@@ -1434,7 +1451,7 @@ test entry-3.72 {EntryWidgetCmd procedure, "xview" widget command} -setup {
.e xview scroll gorp units
} -cleanup {
destroy .e
-} -returnCodes error -result {expected integer but got "gorp"}
+} -returnCodes error -result {expected floating-point number but got "gorp"}
test entry-3.73 {EntryWidgetCmd procedure, "xview" widget command} -setup {
entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e ; update idletasks
@@ -1500,7 +1517,7 @@ test entry-3.77 {EntryWidgetCmd procedure, "xview" widget command} -setup {
.e xview scroll 23 foobars
} -cleanup {
destroy .e
-} -returnCodes error -result {bad argument "foobars": must be units or pages}
+} -returnCodes error -result {bad argument "foobars": must be pages or units}
test entry-3.78 {EntryWidgetCmd procedure, "xview" widget command} -setup {
entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e ; update idletasks
@@ -1544,7 +1561,7 @@ test entry-3.86 {EntryWidgetCmd procedure, "xview" widget command} -setup {
} -body {
.e insert end "This is quite a long text string, so long that it "
.e insert end "runs off the end of the window quite a bit."
- .e insert 10 \u4e4e
+ .e insert 10 乎
update
# UTF
# If Tcl_NumUtfChars wasn't used, wrong answer would be:
@@ -2323,10 +2340,20 @@ test entry-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup {
.e insert 0 "xyzzy"
update
.e delete 2 4
- winfo reqwidth .e
-} -cleanup {
- destroy .e
-} -result 31
+ # To check that deletion actually happened we measure the new width
+ # of the widget, based on the measuring width of the remaining text ("xyy")
+ # in the widget. For that purpose we have to mirror the code in tkEntry.c
+ # for computation of the reqwidth
+ # note: XPAD corresponds to the hardcoded #define XPAD 1
+ set XPAD 1
+ set expected [expr { [font measure [.e cget -font] "xyy"] \
+ + 2 * ( [.e cget -borderwidth] + \
+ [.e cget -highlightthickness] + $XPAD ) } ]
+ expr {[winfo reqwidth .e] == $expected}
+} -cleanup {
+ destroy .e
+ unset XPAD expected
+} -result 1
test entry-9.1 {EntryValueChanged procedure} -setup {
unset -nocomplain x
@@ -3480,7 +3507,7 @@ test entry-20.7 {widget deletion with textvariable active} -body {
# SF bugs 607390 and 617446
set FOO init
entry .e -textvariable FOO -validate all \
- -vcmd {%W configure -bg white; format 1}
+ -validatecommand {%W configure -bg white; format 1}
bind .e <Destroy> { set FOO hello }
destroy .e
winfo exists .e
diff --git a/tests/event.test b/tests/event.test
index f0e2311..fe23743 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in tkEvent.c. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -20,57 +20,10 @@ namespace import -force tcltest::test
proc _init_keypress_lookup {} {
global keypress_lookup
- scan A %c start
- scan Z %c finish
-
- for {set i $start} {$i <= $finish} {incr i} {
- set l [format %c $i]
- set keypress_lookup($l) $l
- }
-
- scan a %c start
- scan z %c finish
-
- for {set i $start} {$i <= $finish} {incr i} {
- set l [format %c $i]
- set keypress_lookup($l) $l
- }
-
- scan 0 %c start
- scan 9 %c finish
-
- for {set i $start} {$i <= $finish} {incr i} {
- set l [format %c $i]
- set keypress_lookup($l) $l
- }
-
- # Most punctuation
- array set keypress_lookup {
- ! exclam
- % percent
- & ampersand
- ( parenleft
- ) parenright
- * asterisk
- + plus
- , comma
- - minus
- . period
- / slash
- : colon
- < less
- = equal
- > greater
- ? question
- @ at
- ^ asciicircum
- _ underscore
- | bar
- ~ asciitilde
- ' apostrophe
- }
# Characters with meaning to Tcl...
array set keypress_lookup [list \
+ - minus \
+ > greater \
\" quotedbl \
\# numbersign \
\$ dollar \
@@ -81,6 +34,7 @@ proc _init_keypress_lookup {} {
\{ braceleft \
\} braceright \
" " space \
+ \xA0 nobreakspace \
"\n" Return \
"\t" Tab]
}
@@ -88,8 +42,8 @@ proc _init_keypress_lookup {} {
# Lookup an event in the keypress table.
# For example:
# Q -> Q
-# . -> period
-# / -> slash
+# ; -> semicolon
+# > -> greater
# Delete -> Delete
# Escape -> Escape
@@ -111,7 +65,7 @@ proc _keypress_lookup {char} {
}
}
-# Lookup and generate a pair of KeyPress and KeyRelease events
+# Lookup and generate a pair of Key and KeyRelease events
proc _keypress {win key} {
set keysym [_keypress_lookup $key]
@@ -124,7 +78,7 @@ proc _keypress {win key} {
if {[focus] != $win} {
focus -force $win
}
- event generate $win <KeyPress-$keysym>
+ event generate $win <Key-$keysym>
_pause 50
if {[focus] != $win} {
focus -force $win
@@ -194,10 +148,10 @@ test event-1.1 {Tk_HandleEvent procedure, filter events for dead windows} -setup
update
bind .b <Destroy> {
lappend x destroy
- event generate .b <1>
+ event generate .b <Button-1>
event generate .b <ButtonRelease-1>
}
- bind .b <1> {
+ bind .b <Button-1> {
lappend x button
}
@@ -269,7 +223,7 @@ test event-2.3(keypress) {type into entry widget, triple click, hit Delete key,
event generate $e <Enter>
for {set i 0} {$i < 3} {incr i} {
_pause 100
- event generate $e <ButtonPress-1>
+ event generate $e <Button-1>
_pause 100
event generate $e <ButtonRelease-1>
}
@@ -323,7 +277,7 @@ test event-2.6(keypress) {type into text widget, triple click,
event generate $e <Enter>
for {set i 0} {$i < 3} {incr i} {
_pause 100
- event generate $e <ButtonPress-1>
+ event generate $e <Button-1>
_pause 100
event generate $e <ButtonRelease-1>
}
@@ -355,7 +309,7 @@ test event-3.1(click-drag) {click and drag in a text widget, this tests
# Click down to set the insert cursor position
event generate $e <Enter>
- event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y
+ event generate $e <Button-1> -x $anchor_x -y $anchor_y
# Save the position of the insert cursor
lappend result [$e index insert]
@@ -381,7 +335,7 @@ test event-3.1(click-drag) {click and drag in a text widget, this tests
# Now click and click and drag to the left, over "Tcl/Tk selection"
- event generate $e <ButtonPress-1> -x $current_x -y $current_y
+ event generate $e <Button-1> -x $current_x -y $current_y
while {[$e compare $current >= [list $anchor - 4 char]]} {
foreach {current_x current_y} [_text_ind_to_x_y $e $current] break
@@ -422,7 +376,7 @@ test event-3.1(click-drag) {click and drag in a text widget, this tests
# Click down to set the insert cursor position
event generate $e <Enter>
- event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y
+ event generate $e <Button-1> -x $anchor_x -y $anchor_y
# Save the position of the insert cursor
lappend result [$e index insert]
@@ -448,7 +402,7 @@ test event-3.1(click-drag) {click and drag in a text widget, this tests
# Now click and click and drag to the left, over "Tcl/Tk selection"
- event generate $e <ButtonPress-1> -x $current_x -y $current_y
+ event generate $e <Button-1> -x $current_x -y $current_y
while {$current >= ($anchor - 4)} {
foreach {current_x current_y} [_text_ind_to_x_y $e $current] break
@@ -487,11 +441,11 @@ test event-4.1(double-click-drag) {click down, click up, click down again,
# Click down, release, then click down again
event generate $e <Enter>
- event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y
+ event generate $e <Button-1> -x $anchor_x -y $anchor_y
_pause 50
event generate $e <ButtonRelease-1> -x $anchor_x -y $anchor_y
_pause 50
- event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y
+ event generate $e <Button-1> -x $anchor_x -y $anchor_y
_pause 50
# Save the highlighted text
@@ -558,11 +512,11 @@ test event-4.2(double-click-drag) {click down, click up, click down again,
# Click down, release, then click down again
event generate $e <Enter>
- event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y
+ event generate $e <Button-1> -x $anchor_x -y $anchor_y
_pause 50
event generate $e <ButtonRelease-1> -x $anchor_x -y $anchor_y
_pause 50
- event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y
+ event generate $e <Button-1> -x $anchor_x -y $anchor_y
_pause 50
set result [list]
@@ -630,17 +584,17 @@ test event-5.1(triple-click-drag) {Triple click and drag across lines in a
event generate $e <Enter>
- event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y
+ event generate $e <Button-1> -x $anchor_x -y $anchor_y
_pause 50
event generate $e <ButtonRelease-1> -x $anchor_x -y $anchor_y
_pause 50
- event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y
+ event generate $e <Button-1> -x $anchor_x -y $anchor_y
_pause 50
event generate $e <ButtonRelease-1> -x $anchor_x -y $anchor_y
_pause 50
- event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y
+ event generate $e <Button-1> -x $anchor_x -y $anchor_y
_pause 50
set result [list]
@@ -680,7 +634,7 @@ test event-6.1(button-state) {button press in a window that is then
} -body {
set t [toplevel .t]
- event generate $t <ButtonPress-1>
+ event generate $t <Button-1>
destroy $t
set t [toplevel .t]
set motion nomotion
@@ -719,11 +673,11 @@ test event-7.1(double-click) {A double click on a lone character
# Double click near left hand egde of the letter A
event generate $e <Enter>
- event generate $e <ButtonPress-1> -x $left_x -y $left_y
+ event generate $e <Button-1> -x $left_x -y $left_y
_pause 50
event generate $e <ButtonRelease-1> -x $left_x -y $left_y
_pause 50
- event generate $e <ButtonPress-1> -x $left_x -y $left_y
+ event generate $e <Button-1> -x $left_x -y $left_y
_pause 50
event generate $e <ButtonRelease-1> -x $left_x -y $left_y
_pause 50
@@ -734,18 +688,18 @@ test event-7.1(double-click) {A double click on a lone character
# Clear selection by clicking at 0,0
- event generate $e <ButtonPress-1> -x 0 -y 0
+ event generate $e <Button-1> -x 0 -y 0
_pause 50
event generate $e <ButtonRelease-1> -x 0 -y 0
_pause 50
# Double click near right hand edge of the letter A
- event generate $e <ButtonPress-1> -x $right_x -y $right_y
+ event generate $e <Button-1> -x $right_x -y $right_y
_pause 50
event generate $e <ButtonRelease-1> -x $right_x -y $right_y
_pause 50
- event generate $e <ButtonPress-1> -x $right_x -y $right_y
+ event generate $e <Button-1> -x $right_x -y $right_y
_pause 50
event generate $e <ButtonRelease-1> -x $right_x -y $right_y
_pause 50
@@ -785,11 +739,11 @@ test event-7.2(double-click) {A double click on a lone character
# Double click near left hand egde of the letter A
event generate $e <Enter>
- event generate $e <ButtonPress-1> -x $left_x -y $left_y
+ event generate $e <Button-1> -x $left_x -y $left_y
_pause 50
event generate $e <ButtonRelease-1> -x $left_x -y $left_y
_pause 50
- event generate $e <ButtonPress-1> -x $left_x -y $left_y
+ event generate $e <Button-1> -x $left_x -y $left_y
_pause 50
event generate $e <ButtonRelease-1> -x $left_x -y $left_y
_pause 50
@@ -800,18 +754,18 @@ test event-7.2(double-click) {A double click on a lone character
# Clear selection by clicking at 0,0
- event generate $e <ButtonPress-1> -x 0 -y 0
+ event generate $e <Button-1> -x 0 -y 0
_pause 50
event generate $e <ButtonRelease-1> -x 0 -y 0
_pause 50
# Double click near right hand edge of the letter A
- event generate $e <ButtonPress-1> -x $right_x -y $right_y
+ event generate $e <Button-1> -x $right_x -y $right_y
_pause 50
event generate $e <ButtonRelease-1> -x $right_x -y $right_y
_pause 50
- event generate $e <ButtonPress-1> -x $right_x -y $right_y
+ event generate $e <Button-1> -x $right_x -y $right_y
_pause 50
event generate $e <ButtonRelease-1> -x $right_x -y $right_y
_pause 50
@@ -834,7 +788,7 @@ test event-8 {event generate with keysyms corresponding to
set e [entry $t.e]
pack $e
tkwait visibility $e
- bind $e <KeyPress> {lappend res keycode: %k keysym: %K}
+ bind $e <Key> {lappend res keycode: %k keysym: %K}
focus -force $e
update
event generate $e <diaeresis>
diff --git a/tests/filebox.test b/tests/filebox.test
index fdb5614..d7d051e 100644
--- a/tests/filebox.test
+++ b/tests/filebox.test
@@ -2,8 +2,8 @@
# "tk_getSaveFile" commands. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -48,7 +48,7 @@ proc ToEnterFileByKey {parent fileName fileDir} {
proc PressButton {btn} {
event generate $btn <Enter>
- event generate $btn <1> -x 5 -y 5
+ event generate $btn <Button-1> -x 5 -y 5
event generate $btn <ButtonRelease-1> -x 5 -y 5
}
@@ -93,7 +93,7 @@ proc SendButtonPress {parent btn type} {
event generate $w <Enter>
focus $w
event generate $button <Enter>
- event generate $w <KeyPress> -keysym Return
+ event generate $w <Key> -keysym Return
}
}
diff --git a/tests/focus.test b/tests/focus.test
index 5a13d91..1a318c3 100644
--- a/tests/focus.test
+++ b/tests/focus.test
@@ -2,8 +2,8 @@
# other procedures in the file tkFocus.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -67,7 +67,7 @@ bind all <FocusIn> {
bind all <FocusOut> {
append focusInfo "out %W %d\n"
}
-bind all <KeyPress> {
+bind all <Key> {
append focusInfo "press %W %K"
}
focusSetup
@@ -319,7 +319,7 @@ test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints {
event gen [testwrapper .t] <FocusIn> -detail NotifyAncestor
set focusInfo {}
set x [focus]
- event gen . <KeyPress-x>
+ event gen . <x>
list $x $focusInfo
} -result {.t.b1 {press .t.b1 x}}
test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} -constraints {
@@ -620,7 +620,7 @@ test focus-5.1 {ChangeXFocus procedure, don't take focus unless have it} -constr
destroy .t
bind all <FocusIn> {}
bind all <FocusOut> {}
-bind all <KeyPress> {}
+bind all <Key> {}
fixfocus
diff --git a/tests/focusTcl.test b/tests/focusTcl.test
index 0e457a6..6cfc230 100644
--- a/tests/focusTcl.test
+++ b/tests/focusTcl.test
@@ -3,8 +3,8 @@
# tk_focusPrev, among other things. This file is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/font.test b/tests/font.test
index 5af2dbb..8dce1f8 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -2,8 +2,8 @@
# plus the procedures in tkFont.c. It is organized in the
# standard white-box fashion for Tcl tests.
#
-# Copyright (c) 1996-1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -13,7 +13,7 @@ tcltest::loadTestedCommands
# Some tests require support for 4-byte UTF-8 sequences
testConstraint fullutf [expr {[format %c 0x010000] != "\uFFFD"}]
-
+testConstraint utfcompat [expr {([string length "\U10000"] == 2) && [package vsatisfies [package provide Tcl] 8]}]
testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
@@ -116,21 +116,21 @@ test font-4.1 {font command: actual: arguments} -body {
test font-4.2 {font command: actual: arguments} -body {
# (objc < 3)
font actual
-} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}
+} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"}
test font-4.3 {font command: actual: arguments} -body {
# (objc - skip > 4) when skip == 0
font actual xyz abc def
-} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}
+} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"}
test font-4.4 {font command: actual: displayof specified, so skip to next} -body {
catch {font actual xyz -displayof . -size}
-} -result {0}
+} -result 0
test font-4.5 {font command: actual: displayof specified, so skip to next} -body {
lindex [font actual xyz -displayof .] 0
} -result {-family}
test font-4.6 {font command: actual: arguments} -body {
# (objc - skip > 4) when skip == 2
font actual xyz -displayof . abc def
-} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}
+} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"}
test font-4.7 {font command: actual: arguments} -constraints noExceed -body {
# (tkfont == NULL)
font actual "\{xyz"
@@ -146,25 +146,25 @@ test font-4.9 {font command: actual} -constraints {unix noExceed failsOnUbuntu}
test font-4.10 {font command: actual} -constraints win -body {
# (objc > 3) so objPtr = objv[3 + skip]
font actual {-family times} -family
-} -result {Times New Roman}
+} -result {times}
test font-4.11 {font command: bad option} -body {
font actual xyz -style
} -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike}
test font-4.12 {font command: actual} -body {
- font actual {-family times} -- \ud800
+ font actual {-family times} -- \uD800
} -match glob -result {*}
test font-4.13 {font command: actual} -body {
- font actual {-family times} -- \udc00
+ font actual {-family times} -- \uDC00
} -match glob -result {*}
-test font-4.14 {font command: actual} -constraints win -body {
+test font-4.14 {font command: actual} -constraints {utfcompat win} -body {
font actual {-family times} -family -- \uD800\uDC00
-} -result {Times New Roman}
+} -result {times}
test font-4.15 {font command: actual} -body {
- font actual {-family times} -- \udc00\ud800
+ font actual {-family times} -- \uDC00\uD800
} -returnCodes 1 -match glob -result {expected a single character but got "*"}
test font-4.16 {font command: actual} -constraints {fullutf win} -body {
font actual {-family times} -family -- \U10000
-} -result {Times New Roman}
+} -result {times}
test font-5.1 {font command: configure} -body {
@@ -432,11 +432,11 @@ test font-10.2 {font command: metrics: arguments} -body {
test font-10.3 {font command: metrics: arguments} -body {
# (objc < 3)
font metrics
-} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?option?"}
+} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?-option?"}
test font-10.4 {font command: metrics: arguments} -body {
# (objc - skip) > 4) when skip == 0
font metrics xyz abc def
-} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?option?"}
+} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?-option?"}
test font-10.5 {font command: metrics: arguments} -body {
# (objc - skip) > 4) when skip == 2
font metrics xyz -displayof . abc
@@ -538,7 +538,7 @@ test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup {
} -cleanup {
destroy .t.f
font delete xyz
-} -result {1}
+} -result 1
test font-13.1 {CreateNamedFont: new named font} -setup {
@@ -1683,14 +1683,14 @@ destroy .t.f
pack [label .t.f]
update
test font-27.1 {Tk_UnderlineTextLayout procedure: no underline chosen} -body {
- .t.f config -text "foo" -under -1
+ .t.f config -text "foo" -underline -1
} -result {}
test font-27.2 {Tk_UnderlineTextLayout procedure: underline not visible} -body {
.t.f config -text "000 00000" -wrap [expr $ax*7] -under 10
} -result {}
test font-27.3 {Tk_UnderlineTextLayout procedure: underline is visible} -body {
.t.f config -text "000 00000" -wrap [expr $ax*7] -under 5
- .t.f config -wrap -1 -under -1
+ .t.f config -wrap -1 -underline -1
} -result {}
destroy .t.f
@@ -1705,7 +1705,7 @@ update
test font-28.1 {Tk_PointToChar procedure: above all lines} -body {
csetup "000"
.t.c index text @-1,0
-} -result {0}
+} -result 0
test font-28.2 {Tk_PointToChar procedure: no chars} -body {
# After fixing the following bug:
#
@@ -1717,46 +1717,46 @@ test font-28.2 {Tk_PointToChar procedure: no chars} -body {
csetup ""
.t.c index text @100,100
-} -result {0}
+} -result 0
test font-28.3 {Tk_PointToChar procedure: loop test} -body {
csetup "000\n000\n000\n000"
.t.c index text @10000,0
-} -result {3}
+} -result 3
test font-28.4 {Tk_PointToChar procedure: intersect line} -body {
csetup "000\n000\n000"
.t.c index text @0,$ay
-} -result {4}
+} -result 4
test font-28.5 {Tk_PointToChar procedure: to the left of all chunks} -body {
csetup "000\n000\n000"
.t.c index text @-100,$ay
-} -result {4}
+} -result 4
test font-28.6 {Tk_PointToChar procedure: past any possible chunk} -body {
csetup "000\n000\n000"
.t.c index text @100000,$ay
-} -result {7}
+} -result 7
test font-28.7 {Tk_PointToChar procedure: which chunk on this line} -body {
csetup "000\n000\t000\t000\n000"
.t.c index text @[expr $ax*2],$ay
-} -result {6}
+} -result 6
test font-28.8 {Tk_PointToChar procedure: which chunk on this line} -body {
csetup "000\n000\t000\t000\n000"
.t.c index text @[expr $ax*10],$ay
-} -result {10}
+} -result 10
test font-28.9 {Tk_PointToChar procedure: in special chunk} -body {
csetup "000\n000\t000\t000\n000"
.t.c index text @[expr $ax*6],$ay
-} -result {7}
+} -result 7
test font-28.10 {Tk_PointToChar procedure: past all chars in chunk} -body {
csetup "000 0000000"
.t.c itemconfig text -width [expr $ax*5]
set x [.t.c index text @[expr $ax*5],0]
.t.c itemconfig text -width 0
return $x
-} -result {3}
+} -result 3
test font-28.11 {Tk_PointToChar procedure: below all chunks} -body {
csetup "000 0000000"
.t.c index text @0,1000000
-} -result {11}
+} -result 11
destroy .t.c
@@ -1803,7 +1803,7 @@ test font-30.1 {Tk_DistanceToTextLayout procedure: loop once} -body {
return $x
} -cleanup {
bind all <Enter> {}
-} -result {0}
+} -result 0
test font-30.2 {Tk_DistanceToTextLayout procedure: loop multiple} -body {
csetup "000\n000\n000"
.t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
@@ -1813,7 +1813,7 @@ test font-30.2 {Tk_DistanceToTextLayout procedure: loop multiple} -body {
return $x
} -cleanup {
bind all <Enter> {}
-} -result {5}
+} -result 5
test font-30.3 {Tk_DistanceToTextLayout procedure: loop to end} -body {
csetup "000\n0\n000"
.t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
@@ -1833,7 +1833,7 @@ test font-30.4 {Tk_DistanceToTextLayout procedure: hit a special char (tab)} -bo
return $x
} -cleanup {
bind all <Enter> {}
-} -result {3}
+} -result 3
test font-30.5 {Tk_DistanceToTextLayout procedure: ignore newline} -body {
csetup "000\n0\n000"
.t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
@@ -1886,7 +1886,7 @@ test font-30.9 {Tk_DistanceToTextLayout procedure: inside line} -body {
return $x
} -cleanup {
bind all <Enter> {}
-} -result {0}
+} -result 0
test font-30.10 {Tk_DistanceToTextLayout procedure: above line} -body {
csetup "0\n000"
.t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
@@ -1916,7 +1916,7 @@ test font-30.12 {Tk_DistanceToTextLayout procedure: in line} -body {
return $x
} -cleanup {
bind all <Enter> {}
-} -result {3}
+} -result 3
.t.c itemconfig text -justify left
test font-30.13 {Tk_DistanceToTextLayout procedure: exact hit} -body {
csetup "000"
@@ -1927,7 +1927,7 @@ test font-30.13 {Tk_DistanceToTextLayout procedure: exact hit} -body {
return $x
} -cleanup {
bind all <Enter> {}
-} -result {1}
+} -result 1
destroy .t.c
@@ -1973,7 +1973,7 @@ test font-31.7 {TkIntersectAngledTextLayout procedure: bug [514ff64dd0]} -body {
# The text has been rotated 90 degrees around it's upper left corner,
# so it's enough to check with a small rectangle with small negative y coords.
.t.c find overlapping 5 -7 7 -5
-} -result {1}
+} -result 1
destroy .t.c
@@ -2184,7 +2184,7 @@ test font-37.3 {GetAttributeInfo procedure: size} -setup {
font config xyz -size
} -cleanup {
font delete xyz
-} -result {20}
+} -result 20
test font-37.4 {GetAttributeInfo procedure: weight} -setup {
catch {font delete xyz}
set x {}
@@ -2211,7 +2211,7 @@ test font-37.6 {GetAttributeInfo procedure: underline} -setup {
font config xyz -underline
} -cleanup {
font delete xyz
-} -result {1}
+} -result 1
test font-37.7 {GetAttributeInfo procedure: overstrike} -setup {
catch {font delete xyz}
set x {}
@@ -2220,7 +2220,7 @@ test font-37.7 {GetAttributeInfo procedure: overstrike} -setup {
font config xyz -overstrike
} -cleanup {
font delete xyz
-} -result {0}
+} -result 0
# In tests below, one field is set to "xyz" so that font name doesn't
@@ -2347,7 +2347,7 @@ test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntu -setup {
font actual {times -12} -size
} -cleanup {
tk scaling $oldscale
-} -result {24}
+} -result 24
test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed failsOnUbuntuNoXft} -setup {
set oldscale [tk scaling]
} -body {
@@ -2355,7 +2355,7 @@ test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed failsOnUbuntu
font actual {times 12} -size
} -cleanup {
tk scaling $oldscale
-} -result {12}
+} -result 12
test font-45.1 {TkFontGetAliasList: no match} -body {
@@ -2363,7 +2363,7 @@ test font-45.1 {TkFontGetAliasList: no match} -body {
} -result [font actual {-size 10} -family]
test font-45.2 {TkFontGetAliasList: match} -constraints win -body {
font actual {times 10} -family
-} -result {Times New Roman}
+} -result {times}
test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed failsOnUbuntu} -body {
if {[font actual {{times new roman} 10} -family] eq "Times New Roman"} {
# avoid test failure on systems that have a real "times new roman" font
@@ -2372,7 +2372,7 @@ test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed failsOnUbuntu}
set res [expr {[font actual {{times new roman} 10} -family] eq \
[font actual {times 10} -family]} ]
}
-} -result {1}
+} -result 1
test font-46.1 {font actual, with character, no option, no --} -body {
diff --git a/tests/fontchooser.test b/tests/fontchooser.test
index 471ed64..8fb9059 100644
--- a/tests/fontchooser.test
+++ b/tests/fontchooser.test
@@ -1,6 +1,6 @@
# Test the "tk::fontchooser" command
#
-# Copyright (c) 2008 Pat Thoyts
+# Copyright © 2008 Pat Thoyts
package require tcltest 2.2
eval tcltest::configure $argv
@@ -82,7 +82,7 @@ test fontchooser-1.7 {tk fontchooser: usage} -returnCodes error -body {
test fontchooser-1.8 {tk fontchooser: usage} -returnCodes ok -body {
tk fontchooser configure -visible
-} -result {0}
+} -result 0
test fontchooser-1.9 {tk fontchooser: usage} -returnCodes error -body {
tk fontchooser configure -visible 1
@@ -112,7 +112,7 @@ test fontchooser-2.0 {fontchooser -title} -constraints scriptImpl -body {
test fontchooser-2.1 {fontchooser -title (cyrillic)} -constraints scriptImpl -body {
start {
tk::fontchooser::Configure \
- -title "\u041f\u0440\u0438\u0432\u0435\u0442"
+ -title "Привет"
tk::fontchooser::Show
}
then {
@@ -120,7 +120,7 @@ test fontchooser-2.1 {fontchooser -title (cyrillic)} -constraints scriptImpl -bo
Click cancel
}
set x
-} -result "\u041f\u0440\u0438\u0432\u0435\u0442"
+} -result "Привет"
test fontchooser-3.0 {fontchooser -parent} -constraints scriptImpl -body {
start {
@@ -158,7 +158,7 @@ test fontchooser-4.1 {fontchooser -font} -constraints scriptImpl -body {
Click ok
}
expr {$::testfont ne {}}
-} -result {1}
+} -result 1
test fontchooser-4.2 {fontchooser -font} -constraints scriptImpl -body {
start {
@@ -169,7 +169,7 @@ test fontchooser-4.2 {fontchooser -font} -constraints scriptImpl -body {
Click ok
}
expr {$::testfont ne {}}
-} -result {1}
+} -result 1
test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body {
start {
@@ -180,7 +180,7 @@ test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body {
Click ok
}
expr {$::testfont ne {}}
-} -result {1}
+} -result 1
test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl failsOnUbuntuNoXft} -body {
start {
diff --git a/tests/frame.test b/tests/frame.test
index 63bb187..d2f9d69 100644
--- a/tests/frame.test
+++ b/tests/frame.test
@@ -1,20 +1,22 @@
-# This file is a Tcl script to test out the "frame" and "toplevel"
-# commands of Tk. It is organized in the standard fashion for Tcl
+# This file is a Tcl script to test out the "frame", "labelframe" and
+# "toplevel" commands of Tk. It is organized in the standard fashion for Tcl
# tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
namespace import ::tcltest::*
-eval tcltest::configure $argv
+tcltest::configure {*}$argv
tcltest::loadTestedCommands
+tcltest::testConstraint x11 [expr {[tk windowingsystem] eq "x11"}]
+
# eatColors --
-# Creates a toplevel window and allocates enough colors in it to
-# use up all the slots in the colormap.
+# Creates a toplevel window and allocates enough colors in it to use up all
+# the slots in an 8-bit colormap.
#
# Arguments:
# w - Name of toplevel window to create.
@@ -27,10 +29,10 @@ proc eatColors {w} {
pack $w.c
for {set y 0} {$y < 8} {incr y} {
for {set x 0} {$x < 40} {incr x} {
- set color [format #%02x%02x%02x [expr $x*6] [expr $y*30] 0]
- $w.c create rectangle [expr 10*$x] [expr 20*$y] \
- [expr 10*$x + 10] [expr 20*$y + 20] -outline {} \
- -fill $color
+ set color [format #%02x%02x%02x [expr {$x*6}] [expr {$y*30}] 0]
+ $w.c create rectangle [expr {10*$x}] [expr {20*$y}] \
+ [expr {10*$x + 10}] [expr {20*$y + 20}] -outline {} \
+ -fill $color
}
}
update
@@ -38,8 +40,8 @@ proc eatColors {w} {
# colorsFree --
#
-# Returns 1 if there appear to be free colormap entries in a window,
-# 0 otherwise.
+# Returns 1 if there appear to be free colormap entries in a window, 0
+# otherwise.
#
# Arguments:
# w - Name of window in which to check.
@@ -47,14 +49,36 @@ proc eatColors {w} {
# to see if there are colormap entries free.
proc colorsFree {w {red 31} {green 245} {blue 192}} {
- set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]]
- expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \
- && ([lindex $vals 2]/256 == $blue)
+ lassign [winfo rgb $w [format "#%02x%02x%02x" $red $green $blue]] r g b
+ expr {($r/256 == $red) && ($g/256 == $green) && ($b/256 == $blue)}
}
+# uniq --
+#
+# Returns the unique items of a list in the order they first appear.
+#
+# Arguments:
+# list - The list to uniq-ify.
+proc uniq {list} {
+ set d {}
+ foreach item $list {
+ dict set d $item {}
+ }
+ return [dict keys $d]
+}
+# optnames --
+#
+# Returns the option names out of a list of option details.
+#
+# Arguments:
+# options - The option detail list.
+proc optnames {options} {
+ lsort [lmap desc $options {lindex $desc 0}]
+}
+
test frame-1.1 {frame configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f -class NewFrame
.f configure -class
@@ -66,12 +90,11 @@ test frame-1.2 {frame configuration options} -setup {
} -body {
frame .f -class NewFrame
.f configure -class Different
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -class option after widget is created}
-
+} -result {can't modify -class option after widget is created}
test frame-1.3 {frame configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f -colormap new
.f configure -colormap
@@ -83,12 +106,11 @@ test frame-1.4 {frame configuration options} -setup {
} -body {
frame .f -colormap new
.f configure -colormap .
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -colormap option after widget is created}
-
+} -result {can't modify -colormap option after widget is created}
test frame-1.5 {frame configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f -visual default
.f configure -visual
@@ -100,19 +122,18 @@ test frame-1.6 {frame configuration options} -setup {
} -body {
frame .f -visual default
.f configure -visual best
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -visual option after widget is created}
-
+} -result {can't modify -visual option after widget is created}
test frame-1.7 {frame configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f -screen bogus
} -cleanup {
deleteWindows
} -returnCodes error -result {unknown option "-screen"}
test frame-1.8 {frame configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f -container true
} -cleanup {
@@ -127,22 +148,22 @@ test frame-1.9 {frame configuration options} -setup {
deleteWindows
} -result {-container container Container 0 1}
test frame-1.10 {frame configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f -container bogus
} -cleanup {
deleteWindows
} -returnCodes error -result {expected boolean value but got "bogus"}
test frame-1.11 {frame configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f
.f configure -container 1
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -container option after widget is created}
+} -result {can't modify -container option after widget is created}
test frame-1.12 {frame configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Make sure all options can be set to the default value
frame .f
@@ -152,11 +173,11 @@ test frame-1.12 {frame configuration options} -setup {
lappend opts [lindex $opt 0] [lindex $opt 4]
}
}
- eval frame .g $opts
- destroy .f .g
+ frame .g {*}$opts
} -cleanup {
+ destroy .f .g
deleteWindows
-} -result {}
+} -result .g
destroy .f
frame .f
@@ -165,7 +186,7 @@ test frame-1.13 {frame configuration options} -body {
lindex [.f configure -background] 4
} -cleanup {
.f configure -background [lindex [.f configure -background] 3]
-} -result {#ff0000}
+} -result "#ff0000"
test frame-1.14 {frame configuration options} -body {
.f configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
@@ -174,7 +195,7 @@ test frame-1.15 {frame configuration options} -body {
lindex [.f configure -bd] 4
} -cleanup {
.f configure -bd [lindex [.f configure -bd] 3]
-} -result {4}
+} -result 4
test frame-1.16 {frame configuration options} -body {
.f configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -183,7 +204,7 @@ test frame-1.17 {frame configuration options} -body {
lindex [.f configure -bg] 4
} -cleanup {
.f configure -bg [lindex [.f configure -bg] 3]
-} -result {#00ff00}
+} -result "#00ff00"
test frame-1.18 {frame configuration options} -body {
.f configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
@@ -192,7 +213,7 @@ test frame-1.19 {frame configuration options} -body {
lindex [.f configure -borderwidth] 4
} -cleanup {
.f configure -borderwidth [lindex [.f configure -borderwidth] 3]
-} -result {1}
+} -result 1
test frame-1.20 {frame configuration options} -body {
.f configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -210,7 +231,7 @@ test frame-1.23 {frame configuration options} -body {
lindex [.f configure -height] 4
} -cleanup {
.f configure -height [lindex [.f configure -height] 3]
-} -result {100}
+} -result 100
test frame-1.24 {frame configuration options} -body {
.f configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
@@ -219,7 +240,7 @@ test frame-1.25 {frame configuration options} -body {
lindex [.f configure -highlightbackground] 4
} -cleanup {
.f configure -highlightbackground [lindex [.f configure -highlightbackground] 3]
-} -result {#112233}
+} -result "#112233"
test frame-1.26 {frame configuration options} -body {
.f configure -highlightbackground ugly
} -returnCodes error -result {unknown color name "ugly"}
@@ -228,7 +249,7 @@ test frame-1.27 {frame configuration options} -body {
lindex [.f configure -highlightcolor] 4
} -cleanup {
.f configure -highlightcolor [lindex [.f configure -highlightcolor] 3]
-} -result {#123456}
+} -result "#123456"
test frame-1.28 {frame configuration options} -body {
.f configure -highlightcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
@@ -237,7 +258,7 @@ test frame-1.29 {frame configuration options} -body {
lindex [.f configure -highlightthickness] 4
} -cleanup {
.f configure -highlightthickness [lindex [.f configure -highlightthickness] 3]
-} -result {6}
+} -result 6
test frame-1.30 {frame configuration options} -body {
.f configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -246,7 +267,7 @@ test frame-1.31 {frame configuration options} -body {
lindex [.f configure -padx] 4
} -cleanup {
.f configure -padx [lindex [.f configure -padx] 3]
-} -result {3}
+} -result 3
test frame-1.32 {frame configuration options} -body {
.f configure -padx badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -255,7 +276,7 @@ test frame-1.33 {frame configuration options} -body {
lindex [.f configure -pady] 4
} -cleanup {
.f configure -pady [lindex [.f configure -pady] 3]
-} -result {4}
+} -result 4
test frame-1.34 {frame configuration options} -body {
.f configure -pady badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -265,9 +286,9 @@ test frame-1.35 {frame configuration options} -body {
} -cleanup {
.f configure -relief [lindex [.f configure -relief] 3]
} -result {ridge}
-test frame-1.36 {frame configuration options} -body {
+test frame-1.36 {frame configuration options} -returnCodes error -body {
.f configure -relief badValue
-} -returnCodes error -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
+} -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
test frame-1.37 {frame configuration options} -body {
.f configure -takefocus {any string}
lindex [.f configure -takefocus] 4
@@ -279,15 +300,14 @@ test frame-1.38 {frame configuration options} -body {
lindex [.f configure -width] 4
} -cleanup {
.f configure -width [lindex [.f configure -width] 3]
-} -result {32}
+} -result 32
test frame-1.39 {frame configuration options} -body {
.f configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
destroy .f
-
test frame-2.1 {toplevel configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -width 200 -height 100 -class NewClass
wm geometry .t +0+0
@@ -301,12 +321,11 @@ test frame-2.2 {toplevel configuration options} -setup {
toplevel .t -width 200 -height 100 -class NewClass
wm geometry .t +0+0
.t configure -class Another
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -class option after widget is created}
-
+} -result {can't modify -class option after widget is created}
test frame-2.3 {toplevel configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -width 200 -height 100 -colormap new
wm geometry .t +0+0
@@ -320,23 +339,21 @@ test frame-2.4 {toplevel configuration options} -setup {
toplevel .t -width 200 -height 100 -colormap new
wm geometry .t +0+0
.t configure -colormap .
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -colormap option after widget is created}
-
+} -result {can't modify -colormap option after widget is created}
test frame-2.5 {toplevel configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -width 200 -height 100
wm geometry .t +0+0
.t configure -container 1
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -container option after widget is created}
+} -result {can't modify -container option after widget is created}
test frame-2.6 {toplevel configuration options} -setup {
deleteWindows
} -body {
- catch {destroy .t}
toplevel .t -width 200 -height 100
wm geometry .t +0+0
catch {.t configure -container 1}
@@ -344,34 +361,25 @@ test frame-2.6 {toplevel configuration options} -setup {
} -cleanup {
deleteWindows
} -result {-container container Container 0 0}
-
test frame-2.7 {toplevel configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -width 200 -height 100 -colormap bogus
} -cleanup {
deleteWindows
} -returnCodes error -result {bad window path name "bogus"}
-
-
-test frame-2.8 {toplevel configuration options} -constraints {
- win
-} -setup {
- deleteWindows
+test frame-2.8 {toplevel configuration options} -constraints win -setup {
+ deleteWindows
} -body {
- catch {destroy .t}
toplevel .t -width 200 -height 100
wm geometry .t +0+0
.t configure -use 0x44022
} -cleanup {
deleteWindows
} -returnCodes error -result {window "0x44022" doesn't exist}
-test frame-2.9 {toplevel configuration options} -constraints {
- win
-} -setup {
+test frame-2.9 {toplevel configuration options} -constraints win -setup {
deleteWindows
} -body {
- catch {destroy .t}
toplevel .t -width 200 -height 100
wm geometry .t +0+0
catch {.t configure -use 0x44022}
@@ -379,25 +387,18 @@ test frame-2.9 {toplevel configuration options} -constraints {
} -cleanup {
deleteWindows
} -result {-use use Use {} {}}
-
-test frame-2.10 {toplevel configuration options} -constraints {
- nonwin
-} -setup {
+test frame-2.10 {toplevel configuration options} -constraints nonwin -setup {
deleteWindows
} -body {
- catch {destroy .t}
toplevel .t -width 200 -height 100
wm geometry .t +0+0
.t configure -use 0x44022
} -cleanup {
deleteWindows
} -returnCodes error -result {can't modify -use option after widget is created}
-test frame-2.11 {toplevel configuration options} -constraints {
- nonwin
-} -setup {
- deleteWindows
+test frame-2.11 {toplevel configuration options} -constraints nonwin -setup {
+ deleteWindows
} -body {
- catch {destroy .t}
toplevel .t -width 200 -height 100
wm geometry .t +0+0
catch {.t configure -use 0x44022}
@@ -405,11 +406,9 @@ test frame-2.11 {toplevel configuration options} -constraints {
} -cleanup {
deleteWindows
} -result {-use use Use {} {}}
-
test frame-2.12 {toplevel configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
- catch {destroy .t}
toplevel .t -width 200 -height 100 -visual default
wm geometry .t +0+0
.t configure -visual
@@ -419,58 +418,59 @@ test frame-2.12 {toplevel configuration options} -setup {
test frame-2.13 {toplevel configuration options} -setup {
deleteWindows
} -body {
- catch {destroy .t}
toplevel .t -width 200 -height 100 -visual default
wm geometry .t +0+0
.t configure -visual best
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -visual option after widget is created}
-
+} -result {can't modify -visual option after widget is created}
test frame-2.14 {toplevel configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -width 200 -height 100 -visual who_knows?
-} -cleanup {
+} -returnCodes error -cleanup {
+ deleteWindows
+} -result {unknown or ambiguous visual name "who_knows?": class must be best, directcolor, grayscale, greyscale, pseudocolor, staticcolor, staticgray, staticgrey, truecolor, or default}
+set expectedScreen ""
+if {[tcltest::testConstraint haveDISPLAY]} {
+ set expectedScreen [list -screen screen Screen {} $env(DISPLAY)]
+}
+test frame-2.15 {toplevel configuration options} -constraints {x11 haveDISPLAY} -setup {
deleteWindows
-} -returnCodes error -result {unknown or ambiguous visual name "who_knows?": class must be best, directcolor, grayscale, greyscale, pseudocolor, staticcolor, staticgray, staticgrey, truecolor, or default}
-test frame-2.15 {toplevel configuration options} -constraints haveDISPLAY -setup {
- deleteWindows
} -body {
toplevel .t -width 200 -height 100 -screen $env(DISPLAY)
wm geometry .t +0+0
- string compare [.t configure -screen] "-screen screen Screen {} $env(DISPLAY)"
+ .t configure -screen
} -cleanup {
deleteWindows
-} -result {0}
-test frame-2.16 {toplevel configuration options} -constraints haveDISPLAY -setup {
+} -result $expectedScreen
+test frame-2.16 {toplevel configuration options} -constraints {x11 haveDISPLAY} -setup {
deleteWindows
} -body {
toplevel .t -width 200 -height 100 -screen $env(DISPLAY)
wm geometry .t +0+0
.t configure -screen another
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -screen option after widget is created}
-
+} -result {can't modify -screen option after widget is created}
test frame-2.17 {toplevel configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -width 200 -height 100 -screen bogus
} -cleanup {
deleteWindows
} -returnCodes error -result {couldn't connect to display "bogus"}
test frame-2.18 {toplevel configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -container 1 -width 300 -height 120
wm geometry .t +0+0
toplevel .x -container 1 -use [winfo id .t]
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {windows cannot have both the -use and the -container option set}
+} -result {windows cannot have both the -use and the -container option set}
test frame-2.19 {toplevel configuration options} -setup {
- deleteWindows
+ deleteWindows
set opts {}
} -body {
# Make sure all options can be set to the default value
@@ -480,12 +480,11 @@ test frame-2.19 {toplevel configuration options} -setup {
lappend opts [lindex $opt 0] [lindex $opt 4]
}
}
- eval toplevel .g $opts
- destroy .f .g
+ toplevel .g {*}$opts
} -cleanup {
+ destroy .f .g
deleteWindows
-} -result {}
-
+} -result .g
destroy .t
toplevel .t -width 300 -height 150
@@ -494,28 +493,28 @@ update
test frame-2.20 {toplevel configuration options} -body {
.t configure -background #ff0000
lindex [.t configure -background] 4
-} -result {#ff0000}
+} -result "#ff0000"
test frame-2.21 {toplevel configuration options} -body {
.t configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-2.22 {toplevel configuration options} -body {
.t configure -bd 4
lindex [.t configure -bd] 4
-} -result {4}
+} -result 4
test frame-2.23 {toplevel configuration options} -body {
.t configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-2.24 {toplevel configuration options} -body {
.t configure -bg #00ff00
lindex [.t configure -bg] 4
-} -result {#00ff00}
+} -result "#00ff00"
test frame-2.25 {toplevel configuration options} -body {
.t configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-2.26 {toplevel configuration options} -body {
.t configure -borderwidth 1.3
lindex [.t configure -borderwidth] 4
-} -result {1}
+} -result 1
test frame-2.27 {toplevel configuration options} -body {
.t configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -529,35 +528,35 @@ test frame-2.29 {toplevel configuration options} -body {
test frame-2.30 {toplevel configuration options} -body {
.t configure -height 100
lindex [.t configure -height] 4
-} -result {100}
+} -result 100
test frame-2.31 {toplevel configuration options} -body {
.t configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
test frame-2.32 {toplevel configuration options} -body {
.t configure -highlightcolor #123456
lindex [.t configure -highlightcolor] 4
-} -result {#123456}
+} -result "#123456"
test frame-2.33 {toplevel configuration options} -body {
.t configure -highlightcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-2.34 {toplevel configuration options} -body {
.t configure -highlightthickness 3
lindex [.t configure -highlightthickness] 4
-} -result {3}
+} -result 3
test frame-2.35 {toplevel configuration options} -body {
.t configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-2.36 {toplevel configuration options} -body {
.t configure -padx 3
lindex [.t configure -padx] 4
-} -result {3}
+} -result 3
test frame-2.37 {toplevel configuration options} -body {
.t configure -padx badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-2.38 {toplevel configuration options} -body {
.t configure -pady 4
lindex [.t configure -pady] 4
-} -result {4}
+} -result 4
test frame-2.39 {toplevel configuration options} -body {
.t configure -pady badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -565,24 +564,23 @@ test frame-2.40 {toplevel configuration options} -body {
.t configure -relief ridge
lindex [.t configure -relief] 4
} -result {ridge}
-test frame-2.41 {toplevel configuration options} -body {
+test frame-2.41 {toplevel configuration options} -returnCodes error -body {
.t configure -relief badValue
-} -returnCodes error -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
+} -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
test frame-2.42 {toplevel configuration options} -body {
.t configure -width 32
lindex [.t configure -width] 4
-} -result {32}
+} -result 32
test frame-2.43 {toplevel configuration options} -body {
.t configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
destroy .t
-
-test frame-3.1 {TkCreateFrame procedure} -body {
+test frame-3.1 {TkCreateFrame procedure} -returnCodes error -body {
frame
-} -returnCodes error -result {wrong # args: should be "frame pathName ?-option value ...?"}
+} -result {wrong # args: should be "frame pathName ?-option value ...?"}
test frame-3.2 {TkCreateFrame procedure} -setup {
- deleteWindows
+ deleteWindows
frame .f
} -body {
.f configure -class
@@ -590,7 +588,7 @@ test frame-3.2 {TkCreateFrame procedure} -setup {
deleteWindows
} -result {-class class Class Frame Frame}
test frame-3.3 {TkCreateFrame procedure} -setup {
- deleteWindows
+ deleteWindows
toplevel .t
wm geometry .t +0+0
} -body {
@@ -599,7 +597,7 @@ test frame-3.3 {TkCreateFrame procedure} -setup {
deleteWindows
} -result {-class class Class Toplevel Toplevel}
test frame-3.4 {TkCreateFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -width 350 -class NewClass -bg black -visual default -height 90
wm geometry .t +0+0
@@ -610,11 +608,10 @@ test frame-3.4 {TkCreateFrame procedure} -setup {
} -cleanup {
deleteWindows
} -result {350 black 90}
-
# Be sure that the -class, -colormap, and -visual options are processed
# before configuring the widget.
test frame-3.5 {TkCreateFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
option add *NewFrame.background #123456
frame .f -class NewFrame
@@ -624,7 +621,7 @@ test frame-3.5 {TkCreateFrame procedure} -setup {
option clear
} -result {#123456}
test frame-3.7 {TkCreateFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
option add *NewFrame.background #332211
option add *f.class NewFrame
@@ -635,7 +632,7 @@ test frame-3.7 {TkCreateFrame procedure} -setup {
option clear
} -result {NewFrame #332211}
test frame-3.8 {TkCreateFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
option add *Silly.background #122334
option add *f.Class Silly
@@ -648,7 +645,7 @@ test frame-3.8 {TkCreateFrame procedure} -setup {
test frame-3.9 {TkCreateFrame procedure, -use option} -constraints {
unix
} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -container 1 -width 300 -height 120
wm geometry .t +0+0
@@ -658,11 +655,11 @@ test frame-3.9 {TkCreateFrame procedure, -use option} -constraints {
[expr {[winfo rooty .x] - [winfo rooty .t]}] \
[winfo width .t] [winfo height .t]
} -cleanup {
-# This call to update idletasks was added to prevent a crash that was
-# observed on OSX 10.12 (Sierra) only. Any change, such as using the
-# Development version to make debugging symbols available, adding a print
-# statement, or calling update idletasks here, would make the test pass
-# with no segfault.
+ # This call to update idletasks was added to prevent a crash that was
+ # observed on OSX 10.12 (Sierra) only. Any change, such as using the
+ # Development version to make debugging symbols available, adding a print
+ # statement, or calling update idletasks here, would make the test pass
+ # with no segfault.
update idletasks
deleteWindows
} -result {0 0 140 300}
@@ -693,42 +690,40 @@ test frame-3.10 {TkCreateFrame procedure, -use option} -constraints {
destroy .t
option clear
} -result {0 0 140 300}
-
-# The tests below require specific display characteristics (i.e. that
-# they are run on a pseudocolor display of depth 8). Even so, they
-# are non-portable: some machines don't seem to ever run out of
-# colors.
+# The tests below require specific display characteristics (i.e. that they are
+# run on a pseudocolor display of depth 8). Even so, they are non-portable:
+# some machines don't seem to ever run out of colors.
if {[testConstraint defaultPseudocolor8]} {
eatColors .t1
}
test frame-3.11 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 nonPortable
+ defaultPseudocolor8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
toplevel .t -width 300 -height 200 -bg #475601
wm geometry .t +0+0
update
colorsFree .t
} -cleanup {
- deleteWindows
-} -result {0}
+ destroy .t
+} -result 0
test frame-3.12 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 nonPortable
+ defaultPseudocolor8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
toplevel .t -width 300 -height 200 -bg #475601 -colormap new
wm geometry .t +0+0
update
colorsFree .t
} -cleanup {
- deleteWindows
-} -result {1}
+ destroy .t
+} -result 1
test frame-3.13 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 nonPortable
+ defaultPseudocolor8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
option add *t.class Toplevel2
option add *Toplevel2.colormap new
@@ -738,12 +733,12 @@ test frame-3.13 {TkCreateFrame procedure} -constraints {
option clear
colorsFree .t
} -cleanup {
- deleteWindows
-} -result {1}
+ destroy .t
+} -result 1
test frame-3.14 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 nonPortable
+ defaultPseudocolor8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
option add *t.class Toplevel3
option add *Toplevel3.Colormap new
@@ -753,12 +748,12 @@ test frame-3.14 {TkCreateFrame procedure} -constraints {
option clear
colorsFree .t
} -cleanup {
- deleteWindows
-} -result {1}
+ destroy .t
+} -result 1
test frame-3.15 {TkCreateFrame procedure, -use and -colormap} -constraints {
defaultPseudocolor8 unix nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
toplevel .t -container 1 -width 300 -height 120
wm geometry .t +0+0
@@ -769,21 +764,21 @@ test frame-3.15 {TkCreateFrame procedure, -use and -colormap} -constraints {
destroy .t
} -result {0 1}
test frame-3.16 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 nonPortable
+ defaultPseudocolor8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
toplevel .t -width 300 -height 200 -bg #475601 -visual default
wm geometry .t +0+0
update
colorsFree .t
} -cleanup {
- deleteWindows
-} -result {0}
+ destroy .t
+} -result 0
test frame-3.17 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 nonPortable
+ defaultPseudocolor8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
toplevel .t -width 300 -height 200 -bg #475601 -visual default \
-colormap new
@@ -791,24 +786,24 @@ test frame-3.17 {TkCreateFrame procedure} -constraints {
update
colorsFree .t
} -cleanup {
- deleteWindows
-} -result {1}
+ destroy .t
+} -result 1
test frame-3.18 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 haveGrayscale8 nonPortable
+ defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343
wm geometry .t +0+0
update
colorsFree .t 131 131 131
} -cleanup {
- deleteWindows
-} -result {1}
+ destroy .t
+} -result 1
test frame-3.19 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 haveGrayscale8 nonPortable
+ defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
option add *t.class T4
option add *T4.visual {grayscale 8}
@@ -818,14 +813,13 @@ test frame-3.19 {TkCreateFrame procedure} -constraints {
option clear
list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
} -cleanup {
- deleteWindows
+ destroy .t
} -result {1 {grayscale 8}}
test frame-3.20 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 haveGrayscale8 nonPortable
+ defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
- set x ok
option add *t.class T5
option add *T5.Visual {grayscale 8}
toplevel .t -width 300 -height 200 -bg #434343
@@ -834,27 +828,25 @@ test frame-3.20 {TkCreateFrame procedure} -constraints {
option clear
list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
} -cleanup {
- deleteWindows
+ destroy .t
} -result {1 {grayscale 8}}
test frame-3.21 {TkCreateFrame procedure} -constraints {
- defaultPseudocolor8 haveGrayscale8 nonPortable
+ defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
- deleteWindows
+ destroy .t
} -body {
- set x ok
toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343
wm geometry .t +0+0
update
colorsFree .t 131 131 131
} -cleanup {
- deleteWindows
-} -result {1}
+ destroy .t
+} -result 1
if {[testConstraint defaultPseudocolor8]} {
destroy .t1
}
-
test frame-3.22 {TkCreateFrame procedure, default dimensions} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t
wm geometry .t +0+0
@@ -879,22 +871,20 @@ test frame-3.24 {TkCreateFrame procedure} -setup {
wm geometry .t +0+0
} -returnCodes error -result {unknown option "-bogus"}
-
test frame-4.1 {TkCreateFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
catch {frame .f -gorp glob}
winfo exists .f
} -result 0
test frame-4.2 {TkCreateFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
list [frame .f -width 200 -height 100] [winfo exists .f]
} -cleanup {
deleteWindows
} -result {.f 1}
-
frame .f -highlightcolor black
test frame-5.1 {FrameWidgetCommand procedure} -body {
.f
@@ -922,10 +912,9 @@ test frame-5.7 {FrameWidgetCommand procedure, cget option} -setup {
} -cleanup {
destroy .t
} -returnCodes ok -match glob -result *
-
test frame-5.8 {FrameWidgetCommand procedure, configure option} -body {
- llength [.f configure]
-} -result {18}
+ optnames [.f configure]
+} -result {-background -backgroundimage -bd -bg -bgimg -borderwidth -class -colormap -container -cursor -height -highlightbackground -highlightcolor -highlightthickness -padx -pady -relief -takefocus -tile -visual -width}
test frame-5.9 {FrameWidgetCommand procedure, configure option} -body {
.f configure -gorp
} -returnCodes error -result {unknown option "-gorp"}
@@ -939,12 +928,12 @@ test frame-5.12 {FrameWidgetCommand procedure} -body {
.f swizzle
} -returnCodes error -result {bad option "swizzle": must be cget or configure}
test frame-5.13 {FrameWidgetCommand procedure, configure option} -body {
- llength [. configure]
-} -result {21}
+ optnames [. configure]
+} -result {-background -backgroundimage -bd -bg -bgimg -borderwidth -class -colormap -container -cursor -height -highlightbackground -highlightcolor -highlightthickness -menu -padx -pady -relief -screen -takefocus -tile -use -visual -width}
destroy .f
test frame-6.1 {ConfigureFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f -width 150
list [winfo reqwidth .f] [winfo reqheight .f]
@@ -952,7 +941,7 @@ test frame-6.1 {ConfigureFrame procedure} -setup {
deleteWindows
} -result {150 1}
test frame-6.2 {ConfigureFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f -height 97
list [winfo reqwidth .f] [winfo reqheight .f]
@@ -960,7 +949,7 @@ test frame-6.2 {ConfigureFrame procedure} -setup {
deleteWindows
} -result {1 97}
test frame-6.3 {ConfigureFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f
set result {}
@@ -974,7 +963,7 @@ test frame-6.3 {ConfigureFrame procedure} -setup {
} -result {1 1 100 180 100 180}
test frame-7.1 {FrameEventProc procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .frame2
set result [info commands .frame2]
@@ -982,7 +971,7 @@ test frame-7.1 {FrameEventProc procedure} -setup {
lappend result [info commands .frame2]
} -result {.frame2 {}}
test frame-7.2 {FrameEventProc procedure} -setup {
- deleteWindows
+ deleteWindows
set x {}
} -body {
frame .f1 -bg #543210
@@ -996,7 +985,7 @@ test frame-7.2 {FrameEventProc procedure} -setup {
} -result {.f1 #543210 {} {}}
test frame-8.1 {FrameCmdDeletedProc procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f1
rename .f1 {}
@@ -1005,7 +994,7 @@ test frame-8.1 {FrameCmdDeletedProc procedure} -setup {
deleteWindows
} -result {{} {}}
test frame-8.2 {FrameCmdDeletedProc procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .f1 -menu .m
wm geometry .f1 +0+0
@@ -1020,7 +1009,6 @@ test frame-8.2 {FrameCmdDeletedProc procedure} -setup {
# This one fails with the dash-patch!!!! Still don't know why :-(
#
#test frame-8.3 {FrameCmdDeletedProc procedure} -setup {
-# eval destroy [winfo children .]
# deleteWindows
#} -body {
# toplevel .f1 -menu .m
@@ -1031,12 +1019,11 @@ test frame-8.2 {FrameCmdDeletedProc procedure} -setup {
# update
# list [info command .f*] [winfo children .]
#} -cleanup {
-# eval destroy [winfo children .]
# deleteWindows
#} -result {{} .m}
test frame-9.1 {MapFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -width 100 -height 400
wm geometry .t +0+0
@@ -1047,16 +1034,16 @@ test frame-9.1 {MapFrame procedure} -setup {
deleteWindows
} -result {0 1}
test frame-9.2 {MapFrame procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t -width 100 -height 400
wm geometry .t +0+0
destroy .t
update
winfo exists .t
-} -result {0}
+} -result 0
test frame-9.3 {MapFrame procedure, window deleted while mapping} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t2 -width 200 -height 200
wm geometry .t2 +0+0
@@ -1070,24 +1057,19 @@ test frame-9.3 {MapFrame procedure, window deleted while mapping} -setup {
winfo exists .t
} -cleanup {
deleteWindows
-} -result {0}
-
+} -result 0
test frame-10.1 {frame widget vs hidden commands} -setup {
- deleteWindows
+ deleteWindows
} -body {
- set l [interp hidden]
frame .t
interp hide {} .t
destroy .t
- set res1 [list [winfo children .] [interp hidden]]
- set res2 [list {} $l]
- expr {$res1 eq $res2}
-} -result 1
-
+ list [winfo children .] [lsort [interp hidden]]
+} -result [list {} [lsort [interp hidden]]]
test frame-11.1 {TkInstallFrameMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m1.system
@@ -1098,9 +1080,9 @@ test frame-11.1 {TkInstallFrameMenu} -setup {
deleteWindows
} -result {.t}
test frame-11.2 {TkInstallFrameMenu - frame renamed} -setup {
- deleteWindows
-} -body {
+ deleteWindows
catch {rename foo {}}
+} -body {
menu .m1
.m1 add cascade -menu .m1.system
menu .m1.system -tearoff 0
@@ -1111,9 +1093,8 @@ test frame-11.2 {TkInstallFrameMenu - frame renamed} -setup {
deleteWindows
} -result {}
-
test frame-12.1 {FrameWorldChanged procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Test -bd -padx and -pady
frame .f -borderwidth 2 -padx 3 -pady 4
@@ -1125,19 +1106,16 @@ test frame-12.1 {FrameWorldChanged procedure} -setup {
deleteWindows
} -result {5 6 30 28}
test frame-12.2 {FrameWorldChanged procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Test all -labelanchor positions
set font {helvetica 12}
labelframe .f -highlightthickness 1 -bd 3 -padx 1 -pady 2 -font $font \
-text "Mupp"
- set fh [expr {[font metrics $font -linespace] + 2 - 3}]
- set fw [expr {[font measure $font "Mupp"] + 2 - 3}]
- if {$fw < 0} {set fw 0}
- if {$fh < 0} {set fh 0}
+ set fh [expr {max([font metrics $font -linespace] + 2 - 3, 0)}]
+ set fw [expr {max([font measure $font "Mupp"] + 2 - 3, 0)}]
place .f -x 0 -y 0 -width 100 -height 100
pack [frame .f.f] -fill both -expand 1
-
set result {}
foreach lp {nw n ne en e es se s sw ws w wn} {
.f configure -labelanchor $lp
@@ -1152,16 +1130,17 @@ test frame-12.2 {FrameWorldChanged procedure} -setup {
w* {incr expx $fw ; incr expw -$fw}
e* {incr expw -$fw}
}
- lappend result [expr {\
- [winfo x .f.f] == $expx && [winfo y .f.f] == $expy &&\
- [winfo width .f.f] == $expw && [winfo height .f.f] == $exph}]
+ lappend result [expr {
+ [winfo x .f.f] == $expx && [winfo y .f.f] == $expy &&
+ [winfo width .f.f] == $expw && [winfo height .f.f] == $exph
+ }]
}
return $result
} -cleanup {
deleteWindows
} -result {1 1 1 1 1 1 1 1 1 1 1 1}
test frame-12.3 {FrameWorldChanged procedure} -setup {
- deleteWindows
+ deleteWindows
update idletasks
} -body {
# Check reaction on font change
@@ -1188,11 +1167,10 @@ test frame-12.3 {FrameWorldChanged procedure} -setup {
} -cleanup {
deleteWindows
font delete myfont
-} -result {0}
-
+} -result 0
test frame-13.1 {labelframe configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
labelframe .f -class NewFrame
.f configure -class
@@ -1204,32 +1182,32 @@ test frame-13.2 {labelframe configuration options} -setup {
} -body {
labelframe .f -class NewFrame
.f configure -class Different
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -class option after widget is created}
+} -result {can't modify -class option after widget is created}
test frame-13.3 {labelframe configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
labelframe .f -colormap new
} -cleanup {
deleteWindows
} -result {.f}
test frame-13.4 {labelframe configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
labelframe .f -visual default
} -cleanup {
deleteWindows
} -result {.f}
test frame-13.5 {labelframe configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
labelframe .f -screen bogus
} -cleanup {
deleteWindows
} -returnCodes error -result {unknown option "-screen"}
test frame-13.6 {labelframe configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
labelframe .f -container true
} -cleanup {
@@ -1244,21 +1222,20 @@ test frame-13.7 {labelframe configuration options} -setup {
deleteWindows
} -result {-container container Container 0 1}
test frame-13.8 {labelframe configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
labelframe .f -container bogus
} -cleanup {
deleteWindows
} -returnCodes error -result {expected boolean value but got "bogus"}
test frame-13.9 {labelframe configuration options} -setup {
- deleteWindows
+ deleteWindows
} -body {
labelframe .f
.f configure -container 1
-} -cleanup {
+} -returnCodes error -cleanup {
deleteWindows
-} -returnCodes error -result {can't modify -container option after widget is created}
-
+} -result {can't modify -container option after widget is created}
destroy .f
labelframe .f
test frame-13.10 {labelframe configuration options} -body {
@@ -1266,36 +1243,36 @@ test frame-13.10 {labelframe configuration options} -body {
lindex [.f configure -background] 4
} -cleanup {
.f configure -background [lindex [.f configure -background] 3]
-} -result {#ff0000}
+} -result "#ff0000"
test frame-13.11 {labelframe configuration options} -body {
- .f configure -background non-existent
+ .f configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.12 {labelframe configuration options} -body {
.f configure -bd 4
lindex [.f configure -bd] 4
} -cleanup {
.f configure -bd [lindex [.f configure -bd] 3]
-} -result {4}
+} -result 4
test frame-13.13 {labelframe configuration options} -body {
- .f configure -bd badValue
+ .f configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.14 {labelframe configuration options} -body {
.f configure -bg #00ff00
lindex [.f configure -bg] 4
} -cleanup {
.f configure -bg [lindex [.f configure -bg] 3]
-} -result {#00ff00}
+} -result "#00ff00"
test frame-13.15 {labelframe configuration options} -body {
- .f configure -bg non-existent
+ .f configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.16 {labelframe configuration options} -body {
.f configure -borderwidth 1.3
lindex [.f configure -borderwidth] 4
} -cleanup {
.f configure -borderwidth [lindex [.f configure -borderwidth] 3]
-} -result {1}
+} -result 1
test frame-13.17 {labelframe configuration options} -body {
- .f configure -borderwidth badValue
+ .f configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.18 {labelframe configuration options} -body {
.f configure -cursor arrow
@@ -1304,16 +1281,16 @@ test frame-13.18 {labelframe configuration options} -body {
.f configure -cursor [lindex [.f configure -cursor] 3]
} -result {arrow}
test frame-13.19 {labelframe configuration options} -body {
- .f configure -cursor badValue
+ .f configure -cursor badValue
} -returnCodes error -result {bad cursor spec "badValue"}
test frame-13.20 {labelframe configuration options} -body {
.f configure -fg #0000ff
lindex [.f configure -fg] 4
} -cleanup {
.f configure -fg [lindex [.f configure -fg] 3]
-} -result {#0000ff}
+} -result "#0000ff"
test frame-13.21 {labelframe configuration options} -body {
- .f configure -fg non-existent
+ .f configure -fg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.22 {labelframe configuration options} -body {
.f configure -font {courier 8}
@@ -1326,45 +1303,45 @@ test frame-13.23 {labelframe configuration options} -body {
lindex [.f configure -foreground] 4
} -cleanup {
.f configure -foreground [lindex [.f configure -foreground] 3]
-} -result {#ff0000}
+} -result "#ff0000"
test frame-13.24 {labelframe configuration options} -body {
- .f configure -foreground non-existent
+ .f configure -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.25 {labelframe configuration options} -body {
.f configure -height 100
lindex [.f configure -height] 4
} -cleanup {
.f configure -height [lindex [.f configure -height] 3]
-} -result {100}
+} -result 100
test frame-13.26 {labelframe configuration options} -body {
- .f configure -height not_a_number
+ .f configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
test frame-13.27 {labelframe configuration options} -body {
.f configure -highlightbackground #112233
lindex [.f configure -highlightbackground] 4
} -cleanup {
.f configure -highlightbackground [lindex [.f configure -highlightbackground] 3]
-} -result {#112233}
+} -result "#112233"
test frame-13.28 {labelframe configuration options} -body {
- .f configure -highlightbackground ugly
+ .f configure -highlightbackground ugly
} -returnCodes error -result {unknown color name "ugly"}
test frame-13.29 {labelframe configuration options} -body {
.f configure -highlightcolor #123456
lindex [.f configure -highlightcolor] 4
} -cleanup {
.f configure -highlightcolor [lindex [.f configure -highlightcolor] 3]
-} -result {#123456}
+} -result "#123456"
test frame-13.30 {labelframe configuration options} -body {
- .f configure -highlightcolor non-existent
+ .f configure -highlightcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.31 {labelframe configuration options} -body {
.f configure -highlightthickness 6
lindex [.f configure -highlightthickness] 4
} -cleanup {
.f configure -highlightthickness [lindex [.f configure -highlightthickness] 3]
-} -result {6}
+} -result 6
test frame-13.32 {labelframe configuration options} -body {
- .f configure -highlightthickness badValue
+ .f configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.33 {labelframe configuration options} -body {
.f configure -labelanchor se
@@ -1372,26 +1349,26 @@ test frame-13.33 {labelframe configuration options} -body {
} -cleanup {
.f configure -labelanchor [lindex [.f configure -labelanchor] 3]
} -result {se}
-test frame-13.34 {labelframe configuration options} -body {
- .f configure -labelanchor badValue
-} -returnCodes error -result {bad labelanchor "badValue": must be e, en, es, n, ne, nw, s, se, sw, w, wn, or ws}
+test frame-13.34 {labelframe configuration options} -returnCodes error -body {
+ .f configure -labelanchor badValue
+} -result {bad labelanchor "badValue": must be e, en, es, n, ne, nw, s, se, sw, w, wn, or ws}
test frame-13.35 {labelframe configuration options} -body {
.f configure -padx 3
lindex [.f configure -padx] 4
} -cleanup {
.f configure -padx [lindex [.f configure -padx] 3]
-} -result {3}
+} -result 3
test frame-13.36 {labelframe configuration options} -body {
- .f configure -padx badValue
+ .f configure -padx badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.37 {labelframe configuration options} -body {
.f configure -pady 4
lindex [.f configure -pady] 4
} -cleanup {
.f configure -pady [lindex [.f configure -pady] 3]
-} -result {4}
+} -result 4
test frame-13.38 {labelframe configuration options} -body {
- .f configure -pady badValue
+ .f configure -pady badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.39 {labelframe configuration options} -body {
.f configure -relief ridge
@@ -1399,9 +1376,9 @@ test frame-13.39 {labelframe configuration options} -body {
} -cleanup {
.f configure -relief [lindex [.f configure -relief] 3]
} -result {ridge}
-test frame-13.40 {labelframe configuration options} -body {
- .f configure -relief badValue
-} -returnCodes error -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
+test frame-13.40 {labelframe configuration options} -returnCodes error -body {
+ .f configure -relief badValue
+} -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
test frame-13.41 {labelframe configuration options} -body {
.f configure -takefocus {any string}
lindex [.f configure -takefocus] 4
@@ -1419,15 +1396,14 @@ test frame-13.43 {labelframe configuration options} -body {
lindex [.f configure -width] 4
} -cleanup {
.f configure -width [lindex [.f configure -width] 3]
-} -result {32}
+} -result 32
test frame-13.44 {labelframe configuration options} -body {
- .f configure -width badValue
+ .f configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
destroy .f
-
test frame-14.1 {labelframe labelwidget option} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Test that label is moved in stacking order
label .l -text Mupp -font {helvetica 8}
@@ -1442,7 +1418,7 @@ test frame-14.1 {labelframe labelwidget option} -setup {
deleteWindows
} -result {{.f .l} 54 52}
test frame-14.2 {labelframe labelwidget option} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Test the labelframe's reaction if the label is destroyed
label .l -text Aratherlonglabel
@@ -1461,7 +1437,7 @@ test frame-14.2 {labelframe labelwidget option} -setup {
deleteWindows
} -result {.l 12 {} 4}
test frame-14.3 {labelframe labelwidget option} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Test the labelframe's reaction if the label is stolen
label .l -text Aratherlonglabel
@@ -1480,7 +1456,7 @@ test frame-14.3 {labelframe labelwidget option} -setup {
deleteWindows
} -result {.l 12 {} 4}
test frame-14.4 {labelframe labelwidget option} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Test the label's reaction if the labelframe is destroyed
label .l -text Mupp
@@ -1494,7 +1470,7 @@ test frame-14.4 {labelframe labelwidget option} -setup {
deleteWindows
} -result {labelframe {}}
test frame-14.5 {labelframe labelwidget option} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Test that the labelframe reacts on changes in label
label .l -text Aratherlonglabel
@@ -1517,12 +1493,12 @@ test frame-14.5 {labelframe labelwidget option} -setup {
deleteWindows
} -result {12 12 1 12 1}
test frame-14.6 {labelframe labelwidget option} -setup {
- deleteWindows
+ deleteWindows
} -body {
- # Destroying a labelframe with a child label caused a crash
- # when not handling mapping of the label correctly.
- # This test does not test anything directly, it's just ment
- # to catch if the same mistake is made again.
+ # Destroying a labelframe with a child label caused a crash when not
+ # handling mapping of the label correctly.
+ # This test does not test anything directly, it's just ment to catch if
+ # the same mistake is made again.
labelframe .f
pack .f
label .f.l -text Mupp
@@ -1531,14 +1507,298 @@ test frame-14.6 {labelframe labelwidget option} -setup {
} -cleanup {
deleteWindows
} -result {}
-deleteWindows
-rename eatColors {}
-rename colorsFree {}
+test frame-15.1 {TIP 262: frame background images} -setup {
+ deleteWindows
+ image create photo gorp -width 10 -height 10
+ gorp put black -to 2 2 7 7
+} -body {
+ frame .f -width 100 -height 100
+ pack .f
+ list [image inuse gorp] [.f configure -backgroundimage gorp;update] \
+ [image inuse gorp] [winfo width .f] [winfo height .f]
+} -cleanup {
+ image delete gorp
+ deleteWindows
+} -result {0 {} 1 100 100}
+test frame-15.2 {TIP 262: frame background images} -setup {
+ deleteWindows
+ catch {rename gorp ""}
+} -body {
+ frame .f -width 100 -height 100
+ pack .f
+ update
+ .f configure -backgroundimage gorp
+} -returnCodes error -cleanup {
+ deleteWindows
+} -result {image "gorp" doesn't exist}
+test frame-15.3 {TIP 262: frame background images} -setup {
+ deleteWindows
+ image create photo gorp -width 10 -height 10
+ gorp put black -to 2 2 7 7
+} -body {
+ frame .f -width 100 -height 100 -backgroundimage gorp
+ pack .f
+ .f configure -tile yes
+ update
+ list [.f cget -bgimg] [.f cget -tile]
+} -cleanup {
+ image delete gorp
+ deleteWindows
+} -result {gorp 1}
+test frame-15.4 {TIP 262: frame background images} -setup {
+ deleteWindows
+ image create photo gorp -width 10 -height 10
+ gorp put black -to 2 2 7 7
+} -body {
+ frame .f -width 100 -height 100 -backgroundimage gorp
+ pack .f
+ .f configure -tile yes
+ update
+ gorp put red -to 15 15 20 20
+ update
+ list [.f cget -bgimg] [.f cget -tile]
+} -cleanup {
+ image delete gorp
+ deleteWindows
+} -result {gorp 1}
+test frame-15.5 {TIP 262: frame background images} -setup {
+ deleteWindows
+ image create photo gorp -width 10 -height 10
+ gorp put black -to 2 2 7 7
+ set result {}
+} -body {
+ frame .f -width 100 -height 100 -backgroundimage gorp
+ pack .f
+ .f configure -tile yes
+ update
+ image delete gorp
+ update
+ set result [list [.f cget -bgimg] [.f cget -tile]]
+ image create photo gorp -width 250 -height 250
+ update
+ lappend result [.f cget -backgroundimage]
+} -cleanup {
+ catch {image delete gorp}
+ deleteWindows
+} -result {gorp 1 gorp}
+test frame-15.6 {TIP 262: frame background images} -setup {
+ deleteWindows
+ set result {}
+ . configure -width 200 -height 200
+} -constraints testImageType -body {
+ image create test gorp -variable result
+ pack [frame .f -width 100 -height 100 -bgimg gorp]
+ update idletasks; update
+ return [uniq $result]
+} -cleanup {
+ deleteWindows
+ catch {image delete gorp}
+} -result {{gorp get} {gorp display 0 0 30 15}}
+test frame-15.6a {TIP 262: frame background images (offsets)} -setup {
+ deleteWindows
+ set result {}
+ . configure -width 200 -height 200
+} -constraints testImageType -body {
+ image create test gorp -variable result
+ pack [frame .f -width 10 -height 10 -bgimg gorp]
+ update idletasks; update
+ # On MacOS must wait for the test image display procedure to run.
+ set timer [after 300 {lappend result "timedout"}]
+ while {"timedout" ni $result &&
+ "gorp display 10 2 10 10" ni $result} {
+ vwait result
+ }
+ after cancel $timer
+ update idletasks; update
+ return [uniq $result]
+} -cleanup {
+ deleteWindows
+ catch {image delete gorp}
+} -result {{gorp get} {gorp display 10 2 10 10}}
+test frame-15.7 {TIP 262: frame background images} -setup {
+ deleteWindows
+ set result {}
+ . configure -width 200 -height 200
+} -constraints testImageType -body {
+ image create test gorp -variable result
+ pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1]
+ update idletasks; update
+ # On MacOS must wait for the test image display procedure to run.
+ set timer [after 300 {lappend result "timedout"}]
+ while {"timedout" ni $result &&
+ "gorp display 0 0 20 10" ni $result} {
+ vwait result
+ }
+ after cancel $timer
+ if {[lindex $result end] eq "timedout"} {
+ return [lreplace $result end end]
+ }
+ return [uniq $result]
+} -cleanup {
+ deleteWindows
+ catch {image delete gorp}
+} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 10} {gorp display 0 0 20 15} {gorp display 0 0 20 10}}
+test frame-15.7a {TIP 262: frame background images (offsets)} -setup {
+ deleteWindows
+ set result {}
+ . configure -width 200 -height 200
+} -constraints testImageType -body {
+ image create test gorp -variable result
+ pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1 -highlightthick 1]
+ update idletasks; update
+ # On MacOS must wait for the test image display procedure to run.
+ set timer [after 300 {lappend result "timedout"}]
+ while {"timedout" ni $result &&
+ "gorp display 0 0 18 8" ni $result} {
+ vwait result
+ }
+ after cancel $timer
+ return [uniq $result]
+} -cleanup {
+ deleteWindows
+ catch {image delete gorp}
+} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 8} {gorp display 0 0 18 15} {gorp display 0 0 18 8}}
+test frame-15.7b {TIP 262: frame background images (offsets)} -setup {
+ deleteWindows
+ set result {}
+ . configure -width 200 -height 200
+} -constraints testImageType -body {
+ image create test gorp -variable result
+ pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1 -bd 2]
+ update idletasks; update
+ return [uniq $result]
+} -cleanup {
+ deleteWindows
+ catch {image delete gorp}
+} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 6} {gorp display 0 0 16 15} {gorp display 0 0 16 6}}
+test frame-15.7c {TIP 262: frame background images (offsets)} -setup {
+ deleteWindows
+ set result {}
+ . configure -width 200 -height 200
+} -constraints testImageType -body {
+ image create test gorp -variable result
+ pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1 -bd 2 -highlightthick 1]
+ update idletasks; update
+ return [uniq $result]
+} -cleanup {
+ deleteWindows
+ catch {image delete gorp}
+} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 4} {gorp display 0 0 14 15} {gorp display 0 0 14 4}}
+test frame-15.8 {TIP 262: toplevel background images} -setup {
+ deleteWindows
+ image create photo gorp -width 10 -height 10
+ gorp put black -to 2 2 7 7
+} -body {
+ toplevel .t -width 100 -height 100
+ update
+ # Used to verify that setting a background image doesn't change the widget size
+ set w [winfo width .t]
+ set h [winfo height .t]
+ list [image inuse gorp] [.t configure -backgroundimage gorp;update] \
+ [image inuse gorp] \
+ [expr {$w-[winfo width .t]}] [expr {$h-[winfo height .t]}]
+} -cleanup {
+ image delete gorp
+ deleteWindows
+} -result {0 {} 1 0 0}
+test frame-15.9 {TIP 262: toplevel background images} -setup {
+ deleteWindows
+ catch {rename gorp ""}
+} -body {
+ toplevel .t -width 100 -height 100
+ update
+ .t configure -backgroundimage gorp
+} -returnCodes error -cleanup {
+ deleteWindows
+} -result {image "gorp" doesn't exist}
+test frame-15.10 {TIP 262: toplevel background images} -setup {
+ deleteWindows
+ image create photo gorp -width 10 -height 10
+ gorp put black -to 2 2 7 7
+} -body {
+ toplevel .t -width 100 -height 100 -backgroundimage gorp -tile yes
+ update
+ list [.t cget -bgimg] [.t cget -tile]
+} -cleanup {
+ image delete gorp
+ deleteWindows
+} -result {gorp 1}
+test frame-15.11 {TIP 262: toplevel background images} -setup {
+ deleteWindows
+ image create photo gorp -width 10 -height 10
+ gorp put black -to 2 2 7 7
+} -body {
+ toplevel .t -width 100 -height 100 -backgroundimage gorp -tile yes
+ update
+ gorp put red -to 15 15 20 20
+ update
+ list [.t cget -bgimg] [.t cget -tile]
+} -cleanup {
+ image delete gorp
+ deleteWindows
+} -result {gorp 1}
+test frame-15.12 {TIP 262: toplevel background images} -setup {
+ deleteWindows
+ image create photo gorp -width 10 -height 10
+ gorp put black -to 2 2 7 7
+ set result {}
+} -body {
+ toplevel .t -width 100 -height 100 -backgroundimage gorp -tile yes
+ update
+ image delete gorp
+ update
+ set result [list [.t cget -bgimg] [.t cget -tile]]
+ image create photo gorp -width 250 -height 250
+ update
+ lappend result [.t cget -backgroundimage]
+} -cleanup {
+ catch {image delete gorp}
+ deleteWindows
+} -result {gorp 1 gorp}
+test frame-15.13 {TIP 262: toplevel background images} -setup {
+ deleteWindows
+ set result {}
+} -constraints testImageType -body {
+ image create test gorp -variable result
+ toplevel .t -width 100 -height 100 -bgimg gorp
+ wm overrideredirect .t 1; # Reduce trouble from window managers
+ update idletasks; update
+ return [uniq $result]
+} -cleanup {
+ deleteWindows
+ catch {image delete gorp}
+} -result {{gorp get} {gorp display 0 0 30 15}}
+test frame-15.14 {TIP 262: toplevel background images} -setup {
+ deleteWindows
+ set result {}
+} -constraints testImageType -body {
+ image create test gorp -variable result
+ toplevel .t -width 50 -height 25 -bgimg gorp -tile 1
+ wm overrideredirect .t 1; # Reduce trouble from window managers
+ update idletasks; update
+ # On MacOS must wait for the test image display procedure to run.
+ set timer [after 300 {lappend result "timedout"}]
+ while {"timedout" ni $result &&
+ "gorp display 0 0 20 10" ni $result} {
+ vwait result
+ }
+ after cancel $timer
+ return [uniq $result]
+} -cleanup {
+ deleteWindows
+ catch {image delete gorp}
+} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 10} {gorp display 0 0 20 15} {gorp display 0 0 20 10}}
+
# cleanup
+deleteWindows
+apply {cmds {foreach cmd $cmds {rename $cmd {}}}} {
+ eatColors colorsFree uniq optnames
+}
+
cleanupTests
return
-
-
-
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/tests/geometry.test b/tests/geometry.test
index c10a119..6576331 100644
--- a/tests/geometry.test
+++ b/tests/geometry.test
@@ -2,9 +2,9 @@
# tkGeometry.c (generic support for geometry managers). It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
proc getsize w {
@@ -282,7 +282,7 @@ test geometry-4.10 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} -setup {
winfo ismapped .t.quit
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
# cleanup
diff --git a/tests/get.test b/tests/get.test
index ea08c8c..51b6b94 100644
--- a/tests/get.test
+++ b/tests/get.test
@@ -2,8 +2,8 @@
# tkGet.c. It is organized in the standard fashion for Tcl
# white-box tests.
#
-# Copyright (c) 1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/grab.test b/tests/grab.test
index 653d756..ea8e992 100644
--- a/tests/grab.test
+++ b/tests/grab.test
@@ -4,7 +4,7 @@
# built-in commands. Sourcing this file runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
+# Copyright © 1998-2000 Ajuba Solutions.
# All rights reserved.
package require tcltest 2.2
@@ -107,7 +107,7 @@ test grab-2.1 {Tk_GrabObjCmd, grab status gives correct status} -body {
grab status .
} -cleanup {
grab release .
-} -result {none}
+} -result none
test grab-2.2 {Tk_GrabObjCmd, grab status gives correct status} -body {
set curr [grab current .]
if { [string length $curr] > 0 } {
diff --git a/tests/grid.test b/tests/grid.test
index dd02729..627b4e7 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out the *NEW* "grid" command of Tk. It is
# (almost) organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -45,7 +45,7 @@ test grid-1.1 {basic argument checking} -body {
} -returnCodes error -result {wrong # args: should be "grid option arg ?arg ...?"}
test grid-1.2 {basic argument checking} -body {
grid foo bar
-} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, size, or slaves}
+} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, or size}
test grid-1.3 {basic argument checking} -body {
button .b
grid .b -row 0 -column
@@ -63,10 +63,10 @@ test grid-1.5 {basic argument checking} -body {
} -returnCodes error -result {can't manage ".": it's a top-level window}
test grid-1.6 {basic argument checking} -body {
grid x
-} -returnCodes error -result {can't determine master window}
+} -returnCodes error -result {can't determine container window}
test grid-1.7 {basic argument checking} -body {
grid configure x
-} -returnCodes error -result {can't determine master window}
+} -returnCodes error -result {can't determine container window}
test grid-1.8 {basic argument checking} -body {
button .b
grid x .b
@@ -93,7 +93,7 @@ test grid-2.2 {bbox} -body {
} -result {0 0 0 0}
test grid-2.3 {bbox: argument checking} -body {
grid bbox . 0 0 5
-} -returnCodes error -result {wrong # args: should be "grid bbox master ?column row ?column row??"}
+} -returnCodes error -result {wrong # args: should be "grid bbox window ?column row ?column row??"}
test grid-2.4 {bbox} -body {
grid bbox .bad 0 0
} -returnCodes error -result {bad window path name ".bad"}
@@ -179,7 +179,7 @@ test grid-3.7 {configure: basic argument checking} -body {
grid .f .f.b
} -cleanup {
grid_reset 3.7
-} -returnCodes error -result {can't put .f.b inside .}
+} -returnCodes error -result {can't put ".f.b" inside "."}
test grid-3.8 {configure: basic argument checking} -body {
button .b
grid configure x .b
@@ -206,7 +206,7 @@ test grid-3.11 {prevent management loops} -body {
grid .f2 -in .f1
} -cleanup {
grid_reset 3.11
-} -returnCodes error -result {can't put .f2 inside .f1, would cause management loop}
+} -returnCodes error -result {can't put ".f2" inside ".f1": would cause management loop}
test grid-3.12 {prevent management loops} -body {
frame .f1
frame .f2
@@ -216,7 +216,7 @@ test grid-3.12 {prevent management loops} -body {
grid .f3 -in .f1
} -cleanup {
grid_reset 3.12
-} -returnCodes error -result {can't put .f3 inside .f1, would cause management loop}
+} -returnCodes error -result {can't put ".f3" inside ".f1": would cause management loop}
test grid-4.1 {forget: basic argument checking} -body {
grid forget foo
@@ -293,7 +293,7 @@ test grid-5.4 {info} -body {
test grid-6.1 {location: basic argument checking} -body {
grid location .
-} -returnCodes error -result {wrong # args: should be "grid location master x y"}
+} -returnCodes error -result {wrong # args: should be "grid location window x y"}
test grid-6.2 {location: basic argument checking} -body {
grid location .bad 0 0
} -returnCodes error -result {bad window path name ".bad"}
@@ -389,12 +389,12 @@ test grid-7.2 {propagate} -body {
grid propagate .
} -cleanup {
grid_reset 7.2
-} -result {1}
+} -result 1
test grid-7.3 {propagate} -body {
grid propagate . 0;grid propagate .
} -cleanup {
grid_reset 7.3
-} -result {0}
+} -result 0
test grid-7.4 {propagate} -body {
grid propagate .x
} -cleanup {
@@ -576,12 +576,12 @@ test grid-10.1 {column/row configure} -body {
grid columnconfigure .
} -cleanup {
grid_reset 10.1
-} -returnCodes error -result {wrong # args: should be "grid columnconfigure master index ?-option value ...?"}
+} -returnCodes error -result {wrong # args: should be "grid columnconfigure window index ?-option value ...?"}
test grid-10.2 {column/row configure} -body {
grid columnconfigure . 0 -weight 0 -pad
} -cleanup {
grid_reset 10.2
-} -returnCodes error -result {wrong # args: should be "grid columnconfigure master index ?-option value ...?"}
+} -returnCodes error -result {wrong # args: should be "grid columnconfigure window index ?-option value ...?"}
test grid-10.3 {column/row configure} -body {
grid columnconfigure .f 0 -weight
} -cleanup {
@@ -596,7 +596,7 @@ test grid-10.5 {column/row configure} -body {
grid columnconfigure . 265 -weight
} -cleanup {
grid_reset 10.5
-} -result {0}
+} -result 0
test grid-10.6 {column/row configure} -body {
grid columnconfigure . 0
} -cleanup {
@@ -622,7 +622,7 @@ test grid-10.10 {column/row configure} -body {
grid columnconfigure . 0 -minsize
} -cleanup {
grid_reset 10.10
-} -result {10}
+} -result 10
test grid-10.11 {column/row configure} -body {
grid columnconfigure . 0 -weight bad
} -cleanup {
@@ -638,7 +638,7 @@ test grid-10.13 {column/row configure} -body {
grid columnconfigure . 0 -weight
} -cleanup {
grid_reset 10.13
-} -result {3}
+} -result 3
test grid-10.14 {column/row configure} -body {
grid columnconfigure . 0 -pad foo
} -cleanup {
@@ -654,7 +654,7 @@ test grid-10.16 {column/row configure} -body {
grid columnconfigure . 0 -pad
} -cleanup {
grid_reset 10.16
-} -result {3}
+} -result 3
test grid-10.17 {column/row configure} -body {
frame .f
set a ""
@@ -856,13 +856,13 @@ test grid-11.1 {default widget placement} -body {
grid ^
} -cleanup {
grid_reset 11.1
-} -returnCodes error -result {can't use '^', cant find master}
+} -returnCodes error -result {can't use '^', can't find container window}
test grid-11.2 {default widget placement} -body {
button .b
grid .b ^
} -cleanup {
grid_reset 11.2
-} -returnCodes error -result {can't find slave to extend with "^"}
+} -returnCodes error -result {can't find content to extend with "^"}
test grid-11.3 {default widget placement} -body {
button .b
grid .b - - .c
@@ -917,7 +917,7 @@ test grid-11.9 {default widget placement} -body {
grid .f x ^
} -cleanup {
grid_reset 11.9
-} -returnCodes error -result {can't find slave to extend with "^"}
+} -returnCodes error -result {can't find content to extend with "^"}
test grid-11.10 {default widget placement} -body {
foreach i {1 2 3} {
frame .f$i -width 100 -height 50 -highlightthickness 0 -bg red
@@ -1162,7 +1162,7 @@ test grid-13.4 {-in} -body {
grid .f -in .top
} -cleanup {
grid_reset 13.3
-} -returnCodes error -result {can't put .f inside .top}
+} -returnCodes error -result {can't put ".f" inside ".top"}
destroy .top
test grid-13.5 {-ipadx} -body {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
@@ -1825,7 +1825,6 @@ test grid-17.1 {forget and pending idle handlers} -body {
set result ok
} -result ok
-
test grid-18.1 {test respect for internalborder} -body {
toplevel .pack
wm geometry .pack 200x200
@@ -2040,8 +2039,123 @@ test grid-23 {grid configure -in leaked from previous container window - bug
pack forget .f
update
winfo ismapped .t ; # must return 1
-} {1}
+} 1
grid_reset 23
+
+test grid-24.1 {<<NoManagedChild>> fires on last grid forget} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ grid [frame .1]
+ update
+ bind . <<NoManagedChild>> {set A 1}
+ grid forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <<NoManagedChild>> {}
+ grid_reset 24.1
+} -result 1
+test grid-24.2 {<<NoManagedChild>> fires on last grid remove} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ grid [frame .1]
+ update
+ bind . <<NoManagedChild>> {set A 1}
+ grid remove .1
+ update
+ info exists A
+} -cleanup {
+ bind . <<NoManagedChild>> {}
+ grid_reset 24.2
+} -result 1
+test grid-24.3 {<<NoManagedChild>> fires on last gridded child destruction} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ grid [frame .1]
+ update
+ bind . <<NoManagedChild>> {incr A}
+ destroy .1
+ update
+ set A
+} -cleanup {
+ bind . <<NoManagedChild>> {}
+ grid_reset 24.3
+} -result 1
+test grid-24.4 {<Configure> does not fire on last grid forget} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ grid [frame .1]
+ update
+ bind . <Configure> {set A 1}
+ grid forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <Configure> {}
+ grid_reset 24.4
+} -result 0
+test grid-24.5 {<Configure> fires on forelast grid forget} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ grid [frame .1]
+ grid [frame .2]
+ update
+ bind . <Configure> {set A 1}
+ grid forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <Configure> {}
+ grid_reset 24.5
+} -result 1
+test grid-24.6 {<<NoManagedChild>> does not fire on forelast grid forget} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ grid [frame .1]
+ grid [frame .2]
+ update
+ bind . <<NoManagedChild>> {set A 1}
+ grid forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <<NoManagedChild>> {}
+ grid_reset 24.6
+} -result 0
+test grid-24.7 {<<NoManagedChild>> does not fire on grid anchor} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ bind . <<NoManagedChild>> {set A 1}
+ grid anchor . w
+ update
+ info exists A
+} -cleanup {
+ grid anchor . nw
+ bind . <<NoManagedChild>> {}
+ grid_reset 24.7
+} -result 0
+test grid-24.8 {<<NoManagedChild>> does not fire on last grid forget if propagation is off} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ grid [frame .1]
+ grid propagate . 0
+ update
+ bind . <<NoManagedChild>> {set A 1}
+ grid forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <<NoManagedChild>> {}
+ grid_reset 24.8
+} -result 0
# cleanup
cleanupTests
diff --git a/tests/image.test b/tests/image.test
index 1f0aad2..c7b6511 100644
--- a/tests/image.test
+++ b/tests/image.test
@@ -2,9 +2,9 @@
# other procedures in the file tkImage.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -50,7 +50,7 @@ test image-1.6 {Tk_ImageCmd procedure, "create" option} -constraints {
expr {$second-$first}
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test image-1.7 {Tk_ImageCmd procedure, "create" option} -constraints {
testImageType
@@ -308,7 +308,9 @@ test image-5.7 {Tk_ImageCmd procedure, "type" option} -constraints {
} -returnCodes error -result {image "myimage" doesn't exist}
-test image-6.1 {Tk_ImageCmd procedure, "types" option} -body {
+test image-6.1 {Tk_ImageCmd procedure, "types" option} -constraints {
+ testImageType
+} -body {
image types x
} -returnCodes error -result {wrong # args: should be "image types"}
test image-6.2 {Tk_ImageCmd procedure, "types" option} -body {
diff --git a/tests/imgBmap.test b/tests/imgBmap.test
index 56484a6..1beafac 100644
--- a/tests/imgBmap.test
+++ b/tests/imgBmap.test
@@ -2,9 +2,9 @@
# the procedures in the file tkImgBmap.c). It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -366,7 +366,7 @@ test imageBmap-7.5 {ImgBmapCmd procedure, "cget" option} -body {
} -returnCodes error -result {unknown option "-stupid"}
test imageBmap-7.6 {ImgBmapCmd procedure} -body {
llength [i1 configure]
-} -result {6}
+} -result 6
test imageBmap-7.7 {ImgBmapCmd procedure} -body {
i1 co -foreground #001122
i1 configure -foreground
diff --git a/tests/imgListFormat.test b/tests/imgListFormat.test
new file mode 100644
index 0000000..4877645
--- /dev/null
+++ b/tests/imgListFormat.test
@@ -0,0 +1,661 @@
+# This file is a Tcl script to test out the default image data format
+# ("list format") implementend in the file tkImgListFormat.c.
+# It is organized in the standard fashion for Tcl tests.
+#
+# Copyright © 2017 Simon Bachmann
+# All rights reserved.
+#
+# Author: Simon Bachmann (simonbachmann@bluewin.ch)
+
+package require tcltest 2.2
+namespace import ::tcltest::*
+tcltest::configure {*}$argv
+tcltest::loadTestedCommands
+
+imageInit
+
+# find the teapot.ppm file for use in these tests
+set teapotPhotoFile [file join [file dirname [info script]] teapot.ppm]
+testConstraint hasTeapotPhoto [file exists $teapotPhotoFile]
+# let's see if we have the semi-transparent one as well
+set transpTeapotPhotoFile [file join [file dirname [info script]] teapotTransparent.png]
+testConstraint hasTranspTeapotPhoto [file exists $transpTeapotPhotoFile]
+
+# ---------------------------------------------------------------------
+
+
+test imgListFormat-1.1 {ParseFormatOptions: default values} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{red green} {blue black}}
+ lindex [photo1 data] 1 1
+} -cleanup {
+ imageCleanup
+} -result {#000000}
+test imgListFormat-1.2 {ParseFormatOptions: format name as first arg} -setup {
+ image create photo photo1
+} -body {
+ photo1 put #1256ef -format {default} -to 0 0 10 10
+} -cleanup {
+ imageCleanup
+} -result {}
+test imgListFormat-1.3 {ParseFormatOptions: unknown option} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format {default -bogus}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {bad format option "-bogus": must be -colorformat}
+test imgListFormat-1.4 {ParseFormatOptions: option not allowed} -setup {
+ image create photo photo1
+} -body {
+ photo1 put yellow -format {default -colorformat rgb}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {bad format option "-colorformat": no options allowed}
+test imgListFormat-1.5 {ParseFormatOptions: no -colorformat value} -setup {
+ image create photo photo1 -data black
+} -body {
+ photo1 data -format {default -colorformat}
+} -returnCodes error -result {the "-colorformat" option requires a value}
+test imgListFormat-1.6 {ParseFormatOptions: bad -colorformat val #1} -setup {
+ image create photo photo1
+} -body {
+ photo1 put yellow
+ photo1 data -format {default -colorformat bogus}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {bad color format "bogus": must be rgb, rgba, or list}
+test imgListFormat-1.7 {ParseFormatOptions: bad -colorformat val #2} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format {default -colorformat tkcolor}
+} -returnCodes error -result \
+ {bad color format "tkcolor": must be rgb, rgba, or list}
+test imgListFormat-1.8 {ParseFormatOptions: bad -colorformat #3} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format {default -colorformat emptystring}
+} -returnCodes error -result \
+ {bad color format "emptystring": must be rgb, rgba, or list}
+test imgListFormat-1.9 {ParseFormatOptions: bad -colorformat #4} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format {default -colorformat rgb-short}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {bad color format "rgb-short": must be rgb, rgba, or list}
+test imgListFormat-1.10 {ParseFormatOptions: bad -colorformat #5} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format {default -colorformat rgba-short}
+} -returnCodes error -result \
+ {bad color format "rgba-short": must be rgb, rgba, or list}
+test imgListFormat-1.11 {valid colorformats} -setup {
+ image create photo photo1
+} -body {
+ photo1 put white#78
+ set result {}
+ lappend result [photo1 data -format {default -colorformat rgb}]
+ lappend result [photo1 data -format {default -colorformat rgba}]
+ lappend result [photo1 data -format {default -colorformat list}]
+ set result
+} -cleanup {
+ imageCleanup
+ unset result
+} -result {{{#ffffff}} {{#ffffff78}} {{{255 255 255 120}}}}
+
+# GetBadOptMsg: only use case already tested with imgListFormat-1.4
+
+test imgListFormat-3.1 {StringMatchDef: data is not a list} -body {
+ testphotostringmatch {not a " proper list}
+ # " (this comment is here only for editor highlighting)
+} -returnCodes error -result {unmatched open quote in list}
+# empty data case tested with imgPhoto-4.95 (imgPhoto.test)
+test imgListFormat-3.2 {StringMatchDef: \
+ list element not a proper list} -body {
+ testphotostringmatch {{red white} {not "} {blue green}}
+ # "
+} -returnCodes error -result {unmatched open quote in list}
+test imgListFormat-3.3 {StringMatchDef: \
+ sublists with differen lengths} -body {
+ testphotostringmatch {{#001122 #334455 #667788}
+ {#99AABB #CCDDEE}
+ {#FF0011 #223344 #556677}}
+} -returnCodes error -result \
+ {invalid row # 1: all rows must have the same number of elements}
+test imgListFormat-3.4 {StringMatchDef: base64 data is not parsed as valid \
+} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {
+ iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCA
+ YAAAEFsT2yAAAABGdBTUEAAYagMeiWXwAA
+ ABdJREFUCJkFwQEBAAAAgiD6P9pACRoqDk
+ fUBvt1wUFKAAAAAElFTkSuQmCC
+ } -format default
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCA"}
+test imgListFormat-3.5 {StringMatchDef: valid data} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{blue green}
+ {yellow magenta}
+ {#000000 #FFFFFFFF}}
+ list [image width photo1] [image height photo1] \
+ [photo1 get 0 2 -withalpha]
+} -cleanup {
+ imageCleanup
+} -result {2 3 {0 0 0 255}}
+
+# ImgStringRead: most of the error cases cannot be tested with current code,
+# as the errors are detected by StringMatchDef
+test imgListFormat-4.1 {StringReadDef: use with -format opt} -setup {
+ image create photo photo1
+} -body {
+ photo1 put white -format "default"
+ photo1 get 0 0
+} -cleanup {
+ imageCleanup
+} -result {255 255 255}
+test imgListFormat-4.2 {StringReadDef: suboptions to format} -setup {
+ image create photo photo1
+} -body {
+ photo1 put white -format {default -bogus}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {bad format option "-bogus": no options allowed}
+test imgListFormat-4.3 {StringReadDef: erroneous non-option argument} -setup {
+ image create photo photo1
+} -body {
+ photo1 put orange -format {default bogus}
+} -returnCodes error -result {bad format option "bogus": no options allowed}
+test imgListFormat-4.4 {StringReadDef: normal use case} -constraints {
+ hasTeapotPhoto
+} -setup {
+ image create photo photo1 -file $teapotPhotoFile
+ image create photo photo2
+} -body {
+ set imgData [photo1 data]
+ photo2 put $imgData
+ string equal [photo1 data] [photo2 data]
+} -cleanup {
+ imageCleanup
+ unset imgData
+} -result 1
+test imgListFormat-4.5 {StringReadDef: correct compositing rule} -constraints {
+ hasTranspTeapotPhoto
+} -setup {
+ image create photo photo1 -file $transpTeapotPhotoFile
+ image create photo photo2
+} -body {
+ photo2 put #FF0000 -to 0 0 50 50
+ photo2 put [photo1 data -format {default -colorformat rgba}] -to 10 10 40 40
+ list [photo2 get 0 0 -withalpha] [photo2 get 20 25 -withalpha] \
+ [photo2 get 49 49 -withalpha]
+} -cleanup {
+ imageCleanup
+} -result {{255 0 0 255} {0 78 185 225} {255 0 0 255}}
+
+test imgListFormat-5.1 {StringWriteDef: format options not a list} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format {default " bogus}
+ # "
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {unmatched open quote in list}
+test imgListFormat-5.2 {StringWriteDef: invalid format option} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format {default -bogus}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {bad format option "-bogus": must be -colorformat}
+test imgListFormat-5.3 {StringWriteDef: non-option arg in format} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format {default -colorformat list bogus}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {bad format option "bogus": must be -colorformat}
+test imgListFormat-5.4 {StringWriteDef: empty image} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format {default -colorformat rgba}
+} -cleanup {
+ imageCleanup
+} -result {}
+test imgListFormat-5.5 {StirngWriteDef: size of data} -setup {
+ image create photo photo1
+} -body {
+ photo1 put blue -to 0 0 35 64
+ set imgData [photo1 data]
+ list [llength [lindex $imgData 0]] [llength $imgData]
+} -cleanup {
+ unset imgData
+ imageCleanup
+} -result {35 64}
+test imgListFormat-5.6 {StringWriteDef: test some pixels #1} -constraints {
+ hasTeapotPhoto
+} -setup {
+ set result {}
+ image create photo photo1 -file $teapotPhotoFile
+} -body {
+ set imgData [photo1 data]
+ # note: with [lindex], the coords are inverted (y x)
+ lappend result [lindex $imgData 0 0]
+ lappend result [lindex $imgData 3 2]
+ lappend result [lindex $imgData 107 53]
+ lappend result [lindex $imgData 203 157]
+ lappend result [lindex $imgData 255 255]
+ set result
+} -cleanup {
+ unset result
+ unset imgData
+ imageCleanup
+} -result {{#135cc0} #135cc0 #a06d52 #e1c8ba #135cc0}
+test imgListFormat-5.7 {StringWriteDef: test some pixels #2} -constraints {
+ hasTeapotPhoto
+} -setup {
+ set result {}
+ image create photo photo1 -file $teapotPhotoFile
+} -body {
+ set imgData [photo1 data -format {default -colorformat rgba}]
+ # note: with [lindex], the coords are inverted (y x)
+ lappend result [lindex $imgData 0 0]
+ lappend result [lindex $imgData 3 2]
+ lappend result [lindex $imgData 107 53]
+ lappend result [lindex $imgData 203 157]
+ lappend result [lindex $imgData 255 255]
+ set result
+} -cleanup {
+ unset result
+ unset imgData
+ imageCleanup
+} -result {{#135cc0ff} #135cc0ff #a06d52ff #e1c8baff #135cc0ff}
+test imgListFormat-5.8 {StringWriteDef: test some pixels #3} -constraints {
+ hasTranspTeapotPhoto
+} -setup {
+ image create photo photo1 -file $transpTeapotPhotoFile
+} -body {
+ set imgData [photo1 data -format {default -colorformat rgb}]
+ set result {}
+ lappend result [lindex $imgData 3 2]
+ lappend result [lindex $imgData 107 53]
+ lappend result [lindex $imgData 203 157]
+ set result
+} -cleanup {
+ unset result
+ unset imgData
+ imageCleanup
+} -result {{#004eb9} #a14100 #ffca9f}
+test imgListFormat-5.9 {StringWriteDef: test some pixels #4} -constraints {
+ hasTranspTeapotPhoto
+} -setup {
+ image create photo photo1 -file $transpTeapotPhotoFile
+} -body {
+ set imgData [photo1 data -format {default -colorformat rgba}]
+ set result [lindex $imgData 3 2]
+ lappend result [lindex $imgData 107 53]
+ lappend result [lindex $imgData 203 157]
+ set result
+} -cleanup {
+ unset result
+ unset imgData
+ imageCleanup
+} -result {{#004eb9e1} #a14100aa #ffca9faf}
+test imgListFormat-5.10 {StringWriteDef: test some pixels #5} -constraints {
+ hasTranspTeapotPhoto
+} -setup {
+ image create photo photo1 -file $transpTeapotPhotoFile
+} -body {
+ set imgData [photo1 data -format {default -colorformat list}]
+ set result {}
+ lappend result [lindex $imgData 3 2]
+ lappend result [lindex $imgData 107 53]
+ lappend result [lindex $imgData 203 157]
+ set result
+} -cleanup {
+ unset imgData
+ unset result
+ imageCleanup
+} -result {{0 78 185 225} {161 65 0 170} {255 202 159 175}}
+
+test imgListFormat-6.1 {ParseColor: empty string} -setup {
+ image create photo photo1
+ set result {}
+} -body {
+ photo1 put {{"" ""} {"" ""}}
+ lappend result [image width photo1]
+ lappend result [image height photo1]
+ lappend result [photo1 get 1 1 -withalpha]
+ set result
+} -cleanup {
+ unset result
+ imageCleanup
+} -result {2 2 {0 0 0 0}}
+test imgListFormat-6.2 {ParseColor: empty string, mixed} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{black white} {{} white}}
+ list [photo1 get 0 0 -withalpha] [photo1 get 0 1 -withalpha]
+} -cleanup {
+ imageCleanup
+} -result {{0 0 0 255} {0 0 0 0}}
+test imgListFormat-6.3 {ParseColor: color name too long} -setup {
+ image create photo photo1
+ set longstr {}
+ for {set i 1} {$i <= 100} {incr i} {
+ append longstr "z"
+ }
+} -body {
+ photo1 put [list [list blue] [list $longstr]]
+} -cleanup {
+ imageCleanup
+ unset longstr
+} -returnCodes error -result {invalid color}
+test imgListFormat-6.4 {ParseColor: #XXX color, different forms} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{#A123 #334455} {#012 #fffefd#00}}
+ photo1 data -format {default -colorformat rgba}
+} -cleanup {
+ imageCleanup
+} -result {{#aa112233 #334455ff} {#001122ff #fffefd00}}
+test imgListFormat-6.5 {ParseColor: list format} -setup {
+ image create photo photo1
+} -body {
+ photo1 put [list [list [list 255 255 255]]]
+ photo1 get 0 0 -withalpha
+} -cleanup {
+ imageCleanup
+} -result {255 255 255 255}
+test imgListFormat-6.6 {ParseColor: string format} -setup {
+ image create photo photo1
+} -body {
+ photo1 put [list [list [list white]]]
+ photo1 get 0 0 -withalpha
+} -cleanup {
+ imageCleanup
+} -result {255 255 255 255}
+test imgListFormat-6.7 {ParseColor: invalid color} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{blue red} {green bogus}}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "bogus"}
+test imgListFormat-6.8 {ParseColor: overall test} -setup {
+ image create photo photo1
+ set result {}
+} -body {
+ photo1 put {
+ {snow@0.5 snow#80 snow#8 #fffffafafafa@0.5 #fffffabbfacc#8}
+ {#fffffafffaff#80 #ffffaafaa@.5 #ffffaafaa#8 #ffffaafaa#80 #fee#8}
+ {#fee#80 #fee@0.5 #fffafa@0.5 #fffafa#8 #fffafa#80}
+ {{0xff 250 0xfa 128} {255 250 250} #fee8 #fffafa80 snow}}
+ for {set y 0} {$y < 4} {incr y} {
+ for {set x 0} {$x < 5} {incr x} {
+ lappend result [photo1 get $x $y -withalpha]
+ }
+ }
+ set result
+} -cleanup {
+ imageCleanup
+ unset result
+} -result \
+{{255 250 250 128} {255 250 250 128} {255 250 250 136} {255 250 250 128}\
+{255 250 250 136} {255 250 250 128} {255 250 250 128} {255 250 250 136}\
+{255 250 250 128} {255 238 238 136} {255 238 238 128} {255 238 238 128}\
+{255 250 250 128} {255 250 250 136} {255 250 250 128} {255 250 250 128}\
+{255 250 250 255} {255 238 238 136} {255 250 250 128} {255 250 250 255}}
+
+# Note: these tests were written for an earlier implementation of
+# ParseColorAsList. For this reason, their order and layout do not follow the
+# current code very well. Test coverage is pretty good, nevertheless.
+test imgListFormat-7.1 {ParseColorAsList: invalid list} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{{123 45 67 89} {123 45 " 67}}}
+ #"
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "123 45 " 67"}
+#"
+test imgListFormat-7.2 {ParseColorAsList: too few elements in list} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{{0 255 0 255} {0 255}}}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "0 255"}
+test imgListFormat-7.3 {ParseColorAsList: too many elements in list} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{{0 100 200 255} {0 100 200 255 0}}}
+} -returnCodes error -result {invalid color name "0 100 200 255 0"}
+test imgListFormat-7.4 {ParseColorAsList: not an integer value} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{{9 0xf3 87 65} {43 21 10 1.0}}}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "43 21 10 1.0"}
+test imgListFormat-7.5 {ParseColorAsList: negative value in list} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{{121 121 121} {121 121 -1}}}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "121 121 -1"}
+test imgListFormat-7.6 {ParseColorAsList: value in list too large} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{{0 1 2 3} {254 255 256}}}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "254 255 256"}
+test imgListFormat-7.7 {ParseColorAsList: suffix not allowed} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{{100 100 100} {100 100 100#FE}}}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "100 100 100#FE"}
+test imgListFormat-7.8 {ParseColorAsList: valid list form} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{{0x0 0x10 0xfe 0xff} {0 100 254}}
+ {{30 30 30 0} {1 1 254 1}}}
+ list [photo1 get 0 0 -withalpha] [photo1 get 1 0 -withalpha] \
+ [photo1 get 0 1 -withalpha] [photo1 get 1 1 -withalpha]
+} -cleanup {
+ imageCleanup
+} -result {{0 16 254 255} {0 100 254 255} {30 30 30 0} {1 1 254 1}}
+test imgListFormat-7.9 {ParseColorAsList: additional spaces in list} -setup {
+ image create photo photo1
+} -body {
+ photo1 put { { { 1 2 3} {1 2 3} } { {1 2 3 } { 1 2 3 4 } } }
+ photo1 data -format {default -colorformat rgba}
+} -cleanup {
+ imageCleanup
+} -result {{#010203ff #010203ff} {#010203ff #01020304}}
+test imgListFormat-7.10 {ParseColorAsList: list format, string rep} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{"111 222 33 44"}}
+ photo1 get 0 0 -withalpha
+} -cleanup {
+ imageCleanup
+} -result {111 222 33 44}
+
+test imgListFormat-8.1 {ParseColorAsHex: RGB format} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{#010 #001100}}
+ photo1 data
+} -cleanup {
+ imageCleanup
+} -result {{#001100 #001100}}
+test imgListFormat-8.2 {ParseColorAsHex: invalid hex digit} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {#ABCD #ABCZ}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "#ABCZ"}
+test imgListFormat-8.3 {ParseColorAsHex: RGB with suffix, 8 chars} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{#FFfFFf #AbCdef#0}}
+ photo1 data
+} -cleanup {
+ imageCleanup
+} -result {{#ffffff #abcdef}}
+test imgListFormat-8.4 {ParseColor: valid #RGBA color} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{#9bd5020d #7acF}}
+ list [photo1 get 0 0 -withalpha] [photo1 get 1 0 -withalpha]
+} -cleanup {
+ imageCleanup
+} -result {{155 213 2 13} {119 170 204 255}}
+
+test imgListFormat-9.1 {ParseColorAsStandard:
+ Tk color, valid suffixes} -setup {
+ image create photo photo1
+ set result {}
+} -body {
+ photo1 put {{blue@0.711 #114433#C} {#8D4#1A magenta}}
+ lappend result [photo1 get 0 0 -withalpha]
+ lappend result [photo1 get 1 0 -withalpha]
+ lappend result [photo1 get 0 1 -withalpha]
+ lappend result [photo1 get 1 1 -withalpha]
+ set result
+} -cleanup {
+ unset result
+ imageCleanup
+} -result {{0 0 255 181} {17 68 51 204} {136 221 68 26} {255 0 255 255}}
+test imgListFormat-9.2 {ParseColorAsStandard:
+ Tk color with and w/o suffixes} -setup {
+ image create photo photo1
+ set result {}
+} -body {
+ photo1 put {{#52D8a0 #2B5} {#E47@0.01 maroon#4}}
+ lappend result [photo1 get 0 0 -withalpha]
+ lappend result [photo1 get 1 0 -withalpha]
+ lappend result [photo1 get 0 1 -withalpha]
+ lappend result [photo1 get 1 1 -withalpha]
+ set result
+} -cleanup {
+ unset result
+ imageCleanup
+} -result {{82 216 160 255} {34 187 85 255} {238 68 119 3} {128 0 0 68}}
+test imgListFormat-9.3 {ParseColorAsStandard: wrong digit count} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{#000 #00}}
+} -returnCodes error -result {invalid color name "#00"}
+test imgListFormat-9.4 {ParseColorAsStandard: @A suffix, not a float} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{blue@0.5 blue@bogus}}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {invalid alpha suffix "@bogus": expected floating-point value}
+test imgListFormat-9.5 {ParseColorAsStandard: @A, value too low} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {green@.1 green@-0.1}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {invalid alpha suffix "@-0.1": value must be in the range from 0 to 1}
+test imgListFormat-9.6 {ParseColorAsStandard: @A, value too high} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {#000000@0 #000000@1.0001}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {invalid alpha suffix "@1.0001": value must be in the range from 0 to 1}
+test imgListFormat-9.7 {ParseColorAsStandard: @A suffix, edge values} -setup {
+ imageCleanup
+ image create photo photo1
+} -body {
+ photo1 put {{yellow@1e-22 yellow@0.12352941 yellow@0.12352942 \
+ yellow@0.9999999}}
+ list [photo1 get 0 0 -withalpha] [photo1 get 1 0 -withalpha] \
+ [photo1 get 2 0 -withalpha] [photo1 get 3 0 -withalpha]
+} -cleanup {
+ imageCleanup
+} -result {{255 255 0 0} {255 255 0 31} {255 255 0 32} {255 255 0 255}}
+test imgListFormat-9.8 {ParseColorAsStandard: # suffix, no hex digits} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{black#f} {black#}}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid alpha suffix "#"}
+test imgListFormat-9.9 {ParseColorAsStandard:
+ '#' suffix, too many digits} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{#ABC#12 #ABC#123}}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid alpha suffix "#123"}
+test imgListFormat-9.10 {ParseColorAsStandard:
+ invalid digit in #X suffix} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {#000#a #000#g}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid alpha suffix "#g": expected hex digit}
+test imgListFormat-9.11 {ParseColorAsStandard:
+ invalid digit in #XX suffix} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {green#2 green#2W}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid alpha suffix "#2W": expected hex digit}
+test imgListFormat-9.12 {ParseColorAsStandard:
+ invalid color: not a hex digit} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {#ABCDEF@.99 #ABCDEG@.99}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "#ABCDEG@.99"}
+test imgListFormat-9.13 {ParseColorAsStandard: suffix not allowed #1} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {#ABC@.5 #ABCD@0.5}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "#ABCD@0.5"}
+test imgListFormat-9.14 {ParseColorAsStandard: suffix not allowed #2} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {#1111 #1111#1}
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "#1111#1"}
+
+
+# ---------------------------------------------------------------------
+
+imageFinish
+
+# cleanup
+cleanupTests
+return
diff --git a/tests/imgPNG.test b/tests/imgPNG.test
index 4900e9c..ab65842 100644
--- a/tests/imgPNG.test
+++ b/tests/imgPNG.test
@@ -2,10 +2,10 @@
# and write PNG-format image files for photo widgets. The files is organized
# in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 1998 Willem van Schaik (images only)
-# Copyright (c) 2008 Donal K. Fellows
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 1998 Willem van Schaik (images only)
+# Copyright © 2008 Donal K. Fellows
# All rights reserved.
package require tcltest 2.2
@@ -1056,7 +1056,10 @@ duFtaSrZF3pfCpiGjN2imToJJ39m6BjG1XZRwrkAI8YUKSZWlEZQDAIrNArHnyvpXtmM/B7wJeAbwO
fBcxKuQMrzfLdBoz29fX9led5v6u1XnBJW7vnr/YlrXEoNo22LRYOYlxZ1S6rkOfDcLvPAY/hGmWC7
H68uFI+x0oSPg2MAN/L5/M/vtqSED/T5cMu9J4Wf7HMGsB/4TEv/DFwe3Y/NPN57VXh+5BWApwFLlh
r661tV1eju/ne8YJrkWtES0tmRe2VOviv2j2aBp5nHihiRaz/A4oCnsAsje/+AAAAAElFTkSuQmCC"
- }
+ dpi100aspect2
+"iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAACXBIWXMAAA9hAAAewgEw8YEEAAAA
+FklEQVR4nGP4+vXrP11lJgYGhj9xSQAzOwXsETZ69QAAAABJRU5ErkJggg=="
+ }
# $encoded(basn0g08), $encoded(basn2c08), $encoded(basn3p08), $encoded(basn6a08)
test imgPNG-1.1 {reading basic images; grayscale} -setup {
@@ -1113,9 +1116,54 @@ test imgPNG-3.1 {reading image with unknown ancillary chunk - bug [1c659ef0f1]}
catch {set i [image create photo -file $fileName]}
} -cleanup {
image delete $i
-} -result {0}
-
+} -result 0
+
+test imgPNG-4.1 {data image with metadata} -body {
+ image create photo i1 -data $encoded(dpi100aspect2)
+ i1 cget -metadata
+} -cleanup {
+ image delete i1
+} -result {DPI 99.9998 aspect 2.0}
+
+test imgPNG-4.2 {file image with metadata} -setup {
+ set path [file join [configure -tmpdir] test.png]
+ set h [open $path "WRONLY BINARY CREAT"]
+ puts -nonewline $h [binary decode base64 $encoded(dpi100aspect2)]
+ close $h
+} -body {
+ image create photo i1 -file $path
+ i1 cget -metadata
+} -cleanup {
+ image delete i1
+ file delete $path
+} -result {DPI 99.9998 aspect 2.0}
+
+test imgPNG-4.3 {data output with metadata} -setup {
+ image create photo i1 -data $encoded(dpi100aspect2)
+} -body {
+ set imgData [i1 data -format png]
+ image delete i1
+ image create photo i1 -data $imgData
+ i1 cget -metadata
+} -cleanup {
+ image delete i1
+} -result {DPI 99.9998 aspect 2.0}
+
+test imgPNG-4.4 {file output with metadata} -setup {
+ image create photo i1 -data $encoded(dpi100aspect2)
+ set path [file join [configure -tmpdir] test.png]
+} -body {
+ i1 write $path -format png
+ image delete i1
+ image create photo i1 -file $path
+ i1 cget -metadata
+} -cleanup {
+ image delete i1
+ file delete $path
+} -result {DPI 99.9998 aspect 2.0}
+
}
+
namespace delete png
imageFinish
cleanupTests
diff --git a/tests/imgPPM.test b/tests/imgPPM.test
index e3a738a..dfabd62 100644
--- a/tests/imgPPM.test
+++ b/tests/imgPPM.test
@@ -2,8 +2,8 @@
# which reads and write PPM-format image files for photo widgets.
# The files is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index a890fd7..544b2e6 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -2,22 +2,92 @@
# procedures in the file tkImgPhoto.c. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1994 The Australian National University
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2002-2008 Donal K. Fellows
+# Copyright © 1994 The Australian National University
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 2002-2008 Donal K. Fellows
# All rights reserved.
#
# Author: Paul Mackerras (paulus@cs.anu.edu.au)
+#
+# This file is somewhat caothic: the order of the tests does not
+# really follow the order of the corresponding functions in
+# tkImgPhoto.c. Probably, because early versions had only a few tests
+# and over time test cases were added in bits and pieces.
+# To be noted, also, that this file is not complete: large portions of
+# code in tkImgPhoto.c have no test coverage.
+#
+# To help keeping the overview, the table below lists where to find
+# tests for each of the functions in tkImgPhoto.c. The function are
+# listed in the order as they appear in the source file.
+#
+
+#
+# Function name Tests for function
+#--------------------------------------------------------------------------
+# PhotoFormatThreadExitProc no tests
+# Tk_Create*PhotoImageFormat no tests
+# ImgPhotoCreate imgPhoto-2.*
+# ImgPhotoCmd imgPhoto-4.*, imgPhoto-17.*
+# GetExtension: no tests
+# ParseSubcommandOptions: imgPhoto-1.*
+# ImgPhotoConfigureModel: imgPhoto-3.*, imgPhoto-15.*
+# toggleComplexAlphaIfNeeded: no tests
+# ImgPhotoDelete: imgPhoto-8.*
+# ImgPhotoCmdDeleteProc: imgPhoto-9.*
+# ImgPhotoSetSize: no tests
+# MatchFileFormat: imgPhoto-18.*
+# MatchSringFormat: imgPhoto-19.*
+# Tk_FindPhoto: imgPhoto-11.*
+# Tk_PhotoPutBlock: imgPhoto-10.*, imgPhoto-16.*
+# Tk_PhotoPutZoomedBlock: imgPhoto-12.*
+# Tk_DitherPhoto: no tets
+# Tk_PhotoBlank: no tests
+# Tk_PhotoExpand: no tests
+# Tk_PhotoGetSize: no tests
+# Tk_PhotoSetSize: no tests
+# TkGetPhotoValidRegion: no tests
+# ImgGetPhoto: no tests
+# Tk_PhotoGetImage no tests
+# ImgPostscriptPhoto no tests
+# Tk_PhotoPutBlock_NoComposite no tests, probably none needed
+# Tk_PhotoPutZoomedBlock_NoComposite no tests, probably none needed
+# Tk_PhotoExpand_Panic no tests, probably none needed
+# Tk_PhotoPutBlock_Panic no tests, probably none needed
+# Tk_PhotoPutZoomedBlock_Panic no tests, probably none needed
+# Tk_PhotoSetSize_Panic no tests, probably none needed
+# Tk_PhotoGetMetadata: imgPhoto-21.*
+# Tk_PhotoSetMetadata: imgPhoto-22.*
+#--------------------------------------------------------------------------
+#
+
+#
+# Some tests are not specific to a function in tkImgPhoto.c. They are:
+#
+
+#
+# Test name(s) Description
+#--------------------------------------------------------------------------
+# imgPhoto-5.* Do not really belong to this file. ImgPhotoGet and
+# ImgPhotoFree are defined in tkImgPhInstance.c.
+# imgPhoto-6.* Do not really belong to this file. ImgPhotoDisplay
+# is defined in tkImgPhInstance.c.
+# imgPhoto-7.* Do not really belong to this file. ImgPhotoFree is
+# defined in tkImgPhInstance.c.
+# imgPhoto-13.* Tests for separation in different interpreters
+# imgPhoto-14.* Test GIF format. Would belong to imgGIF.test
+# - which does not exist.
+#
+
package require tcltest 2.2
namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands
-
-# Used for 4.65 - 4.73 tests
-# Now for some heftier testing, checking that setting and resetting of pixels'
-# transparency status doesn't "leak" with any one-off errors.
+
+#
+# Used for imgPhoto-4.65 - imgPhoto-4.73
+#
proc foreachPixel {img xVar yVar script} {
upvar 1 $xVar x $yVar y
set width [image width $img]
@@ -58,6 +128,11 @@ set README [makeFile {
# find the teapot.ppm file for use in these tests
set teapotPhotoFile [file join [file dirname [info script]] teapot.ppm]
testConstraint hasTeapotPhoto [file exists $teapotPhotoFile]
+# let's see if we have the semi-transparent one as well
+set transpTeapotPhotoFile [file join [file dirname [info script]] teapotTransparent.png]
+testConstraint hasTranspTeapotPhoto [file exists $transpTeapotPhotoFile]
+testConstraint needsTcl867 [package vsatisfies [package provide Tcl] 8.6.7-]
+
test imgPhoto-1.1 {options for photo images} -body {
image create photo photo1 -width 79 -height 83
@@ -107,7 +182,26 @@ test imgPhoto-1.10 {options for photo images - error case} -body {
test imgPhoto-1.11 {options for photo images - error case} -body {
image create photo photo1 -format
} -returnCodes error -result {value for "-format" missing}
-
+test imgPhoto-1.12 {option -alpha, normal use} -setup {
+ image create photo photo1
+} -body {
+ photo1 put "white" -to 0 0
+ photo1 transparency get 0 0 -alpha
+} -cleanup {
+ imageCleanup
+} -result 255
+test imgPhoto-1.13 {option -withalpha, normal use} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{blue green}}
+ photo1 get 1 0 -withalpha
+} -cleanup {
+ imageCleanup
+} -result {0 128 0 255}
+test imgPhoto-1.14 {options for photo images - error case} -body {
+ image create photo photo1 -metadata
+} -returnCodes error -result {value for "-metadata" missing}
+
test imgPhoto-2.1 {ImgPhotoCreate procedure} -setup {
imageCleanup
} -body {
@@ -130,7 +224,7 @@ test imgPhoto-2.2 {ImgPhotoCreate procedure} -setup {
# photo1 copy photo2
# set msg
# } {couldn't open "bogus.img": no such file or directory}
-
+
test imgPhoto-3.1 {ImgPhotoConfigureModel procedure} -constraints {
hasTeapotPhoto
} -body {
@@ -166,7 +260,41 @@ test imgPhoto-3.3 {ImgPhotoConfigureModel procedure} -constraints {
destroy .c
image delete photo1
} -result {256 256 {10 10 266 266} {300 10 556 266}}
-
+test imgPhoto-3.4 {ImgPhotoConfigureModel: -data <ppm>} -constraints {
+ hasTeapotPhoto
+} -setup {
+ image create photo photo1 -file $teapotPhotoFile
+ image create photo photo2
+} -body {
+ photo2 configure -data [photo1 data -format ppm -from 100 100 120 120]
+ list [image width photo2] [image height photo2]
+} -cleanup {
+ imageCleanup
+} -result {20 20}
+# This testcase fails with Tcl < 8.6.7, due to [25842c]
+test imgPhoto-3.5 {ImgPhotoConfigureModel: -data <png>} -constraints {
+ hasTeapotPhoto needsTcl867
+} -setup {
+ image create photo photo1 -file $teapotPhotoFile
+ image create photo photo2
+} -body {
+ photo2 configure -data [photo1 data -format png -from 120 120 140 140]
+ list [image width photo2] [image height photo2]
+} -cleanup {
+ imageCleanup
+} -result {20 20}
+test imgPhoto-3.6 {ImgPhotoConfigureModel: -data <default>} -constraints {
+ hasTeapotPhoto
+} -setup {
+ image create photo photo1 -file $teapotPhotoFile
+ image create photo photo2
+} -body {
+ photo2 configure -data [photo1 data -from 80 90 100 110]
+ list [image width photo2] [image height photo2]
+} -cleanup {
+ imageCleanup
+} -result {20 20}
+
test imgPhoto-4.1 {ImgPhotoCmd procedure} -setup {
image create photo photo1
} -body {
@@ -209,7 +337,7 @@ test imgPhoto-4.6 {ImgPhotoCmd procedure: configure option} -setup {
llength [photo1 configure]
} -cleanup {
image delete photo1
-} -result 7
+} -result 8
test imgPhoto-4.7 {ImgPhotoCmd procedure: configure option} -setup {
image create photo photo1
} -body {
@@ -365,16 +493,19 @@ test imgPhoto-4.21 {ImgPhotoCmd procedure: copy option} -constraints {
} -cleanup {
image delete photo1 photo2
} -result {256 256 49 51 49 51 49 51 10 51 10 10}
+# tests for <imageName> data: imgPhoto-4.
test imgPhoto-4.22 {ImgPhotoCmd procedure: get option} -constraints {
- hasTeapotPhoto
+ hasTranspTeapotPhoto
} -setup {
image create photo photo1
} -body {
- photo1 read $teapotPhotoFile
- list [photo1 get 100 100] [photo1 get 150 100] [photo1 get 100 150]
+ photo1 read $transpTeapotPhotoFile
+ list [photo1 get 100 100 -withalpha] \
+ [photo1 get 150 100 -withalpha] \
+ [photo1 get 100 150] [photo1 get 150 150]
} -cleanup {
image delete photo1
-} -result {{169 117 90} {172 115 84} {35 35 35}}
+} -result {{175 71 0 162} {179 73 0 168} {14 8 0} {0 0 0}}
test imgPhoto-4.23 {ImgPhotoCmd procedure: get option} -setup {
image create photo photo1
} -body {
@@ -392,10 +523,12 @@ test imgPhoto-4.24 {ImgPhotoCmd procedure: get option} -setup {
test imgPhoto-4.25 {ImgPhotoCmd procedure: get option} -setup {
image create photo photo1
} -body {
- photo1 get
+ photo1 get 0
} -cleanup {
image delete photo1
-} -returnCodes error -result {wrong # args: should be "photo1 get x y"}
+} -returnCodes error -result \
+ {wrong # args: should be "photo1 get x y ?-withalpha?"}
+# more test for image get: 4.101-4.102
test imgPhoto-4.26 {ImgPhotoCmd procedure: put option} -setup {
image create photo photo1
} -body {
@@ -409,22 +542,28 @@ test imgPhoto-4.27 {ImgPhotoCmd procedure: put option} -setup {
photo1 put {{white} {white white}}
} -returnCodes error -cleanup {
image delete photo1
-} -result {all elements of color list must have the same number of elements}
+} -result {invalid row # 1: all rows must have the same number of elements}
test imgPhoto-4.28 {ImgPhotoCmd procedure: put option} -setup {
image create photo photo1
} -body {
photo1 put {{blahgle}}
} -cleanup {
image delete photo1
-} -returnCodes error -result {can't parse color "blahgle"}
+} -returnCodes error -result {invalid color name "blahgle"}
test imgPhoto-4.29 {ImgPhotoCmd procedure: put option} -setup {
image create photo photo1
} -body {
- photo1 put -to 10 10 20 20 {{white}}
+ # SB: odd thing - this test passed with tk 8.6.6, even if the data
+ # is in the wrong position:
+ #photo1 put -to 10 10 20 20 {{white}}
+
+ # this is how it's supposed to be:
+ photo1 put {{white}} -to 10 10 20 20
photo1 get 19 19
} -cleanup {
image delete photo1
} -result {255 255 255}
+# more tests for image put: 4.90-4.100
test imgPhoto-4.30 {ImgPhotoCmd procedure: read option} -setup {
image create photo photo1
} -body {
@@ -440,7 +579,7 @@ test imgPhoto-4.31 {ImgPhotoCmd procedure: read option} -constraints {
photo1 read $teapotPhotoFile -zoom 2
} -returnCodes error -cleanup {
image delete photo1
-} -result {unrecognized option "-zoom": must be -format, -from, -shrink, or -to}
+} -result {unrecognized option "-zoom": must be -format, -from, -metadata, -shrink, or -to}
test imgPhoto-4.32 {ImgPhotoCmd procedure: read option} -setup {
image create photo photo1
} -body {
@@ -506,6 +645,7 @@ test imgPhoto-4.39 {ImgPhotoCmd procedure: write option} -setup {
} -cleanup {
image delete photo1
} -returnCodes error -result {image file format "bogus" is unknown}
+# more tests on "imageName write": imgPhoto-17.*
test imgPhoto-4.40 {ImgPhotoCmd procedure: transparency option} -setup {
image create photo photo1
} -body {
@@ -519,21 +659,21 @@ test imgPhoto-4.41 {ImgPhotoCmd procedure: transparency get option} -setup {
photo1 transparency get
} -returnCodes error -cleanup {
image delete photo1
-} -result {wrong # args: should be "photo1 transparency get x y"}
+} -result {wrong # args: should be "photo1 transparency get x y ?-option?"}
test imgPhoto-4.42 {ImgPhotoCmd procedure: transparency get option} -setup {
image create photo photo1
} -body {
photo1 transparency get 0
} -returnCodes error -cleanup {
image delete photo1
-} -result {wrong # args: should be "photo1 transparency get x y"}
+} -result {wrong # args: should be "photo1 transparency get x y ?-option?"}
test imgPhoto-4.43 {ImgPhotoCmd procedure: transparency get option} -setup {
image create photo photo1
} -body {
- photo1 transparency get 0 0 0
+ photo1 transparency get 0 0 0 -alpha
} -returnCodes error -cleanup {
image delete photo1
-} -result {wrong # args: should be "photo1 transparency get x y"}
+} -result {wrong # args: should be "photo1 transparency get x y ?-option?"}
test imgPhoto-4.44 {ImgPhotoCmd procedure: transparency get option} -setup {
image create photo photo1
} -body {
@@ -593,34 +733,39 @@ test imgPhoto-4.51 {ImgPhotoCmd procedure: transparency get option} -setup {
} -cleanup {
image delete photo1
} -result 1
+# more tests for transparency get: 4.65, 4.66, 4.76-4.81
test imgPhoto-4.52 {ImgPhotoCmd procedure: transparency set option} -setup {
image create photo photo1
} -body {
photo1 transparency set
} -returnCodes error -cleanup {
image delete photo1
-} -result {wrong # args: should be "photo1 transparency set x y boolean"}
+} -result \
+ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"}
test imgPhoto-4.53 {ImgPhotoCmd procedure: transparency set option} -setup {
image create photo photo1
} -body {
photo1 transparency set 0
} -returnCodes error -cleanup {
image delete photo1
-} -result {wrong # args: should be "photo1 transparency set x y boolean"}
+} -result \
+ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"}
test imgPhoto-4.54 {ImgPhotoCmd procedure: transparency set option} -setup {
image create photo photo1
} -body {
photo1 transparency set 0 0
} -returnCodes error -cleanup {
image delete photo1
-} -result {wrong # args: should be "photo1 transparency set x y boolean"}
+} -result \
+ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"}
test imgPhoto-4.55 {ImgPhotoCmd procedure: transparency set option} -setup {
image create photo photo1
} -body {
- photo1 transparency set 0 0 0 0
+ photo1 transparency set 0 0 0 0 -alpha
} -returnCodes error -cleanup {
image delete photo1
-} -result {wrong # args: should be "photo1 transparency set x y boolean"}
+} -result \
+ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"}
test imgPhoto-4.56 {ImgPhotoCmd procedure: transparency set option} -setup {
image create photo photo1
} -body {
@@ -637,6 +782,7 @@ test imgPhoto-4.57 {ImgPhotoCmd procedure: transparency set option} -setup {
} -returnCodes error -result {expected integer but got "bogus"}
test imgPhoto-4.58 {ImgPhotoCmd procedure: transparency set option} -setup {
image create photo photo1
+ photo1 put blue
} -body {
photo1 transparency set 0 0 bogus
} -cleanup {
@@ -688,6 +834,7 @@ test imgPhoto-4.64 {ImgPhotoCmd procedure: transparency set option} -setup {
} -cleanup {
image delete photo1
} -result 1
+# more tests for transparency set: 4.67, 4.68, 4.82-4.89
# Now for some heftier testing, checking that setting and resetting of pixels'
# transparency status doesn't "leak" with any one-off errors.
test imgPhoto-4.65 {ImgPhotoCmd procedure: transparency get option} -setup {
@@ -812,7 +959,7 @@ test imgPhoto-4.75 {<photo> read command: filename starting with '-'} -constrain
image delete photo1
file delete ./-teapotPhotoFile
} -result {}
-test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -constraints {
+test imgPhoto-4.75.1 {ImgPhotoCmd procedure: copy to same image} -constraints {
hasTeapotPhoto
} -setup {
imageCleanup
@@ -824,7 +971,411 @@ test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -constraints {
} -cleanup {
imageCleanup
} -result {}
-
+test imgPhoto-4.76 {ImgPhotoCmd, transparency get: too many options} -setup {
+ image create photo photo1
+} -body {
+ photo1 put white -to 0 0 1 1
+ photo1 transparency get 0 0 -alpha -bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {wrong # args: should be "photo1 transparency get x y ?-option?"}
+test imgPhoto-4.77 {ImgPhotoCmd, transparency get: invalid option} -setup {
+ image create photo photo1
+} -body {
+ photo1 put white -to 0 0 1 1
+ photo1 transparency get 0 0 -bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {unrecognized option "-bogus": must be -alpha}
+test imgPhoto-4.78 {ImgPhotoCmd, transparency get: normal use} -setup {
+ image create photo photo1
+} -body {
+ photo1 put white -to 0 0 1 1
+ set result [photo1 transparency get 0 0]
+ lappend result [photo1 transparency get 0 0 -alpha]
+} -cleanup {
+ imageCleanup
+} -result {0 255}
+test imgPhoto-4.79 {ImgPhotoCmd, transparency get: no option} -constraints {
+ hasTranspTeapotPhoto
+} -setup {
+ image create photo photo1 -file $transpTeapotPhotoFile
+ set result {}
+} -body {
+ set pixelCoords {{156 239} {76 207} {153 213} {139 43} {75 112}}
+ foreach coord $pixelCoords {
+ lappend result [photo1 transparency get {*}$coord]
+ }
+ set result
+} -cleanup {
+ imageCleanup
+} -result {0 1 0 0 0}
+# test imgPhoto-4.80: deleted (was transparency get: -boolean)
+test imgPhoto-4.81 {ImgPhotoCmd, transparency get: -alpha} -constraints {
+ hasTranspTeapotPhoto
+} -setup {
+ image create photo photo1 -file $transpTeapotPhotoFile
+ set result {}
+} -body {
+ set pixelCoords {{156 239} {76 207} {153 213} {139 43} {75 112}}
+ foreach coord $pixelCoords {
+ lappend result [photo1 transparency get {*}$coord -alpha]
+ }
+ set result
+} -cleanup {
+ imageCleanup
+} -result {255 0 1 254 206}
+test imgPhoto-4.82 {ImgPhotoCmd, transparency set: too many opts} -setup {
+ image create photo photo1
+} -body {
+ photo1 transparency set 0 0 -alpha -bogus 1
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"}
+test imgPhoto-4.83 {ImgPhotoCmd, transparency set: invalid opt} -setup {
+ image create photo photo1 -data black
+} -body {
+ photo1 transparency set 0 0 0 -bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {unrecognized option "-bogus": must be -alpha}
+test imgPhoto-4.84 {ImgPhotoCmd, transparency set: invalid newVal} -setup {
+ image create photo photo1 -data white
+} -body {
+ photo1 transparency set 0 0 bogus -alpha
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {expected integer but got "bogus"}
+test imgPhoto-4.85 {ImgPhotoCmd, transparency set: invalid newVal} -setup {
+ image create photo photo1 -data red
+} -body {
+ photo1 transparency set 0 0 -1 -alpha
+} -returnCodes error -result \
+ {invalid alpha value "-1": must be integer between 0 and 255}
+test imgPhoto-4.86 {ImgPhotoCmd, transparency set: invalid newVal} -setup {
+ image create photo photo1 -data green
+} -body {
+ photo1 transparency set 0 0 256 -alpha
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {invalid alpha value "256": must be integer between 0 and 255}
+test imgPhoto-4.87 {ImgPhotoCmd, transparency set: no opt} -setup {
+ image create photo photo1
+} -body {
+ photo1 put white -to 0 0 2 1
+ photo1 transparency set 0 0 0
+ photo1 transparency set 1 0 1
+ list [photo1 transparency get 0 0 -alpha] \
+ [photo1 transparency get 1 0 -alpha]
+} -cleanup {
+ imageCleanup
+} -result {255 0}
+# deleted: test imgPhoto-4.88 {ImgPhotoCmd, transparency set: -boolean}
+test imgPhoto-4.89 {ImgPhotoCmd, transparency set: -alpha} -setup {
+ image create photo photo1
+} -body {
+ photo1 put white -to 0 0 2 2
+ photo1 transparency set 0 0 0 -alpha
+ photo1 transparency set 1 0 1 -alpha
+ photo1 transparency set 0 1 254 -alpha
+ photo1 transparency set 1 1 255 -alpha
+ list [photo1 transparency get 0 0] [photo1 transparency get 1 0] \
+ [photo1 transparency get 0 1] [photo1 transparency get 1 1]
+} -cleanup {
+ imageCleanup
+} -result {1 0 0 0}
+test imgPhoto-4.90 {ImgPhotoCmd put: existing but not allowed opt} -setup {
+ image create photo photo1
+} -body {
+ photo1 put yellow -from 0 0 1 1
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {unrecognized option "-from": must be -format, -metadata, or -to}
+test imgPhoto-4.91 {ImgPhotoCmd put: invalid option} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{0 1 2 3}} -bogus x
+} -returnCodes error -result \
+ {unrecognized option "-bogus": must be -format, -metadata, or -to}
+test imgPhoto-4.92 {ImgPhotocmd put: missing data} -setup {
+ image create photo photo1
+} -body {
+ photo1 put -to 0 0
+} -returnCodes error -result \
+ {wrong # args: should be "photo1 put data ?-option value ...?"}
+test imgPhoto-4.93 {ImgPhotoCmd put: data in ppm format} -constraints {
+ hasTeapotPhoto
+} -setup {
+ image create photo photo1 -file $teapotPhotoFile
+ image create photo photo2
+} -body {
+ set imgdata [photo1 data -format ppm]
+ photo2 put $imgdata -format ppm
+ set result {}
+ if {[image width photo1] != [image width photo2] \
+ || [image height photo1] != [image height photo2]} {
+ lappend result [list [image width photo2] [image height photo2]]
+ } else {
+ lappend result 1
+ }
+ foreach point {{206 125} {67 12} {13 46} {19 184}} {
+ if {[photo1 get {*}$point] ne [photo2 get {*}$point]} {
+ lappend result [photo2 get {*}$point]
+ } else {
+ lappend result 1
+ }
+ }
+ set result
+} -cleanup {
+ imageCleanup
+} -result {1 1 1 1 1}
+test imgPhoto-4.94 {ImgPhotoCmd put: unknown format} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {no real data} -format bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {image format "bogus" is not supported}
+test imgPhoto-4.95 {ImgPhotoCmd put: default fmt, invalid data} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{red green blue} {red " blue}}
+ #"
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {unmatched open quote in list}
+test imgPhoto-4.96 {ImgPhotoCmd put: "default" handler is selected} -setup {
+ image create photo photo1
+ image create photo photo2
+ set imgData {{{1 2 3 4} {5 6 7 8} {9 10 11 12}}
+ {{13 14 15 15} {17 18 19 20} {21 22 23 24}}}
+} -body {
+ photo1 put $imgData
+ photo2 put $imgData -format default
+ set result {}
+ lappend result [list [image width photo1] [image height photo1]]
+ lappend result [list [image width photo2] [image height photo2]]
+ lappend result [string equal \
+ [photo1 data -format "default -colorformat rgba"] \
+ [photo2 data -format "default -colorformat rgba"]]
+ set result
+} -cleanup {
+ imageCleanup
+ unset result
+ unset imgData
+} -result {{3 2} {3 2} 1}
+test imgPhoto-4.97 {ImgPhotoCmd put: image size} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{red green blue} {blue red green}}
+ list [image width photo1] [image height photo1]
+} -cleanup {
+ imageCleanup
+} -result {3 2}
+test imgPhoto-4.98 {ImgPhotoCmd put: -to with 2 coords} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{"alice blue" "blanched almond"}
+ {"deep sky blue" "ghost white"}
+ {#AABBCC #AABBCCDD}} -to 5 6
+ list [image width photo1] [image height photo1]
+} -cleanup {
+ imageCleanup
+} -result {7 9}
+test imgPhoto-4.99 {ImgPhotoCmd put: -to with 4 coords} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{#123 #456 #678} {#9AB #CDE #F01}} -to 1 2 20 21
+ set result {}
+ lappend result [photo1 get 19 20 -withalpha]
+ lappend result [string equal \
+ [photo1 data -from 1 2 4 4] [photo1 data -from 4 2 7 4]]
+ lappend result [string equal \
+ [photo1 data -from 10 12 13 14] [photo1 data -from 16 16 19 18]]
+ set result
+} -cleanup {
+ imageCleanup
+} -result {{17 34 51 255} 1 1}
+test imgPhoto-4.100 {ImgPhotoCmd put: no changes on empty data} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{brown blue} {cyan coral}}
+ set imgData [photo1 data]
+ photo1 put {}
+ string equal $imgData [photo1 data]
+} -cleanup {
+ imageCleanup
+} -result 1
+test imgPhoto-4.101 {ImgPhotoCmd get: too many args} -setup {
+ image create photo photo1
+} -body {
+ photo1 get 0 0 -withalpha bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {wrong # args: should be "photo1 get x y ?-withalpha?"}
+test imgPhoto-4.102 {ImgPhotoCmd get: invalid option} -setup {
+ image create photo photo1
+} -body {
+ photo1 get 0 0 -bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {unrecognized option "-bogus": must be -withalpha}
+test imgPhoto-4.103 {ImgPhotoCmd data: accepted opts} -setup {
+ image create photo photo1 -data black
+} -body {
+ photo1 data -format default -from 0 0 -grayscale -background blue
+} -cleanup {
+ imageCleanup
+} -result {{#000000}}
+test imgPhoto-4.104 {ImgPhotoCmd data: existing but not accepted opt} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -to
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+{unrecognized option "-to": must be -background, -format, -from, -grayscale, or -metadata}
+test imgPhoto-4.105 {ImgPhotoCmd data: invalid option} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+{unrecognized option "-bogus": must be -background, -format, -from, -grayscale, or -metadata}
+test imgPhoto-4.106 {ImgPhotoCmd data: extra arg before options} -setup {
+ image create photo photo1
+} -body {
+ photo1 data bogus -grayscale
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {wrong # args: should be "photo1 data ?-option value ...?"}
+test imgPhoto-4.107 {ImgPhotoCmd data: extra arg after options} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format default bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {wrong # args: should be "photo1 data ?-option value ...?"}
+test imgPhoto-4.108 {ImgPhotoCmd data: invalid -from coords #1} -setup {
+ image create photo photo1 -data blue
+} -body {
+ photo1 data -from 2 0
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {coordinates for -from option extend outside image}
+test imgPhoto-4.109 {ImgPhotoCmd data: invalid -from coords #2} -setup {
+ image create photo photo1 -data blue
+} -body {
+ photo1 data -from 0 2
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {coordinates for -from option extend outside image}
+test imgPhoto-4.110 {ImgPhotoCmd data: invalid -from coords #3} -setup {
+ image create photo photo1 -data blue
+} -body {
+ photo1 data -from 0 0 2 1
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {coordinates for -from option extend outside image}
+test imgPhoto-4.111 {ImgPhotoCmd data: invalid -from coords #4} -setup {
+ image create photo photo1 -data blue
+} -body {
+ photo1 data -from 0 0 1 2
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result \
+ {coordinates for -from option extend outside image}
+test imgPhoto-4.112 {ImgPhotoCmd data: -from with 2 coords} -setup {
+ image create photo photo1 -data {
+ {black black black black black}
+ {white white white white white}
+ {green green green green green}}
+} -body {
+ set imgData [photo1 data -from 2 1]
+ list [llength [lindex $imgData 0]] [llength $imgData]
+} -cleanup {
+ imageCleanup
+ unset imgData
+} -result {3 2}
+test imgPhoto-4.113 {ImgPhotoCmd data: default is rgb format} -setup {
+ image create photo photo1 -data red
+} -body {
+ photo1 data
+} -cleanup {
+ imageCleanup
+} -result {{#ff0000}}
+test imgPhoto-4.114 {ImgPhotoCmd data: unknown format} -setup {
+ image create photo photo1
+} -body {
+ photo1 data -format bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {image string format "bogus" is unknown}
+test imgPhoto-4.115 {ImgPhotoCmd data: rgb colorformat} -setup {
+ image create photo photo1 -data {{red#a green#b} {blue#c white}}
+} -body {
+ photo1 data -format {default -colorformat rgb}
+} -result {{#ff0000 #008000} {#0000ff #ffffff}}
+test imgPhoto-4.116 {ImgPhotoCmd data: rgba colorformat} -setup {
+ image create photo photo1 -data {{red green} {blue white}}
+} -body {
+ photo1 data -format {default -colorformat rgba}
+} -result {{#ff0000ff #008000ff} {#0000ffff #ffffffff}}
+test imgPhoto-4.117 {ImgPhotoCmd data: list colorformat} -setup {
+ image create photo photo1 -data {{red#a green} {blue#c white#d}}
+} -body {
+ photo1 data -format {default -colorformat list}
+} -result {{{255 0 0 170} {0 128 0 255}} {{0 0 255 204} {255 255 255 221}}}
+# This testcase fails with Tcl < 8.6.7, due to [25842c]
+test imgPhoto-4.118 {ImgPhotoCmd data: using data for new image
+ results in same image as orignial } -constraints {
+ hasTeapotPhoto hasTranspTeapotPhoto needsTcl867
+} -setup {
+ image create photo teapot -file $teapotPhotoFile
+ teapot copy teapot -from 50 60 70 80 -shrink
+ image create photo teapotTransp -file $transpTeapotPhotoFile
+ teapotTransp copy teapotTransp -from 100 110 120 130 -shrink
+ image create photo photo1
+} -body {
+ set result {}
+ # We don't test gif here, as there seems to be a problem with
+ # <imgName> data and gif format ("too many colors", probably a bug)
+ foreach fmt {ppm png {default -colorformat rgba} \
+ {default -colorformat list}} {
+ set imgData [teapotTransp data -format $fmt]
+ photo1 blank
+ photo1 put $imgData
+ if { ! [string equal [photo1 data] [teapotTransp data]]} {
+ lappend result $fmt
+ }
+ }
+ set imgData [teapot data -format default]
+ photo1 blank
+ photo1 put $imgData
+ if { ! [string equal [photo1 data] [teapot data]]} {
+ lappend result default
+ }
+ set result
+} -cleanup {
+ unset imgData
+ unset result
+ imageCleanup
+} -result {}
+
test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -constraints {
hasTeapotPhoto
} -setup {
@@ -847,7 +1398,7 @@ test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -constraints {
} -cleanup {
destroy .c
} -result {}
-
+
test imgPhoto-6.1 {ImgPhotoDisplay procedure, blank display} -setup {
destroy .c
pack [canvas .c]
@@ -861,7 +1412,7 @@ test imgPhoto-6.1 {ImgPhotoDisplay procedure, blank display} -setup {
destroy .c
image delete photo1
} -result {}
-
+
test imgPhoto-7.1 {ImgPhotoFree procedure, resource freeing} -constraints {
hasTeapotPhoto
} -setup {
@@ -922,7 +1473,7 @@ test imgPhoto-7.3 {ImgPhotoFree procedures, multiple visuals} -constraints {
destroy .f
image delete photo1
} -result {}
-
+
test imgPhoto-8.1 {ImgPhotoDelete procedure} -constraints hasTeapotPhoto -body {
image create photo photo2 -file $teapotPhotoFile
image delete photo2
@@ -946,7 +1497,7 @@ test imgPhoto-8.3 {ImgPhotoDelete procedure, name cleanup} -body {
} -returnCodes error -cleanup {
imageCleanup
} -result {image "photo2" doesn't exist or is not a photo image}
-
+
test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints {
hasTeapotPhoto
} -body {
@@ -954,7 +1505,7 @@ test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints {
rename photo2 {}
list [expr {"photo2" in [imageNames]}] [catch {photo2 foo} msg] $msg
} -result {0 1 {invalid command name "photo2"}}
-
+
test imgPhoto-10.1 {Tk_ImgPhotoPutBlock procedure} -setup {
imageCleanup
} -body {
@@ -976,7 +1527,7 @@ test imgPhoto-10.2 {Tk_ImgPhotoPutBlock, same source and dest img} -constraints
string equal [photo1 data] [photo2 data]
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test imgPhoto-10.3 {Tk_ImgPhotoPutBlock, same source and dest img} -constraints {
hasTeapotPhoto
} -setup {
@@ -990,7 +1541,7 @@ test imgPhoto-10.3 {Tk_ImgPhotoPutBlock, same source and dest img} -constraints
string equal [photo1 data] [photo2 data]
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test imgPhoto-10.4 {Tk_ImgPhotoPutBlock, empty image} -setup {
imageCleanup
} -body {
@@ -1001,7 +1552,6 @@ test imgPhoto-10.4 {Tk_ImgPhotoPutBlock, empty image} -setup {
imageCleanup
} -result {0 0}
-
test imgPhoto-11.1 {Tk_FindPhoto} -setup {
imageCleanup
} -body {
@@ -1011,7 +1561,7 @@ test imgPhoto-11.1 {Tk_FindPhoto} -setup {
} -cleanup {
imageCleanup
} -returnCodes error -result {image "i1" doesn't exist or is not a photo image}
-
+
test imgPhoto-12.1 {Tk_PhotoPutZoomedBlock} -constraints hasTeapotPhoto -body {
image create photo p3 -file $teapotPhotoFile
set result [list [p3 get 50 50] [p3 get 100 100]]
@@ -1033,7 +1583,7 @@ test imgPhoto-12.2 {Tk_ImgPhotoPutZoomedBlock, same source and dest img} -constr
string equal [photo1 data] [photo2 data]
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test imgPhoto-12.3 {Tk_ImgPhotoPutZoomedBlock, same source and dest img} -setup {
imageCleanup
} -body {
@@ -1045,7 +1595,7 @@ test imgPhoto-12.3 {Tk_ImgPhotoPutZoomedBlock, same source and dest img} -setup
string equal [photo1 data] [photo2 data]
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test imgPhoto-12.4 {Tk_ImgPhotoPutZoomedBlock, empty image} -setup {
imageCleanup
} -body {
@@ -1100,7 +1650,7 @@ test imgPhoto-13.1 {check separation of images in different interpreters} -setup
interp delete x1
interp delete x2
} -result T1_data
-
+
test imgPhoto-14.1 {GIF writes work correctly} -setup {
set data {
R0lGODlhYwA5APcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgAysnGy8hKzM
@@ -1244,7 +1794,7 @@ test imgPhoto-15.1 {photo images can fail to allocate memory gracefully} -constr
# free memory available...
image create photo -width 32000 -height 32000
} -returnCodes error -result {not enough free memory for image buffer}
-
+
test imgPhoto-16.1 {copying to self doesn't access freed memory} -setup {
set i [image create photo]
} -body {
@@ -1255,7 +1805,7 @@ test imgPhoto-16.1 {copying to self doesn't access freed memory} -setup {
} -cleanup {
image delete $i
} -result {}
-
+
# Check that we can guess our supported output formats [Bug 2983824]
test imgPhoto-17.1 {photo write: format guessing from filename} -setup {
set i [image create photo -width 3 -height 3]
@@ -1294,11 +1844,114 @@ test imgPhoto-17.3 {photo write: format guessing from filename} -setup {
image delete $i
catch {removeFile $f}
} -result "P6\n"
+test imgPhoto-17.4 {photo write: default format not supported} -setup {
+ image create photo photo1 -data {{blue blue} {red red} {green green}}
+ set f [makeFile {} test.txt]
+} -body {
+ photo1 write $f -format default
+} -cleanup {
+ imageCleanup
+ catch {removeFile $f}
+ unset f
+} -returnCodes error -result \
+ {image file format "default" has no file writing capability}
+test imgPhoto-17.5 {photo write: file with extension .default} -setup {
+ image create photo photo1 -data {{black}}
+ set f [makeFile {} test.default]
+} -body {
+ photo1 write $f
+} -cleanup {
+ imageCleanup
+ catch {removeFile $f}
+ unset f
+} -returnCodes error -result \
+ {image file format "default" has no file writing capability}
+
+test imgPhoto-18.1 {MatchFileFormat: "default" format not supported} -setup {
+ image create photo photo1
+ set f [makeFile {} test.txt]
+} -body {
+ photo1 read $f -format default
+} -cleanup {
+ imageCleanup
+ catch {removeFile $f}
+ unset f
+} -returnCodes error -result {-file option isn't supported for default images}
+
+test imgPhoto-19.1 {MatchStringFormat: with "-format default"} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{red blue red} {yellow green yellow}} -format default
+ list [image width photo1] [image height photo1]
+} -cleanup {
+ imageCleanup
+} -result {3 2}
+test imgPhoto-19.2 {MatchStringFormat: without -format option,
+ default fmt} -body {
+ image create photo photo1
+ photo1 put {{red} {green}}
+ list [image width photo1] [image height photo1]
+} -cleanup {
+ imageCleanup
+} -result {1 2}
+test imgPhoto-19.3 {MatchStringFormat: "-format ppm"} -setup {
+ image create photo photo1
+ image create photo photo2
+ photo2 put {cyan cyan}
+ set imgData [photo2 data -format ppm]
+} -body {
+ photo1 put $imgData -format ppm
+ list [image width photo1] [image height photo1]
+} -cleanup {
+ unset imgData
+ imageCleanup
+} -result {1 2}
+test imgPhoto-19.4 {MatchStringFormat: ppm fmt, without opt} -constraints {
+ hasTeapotPhoto
+} -setup {
+ image create photo photo1 -file $teapotPhotoFile
+ image create photo photo2
+} -body {
+ set imgData [photo1 data -format ppm]
+ photo2 put $imgData
+ list [image width photo2] [image height photo2]
+} -cleanup {
+ imageCleanup
+ unset imgData
+} -result {256 256}
+test imgPhoto-19.5 {MatchStirngFormat: unknown -format} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {} -format bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {image format "bogus" is not supported}
+test imgPhoto-19.6 {MatchStringFormat: invalid data for default} -setup {
+ image create photo photo1
+} -body {
+ photo1 put bogus
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "bogus"}
+test imgPhoto-19.7 {MatchStringFormat: invalid data for default} -setup {
+ image create photo photo1
+} -body {
+ photo1 put bogus -format dEFault
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {invalid color name "bogus"}
+test imgPhoto-19.8 {MatchStirngFormat: invalid data for gif} -setup {
+ image create photo photo1
+} -body {
+ photo1 put bogus -format giF
+} -cleanup {
+ imageCleanup
+} -returnCodes error -result {couldn't recognize image data}
# Reject corrupted or truncated image [Bug b601ce3ab1].
-# WARNING - tests 18.1-18.9 will cause a segfault on 8.5.19 and lower,
+# WARNING - tests 20.1-20.9 will cause a segfault on 8.5.19 and lower,
# and on 8.6.6 and lower.
-test imgPhoto-18.1 {Reject corrupted GIF (binary string)} -setup {
+test imgPhoto-20.1 {Reject corrupted GIF (binary string)} -setup {
set data [binary decode base64 {
R0lGODlhAAQABP8zM/8z/zP/MzP/////M////yH5CiwheLrcLTBCd6Tv2qW16tdK4jhV
5qpraXIvM1JlNyAgOw==
@@ -1308,7 +1961,7 @@ test imgPhoto-18.1 {Reject corrupted GIF (binary string)} -setup {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.2 {Reject corrupted GIF (base 64 string)} -setup {
+test imgPhoto-20.2 {Reject corrupted GIF (base 64 string)} -setup {
set data {
R0lGODlhAAQABP8zM/8z/zP/MzP/////M////yH5CiwheLrcLTBCd6Tv2qW16tdK4jhV
5qpraXIvM1JlNyAgOw==
@@ -1318,14 +1971,14 @@ test imgPhoto-18.2 {Reject corrupted GIF (base 64 string)} -setup {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.3 {Reject corrupted GIF (file)} -setup {
+test imgPhoto-20.3 {Reject corrupted GIF (file)} -setup {
set fileName [file join [file dirname [info script]] corruptMangled.gif]
} -body {
image create photo gif1 -file $fileName
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.4 {Reject truncated GIF (binary string)} -setup {
+test imgPhoto-20.4 {Reject truncated GIF (binary string)} -setup {
set data [binary decode base64 {
R0lGODlhEAAQAMIHAAAAADMz//8zM/8z/zP/MzP///8=
}]
@@ -1334,7 +1987,7 @@ test imgPhoto-18.4 {Reject truncated GIF (binary string)} -setup {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map}
-test imgPhoto-18.5 {Reject truncated GIF (base 64 string)} -setup {
+test imgPhoto-20.5 {Reject truncated GIF (base 64 string)} -setup {
set data {
R0lGODlhEAAQAMIHAAAAADMz//8zM/8z/zP/MzP///8=
}
@@ -1343,14 +1996,14 @@ test imgPhoto-18.5 {Reject truncated GIF (base 64 string)} -setup {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map}
-test imgPhoto-18.6 {Reject truncated GIF (file)} -setup {
+test imgPhoto-20.6 {Reject truncated GIF (file)} -setup {
set fileName [file join [file dirname [info script]] corruptTruncated.gif]
} -body {
image create photo gif1 -file $fileName
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map}
-test imgPhoto-18.7 {Reject corrupted GIF (> 4Gb) (binary string)} -constraints {
+test imgPhoto-20.7 {Reject corrupted GIF (> 4Gb) (binary string)} -constraints {
nonPortable
} -setup {
# About the non portability constraint of this test: see ticket [cc42cc18a5]
@@ -1366,7 +2019,7 @@ test imgPhoto-18.7 {Reject corrupted GIF (> 4Gb) (binary string)} -constraints {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.8 {Reject corrupted GIF (> 4Gb) (base 64 string)} -constraints {
+test imgPhoto-20.8 {Reject corrupted GIF (> 4Gb) (base 64 string)} -constraints {
nonPortable
} -setup {
# About the non portability constraint of this test: see ticket [cc42cc18a5]
@@ -1382,7 +2035,7 @@ test imgPhoto-18.8 {Reject corrupted GIF (> 4Gb) (base 64 string)} -constraints
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.9 {Reject corrupted GIF (> 4Gb) (file)} -constraints {
+test imgPhoto-20.9 {Reject corrupted GIF (> 4Gb) (file)} -constraints {
nonPortable
} -setup {
# About the non portability constraint of this test: see ticket [cc42cc18a5]
@@ -1395,10 +2048,10 @@ test imgPhoto-18.9 {Reject corrupted GIF (> 4Gb) (file)} -constraints {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.10 {Valid GIF (binary string)} -setup {
+test imgPhoto-20.10 {Valid GIF (binary string)} -setup {
# Test the binary string reader with a valid GIF.
# This is not tested elsewhere.
- # Tests 18.11, 18.12, with matching data, are included for completeness.
+ # Tests 20.11, 20.12, with matching data, are included for completeness.
set data [binary decode base64 {
R0lGODlhEAAQAMIHAAAAADMz//8zM/8z/zP/MzP/////M////yH5BAEKAAcALAAA
AAAQABAAAAMheLrcLTBCd6QV79qlterXB0riOFXmmapraXIvM1IdZTcJADs=
@@ -1408,7 +2061,7 @@ test imgPhoto-18.10 {Valid GIF (binary string)} -setup {
} -cleanup {
catch {image delete gif1}
} -result gif1
-test imgPhoto-18.11 {Valid GIF (base 64 string)} -setup {
+test imgPhoto-20.11 {Valid GIF (base 64 string)} -setup {
set data {
R0lGODlhEAAQAMIHAAAAADMz//8zM/8z/zP/MzP/////M////yH5BAEKAAcALAAA
AAAQABAAAAMheLrcLTBCd6QV79qlterXB0riOFXmmapraXIvM1IdZTcJADs=
@@ -1418,7 +2071,7 @@ test imgPhoto-18.11 {Valid GIF (base 64 string)} -setup {
} -cleanup {
catch {image delete gif1}
} -result gif1
-test imgPhoto-18.12 {Valid GIF (file)} -setup {
+test imgPhoto-20.12 {Valid GIF (file)} -setup {
set fileName [file join [file dirname [info script]] red.gif]
} -body {
image create photo gif1 -file $fileName
@@ -1426,6 +2079,443 @@ test imgPhoto-18.12 {Valid GIF (file)} -setup {
catch {image delete gif1}
} -result gif1
+# imgPhoto-21.x : Tk_PhotoGetMetadata
+
+test imgPhoto-21.1 {option -metadata, get configure list} -setup {
+ image create photo photo1 -metadata {dpi 100}
+} -body {
+ photo1 configure -metadata
+} -cleanup {
+ catch {image delete photo1}
+} -result {-metadata {} {} {} {dpi 100}}
+
+test imgPhoto-21.2 {option -metadata, get value} -setup {
+ image create photo photo1 -metadata {dpi 100}
+} -body {
+ photo1 cget -metadata
+} -cleanup {
+ catch {image delete photo1}
+} -result {dpi 100}
+
+test imgPhoto-21.3 {option -metadata, get default value} -setup {
+ image create photo photo1
+} -body {
+ photo1 cget -metadata
+} -cleanup {
+ catch {image delete photo1}
+} -result {}
+
+# imgPhoto-22.x : Tk_PhotoSetMetadata
+
+test imgPhoto-22.1 {option -metadata, set value} -setup {
+ image create photo photo1
+} -body {
+ photo1 configure -metadata {dpi 100}
+ photo1 cget -metadata
+} -cleanup {
+ catch {image delete photo1}
+} -result {dpi 100}
+
+test imgPhoto-22.2 {option -metadata, change value} -setup {
+ image create photo photo1 -metadata {dpi 200}
+} -body {
+ photo1 configure -metadata {dpi 100}
+ photo1 cget -metadata
+} -cleanup {
+ catch {image delete photo1}
+} -result {dpi 100}
+
+test imgPhoto-22.3 {option -metadata, clear value} -setup {
+ image create photo photo1 -metadata {dpi 200}
+} -body {
+ photo1 configure -metadata {}
+ photo1 cget -metadata
+} -cleanup {
+ catch {image delete photo1}
+} -result {}
+
+# 23.x GIF images with metadata
+
+# The following gif core data is used by the following data.
+# N.B. this is the same image as test imgPhoto-18.10
+
+# size 16x16, global color table size: 8
+set gifstart "GIF89a\x10\x00\x10\x00\xc2\x07\x00"
+# color table
+append gifstart "\x00\x00\x00\x33\x33\xff\xff\x33\x33\xff\x33\xff\x33\xff\x33\x33\xff\xff\xff\xff\x33\xff\xff\xff"
+# Graphic control extension: Transparent color index: 7 (not needed here)
+# append gifdata "\x21\xf9\x04\x01\x0a\x00\x07\x00"
+# Image descriptor: 16x16, no local color table
+set gifdata "\x2c\x00\x00\x00\x00\x10\x00\x10\x00\x00"
+# Image data
+append gifdata "\x03\x21\x78\xba\xdc\x2d\x30\x42\x77\xa4\x15\xef\xda\xa5\xb5\xea\xd7\x07\x4a\xe2\x38\x55\xe6\x99\xaa\x6b\x69\x72\x2f\x33\x52\x1d\x65\x37\x09\x00"
+set gifend "\x3b"
+
+test imgPhoto-23.1 {GIF comment before image data (-data)} -setup {
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+} -body {
+ image create photo gif1 -data $data
+ gif1 cget -metadata
+} -cleanup {
+ catch {image delete gif1}
+} -result {comment ABCD}
+
+test imgPhoto-23.2 {GIF file comment before image data (-file)} -setup {
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+ set path [file join [configure -tmpdir] test.gif]
+ set h [open $path "WRONLY BINARY CREAT"]
+ puts -nonewline $h $data
+ close $h
+} -body {
+ image create photo gif1 -file $path
+ gif1 cget -metadata
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {comment ABCD}
+
+test imgPhoto-23.3 {GIF comment after image data (-data)} -setup {
+ set data $::gifstart
+ append data $::gifdata
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifend
+} -body {
+ image create photo gif1 -data $data
+ gif1 cget -metadata
+} -cleanup {
+ catch {image delete gif1}
+} -result {comment ABCD}
+
+test imgPhoto-23.4 {GIF comment after image data (-file)} -setup {
+ set data $::gifstart
+ append data $::gifdata
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifend
+ set path [file join [configure -tmpdir] test.gif]
+ set h [open $path "WRONLY BINARY CREAT"]
+ puts $h $data
+ close $h
+} -body {
+ image create photo gif1 -file $path
+ gif1 cget -metadata
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {comment ABCD}
+
+test imgPhoto-23.5 {Two GIF comment blocks (-data)} -setup {
+ set data $::gifstart
+ # Append a comment extension block with data "1234"
+ append data "\x21\xfe\x04" "1234" "\x0"
+ append data $::gifdata
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifend
+} -body {
+ image create photo gif1 -data $data
+ gif1 cget -metadata
+} -cleanup {
+ catch {image delete gif1}
+} -result {comment ABCD}
+
+test imgPhoto-23.6 {Two GIF comment blocks (-file)} -setup {
+ set data $::gifstart
+ # Append a comment extension block with data "1234"
+ append data "\x21\xfe\x04" "1234" "\x0"
+ append data $::gifdata
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifend
+ set path [file join [configure -tmpdir] test.gif]
+ set h [open $path "WRONLY BINARY CREAT"]
+ puts $h $data
+ close $h
+} -body {
+ image create photo gif1 -file $path
+ gif1 cget -metadata
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {comment ABCD}
+
+test imgPhoto-23.7 {create: test if shared metadata object is not preserved\
+ (-data)}\
+-setup {
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+} -body {
+ set metadataDict [dict create A 1]
+ set metadataDict2 $metadataDict
+ image create photo gif1 -data $data -metadata $metadataDict
+ list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2
+} -cleanup {
+ catch {image delete gif1}
+} -result {{A 1 comment ABCD} {A 1} {A 1}}
+
+test imgPhoto-23.8 {create: test if shared metadata object is not preserved\
+ (-file)}\
+-setup {
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+
+ set path [file join [configure -tmpdir] test.gif]
+ set h [open $path "WRONLY BINARY CREAT"]
+ puts $h $data
+ close $h
+} -body {
+ set metadataDict [dict create A 1]
+ set metadataDict2 $metadataDict
+ image create photo gif1 -file $path -metadata $metadataDict
+ list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {{A 1 comment ABCD} {A 1} {A 1}}
+
+test imgPhoto-23.9 {configure: test if shared metadata object is not\
+ preserved (empty image, -data)}\
+-setup {
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+} -body {
+ image create photo gif1
+ set metadataDict [dict create A 1]
+ set metadataDict2 $metadataDict
+ gif1 configure -data $data -format gif -metadata $metadataDict
+ list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2
+} -cleanup {
+ catch {image delete gif1}
+} -result {{A 1 comment ABCD} {A 1} {A 1}}
+
+test imgPhoto-23.10 {configure: test if shared metadata object is not preserved\
+ (empty image, -file)}\
+-setup {
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+
+ set path [file join [configure -tmpdir] test.gif]
+ set h [open $path "WRONLY BINARY CREAT"]
+ puts $h $data
+ close $h
+} -body {
+ image create photo gif1
+ set metadataDict [dict create A 1]
+ set metadataDict2 $metadataDict
+ gif1 configure -file $path -format gif -metadata $metadataDict
+ list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {{A 1 comment ABCD} {A 1} {A 1}}
+
+test imgPhoto-23.11 {configure: test if shared metadata object is not preserved\
+ (metadata replace, -data}\
+-setup {
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+} -body {
+ image create photo gif1 -data "$::gifstart$::gifdata$::gifend"
+ set metadataDict [dict create A 1]
+ set metadataDict2 $metadataDict
+ gif1 configure -data $data -format gif -metadata $metadataDict
+ list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2
+} -cleanup {
+ catch {image delete gif1}
+} -result {{A 1 comment ABCD} {A 1} {A 1}}
+
+test imgPhoto-23.12 {configure: test if shared metadata object is not preserved\
+ (metadata replace, -file}\
+-setup {
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+
+ set path [file join [configure -tmpdir] test.gif]
+ set h [open $path "WRONLY BINARY CREAT"]
+ puts $h $data
+ close $h
+} -body {
+ image create photo gif1 -data "$::gifstart$::gifdata$::gifend"
+ set metadataDict [dict create A 1]
+ set metadataDict2 $metadataDict
+ gif1 configure -file $path -format gif -metadata $metadataDict
+ list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {{A 1 comment ABCD} {A 1} {A 1}}
+
+test imgPhoto-23.13 {configure: test if shared metadata object is not preserved\
+ (-data)}\
+-setup {
+ set data $::gifstart$::gifdata$::gifend
+} -body {
+ image create photo gif1 -data $data
+ set metadataDict [dict create A 1]
+ set metadataDict2 $metadataDict
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+ gif1 configure -data $data -format gif -metadata $metadataDict
+ list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2
+} -cleanup {
+ catch {image delete gif1}
+} -result {{A 1 comment ABCD} {A 1} {A 1}}
+
+test imgPhoto-23.14 {configure: test if shared metadata object is not preserved\
+ (-file)}\
+-setup {
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+
+ set path [file join [configure -tmpdir] test.gif]
+ set h [open $path "WRONLY BINARY CREAT"]
+ puts $h $data
+ close $h
+} -body {
+ image create photo gif1 -data "$::gifstart$::gifdata$::gifend"
+ set metadataDict [dict create A 1]
+ set metadataDict2 $metadataDict
+ gif1 configure -file $path -format gif -metadata $metadataDict
+ list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {{A 1 comment ABCD} {A 1} {A 1}}
+
+test imgPhoto-23.15 {output data with comment (from -metadata argument)}\
+-setup {
+ set data $::gifstart$::gifdata$::gifend
+} -body {
+ image create photo gif1 -data $data
+ set gifData [gif1 data -format gif -metadata [dict create comment ABCD]]
+} -cleanup {
+ catch {image delete gif1}
+} -match glob -result {*ABCD*}
+
+test imgPhoto-23.22 {output file with comment (from -metadata argument)}\
+-setup {
+ set data $::gifstart$::gifdata$::gifend
+ set path [file join [configure -tmpdir] test.gif]
+} -body {
+ image create photo gif1 -data $data
+ gif1 write $path -format gif -metadata [dict create comment ABCD]
+ image delete gif1
+ image create photo gif1 -file $path
+ dict get [gif1 cget -metadata] comment
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {ABCD}
+
+test imgPhoto-23.16 {output data with comment (from -metadata property)}\
+-setup {
+ set data $::gifstart$::gifdata$::gifend
+} -body {
+ image create photo gif1 -data $data
+ gif1 configure -metadata [dict create comment ABCD]
+ set gifData [gif1 data -format gif]
+} -cleanup {
+ catch {image delete gif1}
+} -match glob -result {*ABCD*}
+
+test imgPhoto-23.17 {output file with comment (from -metadata property)}\
+-setup {
+ set data $::gifstart$::gifdata$::gifend
+ set path [file join [configure -tmpdir] test.gif]
+} -body {
+ image create photo gif1 -data $data
+ gif1 configure -metadata [dict create comment ABCD]
+ gif1 write $path -format gif
+ image delete gif1
+ image create photo gif1 -file $path
+ dict get [gif1 cget -metadata] comment
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {ABCD}
+
+test imgPhoto-23.18 {configure: empty metadata parameter overwrites image metadata} -setup {
+ image create photo gif1 -data $::gifstart$::gifdata$::gifend\
+ -metadata {foo bar}
+ set data $::gifstart
+ # Append a comment extension block with data "ABCD"
+ append data "\x21\xfe\x04" "ABCD" "\x0"
+ # Trailer
+ append data $::gifdata $::gifend
+} -body {
+ gif1 configure -data $data -metadata {}
+ gif1 cget -metadata
+} -cleanup {
+ catch {image delete gif1}
+} -result {comment ABCD}
+
+test imgPhoto-23.19 {write: empty metadata parameter overwrites image metadata} -setup {
+ image create photo gif1 -data $::gifstart$::gifdata$::gifend\
+ -metadata {comment bar}
+ set path [file join [configure -tmpdir] test.gif]
+} -body {
+ gif1 write $path -format gif -metadata {}
+ image delete gif1
+ image create photo gif1 -file $path
+ dict size [gif1 cget -metadata]
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {0}
+
+test imgPhoto-23.20 {data: empty metadata parameter overwrites image metadata} -setup {
+ image create photo gif1 -data $::gifstart$::gifdata$::gifend\
+ -metadata {comment bar}
+} -body {
+ set data [gif1 data -format gif -metadata {}]
+ image delete gif1
+ image create photo gif1 -data $data
+ dict size [gif1 cget -metadata]
+} -cleanup {
+ catch {image delete gif1}
+ file delete $path
+} -result {0}
+
+unset -nocomplain gifstart gifdata gifend
+
+
catch {rename foreachPixel {}}
catch {rename checkImgTrans {}}
catch {rename checkImgTransLoop {}}
diff --git a/tests/imgSVGnano.test b/tests/imgSVGnano.test
new file mode 100644
index 0000000..1dad3a5
--- /dev/null
+++ b/tests/imgSVGnano.test
@@ -0,0 +1,262 @@
+# This file is a Tcl script to test out the code in tkImgSVGnano.c, which reads
+# and write SVG-format image files for photo widgets. The files is organized
+# in the standard fashion for Tcl tests.
+#
+# Copyright © 2018 Rene Zaumseil
+# All rights reserved.
+
+package require tcltest 2.2
+namespace import ::tcltest::*
+eval tcltest::configure $argv
+tcltest::loadTestedCommands
+imageInit
+
+namespace eval svgnano {
+
+ variable data
+
+ set data(plus) {\
+ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
+ <path fill="none" stroke="#000000" d="M0 0 h16 v16 h-16 z"/>
+ <path fill="none" stroke="#000000" d="M8 4 v 8 M4 8 h 8"/>
+ <circle fill="yellow" stroke="red" cx="10" cy="80" r="10" />
+ <ellipse fill="none" stroke="blue" stroke-width="3" cx="60" cy="60" rx="10" ry="20" />
+ <line x1="10" y1="90" x2="50" y2="99"/>
+ <rect fill="none" stroke="green" x="20" y="20" width="60" height="50" rx="3" ry="3"/>
+ <polyline fill="red" stroke="purple" points="80,10 90,20 85,40"/>
+ <polygon fill ="yellow" points="80,80 70,85 90,90"/>
+ </svg>}
+ set data(bad) {<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0:w">
+ </svg>\
+ }
+
+ tcltest::makeFile $data(plus) plus.svg
+ set data(plusFilePath) [file join [tcltest::configure -tmpdir] plus.svg]
+
+ tcltest::makeFile $data(bad) bad.svg
+ set data(badFilePath) [file join [tcltest::configure -tmpdir] bad.svg]
+
+
+test imgSVGnano-1.1 {reading simple image} -setup {
+ catch {rename foo ""}
+} -body {
+ image create photo foo -data $data(plus)
+ list [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+} -result {100 100}
+
+test imgSVGnano-1.2 {simple image with options} -setup {
+ catch {rename foo ""}
+} -body {
+ image create photo foo -data $data(plus) -format {svg -dpi 100 -scale 3}
+ list [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+} -result {300 300}
+
+# test on crash found by Koen Danckaert
+test imgSVGnano-1.3 {reformat image options} -setup {
+ catch {rename foo ""}
+} -body {
+ image create photo foo -data $data(plus)
+ catch {foo configure -format {svg -scale}}
+ list {}
+} -cleanup {
+ rename foo ""
+} -result {{}}
+
+test imgSVGnano-1.4 {image options} -setup {
+ catch {rename foo ""}
+} -body {
+ image create photo foo -data $data(plus)
+ foo configure -format {svg -scale 2}
+ foo configure -format {svg -dpi 600}
+ list [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+} -result {100 100}
+
+test imgSVGnano-1.5 {reading simple image from file} -setup {
+ catch {rename foo ""}
+} -body {
+ image create photo foo -file $data(plusFilePath)
+ list [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+} -result {100 100}
+test imgSVGnano-1.6 {simple image from file with options} -setup {
+ catch {rename foo ""}
+} -body {
+ image create photo foo -file $data(plusFilePath) -format {svg -dpi 100 -scale 3}
+ list [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+} -result {300 300}
+
+test imgSVGnano-1.7 {very small scale gives 1x1 image} -body {
+ image create photo foo -format "svg -scale 0.000001"\
+ -data $data(plus)
+ list [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+} -result {1 1}
+test imgSVGnano-1.8 {very small scale gives 1x1 image, from file} -body {
+ image create photo foo -format "svg -scale 0.000001"\
+ -file $data(plusFilePath)
+ list [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+} -result {1 1}
+
+test imgSVGnano-2.1 {reading a bad image} -body {
+ image create photo foo -format svg -data $data(bad)
+} -returnCodes error -result {couldn't recognize image data}
+test imgSVGnano-2.2 {using bad option} -body {
+ image create photo foo -data $data(plus) -format {svg -scale 0}
+} -returnCodes error -result {-scale value must be positive}
+test imgSVGnano-2.3 {using bad option} -body {
+ image create photo foo -data $data(plus)
+ foo configure -format {svg 1.0}
+} -cleanup {
+ rename foo ""
+} -returnCodes error -result {bad option "1.0": must be -dpi, -scale, -scaletoheight, or -scaletowidth}
+test imgSVGnano-2.4 {reading a bad image from file} -body {
+ image create photo foo -format svg -file $data(badFilePath)
+} -returnCodes error -match glob\
+ -result {couldn't recognize data in image file "*/bad.svg"}
+
+# -scaletoheight and -scaletowidth options
+test imgSVGnano-3.1 {multiple scale options} -body {
+ image create photo foo -format "svg -scale 1 -scaletowidth 20"\
+ -data $data(bad)
+} -returnCodes error -result {only one of -scale, -scaletoheight, -scaletowidth may be given}
+
+test imgSVGnano-3.2 {no number parameter to -scaletowidth} -body {
+ image create photo foo -format "svg -scaletowidth invalid"\
+ -data $data(plus)
+} -returnCodes error -result {expected integer but got "invalid"}
+
+test imgSVGnano-3.3 {no number parameter to -scaletoheight} -body {
+ image create photo foo -format "svg -scaletoheight invalid"\
+ -data $data(plus)
+} -returnCodes error -result {expected integer but got "invalid"}
+
+test imgSVGnano-3.4 {zero parameter to -scaletowidth} -body {
+ image create photo foo -format "svg -scaletowidth 0"\
+ -data $data(plus)
+} -returnCodes error -result {-scaletowidth value must be positive}
+
+test imgSVGnano-3.5 {zero parameter to -scaletoheight} -body {
+ image create photo foo -format "svg -scaletoheight 0"\
+ -data $data(plus)
+} -returnCodes error -result {-scaletoheight value must be positive}
+
+test imgSVGnano-3.6 {no number parameter to -scaletoheight} -body {
+ image create photo foo -format "svg -scaletoheight invalid"\
+ -data $data(plus)
+} -returnCodes error -result {expected integer but got "invalid"}
+
+test imgSVGnano-3.7 {option -scaletowidth} -body {
+ image create photo foo -format "svg -scaletowidth 20"\
+ -data $data(plus)
+ image width foo
+} -cleanup {
+ rename foo ""
+} -result 20
+
+test imgSVGnano-3.8 {option -scaletoheight} -body {
+ image create photo foo -format "svg -scaletoheight 20"\
+ -data $data(plus)
+ image height foo
+} -cleanup {
+ rename foo ""
+} -result 20
+
+test imgSVGnano-3.10 {change from -scaletoheight to -scale} -body {
+ set res {}
+ image create photo foo -format "svg -scaletoheight 16"\
+ -data $data(plus)
+ lappend res [image width foo] [image height foo]
+ foo configure -format "svg -scale 2"
+ lappend res [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+ unset res
+} -result {16 16 200 200}
+
+# svg file access
+test imgSVGnano-4.1 {reread file on configure -scale} -setup {
+ catch {rename foo ""}
+ set res {}
+} -body {
+ image create photo foo -file $data(plusFilePath)
+ lappend res [image width foo] [image height foo]
+ foo configure -format "svg -scale 2"
+ lappend res [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+ unset res
+} -result {100 100 200 200}
+
+test imgSVGnano-4.2 {error on file not accessible on reread due to configure} -setup {
+ catch {rename foo ""}
+ tcltest::makeFile $data(plus) tmpplus.svg
+ image create photo foo -file [file join [tcltest::configure -tmpdir] tmpplus.svg]
+ tcltest::removeFile tmpplus.svg
+} -body {
+ foo configure -format "svg -scale 2"
+} -cleanup {
+ rename foo ""
+ tcltest::removeFile tmpplus.svg
+} -returnCodes error -match glob -result {couldn't open "*/tmpplus.svg": no such file or directory}
+
+# Special images
+test imgSVGnano-5.0 {image without any of "width", "height" and "viewbox"} -body {
+ image create photo foo -data\
+ {<?xml version="1.0"?><!DOCTYPE svg PUBLIC\
+ "-//W3C//DTD SVG 1.0//EN\"\
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\
+ <svg xmlns="http://www.w3.org/2000/svg">\
+ <g style="fill-opacity:0.7;">\
+ <circle cx="6.5cm" cy="2cm" r="100" style="fill:green;\
+ stroke:black; stroke-width:0.1cm" transform="translate(-70,150)"/>\
+ </g></svg>}
+} -cleanup {
+ rename foo ""
+} -result {foo}
+
+test imgSVGnano-5.1 {bug ea665e08f3 - too many values in parameters of the transform attribute} -body {
+ # shall not loop endlessly
+ image create photo foo -data\
+ {<?xml version="1.0"?><!DOCTYPE svg PUBLIC\
+ "-//W3C//DTD SVG 1.0//EN\"\
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\
+ <svg xmlns="http://www.w3.org/2000/svg">\
+ <circle cx="6.5cm" cy="2cm" r="100" transform="skewX(1 1)"/>\
+ </g></svg>}
+} -cleanup {
+ rename foo ""
+} -result {foo}
+
+test imgSVGnano-5.2 {bug d6e9b4db40 - "<svg" and ">" must be present} -body {
+ image create photo foo -format svg -data\
+ {<?xml version="1.0"?><!DOCTYPE svg PUBLIC\
+ "-//W3C//DTD SVG 1.0//EN\" \
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\
+ <sERRORvBADFILEg xmlns="http://www.w3.org/2000/svg">\
+ <circle cx="6.5cm" cy="2cm" r="100" transform="skewX(1 1)"/>\
+ </g></svg>}
+} -returnCodes error -result {couldn't recognize image data}
+
+};# end of namespace svgnano
+
+namespace delete svgnano
+imageFinish
+cleanupTests
+return
+
+# Local Variables:
+# mode: tcl
+# fill-column: 78
+# End:
diff --git a/tests/listbox.test b/tests/listbox.test
index 42dc327..a17146f 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "listbox" command
# of Tk. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1993-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1993-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -718,13 +718,13 @@ test listbox-3.60 {ListboxWidgetCmd procedure, "index" option} -body {
} -result 2
test listbox-3.61 {ListboxWidgetCmd procedure, "index" option} -body {
.l index -1
-} -result {-1}
+} -result -1
test listbox-3.62 {ListboxWidgetCmd procedure, "index" option} -body {
.l index end
} -result 18
test listbox-3.63 {ListboxWidgetCmd procedure, "index" option} -body {
.l index 34
-} -result 34
+} -result 18
test listbox-3.64 {ListboxWidgetCmd procedure, "insert" option} -body {
.l insert
} -returnCodes error -result {wrong # args: should be ".l insert index ?element ...?"}
@@ -2112,7 +2112,7 @@ test listbox-10.17 {GetListboxIndex procedure} -setup {
.l index 20
} -cleanup {
destroy .l
-} -result 20
+} -result 12
test listbox-10.18 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2132,7 +2132,7 @@ test listbox-10.19 {GetListboxIndex procedure} -setup {
.l index -1
} -cleanup {
destroy .l
-} -result -1
+} -result -1
test listbox-10.20 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2143,7 +2143,7 @@ test listbox-10.20 {GetListboxIndex procedure} -setup {
.l index 1
} -cleanup {
destroy .l
-} -result 1
+} -result 0
test listbox-11.1 {ChangeListboxView procedure, boundary conditions for index} -setup {
@@ -2854,7 +2854,7 @@ test listbox-23.4 {ConfigureListboxItem, wrong num args} -setup {
set result
} -cleanup {
destroy .l
-} -result {wrong # args: should be ".l itemconfigure index ?-option? ?value? ?-option value ...?"}
+} -result {wrong # args: should be ".l itemconfigure index ?-option value ...?"}
test listbox-23.5 {ConfigureListboxItem, multiple calls} -setup {
destroy .l
} -body {
@@ -3152,7 +3152,7 @@ test listbox-31.1 {<<ListboxSelect>> event} -setup {
bind .l <<ListboxSelect>> {lappend res [%W curselection]}
.l insert end a b c
focus -force .l
- event generate .l <1> -x 5 -y 5 ; # <<ListboxSelect>> fires
+ event generate .l <Button-1> -x 5 -y 5 ; # <<ListboxSelect>> fires
.l configure -state disabled
focus -force .l
event generate .l <Control-Home> ; # <<ListboxSelect>> does NOT fire
@@ -3175,7 +3175,7 @@ test listbox-31.2 {<<ListboxSelect>> event on lost selection} -setup {
bind .l <<ListboxSelect>> {lappend res [list [selection own] [%W curselection]]}
.l insert end a b c
focus -force .l
- event generate .l <1> -x 5 -y 5 ; # <<ListboxSelect>> fires
+ event generate .l <Button-1> -x 5 -y 5 ; # <<ListboxSelect>> fires
selection clear ; # <<ListboxSelect>> fires again
update
set res
diff --git a/tests/main.test b/tests/main.test
index 4a3be63..29725de 100644
--- a/tests/main.test
+++ b/tests/main.test
@@ -4,8 +4,8 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1997 by Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -27,8 +27,7 @@ test main-2.1 {Tk_MainEx: -encoding option} -constraints stdio -setup {
set f [open $script w]
fconfigure $f -encoding utf-8
puts $f {puts [list $argv0 $argv $tcl_interactive]}
- puts -nonewline $f {puts [string equal \u20ac }
- puts $f "\u20ac]; exit"
+ puts $f {puts [string equal \u20AC €]; exit}
close $f
catch {set f [open "|[list [interpreter] -encoding utf-8 script]" r]}
} -body {
@@ -44,8 +43,7 @@ test main-2.2 {Tk_MainEx: -encoding option} -constraints stdio -setup {
set f [open $script w]
fconfigure $f -encoding utf-8
puts $f {puts [list $argv0 $argv $tcl_interactive]}
- puts -nonewline $f {puts [string equal \u20ac }
- puts $f "\u20ac]; exit"
+ puts $f {puts [string equal \u20AC €]; exit}
close $f
catch {set f [open "|[list [interpreter] -encoding ascii script]" r]}
} -body {
@@ -76,8 +74,7 @@ test main-2.3 {Tk_MainEx: -encoding option} -constraints stdio -setup {
set f [open $script w]
fconfigure $f -encoding utf-8
puts $f {puts [list $argv0 $argv $tcl_interactive]}
- puts -nonewline $f {puts [string equal \u20ac }
- puts $f "\u20ac]"
+ puts $f {puts [string equal \u20AC €]}
close $f
catch {set f [open "|[list [interpreter] -enc utf-8 script]" r+]}
} -body {
diff --git a/tests/menu.test b/tests/menu.test
index 718643e..f830156 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test menus in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1995-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -29,7 +29,7 @@ test menu-1.4 {Tk_MenuCmd procedure} -body {
destroy .m1
menu .m1
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m1}
test menu-1.5 {Tk_MenuCmd - creating menubar} -setup {
destroy .m1
@@ -38,19 +38,19 @@ test menu-1.5 {Tk_MenuCmd - creating menubar} -setup {
.m1 add cascade -label Test -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-1.6 {Tk_MenuCmd procedure menu ref no cascade} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
menu .m1
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m1}
test menu-1.7 {Tk_MenuCmd procedure one clone cascade} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
@@ -58,10 +58,10 @@ test menu-1.7 {Tk_MenuCmd procedure one clone cascade} -setup {
.m1 add cascade -menu .m2
menu .m2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m2}
test menu-1.8 {Tk_MenuCmd procedure two clone cascades} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
@@ -71,10 +71,10 @@ test menu-1.8 {Tk_MenuCmd procedure two clone cascades} -setup {
wm geometry .t3 +0+0
menu .m2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m2}
test menu-1.9 {Tk_MenuCmd procedure two clone cascades different order} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
@@ -84,10 +84,10 @@ test menu-1.9 {Tk_MenuCmd procedure two clone cascades different order} -setup {
wm geometry .t3 +0+0
list [menu .m2]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m2}
test menu-1.10 {Tk_MenuCmd procedure two clone cascades menus last} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
@@ -97,10 +97,10 @@ test menu-1.10 {Tk_MenuCmd procedure two clone cascades menus last} -setup {
.m1 add cascade -menu .m2
list [menu .m2]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m2}
test menu-1.11 {Tk_MenuCmd procedure three clones cascades} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
@@ -112,19 +112,19 @@ test menu-1.11 {Tk_MenuCmd procedure three clones cascades} -setup {
.m1 add cascade -menu .m2
list [menu .m2]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m2}
test menu-1.12 {Tk_MenuCmd procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
list [menu .m1]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m1}
test menu-1.13 {Tk_MenuCmd procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
@@ -132,10 +132,10 @@ test menu-1.13 {Tk_MenuCmd procedure} -setup {
wm geometry .t3 +0+0
list [menu .m1]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m1}
test menu-1.14 {Tk_MenuCmd procedure} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
@@ -145,7 +145,7 @@ test menu-1.14 {Tk_MenuCmd procedure} -setup {
wm geometry .t4 +0+0
list [menu .m1]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m1}
# Used for 2.1 - 2.30 tests
@@ -175,6 +175,14 @@ test menu-2.6 {configuration options -activeforeground non-existent} -body {
.m1 configure -activeforeground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
+test menu-2.6a {configuration options -activerelief sunken} -body {
+ .m1 configure -activerelief sunken
+ .m1 cget -activerelief
+} -result {sunken}
+test menu-2.6b {configuration options -activerelief badValue} -body {
+ .m1 configure -activerelief badValue
+} -returnCodes error -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
+
test menu-2.7 {configuration options -background #ff0000} -body {
.m1 configure -background #ff0000
.m1 cget -background
@@ -262,11 +270,11 @@ test menu-2.27 {configuration options -takefocus {any string}} -body {
test menu-2.28 {configuration options -tearoff 0} -body {
.m1 configure -tearoff 0
.m1 cget -tearoff
-} -result {0}
+} -result 0
test menu-2.29 {configuration options -tearoff 1} -body {
.m1 configure -tearoff 1
.m1 cget -tearoff
-} -result {1}
+} -result 1
test menu-2.30 {configuration options -tearoffcommand {any old string}} -body {
.m1 configure -tearoffcommand {any old string}
.m1 cget -tearoffcommand
@@ -537,12 +545,12 @@ test menu-2.85 {entry configuration options 0 -columnbreak 1 tearoff} -body {
test menu-2.86 {entry configuration options 1 -columnbreak 1 command} -body {
.m1 entryconfigure 1 -columnbreak 1
lindex [.m1 entryconfigure 1 -columnbreak] 4
-} -result {1}
+} -result 1
test menu-2.87 {entry configuration options 2 -columnbreak 1 cascade} -body {
.m1 entryconfigure 2 -columnbreak 1
lindex [.m1 entryconfigure 2 -columnbreak] 4
-} -result {1}
+} -result 1
test menu-2.88 {entry configuration options 3 -columnbreak 1 separator} -body {
.m1 entryconfigure 3 -columnbreak 1
@@ -551,12 +559,12 @@ test menu-2.88 {entry configuration options 3 -columnbreak 1 separator} -body {
test menu-2.89 {entry configuration options 4 -columnbreak 1 checkbutton} -body {
.m1 entryconfigure 4 -columnbreak 1
lindex [.m1 entryconfigure 4 -columnbreak] 4
-} -result {1}
+} -result 1
test menu-2.90 {entry configuration options 5 -columnbreak 1 radiobutton} -body {
.m1 entryconfigure 5 -columnbreak 1
lindex [.m1 entryconfigure 5 -columnbreak] 4
-} -result {1}
+} -result 1
test menu-2.91 {entry configuration options 0 -command beep tearoff} -body {
.m1 entryconfigure 0 -command beep
@@ -821,12 +829,12 @@ test menu-2.142 {entry configuration options 3 -indicatoron 1 separator} -body {
test menu-2.143 {entry configuration options 4 -indicatoron 1 checkbutton} -body {
.m1 entryconfigure 4 -indicatoron 1
lindex [.m1 entryconfigure 4 -indicatoron] 4
-} -result {1}
+} -result 1
test menu-2.144 {entry configuration options 5 -indicatoron 1 radiobutton} -body {
.m1 entryconfigure 5 -indicatoron 1
lindex [.m1 entryconfigure 5 -indicatoron] 4
-} -result {1}
+} -result 1
test menu-2.145 {entry configuration options 0 -label test tearoff} -body {
.m1 entryconfigure 0 -label test
@@ -1164,12 +1172,12 @@ test menu-2.217 {entry configuration options 0 -underline 0 tearoff} -body {
test menu-2.218 {entry configuration options 1 -underline 0 command} -body {
.m1 entryconfigure 1 -underline 0
lindex [.m1 entryconfigure 1 -underline] 4
-} -result {0}
+} -result 0
test menu-2.219 {entry configuration options 2 -underline 0 cascade} -body {
.m1 entryconfigure 2 -underline 0
lindex [.m1 entryconfigure 2 -underline] 4
-} -result {0}
+} -result 0
test menu-2.220 {entry configuration options 3 -underline 0 separator} -body {
.m1 entryconfigure 3 -underline 0
@@ -1178,12 +1186,12 @@ test menu-2.220 {entry configuration options 3 -underline 0 separator} -body {
test menu-2.221 {entry configuration options 4 -underline 0 checkbutton} -body {
.m1 entryconfigure 4 -underline 0
lindex [.m1 entryconfigure 4 -underline] 4
-} -result {0}
+} -result 0
test menu-2.222 {entry configuration options 5 -underline 0 radiobutton} -body {
.m1 entryconfigure 5 -underline 0
lindex [.m1 entryconfigure 5 -underline] 4
-} -result {0}
+} -result 0
test menu-2.223 {entry configuration options 0 -underline 3p tearoff} -body {
.m1 entryconfigure 0 -underline 3p
@@ -1359,7 +1367,7 @@ test menu-3.18 {MenuWidgetCmd procedure, "configure" option} -setup {
llength [.m1 configure]
} -cleanup {
destroy .m1
-} -result {20}
+} -result 21
test menu-3.19 {MenuWidgetCmd procedure, "configure" option} -setup {
destroy .m1
} -body {
@@ -1511,7 +1519,7 @@ test menu-3.36 {MenuWidgetCmd procedure, "entryconfigure" option} -setup {
llength [.m1 entryconfigure 1]
} -cleanup {
destroy .m1
-} -result {15}
+} -result 15
test menu-3.37 {MenuWidgetCmd procedure, "entryconfigure" option} -setup {
destroy .m1
} -body {
@@ -1629,7 +1637,7 @@ test menu-3.50 {MenuWidgetCmd procedure, "post" option} -constraints {
destroy .m1
} -body {
menu .m1
- .m1 add command -label "menu-3.53: hit Escape" -command "puts hello"
+ .m1 add command -label "menu-3.50: hit Escape" -command "puts hello"
.m1 post 40 40
} -cleanup {
destroy .m1
@@ -1656,7 +1664,7 @@ test menu-3.53 {MenuWidgetCmd procedure, "postcascade" option} -constraints {
destroy .m1 .m2
} -body {
menu .m1
- .m1 add command -label "menu-3.56 - hit Escape"
+ .m1 add command -label "menu-3.53 - hit Escape"
menu .m2
.m1 post 40 40
.m1 add cascade -menu .m2
@@ -1758,7 +1766,7 @@ test menu-3.64 {MenuWidgetCmd procedure, "unpost" option} -constraints {
destroy .m1
} -body {
menu .m1
- .m1 add command -label "menu-3.68 - hit Escape"
+ .m1 add command -label "menu-3.64 - hit Escape"
.m1 post 40 40
.m1 unpost
} -cleanup {
@@ -1779,7 +1787,7 @@ test menu-3.66a {MenuWidgetCmd procedure, "yposition" option, no tearoff} -setup
.m1 yposition 1
} -cleanup {
destroy .m1
-} -result {0}
+} -result 0
test menu-3.66b {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints {
notAqua
} -setup {
@@ -1791,7 +1799,7 @@ test menu-3.66b {MenuWidgetCmd procedure, "yposition" option, with tearoff} -con
.m1 yposition 1
} -cleanup {
destroy .m1
-} -result {1}
+} -result 1
test menu-3.66c {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints {
aqua
} -setup {
@@ -1803,7 +1811,7 @@ test menu-3.66c {MenuWidgetCmd procedure, "yposition" option, with tearoff} -con
.m1 yposition 1
} -cleanup {
destroy .m1
-} -result {0}
+} -result 0
test menu-3.67 {MenuWidgetCmd procedure, bad option} -setup {
destroy .m1
} -body {
@@ -1813,7 +1821,7 @@ test menu-3.67 {MenuWidgetCmd procedure, bad option} -setup {
destroy .m1
} -returnCodes error -result {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, index, insert, invoke, post, postcascade, type, unpost, xposition, or yposition}
test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} -setup {
- deleteWindows
+ deleteWindows
} -body {
set t .t
set m1 .t.m1
@@ -1831,7 +1839,7 @@ test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} -setup {
$t configure -menu ""
list [winfo exists $c1] [winfo exists $c2]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {1 1}
test menu-3.69 {MenuWidgetCmd procedure, "xposition" option} -setup {
destroy .m1
@@ -1850,6 +1858,14 @@ test menu-3.70 {MenuWidgetCmd procedure, "xposition" option} -setup {
} -cleanup {
destroy .m1
} -result {}
+test menu-3.71 {MenuWidgetCmd procedure, "index end" option, bug [f3cd942e9e]} -setup {
+ destroy .m1
+} -body {
+ menu .m1
+ list [.m1 index "end"]
+} -cleanup {
+ destroy .m1
+} -result none
test menu-4.1 {TkInvokeMenu: disabled} -setup {
@@ -1869,8 +1885,8 @@ test menu-4.2 {TkInvokeMenu: tearoff} -setup {
menu .m1
catch {.m1 invoke 0}
} -cleanup {
- deleteWindows
-} -result {0}
+ deleteWindows
+} -result 0
test menu-4.3 {TkInvokeMenu: checkbutton -on} -setup {
destroy .m1
} -body {
@@ -2026,7 +2042,7 @@ test menu-5.5 {DestroyMenuInstance - cascades of cloned menus} -setup {
list [destroy .m2] [.m1 entrycget 1 -menu] [. configure -menu ""] [destroy .m1]
} -returnCodes ok -result {{} .m2 {} {}}
test menu-5.6 {DestroyMenuInstance - cascades of cloned menus} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
@@ -2122,7 +2138,7 @@ test menu-6.4 {TkDestroyMenu - reentrancy - clones} -setup {
.m1 clone .m1.m3
destroy .m1
} -cleanup {
- deleteWindows
+ deleteWindows
} -returnCodes ok
test menu-6.5 {TkDestroyMenu} -setup {
destroy .m1 .m2
@@ -2131,7 +2147,7 @@ test menu-6.5 {TkDestroyMenu} -setup {
.m1 clone .m2
destroy .m1
winfo exists .m2
-} -result {0}
+} -result 0
test menu-6.6 {TkDestroyMenu} -setup {
destroy .m1 .m2
} -body {
@@ -2263,7 +2279,7 @@ test menu-7.4 {UnhookCascadeEntry} -setup {
list [destroy .m1] [destroy .m2]
} -returnCodes ok -result {{} {}}
test menu-7.5 {UnhookCascadeEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .m2
@@ -2274,7 +2290,7 @@ test menu-7.5 {UnhookCascadeEntry} -setup {
list [destroy .m1] [destroy .m2 .m3]
} -returnCodes ok -result {{} {}}
test menu-7.6 {UnhookCascadeEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .m2
@@ -2285,7 +2301,7 @@ test menu-7.6 {UnhookCascadeEntry} -setup {
list [destroy .m2] [destroy .m1 .m3]
} -returnCodes ok -result {{} {}}
test menu-7.7 {UnhookCascadeEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .m2
@@ -2296,7 +2312,7 @@ test menu-7.7 {UnhookCascadeEntry} -setup {
list [destroy .m3] [destroy .m1 .m2]
} -returnCodes ok -result {{} {}}
test menu-7.8 {UnhookCascadeEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .m2
@@ -2367,7 +2383,7 @@ test menu-8.6 {DestroyMenuEntry} -setup {
list [.m1 delete 1] [.m1 entrycget 1 -label] [destroy .m1]
} -result {{} two {}}
test menu-8.7 {DestroyMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "one"
@@ -2384,7 +2400,7 @@ test menu-9.1 {ConfigureMenu} -setup {
menu .m1
list [.m1 configure -postcommand "beep"] [.m1 cget -postcommand]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} beep}
test menu-9.2 {ConfigureMenu} -setup {
destroy .m1
@@ -2393,7 +2409,7 @@ test menu-9.2 {ConfigureMenu} -setup {
.m1 add command -label "test"
list [.m1 configure -tearoff 0] [.m1 entrycget 1 -label]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} test}
test menu-9.3 {ConfigureMenu} -setup {
destroy .m1
@@ -2401,7 +2417,7 @@ test menu-9.3 {ConfigureMenu} -setup {
menu .m1
list [.m1 configure -postcommand "beep"] [.m1 cget -postcommand]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} beep}
test menu-9.4 {ConfigureMenu} -setup {
destroy .m1
@@ -2410,7 +2426,7 @@ test menu-9.4 {ConfigureMenu} -setup {
.m1 add command -label "test"
.m1 configure -fg red
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-9.5 {ConfigureMenu} -setup {
destroy .m1
@@ -2420,7 +2436,7 @@ test menu-9.5 {ConfigureMenu} -setup {
.m1 add command -label "two"
.m1 configure -fg red
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-9.6 {ConfigureMenu} -setup {
destroy .m1
@@ -2431,25 +2447,25 @@ test menu-9.6 {ConfigureMenu} -setup {
.m1 add command -label "three"
.m1 configure -fg red
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-9.7 {ConfigureMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2 tearoff
list [.m1 configure -fg red] [.m2 cget -fg]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} red}
test menu-9.8 {ConfigureMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2 tearoff
list [.m2 configure -fg red] [.m1 cget -fg]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} red}
test menu-9.9 {ConfigureMenu} -setup {
destroy .m1
@@ -2457,7 +2473,7 @@ test menu-9.9 {ConfigureMenu} -setup {
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
@@ -2470,7 +2486,7 @@ test menu-10.1 {PostProcessEntry: array variable} -setup {
.m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense"
set foo(1)
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {on}
test menu-10.2 {PostProcessEntry: array variable} -setup {
destroy .m1
@@ -2480,7 +2496,7 @@ test menu-10.2 {PostProcessEntry: array variable} -setup {
.m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense"
set foo(1)
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {off}
@@ -2492,7 +2508,7 @@ test menu-11.1 {ConfigureMenuEntry} -setup {
.m1 add checkbutton -variable foo -onvalue on -offvalue off -label "Nonsense"
list [.m1 entryconfigure 1 -variable bar] [.m1 entrycget 1 -variable]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} bar}
test menu-11.2 {ConfigureMenuEntry} -setup {
destroy .m1
@@ -2501,7 +2517,7 @@ test menu-11.2 {ConfigureMenuEntry} -setup {
.m1 add command -label "test"
list [.m1 entryconfigure 1 -label ""] [.m1 entrycget 1 -label]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-11.3 {ConfigureMenuEntry} -setup {
destroy .m1
@@ -2510,83 +2526,83 @@ test menu-11.3 {ConfigureMenuEntry} -setup {
.m1 add command
list [.m1 entryconfigure 1 -label "test"] [.m1 entrycget 1 -label]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} test}
test menu-11.4 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command
list [.m1 entryconfigure 1 -accel "S"] [.m1 entrycget 1 -accel]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} S}
test menu-11.5 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command
list [.m1 entryconfigure 1 -label "test"] [.m1 entrycget 1 -label]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} test}
test menu-11.6 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command
.m1 entryconfigure 1 -label "test"
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-11.7 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m2
menu .m1
.m1 add cascade
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-11.8 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-11.9 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m3
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-11.10 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-11.11 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-11.12 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .m2
@@ -2599,10 +2615,10 @@ test menu-11.12 {ConfigureMenuEntry} -setup {
.m5 add cascade
.m5 entryconfigure 1 -label "test" -menu .m1
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-11.13 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .m2
@@ -2613,32 +2629,32 @@ test menu-11.13 {ConfigureMenuEntry} -setup {
.m4 add cascade -menu .m1
.m3 entryconfigure 1 -label "test" -menu .m1
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-11.14 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add checkbutton
list [.m1 entryconfigure 1 -variable "test"] [.m1 entrycget 1 -variable]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} test}
test menu-11.15 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
list [.m1 add checkbutton -label "test"] [.m1 entrycget 1 -variable]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} test}
test menu-11.16 {ConfigureMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add radiobutton -label "test"
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-11.17 {ConfigureMenuEntry} -setup {
deleteWindows
@@ -2844,35 +2860,35 @@ test menu-13.8 {TkGetMenuIndex} -setup {
.m1 entrycget -1 -label
} -returnCodes error -result {bad menu entry index "-1"}
test menu-13.9 {TkGetMenuIndex} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "test2"
.m1 entrycget 999 -label
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {test2}
test menu-13.10 {TkGetMenuIndex} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 insert 999 command -label "test"
.m1 entrycget 1 -label
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {test}
test menu-13.11 {TkGetMenuIndex} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "1test"
.m1 entrycget 1test -label
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {1test}
test menu-13.12 {TkGetMenuIndex} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
@@ -2880,176 +2896,176 @@ test menu-13.12 {TkGetMenuIndex} -setup {
.m1 add command -label "test3"
.m1 entrycget test2 -command
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {beep}
test menu-14.1 {MenuCmdDeletedProc} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
destroy .m1
} -cleanup {
- deleteWindows
+ deleteWindows
} -returnCodes ok
test menu-14.2 {MenuCmdDeletedProc} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2
destroy .m1
} -cleanup {
- deleteWindows
+ deleteWindows
} -returnCodes ok
test menu-15.1 {MenuNewEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-15.2 {MenuNewEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "test3"
.m1 insert 2 command -label "test2"
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-15.3 {MenuNewEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "test2"
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-15.4 {MenuNewEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-16.1 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 insert foo command -label "test"
} -returnCodes error -result {bad menu entry index "foo"}
test menu-16.2 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 insert test command -label "foo"
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-16.3 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 insert -1 command -label "test"
} -returnCodes error -result {bad menu entry index "-1"}
test menu-16.4 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1 -tearoff 1
.m1 add command -label "test"
.m1 insert 0 command -label "test2"
.m1 entrycget 1 -label
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {test2}
test menu-16.5 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-16.6 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add checkbutton
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-16.7 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-16.8 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add radiobutton
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-16.9 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add separator
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-16.10 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add blork
} -returnCodes error -result {bad menu entry type "blork": must be cascade, checkbutton, command, radiobutton, or separator}
test menu-16.11 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-16.12 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m2 clone .m3
list [.m2 add command -label "test"] [.m1 entrycget 1 -label] [.m3 entrycget 1 -label]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} test test}
test menu-16.13 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m2 clone .m3
list [.m3 add command -label "test"] [.m1 entrycget 1 -label] [.m2 entrycget 1 -label]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} test test}
test menu-16.14 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -blork
} -returnCodes error -result {unknown option "-blork"}
test menu-16.15 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "File"
@@ -3057,20 +3073,20 @@ test menu-16.15 {MenuAddOrInsert} -setup {
. configure -menu .container
list [.container add cascade -label "File" -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-16.16 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .m2
set tearoff [tk::TearOffMenu .m2]
list [.m2 add cascade -menu .m1] [$tearoff unpost]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-16.17 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .container
@@ -3078,10 +3094,10 @@ test menu-16.17 {MenuAddOrInsert} -setup {
set tearoff [tk::TearOffMenu .container]
list [.container add cascade -label "File" -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-16.18 {MenuAddOrInsert} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .container
@@ -3089,10 +3105,10 @@ test menu-16.18 {MenuAddOrInsert} -setup {
. configure -menu .container
list [.container add cascade -label "File" -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-16.19 {MenuAddOrInsert - Insert a cascade deep into the tree} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .menubar
menu .menubar.test -tearoff 0
@@ -3105,12 +3121,12 @@ test menu-16.19 {MenuAddOrInsert - Insert a cascade deep into the tree} -setup {
[info commands .\#menubar.\#menubar\#test.\#menubar\#test\#cascade] \
[. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {0 .#menubar.#menubar#test.#menubar#test#cascade {}}
test menu-17.1 {MenuVarProc} -setup {
- deleteWindows
+ deleteWindows
} -body {
catch {unset foo}
menu .m1
@@ -3118,21 +3134,21 @@ test menu-17.1 {MenuVarProc} -setup {
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[unset foo]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
# menu-17.2 - Don't know how to generate the flags in the if
test menu-17.2 {MenuVarProc} -setup {
- deleteWindows
+ deleteWindows
} -body {
catch {unset foo}
menu .m1
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[set foo ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-17.3 {MenuVarProc} -setup {
- deleteWindows
+ deleteWindows
} -body {
catch {unset foo}
menu .m1
@@ -3140,30 +3156,30 @@ test menu-17.3 {MenuVarProc} -setup {
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[set foo "hello"] [unset foo]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} hello {}}
test menu-17.4 {MenuVarProc} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
set foo "goodbye"
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[set foo "hello"] [unset foo]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} hello {}}
test menu-17.5 {MenuVarProc} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
set foo "hello"
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[set foo "goodbye"] [unset foo]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} goodbye {}}
test menu-17.6 {MenuVarProc [5d991b822e]} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Want this not to crash
menu .b
@@ -3174,10 +3190,10 @@ test menu-17.6 {MenuVarProc [5d991b822e]} -setup {
}}}
unset var
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-17.7 {MenuVarProc [5d991b822e]} -setup {
- deleteWindows
+ deleteWindows
} -body {
# Want this not to duplicate traces
menu .b
@@ -3188,30 +3204,30 @@ test menu-17.7 {MenuVarProc [5d991b822e]} -setup {
}}}
unset var
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-18.1 {TkActivateMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 activate 1
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-18.2 {TkActivateMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 activate 0
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-18.3 {TkActivateMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
@@ -3219,10 +3235,10 @@ test menu-18.3 {TkActivateMenuEntry} -setup {
.m1 activate 1
.m1 activate 2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-18.4 {TkActivateMenuEntry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
@@ -3230,112 +3246,112 @@ test menu-18.4 {TkActivateMenuEntry} -setup {
.m1 activate 1
.m1 activate 1
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-19.1 {TkPostCommand} -constraints nonUnixUserInteraction -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1 -postcommand "set menu_test menu-19.1"
.m1 add command -label "menu-19.1 - hit Escape"
list [.m1 post 40 40] [.m1 unpost] [set menu_test]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {menu-19.1 {} menu-19.1}
test menu-19.2 {TkPostCommand} -constraints nonUnixUserInteraction -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "menu-19.2 - hit Escape"
list [.m1 post 40 40] [.m1 unpost]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-20.1 {CloneMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-20.2 {CloneMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2 normal
- deleteWindows
+ deleteWindows
} -result {}
test menu-20.3 {CloneMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2 tearoff
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-20.4 {CloneMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2 menubar
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-20.5 {CloneMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2 foo
} -returnCodes error -result {bad menu type "foo": must be normal, tearoff, or menubar}
test menu-20.6 {CloneMenu - hooking up bookeeping ptrs} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-20.7 {CloneMenu - hooking up bookeeping ptrs - multiple children} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m1 clone .m3
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-20.8 {CloneMenu - cascade entries} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
.m1 clone .foo
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-20.9 {CloneMenu - cascades entries} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
menu .m2
.m1 clone .foo
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-20.10 {CloneMenu - tearoff fields} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1 -tearoff 1
list [.m1 clone .m2 normal] [.m2 cget -tearoff]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} 1}
test menu-20.11 {CloneMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .m2
@@ -3343,43 +3359,43 @@ test menu-20.11 {CloneMenu} -setup {
} -returnCodes error -result {window name "m2" already exists in parent}
test menu-21.1 {MenuDoYPosition} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 yposition glorp
} -returnCodes error -result {bad menu entry index "glorp"}
test menu-21.2 {MenuDoYPosition} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "Test"
.m1 yposition 1
} -cleanup {
- deleteWindows
+ deleteWindows
} -returnCodes ok -match glob -result {*}
test menu-22.1 {GetIndexFromCoords} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 configure -tearoff 0
.m1 index @5
} -cleanup {
- deleteWindows
-} -result {0}
+ deleteWindows
+} -result 0
test menu-22.2 {GetIndexFromCoords} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 configure -tearoff 0
.m1 index @5,5
} -cleanup {
- deleteWindows
-} -result {0}
+ deleteWindows
+} -result 0
test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup {
- deleteWindows
+ deleteWindows
} -constraints {x11} -body {
menu .m1
.m1 add command -label "test"
@@ -3388,10 +3404,10 @@ test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup {
tkwait visibility .m1
.m1 index @5
} -cleanup {
- deleteWindows
-} -result {0}
+ deleteWindows
+} -result 0
test menu-22.4 {GetIndexFromCoords: mapped window x,y} -setup {
- deleteWindows
+ deleteWindows
} -constraints {x11} -body {
menu .m1
.m1 add command -label "test"
@@ -3402,10 +3418,10 @@ test menu-22.4 {GetIndexFromCoords: mapped window x,y} -setup {
set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}]
.m1 index @$x,5
} -cleanup {
- deleteWindows
-} -result {0}
+ deleteWindows
+} -result 0
test menu-22.5 {GetIndexFromCoords: mapped wide window} -setup {
- deleteWindows
+ deleteWindows
} -constraints {x11} -body {
menu .m1
.m1 add command -label "test"
@@ -3417,20 +3433,20 @@ test menu-22.5 {GetIndexFromCoords: mapped wide window} -setup {
set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}]
.m1 index @$x,5
} -cleanup {
- deleteWindows
-} -result {0}
+ deleteWindows
+} -result 0
test menu-23.1 {RecursivelyDeleteMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
. configure -menu .m1
. configure -menu ""
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-23.2 {RecursivelyDeleteMenu} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m2
.m2 add command -label "test2"
@@ -3439,28 +3455,28 @@ test menu-23.2 {RecursivelyDeleteMenu} -setup {
. configure -menu .m1
. configure -menu ""
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-24.1 {TkNewMenuName} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-24.2 {TkNewMenuName} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
menu .m1\#0
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-24.3 {TkNewMenuName} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .#m
rename .#m hideme
@@ -3470,33 +3486,33 @@ test menu-24.3 {TkNewMenuName} -setup {
test menu-25.1 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.2 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.3 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
destroy .m1
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.4 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
@@ -3504,10 +3520,10 @@ test menu-25.4 {TkSetWindowMenuBar} -setup {
menu .m2
list [. configure -menu .m2] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.5 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
@@ -3516,10 +3532,10 @@ test menu-25.5 {TkSetWindowMenuBar} -setup {
menu .m3
list [. configure -menu .m3] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.6 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
@@ -3528,10 +3544,10 @@ test menu-25.6 {TkSetWindowMenuBar} -setup {
menu .m3
list [. configure -menu .m3] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.7 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
@@ -3541,10 +3557,10 @@ test menu-25.7 {TkSetWindowMenuBar} -setup {
.t2 configure -menu .m1
list [.t2 configure -menu .m2] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.8 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
@@ -3555,10 +3571,10 @@ test menu-25.8 {TkSetWindowMenuBar} -setup {
.t2 configure -menu .m1
list [. configure -menu .m2] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.9 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
@@ -3570,10 +3586,10 @@ test menu-25.9 {TkSetWindowMenuBar} -setup {
wm geometry .t3 +0+0
list [.t3 configure -menu .m2] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.10 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
@@ -3585,10 +3601,10 @@ test menu-25.10 {TkSetWindowMenuBar} -setup {
wm geometry .t3 +0+0
list [.t2 configure -menu .m2] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.11 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
@@ -3600,57 +3616,57 @@ test menu-25.11 {TkSetWindowMenuBar} -setup {
wm geometry .t3 +0+0
list [. configure -menu .m2] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.12 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.13 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.14 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.15 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-25.16 {TkSetWindowMenuBar} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
. configure -menu .m1
list [toplevel .t2 -menu m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.t2 {}}
test menu-26.1 {DestroyMenuHashTable} -setup {
catch {interp delete testinterp}
- deleteWindows
+ deleteWindows
} -body {
interp create testinterp
load {} Tk testinterp
@@ -3661,48 +3677,48 @@ test menu-26.1 {DestroyMenuHashTable} -setup {
test menu-27.1 {GetMenuHashTable} -setup {
catch {interp delete testinterp}
- deleteWindows
+ deleteWindows
} -body {
interp create testinterp
load {} Tk testinterp
list [catch {interp eval testinterp {menu .m1}} msg] $msg [interp delete testinterp]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {0 .m1 {}}
test menu-28.1 {TkCreateMenuReferences - not there before} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m1}
test menu-28.2 {TkCreateMenuReferences - there already} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
menu .m2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.m2}
test menu-29.1 {TkFindMenuReferences - not there} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
.m1 add cascade -menu .m2
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-30.1 {TkFindMenuReferences - there already} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
@@ -3710,38 +3726,38 @@ test menu-30.1 {TkFindMenuReferences - there already} -setup {
.m1 add cascade -menu .m2
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {{} {}}
test menu-31.1 {TkFreeMenuReferences - menuPtr} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
destroy .m1
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-31.2 {TkFreeMenuReferences - cascadePtr} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu ""
menu .m1
.m1 add cascade -menu .m2
.m1 entryconfigure 1 -menu .m3
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-31.3 {TkFreeMenuReferences - topLevelListPtr} -setup {
- deleteWindows
+ deleteWindows
} -body {
. configure -menu .m1
. configure -menu ""
} -cleanup {
- deleteWindows
+ deleteWindows
} -returnCodes ok -result {}
test menu-31.4 {TkFreeMenuReferences - not empty} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m3
@@ -3749,22 +3765,22 @@ test menu-31.4 {TkFreeMenuReferences - not empty} -setup {
.m2 add cascade -menu .m3
.m2 entryconfigure 1 -menu ".foo"
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-32.1 {DeleteMenuCloneEntries} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label foo
.m1 clone .m2
.m1 delete 1
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-32.2 {DeleteMenuCloneEntries} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
@@ -3775,10 +3791,10 @@ test menu-32.2 {DeleteMenuCloneEntries} -setup {
.m1 clone .m2
.m1 delete 2 3
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-32.3 {DeleteMenuCloneEntries} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1 -tearoff 0
.m1 add command -label one
@@ -3789,10 +3805,10 @@ test menu-32.3 {DeleteMenuCloneEntries} -setup {
.m2 configure -tearoff 1
.m1 delete 1 2
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-32.4 {DeleteMenuCloneEntries} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label one
@@ -3803,10 +3819,10 @@ test menu-32.4 {DeleteMenuCloneEntries} -setup {
.m2 configure -tearoff 0
.m1 delete 2 3
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-32.5 {DeleteMenuCloneEntries} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label one
@@ -3815,29 +3831,29 @@ test menu-32.5 {DeleteMenuCloneEntries} -setup {
.m1 activate one
.m1 delete one
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-32.6 {DeleteMenuCloneEntries - reentrancy - crashes tk8.0} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1
.m1 add command -label test \
-command ".m1 delete test ; .m1 add command -label test -command \".m1 delete test\"; .m1 delete test"
.m1 invoke test
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-32.7 {DeleteMenuCloneEntries - one entry} -setup {
- deleteWindows
+ deleteWindows
} -body {
menu .m1 -tearoff 0
.m1 add command -label Hello
.m1 delete Hello
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-32.8 {Ensure all menu clone commands are deleted} -setup {
- deleteWindows
+ deleteWindows
} -body {
# SF bug #465324
menu .menubar
@@ -3851,11 +3867,11 @@ test menu-32.8 {Ensure all menu clone commands are deleted} -setup {
info commands .#menubar*test*
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-32.9 {Ensure deleting of clones doesn't corrupt menu refs} -setup {
set res {}
- deleteWindows
+ deleteWindows
} -body {
menu .menubar
. configure -menu .menubar
@@ -3873,12 +3889,12 @@ test menu-32.9 {Ensure deleting of clones doesn't corrupt menu refs} -setup {
lappend res [.#menubar.#menubar#test entrycget 1 -menu]
return $res
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {.menubar.cascade .#menubar.#menubar#test.#menubar#cascade .menubar.cascade .#menubar.#menubar#test.#menubar#cascade}
test menu-33.1 {menu vs command hiding} -setup {
- deleteWindows
+ deleteWindows
} -body {
set l [interp hidden]
menu .m
@@ -3896,7 +3912,7 @@ test menu-33.1 {menu vs command hiding} -setup {
test menu-34.1 {menus on multiple screens - crashes tk8.3.1, Bug 5454} -constraints {
altDisplay
} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .one
menu .one.m
@@ -3916,7 +3932,7 @@ test menu-35.1 {menu -underline string overruns Bug 1599877} -setup {
update
tk::TraverseToMenu . "e"
} -cleanup {
- deleteWindows
+ deleteWindows
} -result {}
test menu-37.1 {menubar menues cannot be posted - bug 2160206} -setup {
@@ -3947,7 +3963,7 @@ test menu-38.1 {Can't dismiss ttk::menubutton menu until mouse has hovered over
update
# simulate mouse click on the menu again, i.e. without
# entering/leaving the posted menu
- event generate .top.mb <ButtonPress-1>
+ event generate .top.mb <Button-1>
update
after 50
event generate .top.mb <ButtonRelease-1>
@@ -3956,7 +3972,7 @@ test menu-38.1 {Can't dismiss ttk::menubutton menu until mouse has hovered over
winfo ismapped .top.mb.m
} -cleanup {
destroy .top.mb.m .top.m .top
-} -result {0}
+} -result 0
# cleanup
diff --git a/tests/menuDraw.test b/tests/menuDraw.test
index 9382974..2507a0e 100644
--- a/tests/menuDraw.test
+++ b/tests/menuDraw.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test drawing of menus in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -561,7 +561,7 @@ test menuDraw-15.2 {TkPostTearoffMenu - Deactivation} -setup {
$tearoff index active
} -cleanup {
deleteWindows
-} -result {none}
+} -result none
test menuDraw-15.3 {TkPostTearoffMenu - post command} -setup {
deleteWindows
} -body {
diff --git a/tests/menubut.test b/tests/menubut.test
index d245fd0..f8bd175 100644
--- a/tests/menubut.test
+++ b/tests/menubut.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test menubuttons in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
# XXX This test file is woefully incomplete right now. If any part
@@ -71,7 +71,7 @@ test menubutton-1.9 {configuration options} -body {
.mb cget -bd
} -cleanup {
.mb configure -bd [lindex [.mb configure -bd] 3]
-} -result {4}
+} -result 4
test menubutton-1.10 {configuration options} -body {
.mb configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -98,7 +98,7 @@ test menubutton-1.15 {configuration options} -body {
.mb cget -borderwidth
} -cleanup {
.mb configure -borderwidth [lindex [.mb configure -borderwidth] 3]
-} -result {1}
+} -result 1
test menubutton-1.16 {configuration options} -body {
.mb configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -158,7 +158,7 @@ test menubutton-1.28 {configuration options} -body {
.mb cget -height
} -cleanup {
.mb configure -height [lindex [.mb configure -height] 3]
-} -result {18}
+} -result 18
test menubutton-1.29 {configuration options} -body {
.mb configure -height 20.0
} -returnCodes error -result {expected integer but got "20.0"}
@@ -185,7 +185,7 @@ test menubutton-1.34 {configuration options} -body {
.mb cget -highlightthickness
} -cleanup {
.mb configure -highlightthickness [lindex [.mb configure -highlightthickness] 3]
-} -result {18}
+} -result 18
test menubutton-1.35 {configuration options} -body {
.mb configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -213,7 +213,7 @@ test menubutton-1.38 {configuration options} -body {
.mb cget -indicatoron
} -cleanup {
.mb configure -indicatoron [lindex [.mb configure -indicatoron] 3]
-} -result {1}
+} -result 1
test menubutton-1.39 {configuration options} -body {
.mb configure -indicatoron no_way
} -returnCodes error -result {expected boolean value but got "no_way"}
@@ -237,7 +237,7 @@ test menubutton-1.43 {configuration options} -body {
.mb cget -padx
} -cleanup {
.mb configure -padx [lindex [.mb configure -padx] 3]
-} -result {12}
+} -result 12
test menubutton-1.44 {configuration options} -body {
.mb configure -padx 420x
} -returnCodes error -result {bad screen distance "420x"}
@@ -246,7 +246,7 @@ test menubutton-1.45 {configuration options} -body {
.mb cget -pady
} -cleanup {
.mb configure -pady [lindex [.mb configure -pady] 3]
-} -result {12}
+} -result 12
test menubutton-1.46 {configuration options} -body {
.mb configure -pady 420x
} -returnCodes error -result {bad screen distance "420x"}
@@ -291,7 +291,7 @@ test menubutton-1.54 {configuration options} -body {
.mb cget -underline
} -cleanup {
.mb configure -underline [lindex [.mb configure -underline] 3]
-} -result {5}
+} -result 5
test menubutton-1.55 {configuration options} -body {
.mb configure -underline 3p
} -returnCodes error -result {expected integer but got "3p"}
@@ -300,7 +300,7 @@ test menubutton-1.56 {configuration options} -body {
.mb cget -width
} -cleanup {
.mb configure -width [lindex [.mb configure -width] 3]
-} -result {402}
+} -result 402
test menubutton-1.57 {configuration options} -body {
.mb configure -width 3p
} -returnCodes error -result {expected integer but got "3p"}
@@ -309,7 +309,7 @@ test menubutton-1.58 {configuration options} -body {
.mb cget -wraplength
} -cleanup {
.mb configure -wraplength [lindex [.mb configure -wraplength] 3]
-} -result {100}
+} -result 100
test menubutton-1.59 {configuration options} -body {
.mb configure -wraplength 6x
} -returnCodes error -result {bad screen distance "6x"}
@@ -364,10 +364,10 @@ test menubutton-3.5 {ButtonWidgetCmd procedure, "cget" option} -body {
test menubutton-3.6 {ButtonWidgetCmd procedure, "cget" option} -body {
.mb configure -highlightthickness 3
.mb cget -highlightthickness
-} -result {3}
+} -result 3
test menubutton-3.7 {ButtonWidgetCmd procedure, "configure" option} -body {
llength [.mb configure]
-} -result {33}
+} -result 33
test menubutton-3.8 {ButtonWidgetCmd procedure, "configure" option} -body {
.mb configure -gorp
} -returnCodes error -result {unknown option "-gorp"}
diff --git a/tests/message.test b/tests/message.test
index 2ca6921..941d8c8 100644
--- a/tests/message.test
+++ b/tests/message.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "message" command
# of Tk. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 by Ajuba Solutions.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Ajuba Solutions.
# All rights reserved.
package require tcltest 2.2
@@ -41,7 +41,7 @@ test message-1.3 {configuration option: "aspect"} -setup {
.m cget -aspect
} -cleanup {
destroy .m
-} -result {3}
+} -result 3
test message-1.4 {configuration option: "aspect"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -81,7 +81,7 @@ test message-1.7 {configuration option: "bd"} -setup {
.m cget -bd
} -cleanup {
destroy .m
-} -result {4}
+} -result 4
test message-1.8 {configuration option: "bd"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -121,7 +121,7 @@ test message-1.11 {configuration option: "borderwidth"} -setup {
.m cget -borderwidth
} -cleanup {
destroy .m
-} -result {1}
+} -result 1
test message-1.12 {configuration option: "borderwidth"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -261,7 +261,7 @@ test message-1.25 {configuration option: "highlightthickness"} -setup {
.m cget -highlightthickness
} -cleanup {
destroy .m
-} -result {2}
+} -result 2
test message-1.26 {configuration option: "highlightthickness"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -383,7 +383,7 @@ test message-1.37 {configuration option: "width"} -setup {
.m cget -width
} -cleanup {
destroy .m
-} -result {2}
+} -result 2
test message-1.38 {configuration option: "width"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -452,7 +452,7 @@ test message-3.5 {MessageWidgetObjCmd procedure, "configure"} -setup {
llength [.m configure]
} -cleanup {
destroy .m
-} -result {21}
+} -result 21
test message-3.6 {MessageWidgetObjCmd procedure, "configure"} -setup {
message .m
} -body {
@@ -468,7 +468,7 @@ test message-3.7 {MessageWidgetObjCmd procedure, "configure"} -setup {
lindex [.m configure -bd] 4
} -cleanup {
destroy .m
-} -result {4}
+} -result 4
test message-4.1 {Bug [5d991b822e]} {
# Want this not to segfault, or write to variable with empty name
diff --git a/tests/msgbox.test b/tests/msgbox.test
index 4a6de57..91e52a7 100644
--- a/tests/msgbox.test
+++ b/tests/msgbox.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out Tk's "tk_messageBox" command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -94,7 +94,7 @@ proc ChooseMsgByKey {parent btn} {
proc PressButton {btn} {
event generate $btn <Enter>
- event generate $btn <ButtonPress-1> -x 5 -y 5
+ event generate $btn <Button-1> -x 5 -y 5
event generate $btn <ButtonRelease-1> -x 5 -y 5
}
@@ -113,7 +113,7 @@ proc SendEventToMsg {parent btn type} {
event generate $w <Enter>
focus $w
event generate $w.$btn <Enter>
- event generate $w <KeyPress> -keysym Return
+ event generate $w <Key> -keysym Return
}
}
#
diff --git a/tests/obj.test b/tests/obj.test
index eece58e..87e4a95 100644
--- a/tests/obj.test
+++ b/tests/obj.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test new object types in Tk.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/oldpack.test b/tests/oldpack.test
index 94e0710..a1ba276 100644
--- a/tests/oldpack.test
+++ b/tests/oldpack.test
@@ -2,9 +2,9 @@
# "pack" command (before release 3.3). It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1991-1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1991-1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -30,8 +30,13 @@ frame .pack.violet -width 80 -height 20
label .pack.violet.l -text P -bd 2 -relief raised
place .pack.violet.l -relwidth 1.0 -relheight 1.0
+if {![catch {pack ap .pack .pack.red top}]} {
+
+# Don't execute any of this file if Tk is compiled with -DTCL_NO_DEPRECATED
+
+
test oldpack-1.1 {basic positioning} -body {
- pack ap .pack .pack.red top
+ #pack ap .pack .pack.red top
update
winfo geometry .pack.red
} -result 10x20+45+0
@@ -452,10 +457,10 @@ test oldpack-8.2 {syntax errors} -body {
} -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"}
test oldpack-8.3 {syntax errors} -body {
pack gorp foo
-} -returnCodes error -result {bad option "gorp": must be configure, content, forget, info, propagate, or slaves}
+} -returnCodes error -result {bad option "gorp": must be configure, content, forget, info, or propagate}
test oldpack-8.4 {syntax errors} -body {
pack a .pack
-} -returnCodes error -result {bad option "a": must be configure, content, forget, info, propagate, or slaves}
+} -returnCodes error -result {bad option "a": must be configure, content, forget, info, or propagate}
test oldpack-8.5 {syntax errors} -body {
pack after foobar
} -returnCodes error -result {bad window path name "foobar"}
@@ -492,7 +497,7 @@ test oldpack-8.12 {syntax errors} -body {
} -returnCodes error -result {wrong # args: window ".pack.blue" should be followed by options}
test oldpack-8.13 {syntax errors} -body {
pack append . .pack.blue top
-} -returnCodes error -result {can't pack .pack.blue inside .}
+} -returnCodes error -result {can't pack ".pack.blue" inside "."}
test oldpack-8.14 {syntax errors} -body {
pack append .pack .pack.blue f
} -returnCodes error -result {bad option "f": should be top, bottom, left, right, expand, fill, fillx, filly, padx, pady, or frame}
@@ -544,6 +549,7 @@ test oldpack-9.3 {information output} -body {
[pack info .pack.green] [pack info .pack.violet]
} -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}}
+}
destroy .pack
# cleanup
diff --git a/tests/option.test b/tests/option.test
index 5e1568e..5e29344 100644
--- a/tests/option.test
+++ b/tests/option.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the option-handling facilities
# of Tk. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1991-1993 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1991-1993 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -401,7 +401,7 @@ test option-15.10 {database files} -body {
} -returnCodes error -result {missing colon on line 2}
set option3 [file join [testsDirectory] option.file3]
option read $option3
-test option-15.11 {database files} {option get . {x 4} color} br\xf3wn
+test option-15.11 {database files} {option get . {x 4} color} brówn
test option-16.1 {ReadOptionFile} -body {
set option4 [makeFile {} option.file3]
diff --git a/tests/pack.test b/tests/pack.test
index f365959..a17de62 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -1,9 +1,9 @@
-# This file is a Tcl script to test out the "pack" command
-# of Tk. It is organized in the standard fashion for Tcl tests.
+# This file is a Tcl script to test out the "pack" command of Tk. It is
+# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1993 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1993 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -30,7 +30,7 @@ foreach i {a b c d} {
.pack.b config -width 50 -height 30
.pack.c config -width 80 -height 80
.pack.d config -width 40 -height 30
-
+
test pack-1.1 {-side option} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -233,7 +233,6 @@ test pack-2.21 {x padding and filling} -setup {
update
list [winfo geometry .pack.a] [winfo geometry .pack.b]
} -result {280x40+5+0 300x160+0+40}
-
test pack-2.22 {x padding and filling} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -253,7 +252,6 @@ test pack-2.23 {x padding and filling} -setup {
expr {$res1 eq $res2}
} -result 1
-
test pack-3.1 {y padding and filling} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -422,7 +420,6 @@ test pack-3.21 {y padding and filling} -setup {
update
list [winfo geometry .pack.a] [winfo geometry .pack.b]
} -result {20x50+140+1 300x130+0+70}
-
test pack-3.22 {y padding and filling} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -442,7 +439,6 @@ test pack-3.23 {y padding and filling} -setup {
expr {$res1 eq $res2}
} -result 1
-
test pack-4.1 {anchors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -507,7 +503,6 @@ test pack-4.9 {anchors} -setup {
winfo geometry .pack.a
} -result {30x70+135+65}
-
# Repeat above tests, but with a frame that isn't at (0,0), so that
# we can be sure that the frame offset is being added in correctly.
@@ -593,7 +588,6 @@ test pack-5.9 {more anchors} -setup {
winfo geometry .pack.b
} -result {60x60+160+90}
-
test pack-6.1 {-expand option} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -699,7 +693,6 @@ test pack-6.11 {-expand option} -setup {
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
[winfo geometry .pack.c] [winfo geometry .pack.d]
} -result {100x200+0+0 200x100+100+0 160x100+140+100 40x100+100+100}
-
test pack-6.12 {-expand option} -setup {
toplevel .pack2 -height 400 -width 400
wm geometry .pack2 +0+0
@@ -734,7 +727,6 @@ test pack-6.13 {-expand option} -setup {
destroy .pack2
} -result {38x42+181+45 38x42+181+178 38x42+181+312}
-
wm geometry .pack {}
test pack-7.1 {requesting size for parent} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
@@ -793,7 +785,6 @@ test pack-7.7 {requesting size for parent} -setup {
list [winfo reqwidth .pack] [winfo reqheight .pack]
} -result {100 110}
-
# For the tests below, create a couple of "pad" windows to shrink
# the available space for the remaining windows. The tests have to
# be done this way rather than shrinking the whole window, because
@@ -874,7 +865,6 @@ test pack-8.9 {insufficient space} -body {
} -result {20x40+0+20 1 50x30+100+25 1 80x80+20+0 1}
pack forget .pack.right .pack.bottom
-
test pack-9.1 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -947,7 +937,6 @@ test pack-9.10 {window ordering} -setup {
pack content .pack
} -result {.pack.a .pack.c .pack.d .pack.b}
-
test pack-10.1 {retaining/clearing configuration state} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -977,7 +966,7 @@ test pack-10.4 {bad -in window does not change container window} -setup {
} -body {
winfo manager .pack.a
pack .pack.a -in .pack.a
-} -returnCodes error -result {can't pack .pack.a inside itself}
+} -returnCodes error -result {can't pack ".pack.a" inside itself}
test pack-10.5 {prevent management loops} -body {
frame .f1
frame .f2
@@ -986,7 +975,7 @@ test pack-10.5 {prevent management loops} -body {
} -cleanup {
destroy .f1
destroy .f2
-} -returnCodes error -result {can't put .f2 inside .f1, would cause management loop}
+} -returnCodes error -result {can't put ".f2" inside ".f1": would cause management loop}
test pack-10.6 {prevent management loops} -body {
frame .f1
frame .f2
@@ -998,8 +987,7 @@ test pack-10.6 {prevent management loops} -body {
destroy .f1
destroy .f2
destroy .f3
-} -returnCodes error -result {can't put .f3 inside .f1, would cause management loop}
-
+} -returnCodes error -result {can't put ".f3" inside ".f1": would cause management loop}
test pack-11.1 {info option} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
@@ -1135,7 +1123,6 @@ test pack-11.19 {info option} -setup {
lindex $i [expr [lsearch -exact $i -side]+1]
} -result right
-
test pack-12.1 {command options and errors} -body {
pack
} -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"}
@@ -1296,18 +1283,18 @@ test pack-12.33 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a -in .
-} -returnCodes error -result {can't pack .pack.a inside .}
+} -returnCodes error -result {can't pack ".pack.a" inside "."}
test pack-12.34 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
frame .pack.a.a
pack .pack.a.a -in .pack.b
-} -returnCodes error -result {can't pack .pack.a.a inside .pack.b}
+} -returnCodes error -result {can't pack ".pack.a.a" inside ".pack.b"}
test pack-12.35 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a -in .pack.a
-} -returnCodes error -result {can't pack .pack.a inside itself}
+} -returnCodes error -result {can't pack ".pack.a" inside itself}
test pack-12.36 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -1375,8 +1362,7 @@ test pack-12.46 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack lousy .pack
-} -returnCodes error -result {bad option "lousy": must be configure, content, forget, info, propagate, or slaves}
-
+} -returnCodes error -result {bad option "lousy": must be configure, content, forget, info, or propagate}
test pack-13.1 {window deletion} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d .pack.right .pack.bottom
@@ -1391,7 +1377,6 @@ test pack-13.1 {window deletion} -setup {
[winfo geometry .pack.b] [winfo geometry .pack.c]]
} -result {{.pack.right .pack.bottom .pack.a .pack.b .pack.c} 20x40+30+0 50x30+15+40 80x80+0+70}
-
test pack-14.1 {respond to changes in expansion} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d .pack.right .pack.bottom
} -body {
@@ -1517,7 +1502,6 @@ test pack-15.5 {managing geometry with -in option} -setup {
destroy .pack.f1 .pack.f2
} -result {50x16+25+22 1 50x16+25+22 0}
-
test pack-16.1 {geometry manager name} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
set result {}
@@ -1529,7 +1513,6 @@ test pack-16.1 {geometry manager name} -setup {
lappend result [winfo manager .pack.a]
} -result {{} pack {}}
-
test pack-17.1 {PackLostContentProc procedure} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
@@ -1565,7 +1548,6 @@ test pack-18.1 {unmap content when container unmapped} -constraints {
} -setup {
eval destroy [winfo child .pack]
} -body {
-
# adjust the position of .pack before test to avoid a screen switch
# that occurs with window managers that have desktops four times as big
# as the screen (screen switch causes scale and other tests to fail).
@@ -1595,7 +1577,6 @@ test pack-18.1 {unmap content when container unmapped} -constraints {
test pack-18.2 {unmap content when container unmapped} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
eval destroy [winfo child .pack]
} -body {
-
# adjust the position of .pack before test to avoid a screen switch
# that occurs with window managers that have desktops four times as big
# as the screen (screen switch causes scale and other tests to fail).
@@ -1618,7 +1599,6 @@ test pack-18.2 {unmap content when container unmapped} -constraints {failsOnUbun
lappend result [winfo ismapped .pack.b]
} -result {1 0 100 30 0 1}
-
test pack-19.1 {test respect for internalborder} -setup {
catch {eval pack forget [pack content .pack]}
destroy .pack.l .pack.lf
@@ -1656,10 +1636,98 @@ test pack-19.2 {test support for minreqsize} -setup {
destroy .pack.l .pack.lf
} -result {162x127+0+0 172x112+0+0}
-
+test pack-20.1 {<<NoManagedChild>> fires on last pack forget} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ pack [frame .1]
+ update
+ bind . <<NoManagedChild>> {set A 1}
+ pack forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <<NoManagedChild>> {}
+ destroy .1
+} -result 1
+test pack-20.2 {<<NoManagedChild>> fires on last packed child destruction} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ pack [frame .1]
+ update
+ bind . <<NoManagedChild>> {incr A}
+ destroy .1
+ update
+ set A
+} -cleanup {
+ bind . <<NoManagedChild>> {}
+ destroy .1
+} -result 1
+test pack-20.3 {<Configure> does not fire on last pack forget} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ pack [frame .1]
+ update
+ bind . <Configure> {set A 1}
+ pack forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <Configure> {}
+ destroy .1
+} -result 0
+test pack-20.4 {<<NoManagedChild>> does not fire on forelast pack forget} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ pack [frame .1]
+ pack [frame .2]
+ update
+ bind . <<NoManagedChild>> {set A 1}
+ pack forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <<NoManagedChild>> {}
+ destroy .1 .2
+} -result 0
+test pack-20.5 {<Configure> does not fire on last pack forget} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ pack [frame .1]
+ pack [frame .2]
+ update
+ bind . <Configure> {set A 1}
+ pack forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <Configure> {}
+ destroy .1 .2
+} -result 1
+test pack-20.6 {<<NoManagedChild>> does not fire on last pack forget if propagation is off} -setup {
+ global A
+ unset -nocomplain A
+} -body {
+ pack [frame .1]
+ pack propagate . 0
+ update
+ bind . <<NoManagedChild>> {set A 1}
+ pack forget .1
+ update
+ info exists A
+} -cleanup {
+ bind . <<NoManagedChild>> {}
+ destroy .1
+} -result 0
+
# cleanup
cleanupTests
return
-
-
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/tests/packgrid.test b/tests/packgrid.test
index 6dfba25..db49f60 100644
--- a/tests/packgrid.test
+++ b/tests/packgrid.test
@@ -2,7 +2,7 @@
# "grid" commands.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 2008 Peter Spjuth
+# Copyright © 2008 Peter Spjuth
# All rights reserved.
package require tcltest 2.2
@@ -22,7 +22,7 @@ test packgrid-1.1 {pack and grid in same container window} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager pack inside . which already has slaves managed by grid}
+} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows}
test packgrid-1.2 {pack and grid in same container window} -setup {
grid propagate . true
@@ -36,7 +36,7 @@ test packgrid-1.2 {pack and grid in same container window} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager grid inside . which already has slaves managed by pack}
+} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows}
test packgrid-1.3 {pack and grid in same container window} -setup {
grid propagate . false
@@ -137,7 +137,7 @@ test packgrid-2.1 {pack and grid in same container window, change propagation} -
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager grid inside . which already has slaves managed by pack}
+} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows}
test packgrid-2.2 {pack and grid in same container window, change propagation} -setup {
grid propagate . true
@@ -153,7 +153,7 @@ test packgrid-2.2 {pack and grid in same container window, change propagation} -
destroy .p
update
destroy .g
-} -result {cannot use geometry manager pack inside . which already has slaves managed by grid}
+} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows}
test packgrid-2.3 {pack and grid in same container window, change propagation} -setup {
grid propagate . false
@@ -170,7 +170,7 @@ test packgrid-2.3 {pack and grid in same container window, change propagation} -
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager pack inside . which already has slaves managed by grid}
+} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows}
test packgrid-2.4 {pack and grid in same container window, change propagation} -setup {
grid propagate . false
@@ -186,7 +186,7 @@ test packgrid-2.4 {pack and grid in same container window, change propagation} -
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager grid inside . which already has slaves managed by pack}
+} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows}
test packgrid-3.1 {stealing content} -setup {
grid propagate . true
@@ -229,7 +229,7 @@ test packgrid-3.3 {stealing content} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager pack inside . which already has slaves managed by grid}
+} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows}
test packgrid-3.4 {stealing content} -setup {
grid propagate . true
@@ -244,7 +244,7 @@ test packgrid-3.4 {stealing content} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager grid inside . which already has slaves managed by pack}
+} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows}
test packgrid-4.1 {content stolen after container destruction - bug [aa7679685e]} -setup {
frame .f
diff --git a/tests/panedwindow.test b/tests/panedwindow.test
index bb3a7fd..f8fb3ae 100644
--- a/tests/panedwindow.test
+++ b/tests/panedwindow.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test entry widgets in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -4562,7 +4562,7 @@ test panedwindow-22.2 {PanedWindowReqProc, react to pane geometry changes} -setu
expr {[lindex $result 1] - [lindex $result 0]}
} -cleanup {
deleteWindows
-} -result {10}
+} -result 10
test panedwindow-23.1 {ConfigurePanes, can't add panedwindow to itself} -setup {
@@ -5461,7 +5461,7 @@ test panedwindow-27.2 {destroy the window cleanly on rename [Bug #616589]} -setu
winfo exists .p
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test panedwindow-28.1 {resizing width} -setup {
diff --git a/tests/pkgconfig.test b/tests/pkgconfig.test
new file mode 100644
index 0000000..7d17916
--- /dev/null
+++ b/tests/pkgconfig.test
@@ -0,0 +1,69 @@
+# -*- tcl -*-
+# Commands covered: pkgconfig
+#
+# This file contains a collection of tests for one or more of the Tk
+# built-in commands. Sourcing this file into Tk runs the tests and
+# generates output for errors. No output means no errors were found.
+#
+# Copyright © 1991-1993 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 2017 Stuart Cassoff <stwo@users.sourceforge.net>
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+package require tcltest 2.2
+namespace import ::tcltest::*
+eval tcltest::configure $argv
+tcltest::loadTestedCommands
+
+testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
+
+test pkgconfig-1.1 {query keys} -constraints {nonwin nodeprecated} -body {
+ lsort [::tk::pkgconfig list]
+} -match glob -result [list \
+ 64bit bindir,install bindir,runtime debug demodir,install \
+ demodir,runtime*docdir,install docdir,runtime fontsystem \
+ includedir,install includedir,runtime \
+ libdir,install libdir,runtime mem_debug optimized profiled \
+ scriptdir,install scriptdir,runtime threaded \
+]
+test pkgconfig-1.2 {query keys multiple times} {
+ string compare [::tk::pkgconfig list] [::tk::pkgconfig list]
+} 0
+test pkgconfig-1.3 {query value multiple times} {
+ string compare \
+ [::tk::pkgconfig get 64bit] \
+ [::tk::pkgconfig get 64bit]
+} 0
+
+
+test pkgconfig-2.0 {error: missing subcommand} {
+ catch {::tk::pkgconfig} msg
+ set msg
+} {wrong # args: should be "::tk::pkgconfig subcommand ?arg?"}
+test pkgconfig-2.1 {error: illegal subcommand} {
+ catch {::tk::pkgconfig foo} msg
+ set msg
+} {bad subcommand "foo": must be get or list}
+test pkgconfig-2.2 {error: list with arguments} {
+ catch {::tk::pkgconfig list foo} msg
+ set msg
+} {wrong # args: should be "::tk::pkgconfig list"}
+test pkgconfig-2.3 {error: get without arguments} {
+ catch {::tk::pkgconfig get} msg
+ set msg
+} {wrong # args: should be "::tk::pkgconfig get key"}
+test pkgconfig-2.4 {error: query unknown key} {
+ catch {::tk::pkgconfig get foo} msg
+ set msg
+} {key not known}
+test pkgconfig-2.5 {error: query with to many arguments} {
+ catch {::tk::pkgconfig get foo bar} msg
+ set msg
+} {wrong # args: should be "::tk::pkgconfig subcommand ?arg?"}
+
+# cleanup
+cleanupTests
+return
diff --git a/tests/place.test b/tests/place.test
index a809095..f0dd513 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out the "place" command. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -65,7 +65,7 @@ test place-2.2 {ConfigureContent procedure, -height option} -setup {
place .t.f2 -in .t.f -height 40
update
winfo height .t.f2
-} -result {40}
+} -result 40
test place-2.3 {ConfigureContent procedure, -height option} -setup {
place forget .t.f2
} -body {
@@ -74,7 +74,7 @@ test place-2.3 {ConfigureContent procedure, -height option} -setup {
place .t.f2 -height {}
update
winfo height .t.f2
-} -result {60}
+} -result 60
test place-3.1 {ConfigureContent procedure, -relheight option} -body {
@@ -86,7 +86,7 @@ test place-3.2 {ConfigureContent procedure, -relheight option} -setup {
place .t.f2 -in .t.f -relheight .5
update
winfo height .t.f2
-} -result {40}
+} -result 40
test place-3.3 {ConfigureContent procedure, -relheight option} -setup {
place forget .t.f2
} -body {
@@ -95,14 +95,14 @@ test place-3.3 {ConfigureContent procedure, -relheight option} -setup {
place .t.f2 -relheight {}
update
winfo height .t.f2
-} -result {60}
+} -result 60
test place-4.1 {ConfigureContent procedure, bad -in options} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f2
-} -returnCodes error -result {can't place .t.f2 relative to itself}
+} -returnCodes error -result {can't place ".t.f2" relative to itself}
test place-4.2 {ConfigureContent procedure, bad -in option} -setup {
place forget .t.f2
} -body {
@@ -115,23 +115,23 @@ test place-4.3 {ConfigureContent procedure, bad -in option} -setup {
} -body {
winfo manager .t.f2
place .t.f2 -in .t.f2
-} -returnCodes error -result {can't place .t.f2 relative to itself}
+} -returnCodes error -result {can't place ".t.f2" relative to itself}
test place-4.4 {ConfigureContent procedure, bad -in option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .
-} -returnCodes error -result {can't place .t.f2 relative to .}
+} -returnCodes error -result {can't place ".t.f2" relative to "."}
test place-4.5 {ConfigureContent procedure, bad -in option} -setup {
} -body {
frame .t.f1
place .t.f1 -in .t.f1
-} -returnCodes error -result {can't place .t.f1 relative to itself}
+} -returnCodes error -result {can't place ".t.f1" relative to itself}
test place-4.6 {prevent management loops} -setup {
place forget .t.f1
} -body {
place .t.f1 -in .t.f2
place .t.f2 -in .t.f1
-} -returnCodes error -result {can't put .t.f2 inside .t.f1, would cause management loop}
+} -returnCodes error -result {can't put ".t.f2" inside ".t.f1": would cause management loop}
test place-4.7 {prevent management loops} -setup {
place forget .t.f1
place forget .t.f2
@@ -140,7 +140,7 @@ test place-4.7 {prevent management loops} -setup {
place .t.f1 -in .t.f2
place .t.f2 -in .t.f3
place .t.f3 -in .t.f1
-} -returnCodes error -result {can't put .t.f3 inside .t.f1, would cause management loop}
+} -returnCodes error -result {can't put ".t.f3" inside ".t.f1": would cause management loop}
test place-5.1 {ConfigureContent procedure, -relwidth option} -body {
place .t.f2 -relwidth abcd
@@ -151,7 +151,7 @@ test place-5.2 {ConfigureContent procedure, -relwidth option} -setup {
place .t.f2 -in .t.f -relwidth .5
update
winfo width .t.f2
-} -result {75}
+} -result 75
test place-5.3 {ConfigureContent procedure, -relwidth option} -setup {
place forget .t.f2
} -body {
@@ -160,7 +160,7 @@ test place-5.3 {ConfigureContent procedure, -relwidth option} -setup {
place .t.f2 -relwidth {}
update
winfo width .t.f2
-} -result {30}
+} -result 30
test place-6.1 {ConfigureContent procedure, -width option} -body {
place .t.f2 -width abcd
@@ -171,7 +171,7 @@ test place-6.2 {ConfigureContent procedure, -width option} -setup {
place .t.f2 -in .t.f -width 100
update
winfo width .t.f2
-} -result {100}
+} -result 100
test place-6.3 {ConfigureContent procedure, -width option} -setup {
place forget .t.f2
} -body {
@@ -180,7 +180,7 @@ test place-6.3 {ConfigureContent procedure, -width option} -setup {
place .t.f2 -width {}
update
winfo width .t.f2
-} -result {30}
+} -result 30
test place-7.1 {ReconfigurePlacement procedure, computing position} -setup {
@@ -332,7 +332,7 @@ test place-9.5 {PlaceObjCmd} -setup {
place badopt .foo
} -cleanup {
destroy .foo
-} -returnCodes error -result {bad option "badopt": must be configure, content, forget, info, or slaves}
+} -returnCodes error -result {bad option "badopt": must be configure, content, forget, or info}
test place-9.6 {PlaceObjCmd, configure errors} -setup {
destroy .foo
} -body {
@@ -507,16 +507,17 @@ test place-14.1 {memory leak testing} -constraints memory -setup {
frame .f
frame .f.f
stress {
- place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
- place forget .f.f
+ place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
+ place forget .f.f
} {
- place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
- pack .f.f
+ place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
+ pack .f.f
+ update; # Needed because of TIP #518, handle <<NoManagedChild>> event.
} {
- place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
- destroy .f
- frame .f
- frame .f.f
+ place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
+ destroy .f
+ frame .f
+ frame .f.f
}
} -cleanup {
destroy .f
diff --git a/tests/raise.test b/tests/raise.test
index f8674fc..7a3a063 100644
--- a/tests/raise.test
+++ b/tests/raise.test
@@ -3,9 +3,9 @@
# stacking order. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1993-1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1993-1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/safe.test b/tests/safe.test
index 31cb1b7..aeed361 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the Safe Tk facility. It is organized in
# the standard fashion for Tk tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/safePrimarySelection.test b/tests/safePrimarySelection.test
index 8475ce3..fd237f0 100644
--- a/tests/safePrimarySelection.test
+++ b/tests/safePrimarySelection.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test entry widgets in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -63,7 +63,7 @@ proc ::_test_tmp::unsafeInterp {name} {
set ::_test_tmp::script {
- package require Tk
+ package require tk
namespace eval ::_test_tmp {}
proc ::_test_tmp::getPrimarySelection {} {
@@ -281,7 +281,7 @@ test safePrimarySelection-1.6 {parent interpreter, spinbox spun, no existing sel
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
test safePrimarySelection-1.7 {parent interpreter, spinbox spun/selected/spun, no existing selection} -setup {
catch {interp delete child2}
@@ -293,7 +293,7 @@ test safePrimarySelection-1.7 {parent interpreter, spinbox spun/selected/spun, n
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
test safePrimarySelection-1.8 {parent interpreter, ttk::spinbox as entry, no existing selection} -setup {
catch {interp delete child2}
@@ -317,7 +317,7 @@ test safePrimarySelection-1.9 {parent interpreter, ttk::spinbox spun, no existin
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
test safePrimarySelection-1.10 {parent interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
catch {interp delete child2}
@@ -329,7 +329,7 @@ test safePrimarySelection-1.10 {parent interpreter, ttk::spinbox spun/selected/s
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
test safePrimarySelection-2.1 {child interpreter, text, no existing selection} -setup {
catch {interp delete child2}
@@ -431,7 +431,7 @@ test safePrimarySelection-2.6 {child interpreter, spinbox spun, no existing sele
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
test safePrimarySelection-2.7 {child interpreter, spinbox spun/selected/spun, no existing selection} -setup {
catch {interp delete child2}
@@ -448,7 +448,7 @@ test safePrimarySelection-2.7 {child interpreter, spinbox spun/selected/spun, no
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
test safePrimarySelection-2.8 {child interpreter, ttk::spinbox as entry, no existing selection} -setup {
catch {interp delete child2}
@@ -482,7 +482,7 @@ test safePrimarySelection-2.9 {child interpreter, ttk::spinbox spun, no existing
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
test safePrimarySelection-2.10 {child interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
catch {interp delete child2}
@@ -499,7 +499,7 @@ test safePrimarySelection-2.10 {child interpreter, ttk::spinbox spun/selected/sp
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
test safePrimarySelection-3.1 {IMPORTANT, safe interpreter, text, no existing selection} -setup {
catch {interp delete child2}
@@ -781,7 +781,7 @@ test safePrimarySelection-4.6 {parent interpreter, spinbox spun, existing select
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
test safePrimarySelection-4.7 {parent interpreter, spinbox spun/selected/spun, existing selection} -setup {
catch {interp delete child2}
@@ -793,7 +793,7 @@ test safePrimarySelection-4.7 {parent interpreter, spinbox spun/selected/spun, e
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
test safePrimarySelection-4.8 {parent interpreter, ttk::spinbox as entry, existing selection} -setup {
catch {interp delete child2}
@@ -817,7 +817,7 @@ test safePrimarySelection-4.9 {parent interpreter, ttk::spinbox spun, existing s
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
test safePrimarySelection-4.10 {parent interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
catch {interp delete child2}
@@ -829,7 +829,7 @@ test safePrimarySelection-4.10 {parent interpreter, ttk::spinbox spun/selected/s
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
test safePrimarySelection-5.1 {child interpreter, text, existing selection} -setup {
catch {interp delete child2}
@@ -931,7 +931,7 @@ test safePrimarySelection-5.6 {child interpreter, spinbox spun, existing selecti
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
test safePrimarySelection-5.7 {child interpreter, spinbox spun/selected/spun, existing selection} -setup {
catch {interp delete child2}
@@ -948,7 +948,7 @@ test safePrimarySelection-5.7 {child interpreter, spinbox spun/selected/spun, ex
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
test safePrimarySelection-5.8 {child interpreter, ttk::spinbox as entry, existing selection} -setup {
catch {interp delete child2}
@@ -982,7 +982,7 @@ test safePrimarySelection-5.9 {child interpreter, ttk::spinbox spun, existing se
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
test safePrimarySelection-5.10 {child interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
catch {interp delete child2}
@@ -999,7 +999,7 @@ test safePrimarySelection-5.10 {child interpreter, ttk::spinbox spun/selected/sp
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
test safePrimarySelection-6.1 {IMPORTANT, safe interpreter, text, existing selection} -setup {
catch {interp delete child2}
diff --git a/tests/scale.test b/tests/scale.test
index 6e62710..e9b300b 100644
--- a/tests/scale.test
+++ b/tests/scale.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "scale" command
# of Tk. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -46,7 +46,7 @@ test scale-1.5 {configuration options} -body {
.s cget -bd
} -cleanup {
.s configure -bd [lindex [.s configure -bd] 3]
-} -result {4}
+} -result 4
test scale-1.6 {configuration options} -body {
.s configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -73,7 +73,7 @@ test scale-1.11 {configuration options} -body {
.s cget -borderwidth
} -cleanup {
.s configure -borderwidth [lindex [.s configure -borderwidth] 3]
-} -result {1}
+} -result 1
test scale-1.12 {configuration options} -body {
.s configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -97,7 +97,7 @@ test scale-1.17 {configuration options} -body {
.s cget -digits
} -cleanup {
.s configure -digits [lindex [.s configure -digits] 3]
-} -result {5}
+} -result 5
test scale-1.18 {configuration options} -body {
.s configure -digits badValue
} -returnCodes error -result {expected integer but got "badValue"}
@@ -157,7 +157,7 @@ test scale-1.31 {configuration options} -body {
.s cget -highlightthickness
} -cleanup {
.s configure -highlightthickness [lindex [.s configure -highlightthickness] 3]
-} -result {2}
+} -result 2
test scale-1.32 {configuration options} -body {
.s configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -172,7 +172,7 @@ test scale-1.35 {configuration options} -body {
.s cget -length
} -cleanup {
.s configure -length [lindex [.s configure -length] 3]
-} -result {130}
+} -result 130
test scale-1.36 {configuration options} -body {
.s configure -length badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -205,7 +205,7 @@ test scale-1.43 {configuration options} -body {
.s cget -repeatdelay
} -cleanup {
.s configure -repeatdelay [lindex [.s configure -repeatdelay] 3]
-} -result {14}
+} -result 14
test scale-1.44 {configuration options} -body {
.s configure -repeatdelay bogus
} -returnCodes error -result {expected integer but got "bogus"}
@@ -214,7 +214,7 @@ test scale-1.45 {configuration options} -body {
.s cget -repeatinterval
} -cleanup {
.s configure -repeatinterval [lindex [.s configure -repeatinterval] 3]
-} -result {14}
+} -result 14
test scale-1.46 {configuration options} -body {
.s configure -repeatinterval bogus
} -returnCodes error -result {expected integer but got "bogus"}
@@ -232,7 +232,7 @@ test scale-1.49 {configuration options} -body {
.s cget -showvalue
} -cleanup {
.s configure -showvalue [lindex [.s configure -showvalue] 3]
-} -result {0}
+} -result 0
test scale-1.50 {configuration options} -body {
.s configure -showvalue badValue
} -returnCodes error -result {expected boolean value but got "badValue"}
@@ -241,7 +241,7 @@ test scale-1.51 {configuration options} -body {
.s cget -sliderlength
} -cleanup {
.s configure -sliderlength [lindex [.s configure -sliderlength] 3]
-} -result {86}
+} -result 86
test scale-1.52 {configuration options} -body {
.s configure -sliderlength badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -313,7 +313,7 @@ test scale-1.69 {configuration options} -body {
.s cget -width
} -cleanup {
.s configure -width [lindex [.s configure -width] 3]
-} -result {32}
+} -result 32
test scale-1.70 {configuration options} -body {
.s configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -359,7 +359,7 @@ test scale-3.4 {ScaleWidgetCmd procedure, cget option} -body {
test scale-3.5 {ScaleWidgetCmd procedure, cget option} -body {
.s configure -highlightthickness 2
.s cget -highlightthickness
-} -result {2}
+} -result 2
test scale-3.6 {ScaleWidgetCmd procedure, configure option} -body {
list [llength [.s configure]] [lindex [.s configure] 6]
} -result {33 {-command command Command {} {}}}
@@ -466,7 +466,7 @@ test scale-3.28 {ScaleWidgetCmd procedure, set option} -body {
.s set 181
.s configure -state normal
.s get
-} -result {118}
+} -result 118
test scale-3.29 {ScaleWidgetCmd procedure} -body {
.s dumb
} -returnCodes error -result {bad option "dumb": must be cget, configure, coords, get, identify, or set}
@@ -588,27 +588,27 @@ test scale-6.1 {ComputeFormat procedure} -body {
.s configure -from 10 -to 100 -resolution 10
.s set 49.3
.s get
-} -result {50}
+} -result 50
test scale-6.2 {ComputeFormat procedure} -body {
.s configure -from 100 -to 1000 -resolution 100
.s set 493
.s get
-} -result {500}
+} -result 500
test scale-6.3 {ComputeFormat procedure} -body {
.s configure -from 1000 -to 10000 -resolution 1000
.s set 4930
.s get
-} -result {5000}
+} -result 5000
test scale-6.4 {ComputeFormat procedure} -body {
.s configure -from 10000 -to 100000 -resolution 10000
.s set 49000
.s get
-} -result {50000}
+} -result 50000
test scale-6.5 {ComputeFormat procedure} -body {
.s configure -from 100000 -to 1000000 -resolution 100000
.s set 493000
.s get
-} -result {500000}
+} -result 500000
test scale-6.6 {ComputeFormat procedure} -constraints {
nonPortable
} -body {
@@ -617,7 +617,7 @@ test scale-6.6 {ComputeFormat procedure} -constraints {
.s configure -from 1000000 -to 10000000 -resolution 1000000
.s set 4930000
.s get
-} -result {5000000}
+} -result 5000000
test scale-6.7 {ComputeFormat procedure} -body {
.s configure -from 1000000000 -to 10000000000 -resolution 1000000000
.s set 4930000000
@@ -652,7 +652,7 @@ test scale-6.13 {ComputeFormat procedure} -body {
.s configure -from .000001 -to .00001 -resolution .000001
.s set .000006
expr {[.s get] == 6.0e-06}
-} -result {1}
+} -result 1
test scale-6.14 {ComputeFormat procedure} -body {
.s configure -to .00001 -from .0001 -resolution .00001
.s set .00006
@@ -662,17 +662,17 @@ test scale-6.15 {ComputeFormat procedure} -body {
.s configure -to .000001 -from .00001 -resolution .000001
.s set .000006
expr {[.s get] == 6.0e-06}
-} -result {1}
+} -result 1
test scale-6.16 {ComputeFormat procedure} -body {
.s configure -from .00001 -to .0001 -resolution .00001 -digits 1
.s set .00006
expr {[.s get] == 6e-05}
-} -result {1}
+} -result 1
test scale-6.17 {ComputeFormat procedure} -body {
.s configure -from 10000000 -to 100000000 -resolution 10000000 -digits 3
.s set 49300000
.s get
-} -result {50000000}
+} -result 50000000
test scale-6.18 {ComputeFormat procedure} -body {
.s configure -length 200 -from 0 -to 10 -resolution 0 -digits 0
.s set .111111111
@@ -1135,26 +1135,26 @@ test scale-14.5 {RoundValueToResolution procedure} -body {
-orient horizontal -resolution 4.0
update
.s get 84 152
-} -result {-28}
+} -result -28
test scale-14.6 {RoundValueToResolution procedure} -body {
.s configure -from -100 -to 0 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 86 152
-} -result {-24}
+} -result -24
test scale-14.7 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to -100 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 84 152
-} -result {-72}
+} -result -72
test scale-14.8 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to -100 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 86 152
-} -result {-76}
+} -result -76
test scale-14.9 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to 2.25 -sliderlength 10 -length 114 -bd 2 \
@@ -1205,7 +1205,7 @@ test scale-14a.1 {RoundValueToResolution, RoundIntervalToResolution procedures}
.s get 200 0
} -cleanup {
destroy .s
-} -result {5}
+} -result 5
test scale-14a.2 {RoundValueToResolution, RoundIntervalToResolution procedures} -setup {
pack [scale .s -orient horizontal]
update
@@ -1226,7 +1226,7 @@ test scale-15.1 {ScaleVarProc procedure} -setup {
scale .s -from 0 -to -200 -variable y -orient horizontal -length 150
pack .s
return $y
-} -result {-130}
+} -result -130
test scale-15.2 {ScaleVarProc procedure} -setup {
deleteWindows
} -body {
@@ -1235,7 +1235,7 @@ test scale-15.2 {ScaleVarProc procedure} -setup {
pack .s
set y -87
.s get
-} -result {-87}
+} -result -87
test scale-15.3 {ScaleVarProc procedure} -setup {
deleteWindows
} -body {
@@ -1256,7 +1256,7 @@ test scale-15.4 {ScaleVarProc procedure} -setup {
.s get
} -cleanup {
deleteWindows
-} -result {-130}
+} -result -130
test scale-15.5 {ScaleVarProc procedure} -setup {
deleteWindows
} -body {
@@ -1344,7 +1344,7 @@ test scale-17.1 {bug fix 1786} -setup {
return $x
} -cleanup {
deleteWindows
-} -result {100}
+} -result 100
test scale-18.1 {DestroyScale, -cursor option [Bug: 3897]} -setup {
@@ -1364,7 +1364,7 @@ test scale-18.2 {Scale button 1 events [Bug 787065]} -setup {
pack .s
tkwait visibility .s
list [catch {
- event generate .s <1> -x 0 -y 0
+ event generate .s <Button-1> -x 0 -y 0
event generate .s <ButtonRelease-1> -x 0 -y 0
update
set ::error
@@ -1385,7 +1385,7 @@ test scale-18.3 {Scale button 2 events [Bug 787065]} -setup {
pack .s
tkwait visibility .s
list [catch {
- event generate .s <2> -x 0 -y 0
+ event generate .s <Button-2> -x 0 -y 0
event generate .s <ButtonRelease-2> -x 0 -y 0
update
set ::error
@@ -1411,16 +1411,16 @@ test scale-19 {Bug [3529885fff] - Click in through goes in wrong direction} \
} \
-body {
foreach {x y} [.s1 coord 50] {}
- event generate .s1 <1> -x $x -y $y
+ event generate .s1 <Button-1> -x $x -y $y
event generate .s1 <ButtonRelease-1> -x $x -y $y
foreach {x y} [.s2 coord 50] {}
- event generate .s2 <1> -x $x -y $y
+ event generate .s2 <Button-1> -x $x -y $y
event generate .s2 <ButtonRelease-1> -x $x -y $y
foreach {x y} [.s3 coord 50] {}
- event generate .s3 <1> -x $x -y $y
+ event generate .s3 <Button-1> -x $x -y $y
event generate .s3 <ButtonRelease-1> -x $x -y $y
foreach {x y} [.s4 coord 50] {}
- event generate .s4 <1> -x $x -y $y
+ event generate .s4 <Button-1> -x $x -y $y
event generate .s4 <ButtonRelease-1> -x $x -y $y
update
list $x1 $x2 $x3 $x4
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index c48ff02..f471b15 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -2,9 +2,9 @@
# the "scrollbar" command of Tk. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -13,6 +13,7 @@ tcltest::loadTestedCommands
testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
proc scroll args {
global scrollInfo
@@ -200,7 +201,7 @@ test scrollbar-3.14.1 {ScrollbarWidgetCmd procedure, "cget" option} emptyTest {
destroy .s2
test scrollbar-3.15 {ScrollbarWidgetCmd procedure, "configure" option} {
llength [.s configure]
-} {20}
+} 20
test scrollbar-3.16 {ScrollbarWidgetCmd procedure, "configure" option} {
list [catch {.s configure -bad} msg] $msg
} {1 {unknown option "-bad"}}
@@ -233,7 +234,7 @@ test scrollbar-3.24 {ScrollbarWidgetCmd procedure, "delta" option} {
} {1 {expected integer but got "xxyz"}}
test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} {
format {%.6g} [.s delta 20 0]
-} {0}
+} 0
test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} {
format {%.6g} [.s delta 0 20]
} [format %.6g [expr {20.0/([getTroughSize .s]-1)}]]
@@ -265,20 +266,20 @@ test scrollbar-3.32 {ScrollbarWidgetCmd procedure, "fraction" option} {
} {1 {expected integer but got "bogus"}}
test scrollbar-3.33 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 0 0]
-} {0}
+} 0
test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 0 1000]
-} {1}
+} 1
test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 4 21]
} [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \
/([getTroughSize .s] - 1)}]]
test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu failsOnXQuarz} {
format {%.6g} [.s fraction 4 179]
-} {1}
+} 1
test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} {
format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]]
-} {1}
+} 1
test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu failsOnXQuarz} {
format {%.6g} [.s fraction 4 178]
} {0.993711}
@@ -312,12 +313,12 @@ if {[testConstraint testmetrics]} {
update
test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.t.s fraction 100 0]
-} {0}
+} 0
destroy .t
test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} {
list [catch {.s get a} msg] $msg
} {1 {wrong # args: should be ".s get"}}
-test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} {
+test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} nodeprecated {
.s set 100 10 13 14
.s get
} {100 10 13 14}
@@ -402,36 +403,36 @@ test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} {
}
set result
} {0.4 0.4}
-test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set abc def ghi jkl} msg] $msg
} {1 {expected integer but got "abc"}}
-test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set 1 def ghi jkl} msg] $msg
} {1 {expected integer but got "def"}}
-test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set 1 2 ghi jkl} msg] $msg
} {1 {expected integer but got "ghi"}}
-test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set 1 2 3 jkl} msg] $msg
} {1 {expected integer but got "jkl"}}
-test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
.s set -10 50 20 30
.s get
} {0 50 0 0}
-test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
.s set 100 -10 20 30
.s get
} {100 0 20 30}
-test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
.s set 100 50 30 20
.s get
} {100 50 30 30}
test scrollbar-3.71 {ScrollbarWidgetCmd procedure, "set" option} {
list [catch {.s set 1 2 3} msg] $msg
-} {1 {wrong # args: should be ".s set firstFraction lastFraction" or ".s set totalUnits windowUnits firstUnit lastUnit"}}
+} {1 {wrong # args: should be ".s set firstFraction lastFraction"}}
test scrollbar-3.72 {ScrollbarWidgetCmd procedure, "set" option} {
list [catch {.s set 1 2 3 4 5} msg] $msg
-} {1 {wrong # args: should be ".s set firstFraction lastFraction" or ".s set totalUnits windowUnits firstUnit lastUnit"}}
+} {1 {wrong # args: should be ".s set firstFraction lastFraction"}}
test scrollbar-3.73 {ScrollbarWidgetCmd procedure} {
list [catch {.s bogus} msg] $msg
} {1 {bad option "bogus": must be activate, cget, configure, delta, fraction, get, identify, or set}}
@@ -648,7 +649,7 @@ test scrollbar-8.1 {TkScrollbarEventProc: recursive deletion} notAqua {
.t.f.s set 0 .5
update
set result [winfo exists .t.f.s]
- event generate .t.f.s <ButtonPress> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5
+ event generate .t.f.s <Button> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5
event generate .t <ButtonRelease> -button 1
update
lappend result [winfo exists .t.f.s] [winfo exists .t.f]
@@ -669,7 +670,7 @@ test scrollbar-8.2 {TkScrollbarEventProc: recursive deletion} notAqua {
.t.f.s set 0 .5
update
set result [winfo exists .t.f.s]
- event generate .t.f.s <ButtonPress> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5
+ event generate .t.f.s <Button> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5
event generate .t.f <ButtonRelease> -button 1
update
lappend result [winfo exists .t.f.s] [winfo exists .t.f]
@@ -688,7 +689,7 @@ test scrollbar-9.1 {scrollbar widget vs hidden commands} {
list [winfo children .] [interp hidden]
} [list {} $l]
-test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.1 {<MouseWheel> event on scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -yscrollcommand {.s set}] -side left
@@ -701,23 +702,9 @@ test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -
.t index @0,0
} -cleanup {
destroy .t .s
-} -result {5.0}
-test scrollbar-10.1.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -yscrollcommand {.s set}] -side left
- for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
- pack [scrollbar .s -command {.t yview}] -fill y -expand 1 -side left
- update
- focus -force .s
- event generate .s <MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {5.0}
+} -result {4.0}
-test scrollbar-10.2.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.2 {<MouseWheel> event on scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -730,8 +717,8 @@ test scrollbar-10.2.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -
.t index @0,0
} -cleanup {
destroy .t .s
-} -result {1.4}
-test scrollbar-10.2.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -setup {
+} -result {1.3}
+test scrollbar-10.3 {<MouseWheel> event on horizontal scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -739,12 +726,12 @@ test scrollbar-10.2.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -set
pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
update
focus -force .s
- event generate .s <Shift-MouseWheel> -delta -4
+ event generate .s <MouseWheel> -delta -120
after 200 {set eventprocessed 1} ; vwait eventprocessed
.t index @0,0
} -cleanup {
destroy .t .s
-} -result {1.4}
+} -result {1.3}
test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body {
proc destroy_scrollbar {} {
@@ -754,11 +741,11 @@ test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destructi
}
toplevel .top
scrollbar .top.s
- bind .top.s <2> {destroy_scrollbar}
+ bind .top.s <Button-2> {destroy_scrollbar}
pack .top.s
focus -force .top.s
update
- event generate .top.s <2>
+ event generate .top.s <Button-2>
update ; # shall not trigger error invalid command name ".top.s"
} -cleanup {
destroy .top.s .top
@@ -773,11 +760,11 @@ test scrollbar-11.2 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destructi
wm minsize .top 50 400
update
scrollbar .top.s
- bind .top.s <2> {after idle destroy_scrollbar}
+ bind .top.s <Button-2> {after idle destroy_scrollbar}
pack .top.s -expand true -fill y
focus -force .top.s
update
- event generate .top.s <2> -x 2 -y [expr {[winfo height .top.s] / 2}]
+ event generate .top.s <Button-2> -x 2 -y [expr {[winfo height .top.s] / 2}]
update ; # shall not trigger error invalid command name ".top.s"
} -cleanup {
destroy .top.s .top
diff --git a/tests/select.test b/tests/select.test
index 2177591..55f9184 100644
--- a/tests/select.test
+++ b/tests/select.test
@@ -2,8 +2,8 @@
# especially the "selection" command. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
#
diff --git a/tests/send.test b/tests/send.test
index ccf3eab..9ce8026 100644
--- a/tests/send.test
+++ b/tests/send.test
@@ -2,10 +2,10 @@
# other procedures in the file tkSend.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2001 by ActiveState Corporation.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 2001 ActiveState Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -403,14 +403,14 @@ test send-10.4 {SendEventProc procedure, leading nulls, bogus commands} {secures
set a null
update
set a
-} {44}
+} 44
test send-10.5 {SendEventProc procedure, extraneous command options} {secureserver testsend} {
testsend prop comm Comm \
"c\n-n tktest\n-x miscellanous\n-y who knows?\n-s set a new\n"
set a null
update
set a
-} {new}
+} new
test send-10.6 {SendEventProc procedure, unknown interpreter} {secureserver testsend} {
testsend prop [winfo id .f] Comm {}
testsend prop comm Comm \
diff --git a/tests/spinbox.test b/tests/spinbox.test
index e4f1c5e..f1cb3fa 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test spinbox widgets in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -717,7 +717,7 @@ test spinbox-1.61 {configuration option: "repeatinterval"} -setup {
.e cget -repeatinterval
} -cleanup {
destroy .e
-} -result {-500}
+} -result -500
test spinbox-1.62 {configuration option: "repeatinterval" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -919,14 +919,14 @@ test spinbox-1.79 {configuration option: "values" for spinbox} -setup {
destroy .e
} -returnCodes {error} -result {list element in braces followed by "list" instead of space}
-test spinbox-1.80 {configuration option: "vcmd"} -setup {
+test spinbox-1.80 {configuration option: "validatecommand"} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
pack .e
update
} -body {
- .e configure -vcmd "a command"
- .e cget -vcmd
+ .e configure -validatecommand "a command"
+ .e cget -validatecommand
} -cleanup {
destroy .e
} -result {a command}
@@ -1090,7 +1090,7 @@ test spinbox-3.7 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint
update
} -body {
# Tcl_UtfAtIndex(): utf at end
- .e insert 0 "ab\u4e4e"
+ .e insert 0 "ab乎"
.e bbox end
} -cleanup {
destroy .e
@@ -1103,7 +1103,7 @@ test spinbox-3.8 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint
update
} -body {
# Tcl_UtfAtIndex(): utf before index
- .e insert 0 "ab\u4e4ec"
+ .e insert 0 "ab乎c"
.e bbox 3
} -cleanup {
destroy .e
@@ -1125,7 +1125,7 @@ test spinbox-3.10 {SpinboxWidgetCmd procedure, "bbox" widget command} -constrain
pack .e
update
} -body {
- .e insert 0 "abcdefghij\u4e4eklmnop"
+ .e insert 0 "abcdefghij乎klmnop"
list [.e bbox 0] [.e bbox 1] [.e bbox 10] [.e bbox end]
} -cleanup {
destroy .e
@@ -1167,7 +1167,7 @@ test spinbox-3.15 {SpinboxWidgetCmd procedure, "configure" widget command} -setu
llength [.e configure]
} -cleanup {
destroy .e
-} -result 49
+} -result 51
test spinbox-3.16 {SpinboxWidgetCmd procedure, "configure" widget command} -setup {
spinbox .e
} -body {
@@ -1239,20 +1239,20 @@ test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
set x {}
} -body {
# UTF
- .e insert end "01234\u4e4e67890"
+ .e insert end "01234乎67890"
.e delete 6
lappend x [.e get]
.e delete 0 end
- .e insert end "012345\u4e4e7890"
+ .e insert end "012345乎7890"
.e delete 6
lappend x [.e get]
.e delete 0 end
- .e insert end "0123456\u4e4e890"
+ .e insert end "0123456乎890"
.e delete 6
lappend x [.e get]
} -cleanup {
destroy .e
-} -result [list "01234\u4e4e7890" "0123457890" "012345\u4e4e890"]
+} -result [list "01234乎7890" "0123457890" "012345乎890"]
test spinbox-3.25 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
pack .e
@@ -1356,7 +1356,7 @@ test spinbox-3.35 {SpinboxWidgetCmd procedure, "index" widget command} -setup {
update
} -body {
# UTF
- .e insert 0 abc\u4e4e\u0153def
+ .e insert 0 abc乎œdef
list [.e index 3] [.e index 4] [.e index end]
} -cleanup {
destroy .e
@@ -1777,7 +1777,7 @@ test spinbox-3.71 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e xview scroll 24
} -cleanup {
destroy .e
-} -returnCodes error -result {wrong # args: should be ".e xview scroll number units|pages"}
+} -returnCodes error -result {wrong # args: should be ".e xview scroll number pages|units"}
test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1788,7 +1788,7 @@ test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e xview scroll gorp units
} -cleanup {
destroy .e
-} -returnCodes error -result {expected integer but got "gorp"}
+} -returnCodes error -result {expected floating-point number but got "gorp"}
test spinbox-3.73 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1854,7 +1854,7 @@ test spinbox-3.77 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e xview scroll 23 foobars
} -cleanup {
destroy .e
-} -returnCodes error -result {bad argument "foobars": must be units or pages}
+} -returnCodes error -result {bad argument "foobars": must be pages or units}
test spinbox-3.78 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1898,7 +1898,7 @@ test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
} -body {
.e insert end "This is quite a long text string, so long that it "
.e insert end "runs off the end of the window quite a bit."
- .e insert 10 \u4e4e
+ .e insert 10 乎
update
# UTF
# If Tcl_NumUtfChars wasn't used, wrong answer would be:
@@ -2079,6 +2079,21 @@ test spinbox-5.11 {ConfigureSpinbox procedure} -setup {
} -cleanup {
destroy .e
} -result {}
+test spinbox-5.12 {ConfigureSpinbox procedure, -from and -to swapping} -setup {
+ spinbox .e
+} -body {
+ # this statement used to trigger error "-to value must be greater than -from value"
+ # because default value for -to is zero (bug [841280ffff])
+ set res [catch {.e configure -from 10}]
+ .e configure -from 1971 -to 2016 ; # standard case
+ lappend res [.e cget -from] [.e cget -to]
+ .e configure -from 2016 -to 1971 ; # auto-swapping happens
+ lappend res [.e cget -from] [.e cget -to]
+ .e configure -to 1971 -from 2016 ; # auto-swapping, order of options does not matter
+ lappend res [.e cget -from] [.e cget -to]
+} -cleanup {
+ destroy .e
+} -result {0 1971.0 2016.0 1971.0 2016.0 1971.0 2016.0}
# No tests for DisplaySpinbox.
@@ -2614,10 +2629,25 @@ test spinbox-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup
.e insert 0 "xyzzy"
update
.e delete 2 4
- winfo reqwidth .e
-} -cleanup {
- destroy .e
-} -result 42
+ # To check that deletion actually happened we measure the new width
+ # of the widget, based on the measuring width of the remaining text ("xyy")
+ # in the widget. For that purpose we have to mirror the code in tkEntry.c
+ # for computation of the reqwidth
+ # note: XPAD corresponds to the hardcoded #define XPAD 1
+ set XPAD 1
+ set buttonWidth [expr { [font measure [.e cget -font] "0"] + 2 * (1 + $XPAD) }]
+ if {$buttonWidth < 11} {
+ set buttonWidth 11
+ }
+ set expected [expr { [font measure [.e cget -font] "xyy"] \
+ + 2 * ( [.e cget -borderwidth] + \
+ [.e cget -highlightthickness] + $XPAD ) \
+ + $buttonWidth } ]
+ expr {[winfo reqwidth .e] == $expected}
+} -cleanup {
+ destroy .e
+ unset XPAD buttonWidth expected
+} -result 1
test spinbox-9.1 {SpinboxValueChanged procedure} -setup {
unset -nocomplain x
diff --git a/tests/systray.test b/tests/systray.test
new file mode 100644
index 0000000..25c7bbb
--- /dev/null
+++ b/tests/systray.test
@@ -0,0 +1,223 @@
+# This file is a Tcl script to test systray and sysnotify features in Tk.
+# It is organized in the standard fashion for Tcl tests.
+#
+# Copyright © 2020 Kevin Walzer/WordTech Communications LLC.
+# Copyright © 2020 Francois Vogel.
+# All rights reserved.
+
+package require tcltest 2.2
+namespace import ::tcltest::*
+eval tcltest::configure $argv
+tcltest::loadTestedCommands
+
+test systray-1 {systray icon creation, all options} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book -text "Systray sample" \
+ -button1 {puts "button 1 click"} -button3 {puts "button 3 click"}
+} -cleanup {
+ tk systray destroy
+ image delete _book
+} -result {}
+
+test systray-2 {systray create, argument checking} -body {
+ tk systray create
+} -returnCodes {error} -result {missing required option "-image"}
+
+test systray-3 {systray create, argument checking} -body {
+ tk systray create -text Hell
+} -returnCodes {error} -result {missing required option "-image"}
+
+test systray-4 {systray create, argument checking} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book -gorp invalidOption
+} -returnCodes {error} -result {unknown option "-gorp": must be -image, -text, -button1 or -button3}
+
+test systray-5 {systray icon creation, only required option present} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book
+} -cleanup {
+ tk systray destroy
+ image delete _book
+} -result {}
+
+test systray-6 {systray icon creation, some options present} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book -button3 {puts b3}
+} -cleanup {
+ tk systray destroy
+ image delete _book
+} -result {}
+
+test systray-7 {systray icon, all parameters modification, introspection} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+ image create photo _page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7
+} -body {
+ tk systray create -image _book -text "Systray icon text"
+ tk systray configure -image _page
+ tk systray configure -text "Another text for my icon"
+ tk systray configure -button1 {set a 1}
+ tk systray configure -button3 {set b 2}
+ tk systray configure
+} -cleanup {
+ tk systray destroy
+ image delete _book
+ image delete _page
+} -result {-image _page -text {Another text for my icon} -button1 {set a 1} -button3 {set b 2}}
+
+test systray-8 {systray icon, single parameter modification, introspection} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book -text "Systray icon text" -button1 {puts b1}
+ tk systray configure -button1 {set a 1}
+ tk systray configure -button1
+} -cleanup {
+ tk systray destroy
+ image delete _book
+} -result {set a 1}
+
+test systray-9 {systray icon, several parameters modification at once, introspection} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book -text "Systray icon text" -button1 {puts b1}
+ tk systray configure -button1 {set a 1} -text NewText
+ list [tk systray configure -button1] [tk systray configure -text]
+} -cleanup {
+ tk systray destroy
+ image delete _book
+} -result {{set a 1} NewText}
+
+test systray-10 {configure non-existing systray icon} -setup {
+ catch {tk systray destroy}
+} -body {
+ tk systray configure
+} -returnCodes {error} -result {systray not created}
+
+test systray-11 {destroy non-existing systray icon} -setup {
+ catch {tk systray destroy}
+} -body {
+ tk systray destroy
+} -returnCodes {error} -result {systray not created}
+
+test systray-12 {destroy systray icon works} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book
+ tk systray destroy
+ tk systray create -image _book
+} -result {}
+
+test systray-13 {systray icon creation, attempt to create more than one in an interp} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book
+ tk systray create -image _book
+} -cleanup {
+ tk systray destroy
+ image delete _book
+} -returnCodes {error} -result {only one system tray icon supported per interpeter}
+
+test systray-14 {systray icon creation, create one per interp, visibiliy checks} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book -text "first interp"
+ interp create second
+ # load Tk into the 'second' interp
+ foreach pkg [info loaded] {
+ if {[lindex $pkg 1] == "Tk"} {
+ set loadTk "load $pkg"
+ break
+ }
+ }
+ eval $loadTk second
+ # create the icon in the 'second' interp
+ second eval {
+ # should trigger an error: image _book unknown in 'second' interp'
+ # image from higer interp should not be visible by 'tk systray'
+ tk systray create -image _book -text "second interp"
+ }
+} -cleanup {
+ tk systray destroy
+ image delete _book
+ interp delete second
+} -returnCodes {error} -result {image "_book" doesn't exist}
+
+test systray-15 {systray icon creation, create one per interp} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+} -body {
+ tk systray create -image _book -text "first interp"
+ interp create second
+ # load Tk into the 'second' interp
+ foreach pkg [info loaded] {
+ if {[lindex $pkg 1] == "Tk"} {
+ set loadTk "load $pkg"
+ break
+ }
+ }
+ eval $loadTk second
+ # create the icon in the 'second' interp
+ second eval {
+ image create photo _page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7
+ tk systray create -image _page -text "second interp"
+ }
+} -cleanup {
+ second eval {
+ tk systray destroy
+ image delete _page
+ }
+ interp delete second
+ tk systray destroy
+ image delete _book
+} -result {}
+
+test systray-16 {systray icon creation from a bitmap, on Linux and macOS only} -constraints {
+ nonwin
+} -setup {
+ set data1 {
+ #define foo_width 16
+ #define foo_height 16
+ static unsigned char foo_bits[] = {
+ 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff, 0xff
+ };
+ }
+ image create bitmap cross -data $data1
+} -body {
+ tk systray create -image cross
+} -cleanup {
+ tk systray destroy
+ image delete cross
+} -result {}
+
+
+test sysnotify-1 {system notification popup} -setup {
+ image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
+ tk systray create -image _book -text "Systray sample"
+} -body {
+ tk sysnotify {Alert} {This is an alert}
+} -cleanup {
+ tk systray destroy
+ image delete _book
+} -result {}
+
+test sysnotify-2.1 {system notification stems from a systray icon on Windows} -constraints {
+ win
+} -setup {
+ catch {tk systray destroy}
+} -body {
+ tk sysnotify {Alert} {This is an alert}
+} -returnCodes {error} -result {must create a system tray icon with the "tk systray" command first}
+test sysnotify-2.2 {system notification is not linked to any systray icon on X11 or aqua} -constraints {
+ nonwin
+} -setup {
+ catch {tk systray destroy}
+} -body {
+ tk sysnotify {Alert} {This is an alert}
+} -result {}
+
+
+cleanupTests
diff --git a/tests/teapotTransparent.png b/tests/teapotTransparent.png
new file mode 100644
index 0000000..1e7e46d
--- /dev/null
+++ b/tests/teapotTransparent.png
Binary files differ
diff --git a/tests/text.test b/tests/text.test
index 9ee0eff..5ec97eb 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkText.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -28,7 +28,7 @@ test text-1.1 {configuration option: "autoseparators"} -setup {
.t cget -autoseparators
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-1.1b {configuration option: "autoseparators", default} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -37,7 +37,7 @@ test text-1.1b {configuration option: "autoseparators", default} -setup {
.t cget -autoseparators
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-1.2 {configuration option: "autoseparators"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -75,7 +75,7 @@ test text-1.5 {configuration option: "bd"} -setup {
.t cget -bd
} -cleanup {
destroy .t
-} -result {4}
+} -result 4
test text-1.6 {configuration option: "bd"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -113,7 +113,7 @@ test text-1.9 {configuration option: "blockcursor"} -setup {
.t cget -blockcursor
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.10 {configuration option: "blockcursor"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -132,7 +132,7 @@ test text-1.11 {configuration option: "borderwidth"} -setup {
.t cget -borderwidth
} -cleanup {
destroy .t
-} -result {7}
+} -result 7
test text-1.12 {configuration option: "borderwidth"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -170,7 +170,7 @@ test text-1.15 {configuration option: "exportselection"} -setup {
.t cget -exportselection
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.16 {configuration option: "exportselection"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -246,7 +246,7 @@ test text-1.23 {configuration option: "height"} -setup {
.t cget -height
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-1.24 {configuration option: "height"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -303,7 +303,7 @@ test text-1.29 {configuration option: "highlightthickness"} -setup {
.t cget -highlightthickness
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.30 {configuration option: "highlightthickness"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -360,7 +360,7 @@ test text-1.35 {configuration option: "insertborderwidth"} -setup {
.t cget -insertborderwidth
} -cleanup {
destroy .t
-} -result {45}
+} -result 45
test text-1.36 {configuration option: "insertborderwidth"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -379,7 +379,7 @@ test text-1.37 {configuration option: "insertofftime"} -setup {
.t cget -insertofftime
} -cleanup {
destroy .t
-} -result {100}
+} -result 100
test text-1.38 {configuration option: "insertofftime"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -398,7 +398,7 @@ test text-1.39 {configuration option: "insertontime"} -setup {
.t cget -insertontime
} -cleanup {
destroy .t
-} -result {47}
+} -result 47
test text-1.40 {configuration option: "insertontime"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -417,7 +417,7 @@ test text-1.41 {configuration option: "insertwidth"} -setup {
.t cget -insertwidth
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-1.42 {configuration option: "insertwidth"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -436,7 +436,7 @@ test text-1.43 {configuration option: "maxundo"} -setup {
.t cget -maxundo
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-1.43b {configuration option: "maxundo", default} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -445,7 +445,7 @@ test text-1.43b {configuration option: "maxundo", default} -setup {
.t cget -maxundo
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.44 {configuration option: "maxundo"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -464,7 +464,7 @@ test text-1.45 {configuration option: "padx"} -setup {
.t cget -padx
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-1.46 {configuration option: "padx"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -483,7 +483,7 @@ test text-1.47 {configuration option: "pady"} -setup {
.t cget -pady
} -cleanup {
destroy .t
-} -result {82}
+} -result 82
test text-1.48 {configuration option: "pady"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -540,7 +540,7 @@ test text-1.53 {configuration option: "selectborderwidth"} -setup {
.t cget -selectborderwidth
} -cleanup {
destroy .t
-} -result {21}
+} -result 21
test text-1.54 {configuration option: "selectborderwidth"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -578,7 +578,7 @@ test text-1.57 {configuration option: "spacing1"} -setup {
.t cget -spacing1
} -cleanup {
destroy .t
-} -result {20}
+} -result 20
test text-1.58 {configuration option: "spacing1"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -597,7 +597,7 @@ test text-1.59 {configuration option: "spacing1"} -setup {
.t cget -spacing1
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.60 {configuration option: "spacing1"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -616,7 +616,7 @@ test text-1.61 {configuration option: "spacing2"} -setup {
.t cget -spacing2
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-1.62 {configuration option: "spacing2"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -635,7 +635,7 @@ test text-1.63 {configuration option: "spacing2"} -setup {
.t cget -spacing2
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.64 {configuration option: "spacing2"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -654,7 +654,7 @@ test text-1.65 {configuration option: "spacing3"} -setup {
.t cget -spacing3
} -cleanup {
destroy .t
-} -result {20}
+} -result 20
test text-1.66 {configuration option: "spacing3"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -673,7 +673,7 @@ test text-1.67 {configuration option: "spacing3"} -setup {
.t cget -spacing3
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.68 {configuration option: "spacing3"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -749,7 +749,7 @@ test text-1.75 {configuration option: "undo"} -setup {
.t cget -undo
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-1.75b {configuration option: "undo", default} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -758,7 +758,7 @@ test text-1.75b {configuration option: "undo", default} -setup {
.t cget -undo
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.76 {configuration option: "undo"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -777,7 +777,7 @@ test text-1.77 {configuration option: "width"} -setup {
.t cget -width
} -cleanup {
destroy .t
-} -result {73}
+} -result 73
test text-1.78 {configuration option: "width"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -1004,7 +1004,7 @@ test text-5.4 {TextWidgetCmd procedure, "cget" option} -setup {
.t cget -bd
} -cleanup {
destroy .t
-} -result {17}
+} -result 17
test text-6.1 {TextWidgetCmd procedure, "compare" option} -setup {
@@ -1198,7 +1198,7 @@ test text-7.3 {TextWidgetCmd procedure, "debug" option} -setup {
.t deb
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-7.4 {TextWidgetCmd procedure, "debug" option} -setup {
text .t
} -body {
@@ -1206,7 +1206,7 @@ test text-7.4 {TextWidgetCmd procedure, "debug" option} -setup {
.t debug
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-8.1 {TextWidgetCmd procedure, "delete" option} -setup {
@@ -1252,7 +1252,7 @@ bOy GIrl .#@? x_yz
Line 7"
.t configure -state disabled
.t delete 2.3
- .t g 2.0 2.end
+ .t get 2.0 2.end
} -cleanup {
destroy .t
} -result {abcdefghijklm}
@@ -1458,7 +1458,7 @@ Line 7"
string equal [.t get 1.0 end-1c] $prevtext
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-8.22 {TextWidgetCmd procedure, "replace" option with undo} -setup {
text .t
set res {}
@@ -1485,7 +1485,19 @@ Line 7"
rename .t {}
rename test.t .t
destroy .t
-} -result {{edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} {insert 2.1 ef} {mark set insert 2.3} {see insert}}
+} -result [list {edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} \
+ {mark set tk::undoMarkL2 2.1} {mark set tk::undoMarkR2 2.4} \
+ {mark gravity tk::undoMarkL2 left} {mark gravity tk::undoMarkR2 right} \
+ {insert 2.1 ef} {mark set insert 2.3} {see insert} \
+ {mark set tk::undoMarkL1 2.1} {mark set tk::undoMarkR1 2.3} \
+ {mark gravity tk::undoMarkL1 left} {mark gravity tk::undoMarkR1 right} \
+ {mark names} \
+ {index tk::undoMarkL1} {index tk::undoMarkR1} \
+ {mark unset tk::undoMarkL1 tk::undoMarkR1} \
+ {index tk::undoMarkL2} {index tk::undoMarkR2} \
+ {mark unset tk::undoMarkL2 tk::undoMarkR2} \
+ {compare 2.1 > 2.3} {compare 2.6 > 2.3} ]
+
test text-8.23 {TextWidgetCmd procedure, "replace" option with undo} -setup {
text .t
} -body {
@@ -1502,14 +1514,14 @@ Line 7"
# Ensure that undo (even composite undo like 'replace')
# works when the widget shows nothing useful.
.t replace 2.1 2.3 foo
- .t configure -start 1 -end 1
+ .t configure -startline 1 -endline 1
.t edit undo
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
.t configure -undo 0
string equal [.t get 1.0 end-1c] $prevtext
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-8.24 {TextWidgetCmd procedure, "replace" option with peers, undo} -setup {
text .t
} -body {
@@ -1528,15 +1540,15 @@ Line 7"
# works when the the event took place in one peer, which
# is then deleted, before the undo takes place in another peer.
.tt replace 2.1 2.3 foo
- .tt configure -start 1 -end 1
+ .tt configure -startline 1 -endline 1
destroy .tt
.t edit undo
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
.t configure -undo 0
string equal [.t get 1.0 end-1c] $prevtext
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-8.25 {TextWidgetCmd procedure, "replace" option with peers, undo} -setup {
text .t
} -body {
@@ -1557,14 +1569,14 @@ Line 7"
# which isn't showing everything.
.tt replace 2.1 2.3 foo
set res [.tt get 2.1 2.4]
- .tt configure -start 1 -end 1
+ .tt configure -startline 1 -endline 1
destroy .tt
- .t configure -start 3 -end 4
+ .t configure -startline 3 -endline 4
# msg will actually be set to a silently ignored error message here,
# (that the .tt command doesn't exist), but that is not important.
lappend res [catch {.t edit undo}]
.t configure -undo 0
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [string equal [.t get 1.0 end-1c] $prevtext]
} -cleanup {
destroy .t
@@ -2056,7 +2068,7 @@ test text-10.2 {TextWidgetCmd procedure, "count" option} -setup {
.t count blah 1.0 2.0
} -cleanup {
destroy .t
-} -returnCodes {error} -result {bad option "blah" must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
+} -returnCodes {error} -result {bad option "blah": must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
test text-10.3 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2091,7 +2103,7 @@ Line 7"
.t count 5.7 5.3
} -cleanup {
destroy .t
-} -result {-4}
+} -result -4
test text-10.7 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2105,7 +2117,7 @@ Line 7"
.t count 5.3 5.5
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-10.8 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2119,7 +2131,7 @@ Line 7"
.t count 5.3 end
} -cleanup {
destroy .t
-} -result {29}
+} -result 29
test text-10.9 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2133,7 +2145,7 @@ Line 7"
.t count 5.2 5.7
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-10.10 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2147,7 +2159,7 @@ Line 7"
.t count 5.2 5.3
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-10.11 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2161,7 +2173,7 @@ Line 7"
.t count 5.2 5.4
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-10.12 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2191,7 +2203,7 @@ Line 7"
.t count -displayindices 2.0 3.0
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-10.14 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2207,7 +2219,7 @@ Line 7"
.t count -displayindices 2.2 3.0
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.15 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2224,7 +2236,7 @@ Line 7"
.t count -displayindices 2.0 4.2
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-10.16 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2247,7 +2259,7 @@ Line 7"
.t count -displayindices 2.0 3.0
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-10.17 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2270,7 +2282,7 @@ Line 7"
.t count -displayindices 2.2 3.0
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-10.18 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2295,7 +2307,7 @@ Line 7"
.t count -displayindices a 3.0
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.19 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2319,7 +2331,7 @@ Line 7"
.t count -displayindices 2.0 4.2
} -cleanup {
destroy .t
-} -result {6}
+} -result 6
test text-10.20 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2343,7 +2355,7 @@ Line 7"
.t count -displaychars 2.0 3.0
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-10.21 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2367,7 +2379,7 @@ Line 7"
.t count -displaychars 2.2 3.0
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-10.22 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2392,7 +2404,7 @@ Line 7"
.t count -displaychars a 3.0
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.23 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2416,7 +2428,7 @@ Line 7"
.t count -displaychars 2.0 4.2
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-10.24 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2491,7 +2503,7 @@ Line 7"
.t count -indices 2.0 4.2
} -cleanup {
destroy .t
-} -result {21}
+} -result 21
test text-10.27 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2516,7 +2528,7 @@ Line 7"
.t count -chars 2.2 3.0
} -cleanup {
destroy .t
-} -result {10}
+} -result 10
test text-10.28 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2541,7 +2553,7 @@ Line 7"
.t count -chars a 3.0
} -cleanup {
destroy .t
-} -result {9}
+} -result 9
test text-10.29 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2566,7 +2578,7 @@ Line 7"
.t count -chars 2.0 4.2
} -cleanup {
destroy .t
-} -result {19}
+} -result 19
test text-10.30 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2576,7 +2588,7 @@ test text-10.30 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 1.0 end
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-10.31 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2586,7 +2598,7 @@ test text-10.31 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines end 1.0
} -cleanup {
destroy .t
-} -result {-3}
+} -result -3
test text-10.32 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2596,7 +2608,7 @@ test text-10.32 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 1.0 2.0 3.0
} -cleanup {
destroy .t
-} -returnCodes {error} -result {bad option "1.0" must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
+} -returnCodes {error} -result {bad option "1.0": must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
test text-10.33 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2606,7 +2618,7 @@ test text-10.33 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines end end
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.34 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2616,7 +2628,7 @@ test text-10.34 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 1.5 2.5
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-10.35 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2626,7 +2638,7 @@ test text-10.35 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 2.5 "2.5 lineend"
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.36 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2636,7 +2648,7 @@ test text-10.36 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 2.7 "1.0 lineend"
} -cleanup {
destroy .t
-} -result {-1}
+} -result -1
test text-10.37 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2647,7 +2659,7 @@ test text-10.37 {TextWidgetCmd procedure, "count" option} -setup {
.t count -displaylines 1.0 end
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-10.38 {TextWidgetCmd procedure, "count" option} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .t -expand 1 -fill both
@@ -2679,7 +2691,7 @@ test text-10.39 {TextWidgetCmd procedure, "count" option} -setup {
} -cleanup {
destroy .t
} -result {2 6 1 5}
-test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup {
+test text-10.40 {TextWidgetCmd procedure, "count" option} -setup {
text .t
pack .t
update
@@ -2694,8 +2706,8 @@ test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup {
set res [.t count -displaylines 2.0 3.0]
} -cleanup {
destroy .t
-} -result {0}
-test text-9.2.46 {TextWidgetCmd procedure, "count" option} -setup {
+} -result 0
+test text-10.41 {TextWidgetCmd procedure, "count" option} -setup {
toplevel .mytop
pack [text .mytop.t -font TkFixedFont -bd 0 -padx 0 -wrap char]
set spec [font measure TkFixedFont "Line 1+++Line 1---Li"] ; # 20 chars
@@ -2717,7 +2729,7 @@ test text-9.2.46 {TextWidgetCmd procedure, "count" option} -setup {
} -cleanup {
destroy .mytop
} -result {1 3}
-test text-9.2.47 {TextWidgetCmd procedure, "count" option} -setup {
+test text-10.42 {TextWidgetCmd procedure, "count" option} -setup {
text .t
pack .t
update
@@ -2771,7 +2783,7 @@ test text-11.2 {counting with tag priority eliding} -setup {
.t count -displaychars 1.0 1.5
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-11.3 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
@@ -2784,7 +2796,7 @@ test text-11.3 {counting with tag priority eliding} -setup {
.t count -displaychars 1.0 1.5
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-11.4 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
set res {}
@@ -3110,7 +3122,7 @@ test text-11a.41 {"sync" "pendingsync" and <<WidgetViewSync>>} -setup {
destroy .top.yt .top
} -result {Sync:0 Pending:1 Sync:1 Pending:0}
-test text-11a.51 {<<WidgetViewSync>> calls TkSendVirtualEvent(),
+test text-11a.51 {<<WidgetViewSync>> calls Tk_SendVirtualEvent(),
NOT Tk_HandleEvent().
Bug [b362182e45704dd7bbd6aed91e48122035ea3d16]} -setup {
destroy .top.t .top
@@ -3414,7 +3426,7 @@ test text-14.14 {ConfigureText procedure} -body {
selection get
} -cleanup {
destroy .t .t2
-} -result {1234}
+} -result 1234
test text-14.15 {ConfigureText procedure} -body {
text .t
entry .t.e
@@ -3428,7 +3440,7 @@ test text-14.15 {ConfigureText procedure} -body {
selection get
} -cleanup {
destroy .t2 .t
-} -result {1234}
+} -result 1234
test text-14.16 {ConfigureText procedure} -body {
text .t
entry .t.e
@@ -3457,7 +3469,7 @@ test text-14.17 {ConfigureText procedure} -body {
return $result
} -cleanup {
destroy .t .t2
-} -result {1234}
+} -result 1234
test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
toplevel .top
text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
@@ -3960,7 +3972,7 @@ test text-20.5 {TextFetchSelection procedure, long selections} -setup {
expr {[selection get] eq "$x\n"}
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-21.1 {TkTextLostSelection procedure} -constraints {x11} -setup {
@@ -4569,25 +4581,25 @@ test text-22.68 {TextSearchCmd, freeing copy of pattern} -body {
} -result {}
test text-22.69 {TextSearchCmd, unicode} -body {
text .t
- .t insert end "foo\u30c9\u30cabar"
- .t search \u30c9\u30ca 1.0
+ .t insert end "fooドナbar"
+ .t search ドナ 1.0
} -cleanup {
destroy .t
} -result {1.3}
test text-22.70 {TextSearchCmd, unicode} -body {
text .t
- .t insert end "foo\u30c9\u30cabar"
- list [.t search -count n \u30c9\u30ca 1.0] $n
+ .t insert end "fooドナbar"
+ list [.t search -count n ドナ 1.0] $n
} -cleanup {
destroy .t
} -result {1.3 2}
test text-22.71 {TextSearchCmd, unicode with non-text segments} -body {
text .t
button .b1 -text baz
- .t insert end "foo\u30c9"
+ .t insert end "fooド"
.t window create end -window .b1
- .t insert end "\u30cabar"
- list [.t search -count n \u30c9\u30ca 1.0] $n
+ .t insert end "ナbar"
+ list [.t search -count n ドナ 1.0] $n
} -cleanup {
destroy .t .b1
} -result {1.3 3}
@@ -5812,7 +5824,7 @@ test text-22.217.1 {elide up to match, with UTF-8 chars before the match} -setup
} -body {
.t tag configure e -elide 0
.t insert end A {} xyz e bb\n
- .t insert end \u00c4 {} xyz e bb
+ .t insert end Ä {} xyz e bb
set res {}
lappend res [.t search bb 1.0 "1.0 lineend"]
lappend res [.t search bb 2.0 "2.0 lineend"]
@@ -6419,19 +6431,19 @@ test text-24.24 {TextDumpCmd procedure, command script} -setup {
} -result {mark 1.0 current mark 1.0 insert mark 2.4 m}
test text-24.25 {TextDumpCmd procedure, unicode characters} -body {
text .t
- .t insert 1.0 \xb1\xb1\xb1
+ .t insert 1.0 ±±±
.t dump -all 1.0 2.0
} -cleanup {
destroy .t
-} -result "text \xb1\xb1\xb1 1.0 mark insert 1.3 mark current 1.3 text {\n} 1.3"
+} -result "text ±±± 1.0 mark insert 1.3 mark current 1.3 text {\n} 1.3"
test text-24.26 {TextDumpCmd procedure, unicode characters} -body {
text .t
.t delete 1.0 end
- .t insert 1.0 abc\xb1\xb1\xb1
+ .t insert 1.0 abc±±±
.t dump -all 1.0 2.0
} -cleanup {
destroy .t
-} -result "text abc\xb1\xb1\xb1 1.0 mark insert 1.6 mark current 1.6 text {\n} 1.6"
+} -result "text abc±±± 1.0 mark insert 1.6 mark current 1.6 text {\n} 1.6"
test text-24.27 {TextDumpCmd procedure, peer present} -body {
text .t
.t peer create .t.t
@@ -6447,7 +6459,7 @@ test text-25.1 {text widget vs hidden commands} -body {
destroy .t
set x [list [winfo children .] [interp hidden]]
expr {$x eq $y}
-} -result {1}
+} -result 1
test text-26.1 {bug fix - 1642} -body {
@@ -6540,7 +6552,7 @@ test text-27.8 {TextEditCmd procedure, modified flag} -body {
.t edit modified
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-27.9 {TextEditCmd procedure, reset modified flag} -body {
text .t
pack .t
@@ -6549,7 +6561,7 @@ test text-27.9 {TextEditCmd procedure, reset modified flag} -body {
.t edit modified
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-27.10 {TextEditCmd procedure, set modified flag} -body {
text .t
pack .t
@@ -6557,13 +6569,14 @@ test text-27.10 {TextEditCmd procedure, set modified flag} -body {
.t edit modified
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-27.11 {TextEditCmd procedure, set modified flag repeat} -setup {
text .t
pack .t
# Make sure the Text is mapped before we start
update
set ::retval {}
+ update
} -body {
bind .t <<Modified>> "lappend ::retval modified"
# Shouldn't require [update idle] to trigger event [Bug 1809538]
@@ -6627,7 +6640,7 @@ test text-27.14a {<<Modified>> virtual event - propagation to peers} -body {
set ::retval
} -cleanup {
destroy .t .tt
-} -result {4}
+} -result 4
test text-27.15 {<<Selection>> virtual event on sel tagging} -body {
set ::retval no_selection
pack [text .t]
@@ -6746,7 +6759,7 @@ test text-27.15g {No <<Selection>> virtual event on <<Cut>> without widget selec
destroy .t
} -result {no_<<Selection>>_event_fired}
test text-27.16 {-maxundo configuration option} -body {
- text .t -undo 1 -autoseparators 1 -maxundo 2
+ text .t -undo 1 -autoseparators 1 -maxundo 2
pack .t
.t insert end "line 1\n"
.t delete 1.4 1.6
@@ -6810,14 +6823,14 @@ test text-27.18 {patch 1469210 - inserting after undo} -setup {
} -cleanup {
destroy .t
} -result 1
-test text-27.19 {patch 1669632 (i) - undo after <Control-1>} -setup {
+test text-27.19 {patch 1669632 (i) - undo after <Control-Button-1>} -setup {
destroy .t
} -body {
text .t -undo 1
.t insert end foo\nbar
.t edit reset
.t insert 2.2 WORLD
- event generate .t <Control-1> -x 1 -y 1
+ event generate .t <Control-Button-1> -x 1 -y 1
.t insert insert HELLO
.t edit undo
.t get 2.2 2.7
@@ -6850,7 +6863,7 @@ test text-27.21 {patch 1669632 (vii) - <<Undo>> shall not remove separators} -se
.t insert end "This is an example text"
.t edit reset
.t insert 1.5 "WORLD "
- event generate .t <Control-1> -x 1 -y 1
+ event generate .t <Control-Button-1> -x 1 -y 1
.t insert insert HELLO
event generate .t <<Undo>>
.t insert insert E
@@ -6967,6 +6980,66 @@ test text-27.25 {<<UndoStack>> virtual event} -setup {
} -cleanup {
destroy .t
} -result {0 0 1 2 3 4 4 5 6 6 7 8 8 9}
+test text-27.26 {edit undo and edit redo return ranges} -setup {
+ destroy .t
+ set res {}
+} -body {
+ text .t -undo true -autoseparators false
+ .t insert end "Hello "
+ .t edit separator
+ .t insert end "World!\n"
+ .t insert 1.6 "GREAT "
+ .t insert end "Another edit here!!"
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+ .t edit separator
+ .t delete 1.6
+ .t delete 1.9 1.10
+ .t insert 1.9 L
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+ .t replace 1.6 1.10 Tcl/Tk
+ .t replace 2.8 2.12 "one bites the dust"
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+} -cleanup {
+ destroy .t
+} -result [list {1.6 2.0} \
+ {1.6 2.19} \
+ {1.6 1.7 1.10 1.12} \
+ {1.6 1.7 1.9 1.11} \
+ {1.6 1.16 2.8 2.19} \
+ {1.6 1.16 2.8 2.30} ]
+test text-27.27 {edit undo and edit redo return ranges} -setup {
+ destroy .t
+ set res {}
+} -body {
+ text .t -undo true -autoseparators false
+ for {set i 3} {$i >= 1} {incr i -1} {
+ .t insert 1.0 "Line $i\n"
+ }
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+} -cleanup {
+ destroy .t
+} -result [list {1.0 2.0} \
+ {1.0 4.0} ]
+test text-27.28 {edit undo and edit redo do not leave \
+ spurious temporary marks behind them} -setup {
+ destroy .t
+ set res {}
+} -body {
+ pack [text .t -undo true -autoseparators false]
+ .t insert end "Hello World.\n"
+ .t edit separator
+ .t insert end "Again hello.\n"
+ .t edit undo
+ lappend res [expr {[lsearch [.t mark names] tk::undoMark*]<0}]
+ .t edit redo
+ lappend res [expr {[lsearch [.t mark names] tk::undoMark*]<0}]
+} -cleanup {
+ destroy .t
+} -result {1 1}
test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body {
@@ -6979,13 +7052,13 @@ test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body {
test text-29.1 {tabs - must be positive and must be increasing} -body {
pack [text .t -wrap none]
- .t configure -tabs {0}
+ .t configure -tabs 0
} -cleanup {
destroy .t
} -returnCodes {error} -result {tab stop "0" is not at a positive distance}
test text-29.2 {tabs - must be positive and must be increasing} -body {
pack [text .t -wrap none]
- .t configure -tabs {-5}
+ .t configure -tabs -5
} -cleanup {
destroy .t
} -returnCodes {error} -result {tab stop "-5" is not at a positive distance}
@@ -7008,7 +7081,7 @@ test text-29.4 {tabs - must be positive and must be increasing} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-30.1 {repeated insert and scroll} -body {
@@ -7021,7 +7094,7 @@ test text-30.1 {repeated insert and scroll} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-30.2 {repeated insert and scroll} -body {
pack [text .t]
for {set i 0} {$i < 30} {incr i} {
@@ -7032,7 +7105,7 @@ test text-30.2 {repeated insert and scroll} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-30.3 {repeated insert and scroll} -body {
pack [text .t]
for {set i 0} {$i < 30} {incr i} {
@@ -7043,7 +7116,7 @@ test text-30.3 {repeated insert and scroll} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-30.4 {repeated insert and scroll} -body {
pack [text .t]
for {set i 0} {$i < 30} {incr i} {
@@ -7054,7 +7127,7 @@ test text-30.4 {repeated insert and scroll} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-31.1 {peer widgets} -body {
@@ -7099,7 +7172,7 @@ test text-31.4 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update
destroy .t .top
} -result {}
@@ -7109,7 +7182,7 @@ test text-31.5 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
pack [.top.t peer create .top.t2]
set res [list [.top.t index end] [.top.t2 index end]]
update
@@ -7123,8 +7196,8 @@ test text-31.6 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
- pack [.top.t peer create .top.t2 -start {} -end {}]
+ pack [.t peer create .top.t -startline 5 -endline 11]
+ pack [.top.t peer create .top.t2 -startline {} -endline {}]
set res [list [.top.t index end] [.top.t2 index end]]
update
return $res
@@ -7137,21 +7210,21 @@ test text-31.7 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
set p1 [.top.t count -update -ypixels 1.0 end]
set p2 [.t count -update -ypixels 5.0 11.0]
expr {$p1 eq $p2}
} -cleanup {
destroy .t .top
-} -result {1}
+} -result 1
test text-31.8 {peer widgets} -body {
toplevel .top
pack [text .t]
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
.t delete 3.0 6.0
.top.t index end
@@ -7164,7 +7237,7 @@ test text-31.9 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
.t delete 8.0 12.0
.top.t index end
@@ -7177,7 +7250,7 @@ test text-31.10 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
.t delete 3.0 13.0
.top.t index end
@@ -7193,7 +7266,7 @@ test text-31.11 {peer widgets} -setup {
}
.t tag add sel 1.0 end-1c
lappend res [.t tag ranges sel]
- .t configure -start 10 -end 20
+ .t configure -startline 10 -endline 20
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7208,7 +7281,7 @@ test text-31.12 {peer widgets} -setup {
}
.t tag add sel 1.0 end-1c
lappend res [.t tag ranges sel]
- .t configure -start 11
+ .t configure -startline 11
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7223,7 +7296,7 @@ test text-31.13 {peer widgets} -setup {
}
.t tag add sel 1.0 end-1c
lappend res [.t tag ranges sel]
- .t configure -end 90
+ .t configure -endline 90
lappend res [.t tag ranges sel]
destroy .t
return $res
@@ -7239,7 +7312,7 @@ test text-31.14 {peer widgets} -setup {
}
.t tag add sel 1.0 3.0 5.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0
lappend res [.t tag prevrange sel 1.0]
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
lappend res "next" [.t tag nextrange sel 4.0] \
[.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
@@ -7259,7 +7332,7 @@ test text-31.15 {peer widgets} -setup {
.t insert end "Line $i\n"
}
.t tag add sel 1.0 3.0 9.0 11.0 13.0 15.0 17.0 19.0
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
lappend res "next" [.t tag nextrange sel 4.0] \
[.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
@@ -7279,7 +7352,7 @@ test text-31.16 {peer widgets} -setup {
.t insert end "Line $i\n"
}
.t tag add sel 1.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
lappend res "next" [.t tag nextrange sel 4.0] \
[.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
@@ -7300,11 +7373,11 @@ test text-31.17 {peer widgets} -setup {
}
.t tag add sel 1.0 11.0
lappend res [.t tag ranges sel]
- lappend res [catch {.t configure -start 15 -end 10}]
+ lappend res [catch {.t configure -startline 15 -endline 10}]
lappend res [.t tag ranges sel]
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7371,9 +7444,9 @@ test text-32.1 {line heights on creation} -setup {
expr {$before eq $after}
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
-test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.2 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7401,9 +7474,9 @@ test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup {
set res 1
} -cleanup {
destroy .pt
-} -result {1}
+} -result 1
-test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.3 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7424,7 +7497,7 @@ test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
destroy .pt
} -result {4 3 {Line 5}}
-test text-32.4 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.4 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7485,7 +7558,7 @@ test text-33.2 {TextWidgetCmd procedure, "peer" option} -setup {
test text-33.3 {TextWidgetCmd procedure, "peer" option} -setup {
text .t
} -body {
- .t pee names
+ .t peer names
} -cleanup {
destroy .t
} -returnCodes {ok} -result {}
@@ -7517,17 +7590,17 @@ test text-33.6 {TextWidgetCmd procedure, "peer" option} -setup {
} -result {.t2 .t {}}
test text-33.7 {peer widget -start, -end} -body {
text .t
- set res [.t configure -start 10 -end 5]
+ set res [.t configure -startline 10 -endline 5]
return $res
} -cleanup {
destroy .t
-} -returnCodes {2} -result {}
+} -returnCodes 2 -result {}
test text-33.8 {peer widget -start, -end} -body {
text .t
for {set i 1} {$i < 100} {incr i} {
.t insert end "Line $i\n"
}
- .t configure -start 10 -end 5
+ .t configure -startline 10 -endline 5
} -cleanup {
destroy .t
} -returnCodes {error} -result {-startline must be less than or equal to -endline}
@@ -7536,7 +7609,7 @@ test text-33.9 {peer widget -start, -end} -body {
for {set i 1} {$i < 100} {incr i} {
.t insert end "Line $i\n"
}
- .t configure -start 5 -end 10
+ .t configure -startline 5 -endline 10
} -cleanup {
destroy .t
} -returnCodes {ok} -result {}
@@ -7546,11 +7619,11 @@ test text-33.10 {peer widget -start, -end} -body {
.t insert end "Line $i\n"
}
set res [.t index end]
- lappend res [catch {.t configure -start 5 -end 10 -tab foo}]
+ lappend res [catch {.t configure -startline 5 -endline 10 -tab foo}]
lappend res [.t index end]
- lappend res [catch {.t configure -tab foo -start 15 -end 20}]
+ lappend res [catch {.t configure -tab foo -startline 15 -endline 20}]
lappend res [.t index end]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t index end]
return $res
} -cleanup {
@@ -7562,18 +7635,18 @@ test text-33.11 {peer widget -start, -end} -body {
.t insert end "Line $i\n"
}
set res [.t index end]
- lappend res [catch {.t configure -start 5 -end 15}]
+ lappend res [catch {.t configure -startline 5 -endline 15}]
lappend res [.t index end]
- lappend res [catch {.t configure -start 10 -end 40}]
+ lappend res [catch {.t configure -startline 10 -endline 40}]
lappend res [.t index end]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t index end]
return $res
} -cleanup {
destroy .t
} -result {101.0 0 11.0 0 31.0 101.0}
-test text-34.1 {peer widget -start, -end and selection} -setup {
+test text-34.1 {peer widget -start, -endline and selection} -setup {
text .t
set res {}
} -body {
@@ -7582,17 +7655,17 @@ test text-34.1 {peer widget -start, -end and selection} -setup {
}
.t tag add sel 10.0 20.0
lappend res [.t tag ranges sel]
- .t configure -start 5 -end 30
+ .t configure -startline 5 -endline 30
lappend res [.t tag ranges sel]
- .t configure -start 5 -end 15
+ .t configure -startline 5 -endline 15
lappend res [.t tag ranges sel]
- .t configure -start 15 -end 30
+ .t configure -startline 15 -endline 30
lappend res [.t tag ranges sel]
- .t configure -start 15 -end 16
+ .t configure -startline 15 -endline 16
lappend res [.t tag ranges sel]
- .t configure -start 25 -end 30
+ .t configure -startline 25 -endline 30
lappend res [.t tag ranges sel]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7601,7 +7674,6 @@ test text-34.1 {peer widget -start, -end and selection} -setup {
test text-35.1 {widget dump -command alters tags} -setup {
proc Dumpy {key value index} {
-#puts "KK: $key, $value"
.t tag add $value [list $index linestart] [list $index lineend]
}
text .t
@@ -7615,7 +7687,6 @@ test text-35.1 {widget dump -command alters tags} -setup {
} -result {ok}
test text-35.2 {widget dump -command makes massive changes} -setup {
proc Dumpy {key value index} {
-#puts "KK: $key, $value"
.t delete 1.0 end
}
text .t
@@ -7629,7 +7700,6 @@ test text-35.2 {widget dump -command makes massive changes} -setup {
} -result {ok}
test text-35.3 {widget dump -command destroys widget} -setup {
proc Dumpy {key value index} {
-#puts "KK: $key, $value"
destroy .t
}
text .t
@@ -7651,8 +7721,8 @@ test text-36.1 "bug #1777362: event handling with hyphenated windows" -setup {
pack [set w [text .t-1]]
} -body {
tkwait visibility $w
- event generate $w <1>
- event generate $w <1>
+ event generate $w <Button-1>
+ event generate $w <Button-1>
update
set ::my_error
} -cleanup {
@@ -7669,8 +7739,8 @@ test text-36.2 "bug #1777362: event handling with hyphenated windows" -setup {
pack [set w [text .t+1]]
} -body {
tkwait visibility $w
- event generate $w <1>
- event generate $w <1>
+ event generate $w <Button-1>
+ event generate $w <Button-1>
update
set ::my_error
} -cleanup {
@@ -7687,8 +7757,8 @@ test text-36.3 "bug #1777362: event handling with hyphenated windows" -setup {
pack [set w [text .t*1]]
} -body {
tkwait visibility $w
- event generate $w <1>
- event generate $w <1>
+ event generate $w <Button-1>
+ event generate $w <Button-1>
update
set ::my_error
} -cleanup {
diff --git a/tests/textBTree.test b/tests/textBTree.test
index fd97afa..467e8dd 100644
--- a/tests/textBTree.test
+++ b/tests/textBTree.test
@@ -3,9 +3,9 @@
# several file with additional tests for other features of text widgets.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/textDisp.test b/tests/textDisp.test
index b35a107..540ae31 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkTextDisp.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -66,7 +66,15 @@ catch {destroy .f .t}
frame .f -width 100 -height 20
pack .f -side left
-set fixedFont {Courier -12}
+# On macOS the font "Courier New" has different metrics than "Courier",
+# and this causes tests 20.1 - 20.5 to fail. So we use "Courier" as the
+# fixed font for testing on Aqua.
+
+if {[tk windowingsystem] eq "aqua"} {
+ set fixedFont {Courier -12}
+} else {
+ set fixedFont {"Courier New" -12}
+}
# 15 on XP, 13 on Solaris 8
set fixedHeight [font metrics $fixedFont -linespace]
# 7 on all platforms
@@ -218,9 +226,9 @@ test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
.t delete 1.0 end
.t insert 1.0 "x\ty"
.t tag delete x y z
- .t tag configure x -tabs {50}
+ .t tag configure x -tabs 50
.t tag configure y -foreground black
- .t tag configure z -tabs {70}
+ .t tag configure z -tabs 70
.t tag add x 1.0 1.end
.t tag add y 1.0 1.end
.t tag add z 1.0 1.end
@@ -228,7 +236,7 @@ test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
set x [lindex [.t bbox 1.2] 0]
.t tag configure z -tabs {}
lappend x [lindex [.t bbox 1.2] 0]
- .t tag configure z -tabs {30}
+ .t tag configure z -tabs 30
.t tag raise x
update idletasks
lappend x [lindex [.t bbox 1.2] 0]
@@ -499,7 +507,7 @@ test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {textfonts} {
.t tag add x 1.0 end
.t tag add y 1.1 end
lindex [.t bbox 1.3] 0
-} {75}
+} 75
test textDisp-2.25 {LayoutDLine, tabs, breaking chunks at tabs} {textfonts} {
.t delete 1.0 end
.t tag delete x
@@ -713,7 +721,7 @@ test textDisp-4.12 {UpdateDisplayInfo, filling in extra vertical space} {
.t yview moveto 1
updateText
winfo ismapped .b
-} {0}
+} 0
.t configure -wrap word
.t delete 1.0 end
.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\n"
@@ -1341,11 +1349,11 @@ test textDisp-9.10 {TkTextRedrawTag} {
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
.t tag add big 1.0 2.0
updateText
- set tk_textRedraw {none}
+ set tk_textRedraw none
.t tag add big 1.3 1.5
updateText
set tk_textRedraw
-} {none}
+} none
test textDisp-9.11 {TkTextRedrawTag} {
.t configure -wrap char
.t delete 1.0 end
@@ -1838,7 +1846,7 @@ test textDisp-13.11 {TkTextSeeCmd procedure} {} {
set res [.top2.t2 compare $ref == $new]
destroy .top2
set res
-} {0}
+} 0
wm geom . {}
.t configure -wrap none
@@ -1904,13 +1912,13 @@ test textDisp-14.9 {TkTextXviewCmd procedure} {
} [list [expr {9.0/14}] 1.0]
test textDisp-14.10 {TkTextXviewCmd procedure} {
list [catch {.t xview scroll a} msg] $msg
-} {1 {wrong # args: should be ".t xview scroll number units|pages|pixels"}}
+} {1 {wrong # args: should be ".t xview scroll number pages|pixels|units"}}
test textDisp-14.11 {TkTextXviewCmd procedure} {
list [catch {.t xview scroll a b c} msg] $msg
-} {1 {wrong # args: should be ".t xview scroll number units|pages|pixels"}}
+} {1 {wrong # args: should be ".t xview scroll number pages|pixels|units"}}
test textDisp-14.12 {TkTextXviewCmd procedure} {
list [catch {.t xview scroll gorp units} msg] $msg
-} {1 {expected integer but got "gorp"}}
+} {1 {expected floating-point number but got "gorp"}}
test textDisp-14.13 {TkTextXviewCmd procedure} {
.t delete 1.0 end
.t insert end xxxxxxxxx\n
@@ -1941,7 +1949,7 @@ test textDisp-14.14 {TkTextXviewCmd procedure} {
} {2.21 2.20 2.99 2.84}
test textDisp-14.15 {TkTextXviewCmd procedure} {
list [catch {.t xview scroll 14 globs} msg] $msg
-} {1 {bad argument "globs": must be units, pages, or pixels}}
+} {1 {bad argument "globs": must be pages, pixels, or units}}
test textDisp-14.16 {TkTextXviewCmd procedure} {
list [catch {.t xview flounder} msg] $msg
} {1 {bad option "flounder": must be moveto or scroll}}
@@ -2027,7 +2035,7 @@ test textDisp-15.8 {Scrolling near end of window} {
set res [.tf.f.t compare $newind > $refind]
destroy .tf
set res
-} {1}
+} 1
.t configure -wrap char
.t delete 1.0 end
@@ -2124,16 +2132,16 @@ test textDisp-16.18 {TkTextYviewCmd procedure, "moveto" roundoff} {textfonts} {
} [list [expr {1.0/3}] [expr {5.0/6}]]
test textDisp-16.19 {TkTextYviewCmd procedure, "scroll" option} {
list [catch {.t yview scroll a} msg] $msg
-} {1 {wrong # args: should be ".t yview scroll number units|pages|pixels"}}
+} {1 {wrong # args: should be ".t yview scroll number pages|pixels|units"}}
test textDisp-16.20 {TkTextYviewCmd procedure, "scroll" option} {
list [catch {.t yview scroll a b c} msg] $msg
-} {1 {wrong # args: should be ".t yview scroll number units|pages|pixels"}}
+} {1 {wrong # args: should be ".t yview scroll number pages|pixels|units"}}
test textDisp-16.21 {TkTextYviewCmd procedure, "scroll" option} {
- list [catch {.t yview scroll badInt bogus} msg] $msg
-} {1 {bad argument "bogus": must be units, pages, or pixels}}
+ list [catch {.t yview scroll bogus bogus} msg] $msg
+} {1 {bad argument "bogus": must be pages, pixels, or units}}
test textDisp-16.21.2 {TkTextYviewCmd procedure, "scroll" option} {
- list [catch {.t yview scroll badInt units} msg] $msg
-} {1 {expected integer but got "badInt"}}
+ list [catch {.t yview scroll bogus units} msg] $msg
+} {1 {expected floating-point number but got "bogus"}}
test textDisp-16.22 {TkTextYviewCmd procedure, "scroll" option, back pages} {
.t yview 50.0
updateText
@@ -2142,7 +2150,7 @@ test textDisp-16.22 {TkTextYviewCmd procedure, "scroll" option, back pages} {
} {42.0}
test textDisp-16.22.1 {TkTextYviewCmd procedure, "scroll" option, back pages} {
list [catch {.t yview scroll -3 p} res] $res
-} {1 {ambiguous argument "p": must be units, pages, or pixels}}
+} {1 {ambiguous argument "p": must be pages, pixels, or units}}
test textDisp-16.23 {TkTextYviewCmd procedure, "scroll" option, back pages} {
.t yview 50.0
updateText
@@ -2187,7 +2195,7 @@ test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
incr res -1
}
set res
-} {102}
+} 102
test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
.t configure -height 1
updateText
@@ -2213,7 +2221,7 @@ test textDisp-16.31 {TkTextYviewCmd procedure, "scroll units" option} {
} {151.40}
test textDisp-16.32 {TkTextYviewCmd procedure} {
list [catch {.t yview scroll 12 bogoids} msg] $msg
-} {1 {bad argument "bogoids": must be units, pages, or pixels}}
+} {1 {bad argument "bogoids": must be pages, pixels, or units}}
test textDisp-16.33 {TkTextYviewCmd procedure} {
list [catch {.t yview bad_arg 1 2} msg] $msg
} {1 {bad option "bad_arg": must be moveto or scroll}}
@@ -2525,8 +2533,6 @@ test textDisp-18.8 {GetXView procedure} {
catch {rename bgerror {}}
catch {rename bogus {}}
.t configure -xscrollcommand {} -yscrollcommand scroll
-
-.t configure -xscrollcommand {} -yscrollcommand scroll
test textDisp-19.1 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -2671,66 +2677,66 @@ test textDisp-19.11 {GetYView procedure} {
} {0.5 1.0}
test textDisp-19.11.2 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 1.0 end
-} {20}
+} 20
test textDisp-19.11.3 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines end 1.0
-} {-20}
+} -20
test textDisp-19.11.4 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 1.1 1.3
-} {0}
+} 0
test textDisp-19.11.5 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.1
-} {0}
+} 0
test textDisp-19.11.5.1 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.5
-} {0}
+} 0
test textDisp-19.11.6 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.24
-} {1}
+} 1
test textDisp-19.11.7 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.40
-} {2}
+} 2
test textDisp-19.11.8 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines "16.0 displaylineend +1c" "16.0 lineend"
-} {3}
+} 3
test textDisp-19.11.9 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 lineend"
-} {4}
+} 4
test textDisp-19.11.10 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.11 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 +2displaylines"
-} {2}
+} 2
test textDisp-19.11.12 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines "16.0 +1displayline" "16.0 +2displaylines -1c"
-} {0}
+} 0
.t tag configure elide -elide 1
test textDisp-19.11.13 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +1displaylines +6c"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.14 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +1displaylines displaylineend"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.15 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
.t count -displaylines 16.0 "16.0 +4displaylines -1c"
-} {3}
+} 3
test textDisp-19.11.15a {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.16 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
.t count -displaylines 12.0 16.0
-} {2}
+} 2
test textDisp-19.11.17 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
@@ -2751,7 +2757,7 @@ test textDisp-19.11.19 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
.t count -displaylines 12.0 17.0
-} {4}
+} 4
test textDisp-19.11.20 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
@@ -3031,7 +3037,7 @@ set res [.tt.u count -displaylines 3.10 2.173]
destroy .tt
unset message
set res
-} {-1}
+} -1
.t delete 1.0 end
.t insert end "Line 1"
@@ -3518,7 +3524,7 @@ test textDisp-26.5 {AdjustForTab procedure, numeric alignment} {
.t tag add y 1.2
.t tag add y 1.5
lindex [.t bbox 1.3] 0
-} {120}
+} 120
test textDisp-26.6 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1,456.234
@@ -3527,7 +3533,7 @@ test textDisp-26.6 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.7] 0
-} {120}
+} 120
test textDisp-26.7 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1.456.234,7
@@ -3536,7 +3542,7 @@ test textDisp-26.7 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.11] 0
-} {120}
+} 120
test textDisp-26.8 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\ttest
@@ -3545,7 +3551,7 @@ test textDisp-26.8 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.6] 0
-} {120}
+} 120
test textDisp-26.9 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1234
@@ -3554,7 +3560,7 @@ test textDisp-26.9 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.6] 0
-} {120}
+} 120
test textDisp-26.10 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1.234567
@@ -3563,7 +3569,7 @@ test textDisp-26.10 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.5
lindex [.t bbox 1.3] 0
-} {120}
+} 120
test textDisp-26.11 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\tx=1.234567
@@ -3573,7 +3579,7 @@ test textDisp-26.11 {AdjustForTab procedure, numeric alignment} {
.t tag add y 1.7
.t tag add y 1.9
lindex [.t bbox 1.5] 0
-} {120}
+} 120
test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
.t delete 1.0 end
.t insert 1.0 a\tx1.234567
@@ -3586,7 +3592,7 @@ test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
.t window create 1.3 -window .b
updateText
lindex [.t bbox 1.5] 0
-} {120}
+} 120
test textDisp-26.13 {AdjustForTab procedure, not enough space} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "abc\txyz\tqrs\txyz\t0"
@@ -3743,7 +3749,7 @@ test textDisp-27.7.2 {SizeOfTab procedure, fractional tab interpolation problem}
.t configure -tabs $precisetab
updateText
expr {[lindex $res 0] - [lindex [.t bbox 1.20] 0]}
-} {0}
+} 0
.t configure -wrap char -tabs {} -width 20
updateText
@@ -3759,7 +3765,7 @@ test textDisp-27.9 {SizeOfTab procedure, left alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\txyzzyabc
.t tag delete x
- .t tag configure x -tabs {120}
+ .t tag configure x -tabs 120
.t tag add x 1.0 end
list [.t bbox 1.3] [.t bbox 1.4]
} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
@@ -3775,7 +3781,7 @@ test textDisp-27.11 {SizeOfTab procedure, making tabs at least as wide as a spac
.t delete 1.0 end
.t insert 1.0 abc\tdefghijklmnopqrst
.t tag delete x
- .t tag configure x -tabs {120}
+ .t tag configure x -tabs 120
.t tag add x 1.0 end
list [.t bbox 1.5] [.t bbox 1.6]
} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
@@ -3948,14 +3954,14 @@ test textDisp-30.1 {elidden text joining multiple logical lines} {
.t2.t tag configure elidden -elide 1 -background red
.t2.t tag add elidden 1.2 3.2
.t2.t count -displaylines 1.0 end
-} {1}
+} 1
test textDisp-30.2 {elidden text joining multiple logical lines} {
.t2.t delete 1.0 end
.t2.t insert 1.0 "1111\n2222\n3333"
.t2.t tag configure elidden -elide 1 -background red
.t2.t tag add elidden 1.2 2.2
.t2.t count -displaylines 1.0 end
-} {2}
+} 2
catch {destroy .t2}
.t configure -height 1
@@ -4262,7 +4268,7 @@ test textDisp-33.3 {one line longer than fits in the widget} {
# Each line should have been recalculated just once
.tt debug 0
expr {[llength $tk_textHeightCalc] == [.tt count -displaylines 1.0 end]}
-} {1}
+} 1
test textDisp-33.4 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
@@ -4333,7 +4339,7 @@ test textDisp-34.1 {Line heights recalculation problem: bug 2677890} -setup {
set negative
} -cleanup {
destroy .t1
-} -result {0}
+} -result 0
test textDisp-35.1 {Init value of charHeight - Dancing scrollbar bug 1499165} -setup {
pack [text .t1] -fill both -expand y -side left
diff --git a/tests/textImage.test b/tests/textImage.test
index 2666ec5..9c40045 100644
--- a/tests/textImage.test
+++ b/tests/textImage.test
@@ -4,7 +4,7 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/textIndex.test b/tests/textIndex.test
index 44b4184..faddcfa 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkTextIndex.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -30,7 +30,7 @@ wm deiconify .
abcdefghijklm
12345
Line 4
-b\u4e4fy GIrl .#@? x_yz
+b乏y GIrl .#@? x_yz
!@#$%
Line 7"
@@ -118,7 +118,7 @@ test textIndex-1.16 {TkTextMakeByteIndex: UTF-8 characters} {testtext} {
test textIndex-1.17 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \
{testtext} {
# ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType))
- # Wrong answer would be \xb9 (the 2nd byte of UTF rep of 0x4e4f).
+ # Wrong answer would be ¹ (the 2nd byte of UTF rep of 0x4e4f).
set x [testtext .t byteindex 5 2]
list $x [.t get insert]
@@ -128,7 +128,7 @@ test textIndex-1.18 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \
# ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType))
testtext .t byteindex 5 1
.t get insert
-} "\u4e4f"
+} "乏"
test textIndex-2.1 {TkTextMakeCharIndex} {
# (lineIndex < 0)
@@ -183,7 +183,7 @@ test textIndex-2.11 {TkTextMakeCharIndex: verify index is in range} {
} 3.4
test textIndex-2.12 {TkTextMakeCharIndex: verify index is in range} {
# (segPtr->typePtr == &tkTextCharType)
- # Wrong answer would be \xb9 (the 2nd byte of UTF rep of 0x4e4f).
+ # Wrong answer would be ¹ (the 2nd byte of UTF rep of 0x4e4f).
.t mark set insert 5.2
.t get insert
@@ -608,7 +608,7 @@ test textIndex-14.15 {TkTextIndexBackChars: UTF} {
} y
test textIndex-14.16 {TkTextIndexBackChars: UTF} {
.t get {5.3 - 2 chars}
-} \u4e4f
+} 乏
test textIndex-14.17 {TkTextIndexBackChars: UTF} {
.t get {5.3 - 3 chars}
} b
@@ -809,7 +809,7 @@ test textIndex-19.12.1 {Display lines} {
test textIndex-19.12.2 {Display lines} {
.t compare [.t index "2.50 + 100 displaylines"] == "end - 1 c"
-} {1}
+} 1
test textIndex-19.13 {Display lines} {
destroy {*}[pack content .]
@@ -883,19 +883,19 @@ test textIndex-21.9 {text index wordend} {
text_test_word worde "x.y" end-1
} 2
test textIndex-21.10 {text index wordend, unicode} {
- text_test_word wordend "xyz\u00c7de fg" 0
+ text_test_word wordend "xyzÇde fg" 0
} 6
test textIndex-21.11 {text index wordend, unicode} {
- text_test_word wordend "xyz\uc700de fg" 0
+ text_test_word wordend "xyz윀de fg" 0
} 6
test textIndex-21.12 {text index wordend, unicode} {
- text_test_word wordend "xyz\u203fde fg" 0
+ text_test_word wordend "xyz‿de fg" 0
} 6
test textIndex-21.13 {text index wordend, unicode} {
- text_test_word wordend "xyz\u2045de fg" 0
+ text_test_word wordend "xyz⁅de fg" 0
} 3
test textIndex-21.14 {text index wordend, unicode} {
- text_test_word wordend "\uc700\uc700 abc" 8
+ text_test_word wordend "윀윀 abc" 8
} 6
test textIndex-22.5 {text index wordstart} {
@@ -917,19 +917,19 @@ test textIndex-22.10 {text index wordstart} {
text_test_word wordstart "one two three" end-5
} 7
test textIndex-22.11 {text index wordstart, unicode} {
- text_test_word wordstart "one tw\u00c7o three" 7
+ text_test_word wordstart "one twÇo three" 7
} 4
test textIndex-22.12 {text index wordstart, unicode} {
- text_test_word wordstart "ab\uc700\uc700 cdef ghi" 12
+ text_test_word wordstart "ab윀윀 cdef ghi" 12
} 10
test textIndex-22.13 {text index wordstart, unicode} {
- text_test_word wordstart "\uc700\uc700 abc" 8
+ text_test_word wordstart "윀윀 abc" 8
} 3
test textIndex-22.14 {text index wordstart, unicode, start index at internal segment start} {
catch {destroy .t}
text .t
- .t insert end "C'est du texte en fran\u00e7ais\n"
- .t insert end "\u042D\u0442\u043E\u0020\u0442\u0435\u043A\u0441\u0442\u0020\u043D\u0430\u0020\u0440\u0443\u0441\u0441\u043A\u043E\u043C"
+ .t insert end "C'est du texte en français\n"
+ .t insert end "Это текст на русском"
.t mark set insert 1.23
set res [.t index "1.23 wordstart"]
.t mark set insert 2.16
diff --git a/tests/textMark.test b/tests/textMark.test
index 4d2e623..bbe839f 100644
--- a/tests/textMark.test
+++ b/tests/textMark.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkTextMark.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -52,7 +52,7 @@ test textMark-1.4 {TkTextMarkCmd - "gravity" option} -body {
} -result {right 1.4}
test textMark-1.5 {TkTextMarkCmd - "gravity" option} -body {
.t mark set x 1.3
- .t mark g x left
+ .t mark gr x left
.t insert 1.3 x
list [.t mark gravity x] [.t index x]
} -result {left 1.3}
@@ -177,7 +177,7 @@ test textMark-6.4 {TkTextMarkNameToIndex, with mark outside -startline/-endline
} -result {1 {bad text index "mymark"} 1.0 1.0 1 {bad text index "mymark"} L 1 {bad text index "mymark"}}
test textMark-6.5 {insert and current marks in an empty peer - bug 3487407} -body {
.t mark set insert 1.0
- .t configure -start 5 -end 5
+ .t configure -startline 5 -endline 5
set res [.t index insert]
} -cleanup {
.t configure -startline {} -endline {}
diff --git a/tests/textTag.test b/tests/textTag.test
index 9e5ccdc..2d25f4c 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkTextTag.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -11,21 +11,32 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+set textWidgetFont {Courier 12}
+set bigFont {Courier 24}
+
+# what is needed is a font that is both fixed-width and featuring a
+# specific size because in some tests (that will be constrained by
+# haveFontSizes), a tag applying the $bigFont will be set to some
+# characters, which action has the effect of changing what character
+# is under the mouse pointer, which is the purpose of the tests
+testConstraint haveFontSizes [expr {
+ [font metrics $textWidgetFont -fixed] &&
+ [font actual $textWidgetFont -size] == 12 &&
+ [font metrics $bigFont -fixed] &&
+ [font actual $bigFont -size] == 24 }
+]
+
testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
destroy .t
text .t -width 20 -height 10
-testConstraint haveCourier12 [expr {[catch {
- .t configure -font {Courier 12}
-}] == 0}]
pack .t -expand 1 -fill both
update
.t debug on
wm geometry . {}
-set bigFont {Helvetica 24}
# The statements below reset the main window; it's needed if the window
# manager is mwm, to make mwm forget about a previous minimum size setting.
@@ -43,130 +54,96 @@ bOy GIrl .#@? x_yz
!@#$%
Line 7"
-test textTag-1.1 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.1 {tag configuration options} -body {
.t tag configure x -background #012345
.t tag cget x -background
} -cleanup {
.t tag configure x -background [lindex [.t tag configure x -background] 3]
} -result {#012345}
-test textTag-1.2 {configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.2 {configuration options} -body {
.t tag configure x -background non-existent
} -cleanup {
.t tag configure x -background [lindex [.t tag configure x -background] 3]
} -returnCodes error -result {unknown color name "non-existent"}
-test textTag-1.3 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.3 {tag configuration options} -body {
.t tag configure x -bgstipple gray50
.t tag cget x -bgstipple
} -cleanup {
.t tag configure x -bgstipple [lindex [.t tag configure x -bgstipple] 3]
} -result {gray50}
-test textTag-1.4 {configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.4 {configuration options} -body {
.t tag configure x -bgstipple badStipple
} -cleanup {
.t tag configure x -bgstipple [lindex [.t tag configure x -bgstipple] 3]
} -returnCodes error -result {bitmap "badStipple" not defined}
-test textTag-1.5 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.5 {tag configuration options} -body {
.t tag configure x -borderwidth 2
.t tag cget x -borderwidth
} -cleanup {
.t tag configure x -borderwidth [lindex [.t tag configure x -borderwidth] 3]
-} -result {2}
-test textTag-1.6 {configuration options} -constraints {
- haveCourier12
-} -body {
+} -result 2
+test textTag-1.6 {configuration options} -body {
.t tag configure x -borderwidth 46q
} -cleanup {
.t tag configure x -borderwidth [lindex [.t tag configure x -borderwidth] 3]
} -returnCodes error -result {bad screen distance "46q"}
-test textTag-1.7 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.7 {tag configuration options} -body {
.t tag configure x -fgstipple gray25
.t tag cget x -fgstipple
} -cleanup {
.t tag configure x -fgstipple [lindex [.t tag configure x -fgstipple] 3]
} -result {gray25}
-test textTag-1.8 {configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.8 {configuration options} -body {
.t tag configure x -fgstipple bogus
} -cleanup {
.t tag configure x -fgstipple [lindex [.t tag configure x -fgstipple] 3]
} -returnCodes error -result {bitmap "bogus" not defined}
-test textTag-1.9 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.9 {tag configuration options} -body {
.t tag configure x -font fixed
.t tag cget x -font
} -cleanup {
.t tag configure x -font [lindex [.t tag configure x -font] 3]
} -result {fixed}
-test textTag-1.10 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.10 {tag configuration options} -body {
.t tag configure x -foreground #001122
.t tag cget x -foreground
} -cleanup {
.t tag configure x -foreground [lindex [.t tag configure x -foreground] 3]
} -result {#001122}
-test textTag-1.11 {configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.11 {configuration options} -body {
.t tag configure x -foreground {silly color}
} -cleanup {
.t tag configure x -foreground [lindex [.t tag configure x -foreground] 3]
} -returnCodes error -result {unknown color name "silly color"}
-test textTag-1.12 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.12 {tag configuration options} -body {
.t tag configure x -justify left
.t tag cget x -justify
} -cleanup {
.t tag configure x -justify [lindex [.t tag configure x -justify] 3]
} -result {left}
-test textTag-1.13 {configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.13 {configuration options} -body {
.t tag configure x -justify middle
} -cleanup {
.t tag configure x -justify [lindex [.t tag configure x -justify] 3]
} -returnCodes error -result {bad justification "middle": must be left, right, or center}
-test textTag-1.14 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.14 {tag configuration options} -body {
.t tag configure x -lmargin1 10
.t tag cget x -lmargin1
} -cleanup {
.t tag configure x -lmargin1 [lindex [.t tag configure x -lmargin1] 3]
-} -result {10}
-test textTag-1.15 {configuration options} -constraints {
- haveCourier12
-} -body {
+} -result 10
+test textTag-1.15 {configuration options} -body {
.t tag configure x -lmargin1 bad
} -cleanup {
.t tag configure x -lmargin1 [lindex [.t tag configure x -lmargin1] 3]
} -returnCodes error -result {bad screen distance "bad"}
-test textTag-1.16 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.16 {tag configuration options} -body {
.t tag configure x -lmargin2 10
.t tag cget x -lmargin2
} -cleanup {
.t tag configure x -lmargin2 [lindex [.t tag configure x -lmargin2] 3]
-} -result {10}
-test textTag-1.17 {configuration options} -constraints {
- haveCourier12
-} -body {
+} -result 10
+test textTag-1.17 {configuration options} -body {
.t tag configure x -lmargin2 bad
} -cleanup {
.t tag configure x -lmargin2 [lindex [.t tag configure x -lmargin2] 3]
@@ -182,32 +159,24 @@ test textTag-1.17b {configuration options} -body {
} -cleanup {
.t tag configure x -lmargincolor [lindex [.t tag configure x -lmargincolor] 3]
} -returnCodes error -result {unknown color name "non-existent"}
-test textTag-1.18 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.18 {tag configuration options} -body {
.t tag configure x -offset 2
.t tag cget x -offset
} -cleanup {
.t tag configure x -offset [lindex [.t tag configure x -offset] 3]
-} -result {2}
-test textTag-1.19 {configuration options} -constraints {
- haveCourier12
-} -body {
+} -result 2
+test textTag-1.19 {configuration options} -body {
.t tag configure x -offset 100xyz
} -cleanup {
.t tag configure x -offset [lindex [.t tag configure x -offset] 3]
} -returnCodes error -result {bad screen distance "100xyz"}
-test textTag-1.20 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.20 {tag configuration options} -body {
.t tag configure x -overstrike on
.t tag cget x -overstrike
} -cleanup {
.t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3]
} -result {on}
-test textTag-1.21 {configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.21 {configuration options} -body {
.t tag configure x -overstrike stupid
} -cleanup {
.t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3]
@@ -223,32 +192,24 @@ test textTag-1.21b {configuration options} -body {
} -cleanup {
.t tag configure x -overstrikefg [lindex [.t tag configure x -overstrikefg] 3]
} -returnCodes error -result {unknown color name "stupid"}
-test textTag-1.22 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.22 {tag configuration options} -body {
.t tag configure x -relief raised
.t tag cget x -relief
} -cleanup {
.t tag configure x -relief [lindex [.t tag configure x -relief] 3]
} -result {raised}
-test textTag-1.23 {configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.23 {configuration options} -body {
.t tag configure x -relief stupid
} -cleanup {
.t tag configure x -relief [lindex [.t tag configure x -relief] 3]
} -returnCodes error -result {bad relief "stupid": must be flat, groove, raised, ridge, solid, or sunken}
-test textTag-1.24 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.24 {tag configuration options} -body {
.t tag configure x -rmargin 10
.t tag cget x -rmargin
} -cleanup {
.t tag configure x -rmargin [lindex [.t tag configure x -rmargin] 3]
-} -result {10}
-test textTag-1.25 {configuration options} -constraints {
- haveCourier12
-} -body {
+} -result 10
+test textTag-1.25 {configuration options} -body {
.t tag configure x -rmargin bad
} -cleanup {
.t tag configure x -rmargin [lindex [.t tag configure x -rmargin] 3]
@@ -286,77 +247,57 @@ test textTag-1.25f {configuration options} -body {
} -cleanup {
.t tag configure x -selectforeground [lindex [.t tag configure x -selectforeground] 3]
} -returnCodes error -result {unknown color name "non-existent"}
-test textTag-1.26 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.26 {tag configuration options} -body {
.t tag configure x -spacing1 10
.t tag cget x -spacing1
} -cleanup {
.t tag configure x -spacing1 [lindex [.t tag configure x -spacing1] 3]
-} -result {10}
-test textTag-1.27 {configuration options} -constraints {
- haveCourier12
-} -body {
+} -result 10
+test textTag-1.27 {configuration options} -body {
.t tag configure x -spacing1 bad
} -cleanup {
.t tag configure x -spacing1 [lindex [.t tag configure x -spacing1] 3]
} -returnCodes error -result {bad screen distance "bad"}
-test textTag-1.28 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.28 {tag configuration options} -body {
.t tag configure x -spacing2 10
.t tag cget x -spacing2
} -cleanup {
.t tag configure x -spacing2 [lindex [.t tag configure x -spacing2] 3]
-} -result {10}
-test textTag-1.29 {configuration options} -constraints {
- haveCourier12
-} -body {
+} -result 10
+test textTag-1.29 {configuration options} -body {
.t tag configure x -spacing2 bad
} -cleanup {
.t tag configure x -spacing2 [lindex [.t tag configure x -spacing2] 3]
} -returnCodes error -result {bad screen distance "bad"}
-test textTag-1.30 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.30 {tag configuration options} -body {
.t tag configure x -spacing3 10
.t tag cget x -spacing3
} -cleanup {
.t tag configure x -spacing3 [lindex [.t tag configure x -spacing3] 3]
-} -result {10}
-test textTag-1.31 {configuration options} -constraints {
- haveCourier12
-} -body {
+} -result 10
+test textTag-1.31 {configuration options} -body {
.t tag configure x -spacing3 bad
} -cleanup {
.t tag configure x -spacing3 [lindex [.t tag configure x -spacing3] 3]
} -returnCodes error -result {bad screen distance "bad"}
-test textTag-1.32 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.32 {tag configuration options} -body {
.t tag configure x -tabs {10 20 30}
.t tag cget x -tabs
} -cleanup {
.t tag configure x -tabs [lindex [.t tag configure x -tabs] 3]
} -result {10 20 30}
-test textTag-1.33 {configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.33 {configuration options} -body {
.t tag configure x -tabs {10 fork}
} -cleanup {
.t tag configure x -tabs [lindex [.t tag configure x -tabs] 3]
} -returnCodes error -result {bad tab alignment "fork": must be left, right, center, or numeric}
-test textTag-1.34 {tag configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.34 {tag configuration options} -body {
.t tag configure x -underline no
.t tag cget x -underline
} -cleanup {
.t tag configure x -underline [lindex [.t tag configure x -underline] 3]
} -result {no}
-test textTag-1.35 {configuration options} -constraints {
- haveCourier12
-} -body {
+test textTag-1.35 {configuration options} -body {
.t tag configure x -underline stupid
} -cleanup {
.t tag configure x -underline [lindex [.t tag configure x -underline] 3]
@@ -374,43 +315,29 @@ test textTag-1.37 {configuration options} -body {
} -returnCodes error -result {unknown color name "stupid"}
-test textTag-2.1 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -body {
+test textTag-2.1 {TkTextTagCmd - "add" option} -body {
.t tag
} -returnCodes error -result {wrong # args: should be ".t tag option ?arg ...?"}
-test textTag-2.2 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -body {
+test textTag-2.2 {TkTextTagCmd - "add" option} -body {
.t tag gorp
} -returnCodes error -result {bad tag option "gorp": must be add, bind, cget, configure, delete, lower, names, nextrange, prevrange, raise, ranges, or remove}
-test textTag-2.3 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -body {
+test textTag-2.3 {TkTextTagCmd - "add" option} -body {
.t tag add foo
} -returnCodes error -result {wrong # args: should be ".t tag add tagName index1 ?index2 index1 index2 ...?"}
-test textTag-2.4 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -body {
+test textTag-2.4 {TkTextTagCmd - "add" option} -body {
.t tag add x gorp
} -returnCodes error -result {bad text index "gorp"}
-test textTag-2.5 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -body {
+test textTag-2.5 {TkTextTagCmd - "add" option} -body {
.t tag add x 1.2 gorp
} -returnCodes error -result {bad text index "gorp"}
-test textTag-2.6 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-2.6 {TkTextTagCmd - "add" option} -setup {
.t tag delete sel
} -body {
.t tag add sel 3.2 3.4
.t tag add sel 3.2 3.0
.t tag ranges sel
} -result {3.2 3.4}
-test textTag-2.7 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-2.7 {TkTextTagCmd - "add" option} -setup {
.t tag delete x
} -body {
.t tag add x 1.0 1.end
@@ -418,9 +345,7 @@ test textTag-2.7 {TkTextTagCmd - "add" option} -constraints {
} -cleanup {
.t tag delete x
} -result {1.0 1.6}
-test textTag-2.8 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-2.8 {TkTextTagCmd - "add" option} -setup {
.t tag remove x 1.0 end
} -body {
.t tag add x 1.2
@@ -428,9 +353,7 @@ test textTag-2.8 {TkTextTagCmd - "add" option} -constraints {
} -cleanup {
.t tag delete x
} -result {1.2 1.3}
-test textTag-2.9 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-2.9 {TkTextTagCmd - "add" option} -setup {
destroy .t.e
} -body {
entry .t.e
@@ -442,9 +365,7 @@ test textTag-2.9 {TkTextTagCmd - "add" option} -constraints {
} -cleanup {
destroy .t.e
} -result 34
-test textTag-2.10 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-2.10 {TkTextTagCmd - "add" option} -setup {
destroy .t.e
} -body {
entry .t.e
@@ -457,23 +378,19 @@ test textTag-2.10 {TkTextTagCmd - "add" option} -constraints {
} -cleanup {
destroy .t.e
} -result {Text}
-test textTag-2.11 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -body {
+test textTag-2.11 {TkTextTagCmd - "add" option} -body {
.t tag remove sel 1.0 end
.t tag add sel 1.1 1.5 2.4 3.1 4.2 4.4
.t tag ranges sel
} -result {1.1 1.5 2.4 3.1 4.2 4.4}
-test textTag-2.12 {TkTextTagCmd - "add" option} -constraints {
- haveCourier12
-} -body {
+test textTag-2.12 {TkTextTagCmd - "add" option} -body {
.t tag remove sel 1.0 end
.t tag add sel 1.1 1.5 2.4
.t tag ranges sel
} -cleanup {
.t tag remove sel 1.0 end
} -result {1.1 1.5 2.4 2.5}
-test textTag-2.14 {tag add before -startline - Bug 1615425} haveCourier12 {
+test textTag-2.14 {tag add before -startline - Bug 1615425} -body {
text .tt
for {set i 1} {$i <10} {incr i} {
.tt insert end "Line $i\n"
@@ -485,44 +402,32 @@ test textTag-2.14 {tag add before -startline - Bug 1615425} haveCourier12 {
.tt tag add mytag 1.0 1.end
destroy .ptt .tt
set res 1
-} {1}
+} -result 1
-test textTag-3.1 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.1 {TkTextTagCmd - "bind" option} -body {
.t tag bind
} -returnCodes error -result {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"}
-test textTag-3.2 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.2 {TkTextTagCmd - "bind" option} -body {
.t tag bind 1 2 3 4
} -returnCodes error -result {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"}
-test textTag-3.3 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.3 {TkTextTagCmd - "bind" option} -body {
.t tag bind x <Enter> script1
.t tag bind x <Enter>
} -cleanup {
.t tag delete x
} -result {script1}
-test textTag-3.4 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.4 {TkTextTagCmd - "bind" option} -body {
.t tag bind x <Gorp> script2
} -returnCodes error -result {bad event type or keysym "Gorp"}
-test textTag-3.5 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.5 {TkTextTagCmd - "bind" option} -body {
.t tag delete x
.t tag bind x <Enter> script1
.t tag bind x <FocusIn> script2
} -cleanup {
.t tag delete x
} -returnCodes error -result {requested illegal events; only key, button, motion, enter, leave, and virtual events may be used}
-test textTag-3.6 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.6 {TkTextTagCmd - "bind" option} -body {
.t tag delete x
.t tag bind x <Enter> script1
catch {.t tag bind x <FocusIn> script2}
@@ -530,9 +435,7 @@ test textTag-3.6 {TkTextTagCmd - "bind" option} -constraints {
} -cleanup {
.t tag delete x
} -result {<Enter>}
-test textTag-3.7 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.7 {TkTextTagCmd - "bind" option} -body {
.t tag delete x
.t tag bind x <Enter> script1
.t tag bind x <Leave> script2
@@ -541,9 +444,7 @@ test textTag-3.7 {TkTextTagCmd - "bind" option} -constraints {
} -cleanup {
.t tag delete x
} -result {{<Enter> <Leave> a} script1 xyzzy}
-test textTag-3.8 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.8 {TkTextTagCmd - "bind" option} -body {
.t tag delete x
.t tag bind x <Enter> script1
.t tag bind x <Enter> +script2
@@ -552,17 +453,13 @@ test textTag-3.8 {TkTextTagCmd - "bind" option} -constraints {
.t tag delete x
} -result {script1
script2}
-test textTag-3.9 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.9 {TkTextTagCmd - "bind" option} -body {
.t tag delete x
.t tag bind x <Enter>
} -cleanup {
.t tag delete x
} -returnCodes ok -result {}
-test textTag-3.10 {TkTextTagCmd - "bind" option} -constraints {
- haveCourier12
-} -body {
+test textTag-3.10 {TkTextTagCmd - "bind" option} -body {
.t tag delete x
.t tag bind x <
} -cleanup {
@@ -570,30 +467,20 @@ test textTag-3.10 {TkTextTagCmd - "bind" option} -constraints {
} -returnCodes error -result {no event type or button # or keysym}
-test textTag-4.1 {TkTextTagCmd - "cget" option} -constraints {
- haveCourier12
-} -body {
+test textTag-4.1 {TkTextTagCmd - "cget" option} -body {
.t tag cget a
} -returnCodes error -result {wrong # args: should be ".t tag cget tagName option"}
-test textTag-4.2 {TkTextTagCmd - "cget" option} -constraints {
- haveCourier12
-} -body {
+test textTag-4.2 {TkTextTagCmd - "cget" option} -body {
.t tag cget a b c
} -returnCodes error -result {wrong # args: should be ".t tag cget tagName option"}
-test textTag-4.3 {TkTextTagCmd - "cget" option} -constraints {
- haveCourier12
-} -body {
+test textTag-4.3 {TkTextTagCmd - "cget" option} -body {
.t tag delete foo
.t tag cget foo bar
} -returnCodes error -result {tag "foo" isn't defined in text widget}
-test textTag-4.4 {TkTextTagCmd - "cget" option} -constraints {
- haveCourier12
-} -body {
+test textTag-4.4 {TkTextTagCmd - "cget" option} -body {
.t tag cget sel bogus
} -returnCodes error -result {unknown option "bogus"}
-test textTag-4.5 {TkTextTagCmd - "cget" option} -constraints {
- haveCourier12
-} -body {
+test textTag-4.5 {TkTextTagCmd - "cget" option} -body {
.t tag delete x
.t tag configure x -background red
.t tag cget x -background
@@ -602,26 +489,18 @@ test textTag-4.5 {TkTextTagCmd - "cget" option} -constraints {
} -result {red}
-test textTag-5.1 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.1 {TkTextTagCmd - "configure" option} -body {
.t tag configure
-} -returnCodes error -result {wrong # args: should be ".t tag configure tagName ?-option? ?value? ?-option value ...?"}
-test textTag-5.2 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+} -returnCodes error -result {wrong # args: should be ".t tag configure tagName ?-option value ...?"}
+test textTag-5.2 {TkTextTagCmd - "configure" option} -body {
.t tag configure x -foo
} -returnCodes error -result {unknown option "-foo"}
-test textTag-5.3 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.3 {TkTextTagCmd - "configure" option} -body {
.t tag configure x -background red -underline
} -cleanup {
.t tag delete x
} -returnCodes error -result {value for "-underline" missing}
-test textTag-5.4 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.4 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -underline yes
.t tag configure x -underline
@@ -635,9 +514,7 @@ test textTag-5.4a {TkTextTagCmd - "configure" option} -body {
} -cleanup {
.t tag delete x
} -result {-underlinefg {} {} {} lightgreen}
-test textTag-5.5 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.5 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -overstrike on
.t tag cget x -overstrike
@@ -651,58 +528,44 @@ test textTag-5.5a {TkTextTagCmd - "configure" option} -body {
} -cleanup {
.t tag delete x
} -result {-overstrikefg {} {} {} lightgreen}
-test textTag-5.6 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.6 {TkTextTagCmd - "configure" option} -body {
.t tag configure x -overstrike foo
} -cleanup {
.t tag delete x
} -returnCodes error -result {expected boolean value but got "foo"}
-test textTag-5.7 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.7 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -underline stupid
} -cleanup {
.t tag delete x
} -returnCodes error -result {expected boolean value but got "stupid"}
-test textTag-5.8 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.8 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -justify left
.t tag configure x -justify
} -cleanup {
.t tag delete x
} -result {-justify {} {} {} left}
-test textTag-5.9 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.9 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -justify bogus
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad justification "bogus": must be left, right, or center}
-test textTag-5.10 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.10 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -justify fill
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad justification "fill": must be left, right, or center}
-test textTag-5.11 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.11 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -offset 2
.t tag configure x -offset
} -cleanup {
.t tag delete x
} -result {-offset {} {} {} 2}
-test textTag-5.12 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.12 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -offset 1.0q
} -cleanup {
@@ -721,17 +584,13 @@ test textTag-5.13 {TkTextTagCmd - "configure" option} -body {
{-rmargin {} {} {} 5} \
{-lmargincolor {} {} {} darkblue} {-rmargincolor {} {} {} lightgreen} \
]
-test textTag-5.14 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.14 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -lmargin1 2.0x
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad screen distance "2.0x"}
-test textTag-5.15 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.15 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -lmargin2 gorp
} -cleanup {
@@ -743,9 +602,7 @@ test textTag-5.15a {TkTextTagCmd - "configure" option} -body {
} -cleanup {
.t tag delete x
} -returnCodes error -result {unknown color name "rainbow"}
-test textTag-5.16 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.16 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -rmargin 140.1.1
} -cleanup {
@@ -758,9 +615,7 @@ test textTag-5.16a {TkTextTagCmd - "configure" option} -body {
.t tag delete x
} -returnCodes error -result {unknown color name "rainbow"}
.t tag delete x
-test textTag-5.17 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.17 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -spacing1 2 -spacing2 4 -spacing3 6
list [.t tag configure x -spacing1] [.t tag configure x -spacing2] \
@@ -768,33 +623,25 @@ test textTag-5.17 {TkTextTagCmd - "configure" option} -constraints {
} -cleanup {
.t tag delete x
} -result {{-spacing1 {} {} {} 2} {-spacing2 {} {} {} 4} {-spacing3 {} {} {} 6}}
-test textTag-5.18 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.18 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -spacing1 2.0x
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad screen distance "2.0x"}
-test textTag-5.19 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.19 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -spacing1 lousy
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad screen distance "lousy"}
-test textTag-5.20 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.20 {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -spacing1 4.2.3
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad screen distance "4.2.3"}
-test textTag-5.21 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.21 {TkTextTagCmd - "configure" option} -body {
.t configure -selectborderwidth 2 -selectforeground blue \
-selectbackground black
.t tag configure sel -borderwidth 4 -foreground green -background yellow
@@ -804,9 +651,7 @@ test textTag-5.21 {TkTextTagCmd - "configure" option} -constraints {
}
return $x
} -result {4 green yellow}
-test textTag-5.22 {TkTextTagCmd - "configure" option} -constraints {
- haveCourier12
-} -body {
+test textTag-5.22 {TkTextTagCmd - "configure" option} -body {
.t configure -selectborderwidth 20
.t tag configure sel -borderwidth {}
.t cget -selectborderwidth
@@ -858,19 +703,13 @@ test textTag-5.24 {TkTextTagCmd - "configure" option} -body {
return $x
} -result {yellow blue red white}
-test textTag-6.1 {TkTextTagCmd - "delete" option} -constraints {
- haveCourier12
-} -body {
+test textTag-6.1 {TkTextTagCmd - "delete" option} -body {
.t tag delete
} -returnCodes error -result {wrong # args: should be ".t tag delete tagName ?tagName ...?"}
-test textTag-6.2 {TkTextTagCmd - "delete" option} -constraints {
- haveCourier12
-} -body {
+test textTag-6.2 {TkTextTagCmd - "delete" option} -body {
.t tag delete zork
} -returnCodes ok -result {}
-test textTag-6.3 {TkTextTagCmd - "delete" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-6.3 {TkTextTagCmd - "delete" option} -setup {
.t tag delete {*}[.t tag names]
} -body {
.t tag config x -background black
@@ -881,9 +720,7 @@ test textTag-6.3 {TkTextTagCmd - "delete" option} -constraints {
} -cleanup {
.t tag delete x
} -result {sel x}
-test textTag-6.4 {TkTextTagCmd - "delete" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-6.4 {TkTextTagCmd - "delete" option} -setup {
.t tag delete {*}[.t tag names]
} -body {
.t tag config x -background black
@@ -892,9 +729,7 @@ test textTag-6.4 {TkTextTagCmd - "delete" option} -constraints {
eval .t tag delete [.t tag names]
.t tag names
} -result {sel}
-test textTag-6.5 {TkTextTagCmd - "delete" option} -constraints {
- haveCourier12
-} -body {
+test textTag-6.5 {TkTextTagCmd - "delete" option} -body {
.t tag bind x <Enter> foo
.t tag delete x
.t tag configure x -background black
@@ -904,24 +739,16 @@ test textTag-6.5 {TkTextTagCmd - "delete" option} -constraints {
} -result {}
-test textTag-7.1 {TkTextTagCmd - "lower" option} -constraints {
- haveCourier12
-} -body {
+test textTag-7.1 {TkTextTagCmd - "lower" option} -body {
.t tag lower
} -returnCodes error -result {wrong # args: should be ".t tag lower tagName ?belowThis?"}
-test textTag-7.2 {TkTextTagCmd - "lower" option} -constraints {
- haveCourier12
-} -body {
+test textTag-7.2 {TkTextTagCmd - "lower" option} -body {
.t tag lower foo
} -returnCodes error -result {tag "foo" isn't defined in text widget}
-test textTag-7.3 {TkTextTagCmd - "lower" option} -constraints {
- haveCourier12
-} -body {
+test textTag-7.3 {TkTextTagCmd - "lower" option} -body {
.t tag lower sel bar
} -returnCodes error -result {tag "bar" isn't defined in text widget}
-test textTag-7.4 {TkTextTagCmd - "lower" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-7.4 {TkTextTagCmd - "lower" option} -setup {
.t tag delete {*}[.t tag names]
.t tag remove sel 1.0 end
foreach i {a b c d} {
@@ -933,9 +760,7 @@ test textTag-7.4 {TkTextTagCmd - "lower" option} -constraints {
} -cleanup {
.t tag delete {*}[.t tag names]
} -result {c sel a b d}
-test textTag-7.5 {TkTextTagCmd - "lower" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-7.5 {TkTextTagCmd - "lower" option} -setup {
.t tag delete {*}[.t tag names]
.t tag remove sel 1.0 end
foreach i {a b c d} {
@@ -947,9 +772,7 @@ test textTag-7.5 {TkTextTagCmd - "lower" option} -constraints {
} -cleanup {
.t tag delete {*}[.t tag names]
} -result {sel a d b c}
-test textTag-7.6 {TkTextTagCmd - "lower" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-7.6 {TkTextTagCmd - "lower" option} -setup {
.t tag delete {*}[.t tag names]
.t tag remove sel 1.0 end
foreach i {a b c d} {
@@ -963,16 +786,12 @@ test textTag-7.6 {TkTextTagCmd - "lower" option} -constraints {
} -result {sel b a c d}
-test textTag-8.1 {TkTextTagCmd - "names" option} -constraints {
- haveCourier12
-} -body {
+test textTag-8.1 {TkTextTagCmd - "names" option} -body {
.t tag names a b
} -cleanup {
.t tag delete {*}[.t tag names]
} -returnCodes error -result {wrong # args: should be ".t tag names ?index?"}
-test textTag-8.2 {TkTextTagCmd - "names" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-8.2 {TkTextTagCmd - "names" option} -setup {
.t tag delete {*}[.t tag names]
.t tag remove sel 1.0 end
foreach i {a b c d} {
@@ -983,9 +802,7 @@ test textTag-8.2 {TkTextTagCmd - "names" option} -constraints {
} -cleanup {
.t tag delete {*}[.t tag names]
} -result {sel a b c d}
-test textTag-8.3 {TkTextTagCmd - "names" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-8.3 {TkTextTagCmd - "names" option} -setup {
.t tag delete {*}[.t tag names]
.t tag remove sel 1.0 end
foreach i {a b c d} {
@@ -1000,24 +817,16 @@ test textTag-8.3 {TkTextTagCmd - "names" option} -constraints {
} -result {c {a b}}
-test textTag-9.1 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -body {
+test textTag-9.1 {TkTextTagCmd - "nextrange" option} -body {
.t tag nextrange x
} -returnCodes error -result {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"}
-test textTag-9.2 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -body {
+test textTag-9.2 {TkTextTagCmd - "nextrange" option} -body {
.t tag nextrange x 1 2 3
} -returnCodes error -result {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"}
-test textTag-9.3 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -body {
+test textTag-9.3 {TkTextTagCmd - "nextrange" option} -body {
.t tag nextrange foo 1.0
} -returnCodes ok -result {}
-test textTag-9.4 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.4 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1025,9 +834,7 @@ test textTag-9.4 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad text index "foo"}
-test textTag-9.5 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.5 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1037,9 +844,7 @@ test textTag-9.5 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad text index "bar"}
-test textTag-9.6 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.6 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1049,9 +854,7 @@ test textTag-9.6 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.3 2.5}
-test textTag-9.7 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.7 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1061,9 +864,7 @@ test textTag-9.7 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.3 2.5}
-test textTag-9.8 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.8 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1073,9 +874,7 @@ test textTag-9.8 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.3 2.5}
-test textTag-9.9 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.9 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1085,9 +884,7 @@ test textTag-9.9 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.9 3.1}
-test textTag-9.10 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.10 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1097,9 +894,7 @@ test textTag-9.10 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {}
-test textTag-9.11 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.11 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1109,9 +904,7 @@ test textTag-9.11 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.9 3.1}
-test textTag-9.12 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.12 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1121,9 +914,7 @@ test textTag-9.12 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.9 3.1}
-test textTag-9.13 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.13 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1133,9 +924,7 @@ test textTag-9.13 {TkTextTagCmd - "nextrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {7.2 7.3}
-test textTag-9.14 {TkTextTagCmd - "nextrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-9.14 {TkTextTagCmd - "nextrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1147,28 +936,20 @@ test textTag-9.14 {TkTextTagCmd - "nextrange" option} -constraints {
} -result {}
-test textTag-10.1 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -body {
+test textTag-10.1 {TkTextTagCmd - "prevrange" option} -body {
.t tag prevrange x
} -returnCodes error -result {wrong # args: should be ".t tag prevrange tagName index1 ?index2?"}
-test textTag-10.2 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -body {
+test textTag-10.2 {TkTextTagCmd - "prevrange" option} -body {
.t tag prevrange x 1 2 3
} -returnCodes error -result {wrong # args: should be ".t tag prevrange tagName index1 ?index2?"}
-test textTag-10.3 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.3 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag prevrange foo end
} -cleanup {
.t tag delete x
} -returnCodes ok -result {}
-test textTag-10.4 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.4 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1178,9 +959,7 @@ test textTag-10.4 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad text index "foo"}
-test textTag-10.5 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.5 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1190,9 +969,7 @@ test textTag-10.5 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -returnCodes error -result {bad text index "bar"}
-test textTag-10.6 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.6 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1202,9 +979,7 @@ test textTag-10.6 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {7.2 7.3}
-test textTag-10.7 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.7 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1214,9 +989,7 @@ test textTag-10.7 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.3 2.5}
-test textTag-10.8 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.8 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1226,9 +999,7 @@ test textTag-10.8 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.3 2.5}
-test textTag-10.9 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.9 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1238,9 +1009,7 @@ test textTag-10.9 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.3 2.5}
-test textTag-10.10 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.10 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1250,9 +1019,7 @@ test textTag-10.10 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {}
-test textTag-10.11 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.11 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1262,9 +1029,7 @@ test textTag-10.11 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {}
-test textTag-10.12 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.12 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1274,9 +1039,7 @@ test textTag-10.12 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.3 2.5}
-test textTag-10.13 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.13 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1286,9 +1049,7 @@ test textTag-10.13 {TkTextTagCmd - "prevrange" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.9 3.1}
-test textTag-10.14 {TkTextTagCmd - "prevrange" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-10.14 {TkTextTagCmd - "prevrange" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.3 2.5
@@ -1300,24 +1061,16 @@ test textTag-10.14 {TkTextTagCmd - "prevrange" option} -constraints {
} -result {}
-test textTag-11.1 {TkTextTagCmd - "raise" option} -constraints {
- haveCourier12
-} -body {
+test textTag-11.1 {TkTextTagCmd - "raise" option} -body {
.t tag raise
} -returnCodes error -result {wrong # args: should be ".t tag raise tagName ?aboveThis?"}
-test textTag-11.2 {TkTextTagCmd - "raise" option} -constraints {
- haveCourier12
-} -body {
+test textTag-11.2 {TkTextTagCmd - "raise" option} -body {
.t tag raise foo
} -returnCodes error -result {tag "foo" isn't defined in text widget}
-test textTag-11.3 {TkTextTagCmd - "raise" option} -constraints {
- haveCourier12
-} -body {
+test textTag-11.3 {TkTextTagCmd - "raise" option} -body {
.t tag raise sel bar
} -returnCodes error -result {tag "bar" isn't defined in text widget}
-test textTag-11.4 {TkTextTagCmd - "raise" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-11.4 {TkTextTagCmd - "raise" option} -setup {
.t tag delete {*}[.t tag names]
.t tag remove sel 1.0 end
foreach i {a b c d} {
@@ -1329,9 +1082,7 @@ test textTag-11.4 {TkTextTagCmd - "raise" option} -constraints {
} -cleanup {
.t tag delete {*}[.t tag names]
} -result {sel a b d c}
-test textTag-11.5 {TkTextTagCmd - "raise" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-11.5 {TkTextTagCmd - "raise" option} -setup {
.t tag delete {*}[.t tag names]
.t tag remove sel 1.0 end
foreach i {a b c d} {
@@ -1343,9 +1094,7 @@ test textTag-11.5 {TkTextTagCmd - "raise" option} -constraints {
} -cleanup {
.t tag delete {*}[.t tag names]
} -result {sel a b d c}
-test textTag-11.6 {TkTextTagCmd - "raise" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-11.6 {TkTextTagCmd - "raise" option} -setup {
.t tag delete {*}[.t tag names]
.t tag remove sel 1.0 end
foreach i {a b c d} {
@@ -1359,20 +1108,14 @@ test textTag-11.6 {TkTextTagCmd - "raise" option} -constraints {
} -result {sel b c a d}
-test textTag-12.1 {TkTextTagCmd - "ranges" option} -constraints {
- haveCourier12
-} -body {
+test textTag-12.1 {TkTextTagCmd - "ranges" option} -body {
.t tag ranges
} -returnCodes error -result {wrong # args: should be ".t tag ranges tagName"}
-test textTag-12.2 {TkTextTagCmd - "ranges" option} -constraints {
- haveCourier12
-} -body {
+test textTag-12.2 {TkTextTagCmd - "ranges" option} -body {
.t tag delete x
.t tag ranges x
} -result {}
-test textTag-12.3 {TkTextTagCmd - "ranges" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-12.3 {TkTextTagCmd - "ranges" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.2
@@ -1382,9 +1125,7 @@ test textTag-12.3 {TkTextTagCmd - "ranges" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.2 2.3 2.7 4.6 5.2 5.5}
-test textTag-12.4 {TkTextTagCmd - "ranges" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-12.4 {TkTextTagCmd - "ranges" option} -setup {
.t tag delete x
} -body {
.t tag add x 1.0 3.0
@@ -1395,14 +1136,10 @@ test textTag-12.4 {TkTextTagCmd - "ranges" option} -constraints {
} -result {1.0 3.0 4.0 8.0}
-test textTag-13.1 {TkTextTagCmd - "remove" option} -constraints {
- haveCourier12
-} -body {
+test textTag-13.1 {TkTextTagCmd - "remove" option} -body {
.t tag remove
} -returnCodes error -result {wrong # args: should be ".t tag remove tagName index1 ?index2 index1 index2 ...?"}
-test textTag-13.2 {TkTextTagCmd - "remove" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-13.2 {TkTextTagCmd - "remove" option} -setup {
.t tag delete x
} -body {
.t tag add x 2.2 2.11
@@ -1411,9 +1148,7 @@ test textTag-13.2 {TkTextTagCmd - "remove" option} -constraints {
} -cleanup {
.t tag delete x
} -result {2.2 2.3 2.7 2.11}
-test textTag-13.3 {TkTextTagCmd - "remove" option} -constraints {
- haveCourier12
-} -setup {
+test textTag-13.3 {TkTextTagCmd - "remove" option} -setup {
destroy .t.e
} -body {
entry .t.e
@@ -1429,7 +1164,7 @@ test textTag-13.3 {TkTextTagCmd - "remove" option} -constraints {
} -result {Text}
-test textTag-14.1 {SortTags} -constraints haveCourier12 -setup {
+test textTag-14.1 {SortTags} -setup {
.t tag delete a b c d
} -body {
foreach i {a b c d} {
@@ -1440,7 +1175,7 @@ test textTag-14.1 {SortTags} -constraints haveCourier12 -setup {
.t tag delete a b c d
} -result {a b c d}
.t tag delete a b c d
-test textTag-14.2 {SortTags} -constraints haveCourier12 -setup {
+test textTag-14.2 {SortTags} -setup {
.t tag delete a b c d
} -body {
foreach i {a b c d} {
@@ -1453,7 +1188,7 @@ test textTag-14.2 {SortTags} -constraints haveCourier12 -setup {
} -cleanup {
.t tag delete a b c d
} -result {a b c d}
-test textTag-14.3 {SortTags} -constraints haveCourier12 -setup {
+test textTag-14.3 {SortTags} -setup {
.t tag delete {*}[.t tag names]
} -body {
for {set i 0} {$i < 30} {incr i} {
@@ -1463,7 +1198,7 @@ test textTag-14.3 {SortTags} -constraints haveCourier12 -setup {
} -cleanup {
.t tag delete {*}[.t tag names]
} -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29}
-test textTag-14.4 {SortTags} -constraints haveCourier12 -setup {
+test textTag-14.4 {SortTags} -setup {
.t tag delete {*}[.t tag names]
} -body {
for {set i 0} {$i < 30} {incr i} {
@@ -1478,7 +1213,8 @@ test textTag-14.4 {SortTags} -constraints haveCourier12 -setup {
} -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29}
-
+set curFont [.t cget -font]
+set curWrap [.t cget -wrap]
set c [.t bbox 2.1]
set x1 [expr {[lindex $c 0] + [lindex $c 2]/2}]
set y1 [expr {[lindex $c 1] + [lindex $c 3]/2}]
@@ -1488,8 +1224,17 @@ set y2 [expr {[lindex $c 1] + [lindex $c 3]/2}]
set c [.t bbox 4.3]
set x3 [expr {[lindex $c 0] + [lindex $c 2]/2}]
set y3 [expr {[lindex $c 1] + [lindex $c 3]/2}]
+.t configure -font $textWidgetFont -wrap none
+update
+set c [.t bbox 2.1]
+set x4 [expr [lindex $c 0] + [lindex $c 2]/2]
+set y4 [expr [lindex $c 1] + [lindex $c 3]/2]
+set c [.t bbox 3.2]
+set x5 [expr [lindex $c 0] + [lindex $c 2]/2]
+set y5 [expr [lindex $c 1] + [lindex $c 3]/2]
+.t configure -font $curFont -wrap $curWrap
-test textTag-15.1 {TkTextBindProc} -constraints haveCourier12 -setup {
+test textTag-15.1 {TkTextBindProc} -setup {
.t tag delete x y
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5
@@ -1516,18 +1261,18 @@ test textTag-15.1 {TkTextBindProc} -constraints haveCourier12 -setup {
bind .t <ButtonRelease> {}
} -result {x-up up up y-up up}
-test textTag-15.2 {TkTextBindProc} -constraints haveCourier12 -setup {
+test textTag-15.2 {TkTextBindProc} -setup {
.t tag delete x y
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
.t tag bind x <Enter> {lappend x x-enter}
- .t tag bind x <ButtonPress> {lappend x x-down}
+ .t tag bind x <Button> {lappend x x-down}
.t tag bind x <ButtonRelease> {lappend x x-up}
.t tag bind x <Leave> {lappend x x-leave}
.t tag bind y <Enter> {lappend x y-enter}
- .t tag bind y <ButtonPress> {lappend x y-down}
+ .t tag bind y <Button> {lappend x y-down}
.t tag bind y <ButtonRelease> {lappend x y-up}
.t tag bind y <Leave> {lappend x y-leave}
event gen .t <Motion> -x 0 -y 0
@@ -1546,19 +1291,19 @@ test textTag-15.2 {TkTextBindProc} -constraints haveCourier12 -setup {
.t tag delete x y
} -result {x-enter | x-down | | x-up x-leave y-enter}
-test textTag-15.3 {TkTextBindProc} -constraints haveCourier12 -setup {
+test textTag-15.3 {TkTextBindProc} -setup {
.t tag delete x y
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
.t tag bind x <Enter> {lappend x x-enter}
- .t tag bind x <Any-ButtonPress-1> {lappend x x-down}
- .t tag bind x <Any-ButtonRelease-1> {lappend x x-up}
+ .t tag bind x <Button-1> {lappend x x-down}
+ .t tag bind x <ButtonRelease-1> {lappend x x-up}
.t tag bind x <Leave> {lappend x x-leave}
.t tag bind y <Enter> {lappend x y-enter}
- .t tag bind y <Any-ButtonPress-1> {lappend x y-down}
- .t tag bind y <Any-ButtonRelease-1> {lappend x y-up}
+ .t tag bind y <Button-1> {lappend x y-down}
+ .t tag bind y <ButtonRelease-1> {lappend x y-up}
.t tag bind y <Leave> {lappend x y-leave}
event gen .t <Motion> -x 0 -y 0
set x {}
@@ -1581,9 +1326,7 @@ test textTag-15.3 {TkTextBindProc} -constraints haveCourier12 -setup {
} -result {x-enter | x-down | | | x-up | x-leave y-enter}
-test textTag-16.1 {TkTextPickCurrent procedure} -constraints {
- haveCourier12
-} -setup {
+test textTag-16.1 {TkTextPickCurrent procedure} -setup {
.t tag delete {*}[.t tag names]
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5
@@ -1606,29 +1349,29 @@ test textTag-16.1 {TkTextPickCurrent procedure} -constraints {
} -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3}
test textTag-16.2 {TkTextPickCurrent procedure} -constraints {
- haveCourier12 failsOnUbuntuNoXft
+ haveFontSizes failsOnUbuntuNoXft
} -setup {
.t tag delete {*}[.t tag names]
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
+ .t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
# update needed here to stabilize the test
update
- event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
- event gen .t <Motion> -x $x2 -y $y2
+ event gen .t <ButtonRelease-1> -state 0x100 -x $x4 -y $y4
+ event gen .t <Motion> -x $x5 -y $y5
set x [.t index current]
.t tag add big 3.0
update
lappend x [.t index current]
} -cleanup {
.t tag delete big
+ .t configure -font $curFont -wrap $curWrap
} -result {3.2 3.1}
-test textTag-16.3 {TkTextPickCurrent procedure} -constraints {
- haveCourier12
-} -setup {
+test textTag-16.3 {TkTextPickCurrent procedure} -setup {
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -1657,9 +1400,7 @@ test textTag-16.3 {TkTextPickCurrent procedure} -constraints {
.t tag delete {*}[.t tag names]
} -result {enter-a enter-b | leave-b enter-c | leave-a leave-c}
-test textTag-16.4 {TkTextPickCurrent procedure} -constraints {
- haveCourier12
-} -setup {
+test textTag-16.4 {TkTextPickCurrent procedure} -setup {
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -1688,7 +1429,7 @@ test textTag-16.4 {TkTextPickCurrent procedure} -constraints {
} -result {enter-a enter-b enter-c | leave-c leave-b}
test textTag-16.5 {TkTextPickCurrent procedure} -constraints {
- haveCourier12
+ haveFontSizes
} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
@@ -1696,19 +1437,21 @@ test textTag-16.5 {TkTextPickCurrent procedure} -constraints {
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
+ .t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
- event gen .t <Motion> -x $x1 -y $y1
+ event gen .t <Motion> -x $x4 -y $y4
.t tag bind a <Enter> {.t tag add big 3.0 3.2}
.t tag add a 3.2
- event gen .t <Motion> -x $x2 -y $y2
+ event gen .t <Motion> -x $x5 -y $y5
.t index current
} -cleanup {
.t tag delete a big
+ .t configure -font $curFont -wrap $curWrap
} -result {3.2}
test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
- haveCourier12 failsOnUbuntuNoXft
+ haveFontSizes failsOnUbuntuNoXft
} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
@@ -1716,20 +1459,22 @@ test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
+ .t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
- event gen .t <Motion> -x $x1 -y $y1
+ event gen .t <Motion> -x $x4 -y $y4
.t tag bind a <Enter> {.t tag add big 3.0 3.2}
.t tag add a 3.2
- event gen .t <Motion> -x $x2 -y $y2
+ event gen .t <Motion> -x $x5 -y $y5
update
.t index current
} -cleanup {
.t tag delete a big
+ .t configure -font $curFont -wrap $curWrap
} -result {3.1}
test textTag-16.7 {TkTextPickCurrent procedure} -constraints {
- haveCourier12 failsOnUbuntuNoXft
+ haveFontSizes failsOnUbuntuNoXft
} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
@@ -1737,19 +1482,21 @@ test textTag-16.7 {TkTextPickCurrent procedure} -constraints {
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
+ .t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
.t tag bind a <Enter> {.t tag add big 3.0 3.2}
.t tag add a 3.2
- event gen .t <Motion> -x $x1 -y $y1
+ event gen .t <Motion> -x $x4 -y $y4
.t tag bind a <Leave> {.t tag add big 3.0 3.2}
.t tag add a 2.1
- event gen .t <Motion> -x $x2 -y $y2
+ event gen .t <Motion> -x $x5 -y $y5
update
.t index current
} -cleanup {
.t tag delete a big
+ .t configure -font $curFont -wrap $curWrap
} -result {3.1}
diff --git a/tests/textWind.test b/tests/textWind.test
index 5b99126..d7dab90 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkTextWind.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -173,7 +173,7 @@ test textWind-2.7 {TkTextWindowCmd procedure, "cget" option} -setup {
.t window cget .f -pady
} -cleanup {
destroy .f
-} -returnCodes ok -result {2}
+} -returnCodes ok -result 2
test textWind-2.8 {TkTextWindowCmd procedure} -body {
.t window co
} -returnCodes error -result {wrong # args: should be ".t window configure index ?-option value ...?"}
@@ -1409,7 +1409,7 @@ test textWind-17.1 {peer widgets and embedded windows} -setup {
update
destroy .t .tt
winfo exists .f
-} -result {0}
+} -result 0
test textWind-17.2 {peer widgets and embedded windows} -setup {
destroy .t .f .tt
diff --git a/tests/tk.test b/tests/tk.test
index d2e9044..0316a7b 100644
--- a/tests/tk.test
+++ b/tests/tk.test
@@ -1,21 +1,23 @@
# This file is a Tcl script to test the tk command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2002 ActiveState Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 2002 ActiveState Corporation.
package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
+testConstraint testprintf [llength [info command testprintf]]
+
test tk-1.1 {tk command: general} -body {
tk
} -returnCodes error -result {wrong # args: should be "tk subcommand ?arg ...?"}
test tk-1.2 {tk command: general} -body {
tk xyz
-} -returnCodes error -result {unknown or ambiguous subcommand "xyz": must be appname, busy, caret, fontchooser, inactive, scaling, useinputmethods, or windowingsystem}
+} -returnCodes error -result {unknown or ambiguous subcommand "xyz": must be appname, busy, caret, fontchooser, inactive, print, scaling, sysnotify, systray, useinputmethods, or windowingsystem}
# Value stored to restore default settings after 2.* tests
set appname [tk appname]
@@ -28,7 +30,7 @@ test tk-2.2 {tk command: appname} -body {
test tk-2.3 {tk command: appname} -constraints unix -body {
tk appname bazfoogarply
expr {[lsearch -exact [winfo interps] [tk appname]] >= 0}
-} -result {1}
+} -result 1
test tk-2.4 {tk command: appname} -body {
tk appname [tk appname]
} -result [tk appname]
@@ -64,21 +66,21 @@ test tk-3.7 {tk command: scaling: set new} -body {
test tk-3.8 {tk command: scaling: negative} -body {
tk scaling -1
expr {[tk scaling] > 0}
-} -result {1}
+} -result 1
test tk-3.9 {tk command: scaling: too big} -body {
tk scaling 1000000
expr {[tk scaling] < 10000}
-} -result {1}
+} -result 1
test tk-3.10 {tk command: scaling: widthmm} -body {
tk scaling 1.25
expr {int((25.4*[winfo screenwidth .])/(72*1.25) + 0.5) \
- [winfo screenmmwidth .]}
-} -result {0}
+} -result 0
test tk-3.11 {tk command: scaling: heightmm} -body {
tk scaling 1.25
expr {int((25.4*[winfo screenheight .])/(72*1.25) + 0.5) \
- [winfo screenmmheight .]}
-} -result {0}
+} -result 0
tk scaling $scaling
# Value stored to restore default settings after 4.* tests
@@ -137,7 +139,7 @@ test tk-5.5 {tk caret} -body {
} -result {-height 12 -x 10 -y 11}
test tk-5.6 {tk caret} -body {
tk caret . -x 20 -y 25 -h 30; tk caret . -hei
-} -result {30}
+} -result 30
# tk inactive
test tk-6.1 {tk inactive} -body {
@@ -177,6 +179,10 @@ test tk-7.2 {tk inactive reset in a safe interpreter} -body {
::safe::interpDelete foo
} -returnCodes 1 -result {resetting the user inactivity timer is not allowed in a safe interpreter}
+test tk-8.1 {Test for ticket [1cc44617e2], see if TCL_LL_MODIFIER works as expected on all platforms} -constraints testprintf -body {
+ testprintf -21474836480
+} -result {-21474836480 18446744052234715136}
+
# tests of [tk busy] in busy.test
# cleanup
diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl
index 8a75ba7..8f0234d 100644
--- a/tests/ttk/all.tcl
+++ b/tests/ttk/all.tcl
@@ -4,12 +4,12 @@
# tests. Execute it by invoking "source all.tcl" when running tktest
# in this directory.
#
-# Copyright © 2007 by the Tk developers.
+# Copyright © 2007 the Tk developers.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require Tk ;# This is the Tk test suite; fail early if no Tk!
+package require tk ;# This is the Tk test suite; fail early if no Tk!
package require tcltest 2.2
tcltest::configure {*}$argv
tcltest::configure -testdir [file normalize [file dirname [info script]]]
diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test
index 8b8c9b7..248db96 100644
--- a/tests/ttk/checkbutton.test
+++ b/tests/ttk/checkbutton.test
@@ -2,7 +2,7 @@
# ttk::checkbutton widget tests.
#
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -57,7 +57,7 @@ test checkbutton-1.7 "Button destroyed by click" -body {
pack .top.mb
focus -force .top.mb
update
- event generate .top.mb <1>
+ event generate .top.mb <Button-1>
event generate .top.mb <ButtonRelease-1>
update ; # shall not trigger error invalid command name ".top.b"
} -result {}
@@ -71,4 +71,18 @@ test checkbutton-1.8 "Empty -variable" -body {
destroy .cbev
} -result {}
+test checkbutton-2.1 "style command" -body {
+ ttk::checkbutton .w
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {{} TCheckbutton TCheckbutton}
+test checkbutton-2.2 "style command" -body {
+ ttk::style configure customStyle.TCheckbutton
+ ttk::checkbutton .w -style customStyle.TCheckbutton
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.TCheckbutton customStyle.TCheckbutton TCheckbutton}
+
tcltest::cleanupTests
diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test
index 48179f3..a5627d2 100644
--- a/tests/ttk/combobox.test
+++ b/tests/ttk/combobox.test
@@ -2,7 +2,7 @@
# ttk::combobox widget tests
#
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -86,4 +86,18 @@ test combobox-1890211 "ComboboxSelected event after listbox unposted" -body {
destroy .cb
}
+test combobox-4.1 "style command" -body {
+ ttk::combobox .w
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {{} TCombobox TCombobox}
+test combobox-4.2 "style command" -body {
+ ttk::style configure customStyle.TCombobox
+ ttk::combobox .w -style customStyle.TCombobox
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.TCombobox customStyle.TCombobox TCombobox}
+
tcltest::cleanupTests
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test
index 384f297..5bd85cb 100644
--- a/tests/ttk/entry.test
+++ b/tests/ttk/entry.test
@@ -2,7 +2,7 @@
# Tile package: entry widget tests
#
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -67,6 +67,12 @@ test entry-1.7 "Deletion - insert cursor in the middle " -body {
.e index insert
} -result 0
+test entry-1.8 "Index is between 0 and end" -body {
+ .e delete 0 end
+ .e insert end abcde
+ set res [list [.e index -1] [.e index -4] [.e index 999]]
+} -result {0 0 5}
+
test entry-1.done "Cleanup" -body { destroy .e }
# Scrollbar tests.
@@ -87,7 +93,7 @@ test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constra
pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \
-expand false -fill x
update ; # no error
- lappend res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update
+ set res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update
} -result 1 -cleanup {destroy .te .tsb}
test entry-2.2 "Initial scroll position" -body {
@@ -110,7 +116,7 @@ test entry-3.0 "Series 3 setup" -body {
variable cw [font measure $fixed a]
variable ch [font metrics $fixed -linespace]
variable bd 2 ;# border + padding
- variable ux [font measure $fixed \u4e4e]
+ variable ux [font measure $fixed 乎]
pack [ttk::entry .e -font $fixed -width 20]
update
@@ -328,7 +334,37 @@ test entry-9.1 "Index range invariants" -setup {
destroy .e
}
-test entry-10.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup {
+test entry-10.1 {configuration option: "-placeholder"} -setup {
+ pack [ttk::entry .e]
+} -body {
+ .e configure -placeholder {Some text}
+ .e cget -placeholder
+} -cleanup {
+ destroy .e
+} -result {Some text}
+
+test entry-10.2 {configuration option: "-placeholderforeground"} -setup {
+ pack [ttk::entry .e]
+} -body {
+ .e configure -placeholder {Some text} -placeholderforeground red
+ .e cget -placeholderforeground
+} -cleanup {
+ destroy .e
+} -result {red}
+
+test entry-10.3 {styling option: "-placeholderforeground"} -setup {
+ pack [ttk::entry .e]
+} -body {
+ set current [ttk::style configure TEntry -placeholderforeground]
+ ttk::style configure TEntry -placeholderforeground blue
+ set res [ttk::style configure TEntry -placeholderforeground]
+ ttk::style configure TEntry -placeholderforeground $current
+ set res
+} -cleanup {
+ destroy .e
+} -result {blue}
+
+test entry-11.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup {
pack [ttk::entry .e]
update
} -body {
@@ -340,4 +376,18 @@ test entry-10.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup
destroy .e
}
+test entry-12.1 "style command" -body {
+ ttk::entry .w
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {{} TEntry TEntry}
+test entry-12.2 "style command" -body {
+ ttk::style configure customStyle.TEntry
+ ttk::entry .w -style customStyle.TEntry
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.TEntry customStyle.TEntry TEntry}
+
tcltest::cleanupTests
diff --git a/tests/ttk/image.test b/tests/ttk/image.test
index bb593fc..51f0f00 100644
--- a/tests/ttk/image.test
+++ b/tests/ttk/image.test
@@ -1,4 +1,4 @@
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test
index 9ffffd8..d81d33d 100644
--- a/tests/ttk/labelframe.test
+++ b/tests/ttk/labelframe.test
@@ -1,4 +1,4 @@
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -128,4 +128,18 @@ test labelframe-6.1 "Stacking order" -body {
destroy .t
} -result [list .t.x1 .t.lf .t.lb .t.x2]
+test labelframe-7.1 "style command" -body {
+ ttk::labelframe .w
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {{} TLabelframe TLabelframe}
+test labelframe-7.2 "style command" -body {
+ ttk::style configure customStyle.TLabelframe
+ ttk::labelframe .w -style customStyle.TLabelframe
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.TLabelframe customStyle.TLabelframe TLabelframe}
+
tcltest::cleanupTests
diff --git a/tests/ttk/layout.test b/tests/ttk/layout.test
index 5dfce9b..31ef1f5 100644
--- a/tests/ttk/layout.test
+++ b/tests/ttk/layout.test
@@ -1,4 +1,4 @@
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test
index e58812a..8c2e186 100644
--- a/tests/ttk/notebook.test
+++ b/tests/ttk/notebook.test
@@ -1,4 +1,4 @@
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -512,4 +512,18 @@ test notebook-1343984-2 "don't autoselect on destroy" -body {
set ::history
} -result [list DESTROY .nb.frame1 DESTROY .nb.frame2 DESTROY .nb.frame3]
+test notebook-8.1 "style command" -body {
+ ttk::notebook .w
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {{} TNotebook TNotebook}
+test notebook-8.2 "style command" -body {
+ ttk::style configure customStyle.TNotebook
+ ttk::notebook .w -style customStyle.TNotebook
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.TNotebook customStyle.TNotebook TNotebook}
+
tcltest::cleanupTests
diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test
index 528d56b..d9909c0 100644
--- a/tests/ttk/panedwindow.test
+++ b/tests/ttk/panedwindow.test
@@ -1,4 +1,4 @@
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -289,4 +289,22 @@ test paned-propagation-5 "Pane change after map, on-axis" -body {
test paned-propagation-cleanup "Clean up." -body { destroy .pw }
+test panedwindow-6.1 "style command" -body {
+ # Contrary to ttk::scrollbar, ttk::progressbar and ttk::scale,
+ # ttk::panedwindow has same style TPanedwindow whatever -orient is
+ ttk::panedwindow .wv ; # default is -orient vertical
+ ttk::panedwindow .wh -orient horizontal
+ list [.wv cget -style] [.wv style] [winfo class .wv]\
+ [.wh cget -style] [.wh style] [winfo class .wh]
+} -cleanup {
+ destroy .wv .wh
+} -result {{} TPanedwindow TPanedwindow {} TPanedwindow TPanedwindow}
+test panedwindow-6.2 "style command" -body {
+ ttk::style configure customStyle.TPanedwindow
+ ttk::panedwindow .w -style customStyle.TPanedwindow
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.TPanedwindow customStyle.TPanedwindow TPanedwindow}
+
tcltest::cleanupTests
diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test
index 464469e..80e51ea 100644
--- a/tests/ttk/progressbar.test
+++ b/tests/ttk/progressbar.test
@@ -1,4 +1,4 @@
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -83,4 +83,59 @@ test progressbar-end "Cleanup" -body {
destroy .pb
}
+# check existence and default value of each non-core option of the widget
+test progressbar-3.1 "progressbar non-core options" -setup {
+ set res {}
+ ttk::progressbar .defaultpb
+} -body {
+ foreach option {-anchor -foreground -justify -style -text -wraplength \
+ -length -maximum -mode -orient -phase -value -variable} {
+ lappend res [.defaultpb cget $option]
+ }
+ set res
+} -cleanup {
+ unset res
+ destroy .defaultpb
+} -result {w black left {} {} 0 100 100 determinate horizontal 0 0.0 {}}
+
+test progressbar-3.2 "TIP #442 options are taken into account" -setup {
+ set res {}
+ pack [ttk::progressbar .p -value 0 -maximum 50 -orient horizontal -mode determinate -length 500]
+ set thefont [font actual {Arial 10}]
+} -body {
+ .p configure -anchor c -foreground blue -justify right \
+ -text "TIP #442\noptions are now tested" -wraplength 100
+ update
+ .p step 10
+ .p configure -anchor e -font $thefont -foreground green -justify center \
+ -text "Changing the value of each option\nfrom TIP #442" -wraplength 250
+ update
+ .p step 20
+ .p configure -orient vertical -text "Cannot be seen"
+ update
+ foreach option {-anchor -foreground -justify -text -wraplength} {
+ lappend res [list $option [.p cget $option]]
+ }
+ set res
+} -cleanup {
+ unset res thefont
+ destroy .p
+} -result {{-anchor e} {-foreground green} {-justify center} {-text {Cannot be seen}} {-wraplength 250}}
+
+test progressbar-4.1 "style command" -body {
+ ttk::progressbar .wh ; # default is -orient horizontal
+ ttk::progressbar .wv -orient vertical
+ list [.wh cget -style] [.wh style] [winfo class .wh]\
+ [.wv cget -style] [.wv style] [winfo class .wv]
+} -cleanup {
+ destroy .wh .wv
+} -result {{} Horizontal.TProgressbar TProgressbar {} Vertical.TProgressbar TProgressbar}
+test progressbar-4.2 "style command" -body {
+ ttk::style configure customStyle.Vertical.TProgressbar
+ ttk::progressbar .w -orient vertical -style customStyle.Vertical.TProgressbar
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.Vertical.TProgressbar Vertical.customStyle.Vertical.TProgressbar TProgressbar}
+
tcltest::cleanupTests
diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test
index 09abcb8..6de5b5e 100644
--- a/tests/ttk/radiobutton.test
+++ b/tests/ttk/radiobutton.test
@@ -2,7 +2,7 @@
# ttk::radiobutton widget tests.
#
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -46,4 +46,18 @@ test radiobutton-1.8 "Reset radiobutton variable" -body {
list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate]
} -result {1 0 0}
+test radiobutton-2.1 "style command" -body {
+ ttk::radiobutton .w
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {{} TRadiobutton TRadiobutton}
+test radiobutton-2.2 "style command" -body {
+ ttk::style configure customStyle.TRadiobutton
+ ttk::radiobutton .w -style customStyle.TRadiobutton
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.TRadiobutton customStyle.TRadiobutton TRadiobutton}
+
tcltest::cleanupTests
diff --git a/tests/ttk/scale.test b/tests/ttk/scale.test
new file mode 100644
index 0000000..0851cb6
--- /dev/null
+++ b/tests/ttk/scale.test
@@ -0,0 +1,53 @@
+package require tk
+package require tcltest 2.2
+namespace import -force tcltest::*
+loadTestedCommands
+
+test scale-1.0 "Self-destruction" -body {
+ trace variable v w { destroy .s ;# }
+ ttk::scale .s -variable v
+ pack .s ; update
+ .s set 1 ; update
+} -returnCodes error -match glob -result "*"
+
+test scale-2.1 "-state option" -setup {
+ ttk::scale .s
+ set res ""
+} -body {
+ # defaults
+ lappend res [.s instate disabled] [.s cget -state]
+ # set -state: instate returns accordingly
+ .s configure -state disabled
+ lappend res [.s instate disabled] [.s cget -state]
+ # back to normal
+ .s configure -state normal
+ lappend res [.s instate disabled] [.s cget -state]
+ # use state command: -state does NOT reflect it
+ .s state disabled
+ lappend res [.s instate disabled] [.s cget -state]
+ # further use state command
+ .s state readonly
+ lappend res [.s state] [.s cget -state]
+} -cleanup {
+ destroy .s
+ unset -nocomplain res
+} -result {0 normal 1 disabled 0 normal 1 normal {disabled readonly} normal}
+
+test scale-3.1 "style command" -body {
+ ttk::scale .wh ; # default is -orient horizontal
+ ttk::scale .wv -orient vertical
+ list [.wh cget -style] [.wh style] [winfo class .wh] \
+ [.wv cget -style] [.wv style] [winfo class .wv]
+} -cleanup {
+ destroy .wh .wv
+} -result {{} Horizontal.TScale TScale {} Vertical.TScale TScale}
+test scale-3.2 "style command" -body {
+ ttk::style configure customStyle.Vertical.TScale
+ ttk::scale .w -orient vertical -style customStyle.Vertical.TScale
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.Vertical.TScale Vertical.customStyle.Vertical.TScale TScale}
+
+tcltest::cleanupTests
+
diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test
index 9faa771..6d35bea 100644
--- a/tests/ttk/scrollbar.test
+++ b/tests/ttk/scrollbar.test
@@ -1,4 +1,4 @@
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -71,39 +71,65 @@ test scrollbar-1.3 "Change orientation" -body {
expr {$h < $w}
} -result 1
-#
-# Scale tests:
-#
-
-test scale-1.0 "Self-destruction" -body {
- trace variable v w { destroy .s ;# }
- ttk::scale .s -variable v
- pack .s ; update
- .s set 1 ; update
-} -returnCodes error -match glob -result "*"
+test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -yscrollcommand {.s set}] -side left
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
+ pack [ttk::scrollbar .s -command {.t yview}] -fill y -expand 1 -side left
+ update
+ focus -force .s
+ event generate .s <MouseWheel> -delta -120
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {4.0}
-test scale-2.1 "-state option" -setup {
- ttk::scale .s
- set res ""
+test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -setup {
+ destroy .t .s
} -body {
- # defaults
- lappend res [.s instate disabled] [.s cget -state]
- # set -state: instate returns accordingly
- .s configure -state disabled
- lappend res [.s instate disabled] [.s cget -state]
- # back to normal
- .s configure -state normal
- lappend res [.s instate disabled] [.s cget -state]
- # use state command: -state does NOT reflect it
- .s state disabled
- lappend res [.s instate disabled] [.s cget -state]
- # further use state command
- .s state readonly
- lappend res [.s state] [.s cget -state]
+ pack [text .t -xscrollcommand {.s set} -wrap none] -side top
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
+ pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
+ update
+ focus -force .s
+ event generate .s <Shift-MouseWheel> -delta -120
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {1.3}
+test scrollbar-10.2.2 {<MouseWheel> event on horizontal scrollbar} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -xscrollcommand {.s set} -wrap none] -side top
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
+ pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
+ update
+ focus -force .s
+ event generate .s <MouseWheel> -delta -120
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {1.3}
+
+test scrollbar-11.1 "style command" -body {
+ ttk::scrollbar .wv ; # default is -orient vertical
+ ttk::scrollbar .wh -orient horizontal
+ list [.wv cget -style] [.wv style] [winfo class .wv] \
+ [.wh cget -style] [.wh style] [winfo class .wh]
+} -cleanup {
+ destroy .wv .wh
+} -result {{} Vertical.TScrollbar TScrollbar {} Horizontal.TScrollbar TScrollbar}
+test scrollbar-11.2 "style command" -body {
+ ttk::style configure customStyle.Horizontal.TScrollbar
+ ttk::scrollbar .w -orient horizontal -style customStyle.Horizontal.TScrollbar
+ list [.w cget -style] [.w style] [winfo class .w]
} -cleanup {
- destroy .s
- unset -nocomplain res
-} -result {0 normal 1 disabled 0 normal 1 normal {disabled readonly} normal}
+ destroy .w
+} -result {customStyle.Horizontal.TScrollbar Horizontal.customStyle.Horizontal.TScrollbar TScrollbar}
tcltest::cleanupTests
diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test
index 8656d9d..e2b91f6 100644
--- a/tests/ttk/spinbox.test
+++ b/tests/ttk/spinbox.test
@@ -2,7 +2,7 @@
# ttk::spinbox widget tests
#
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -127,7 +127,7 @@ test spinbox-1.8.2 "option -validate" -setup {
.sb cget -validate
} -cleanup {
destroy .sb
-} -result {none}
+} -result none
test spinbox-1.8.3 "option -validate" -setup {
ttk::spinbox .sb -from 0 -to 100
@@ -362,6 +362,20 @@ test spinbox-dieoctaldie-2 "Cope with general bad input" -body {
destroy .sb
}
+test spinbox-5.1 "style command" -body {
+ ttk::spinbox .w
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {{} TSpinbox TSpinbox}
+test spinbox-5.2 "style command" -body {
+ ttk::style configure customStyle.TSpinbox
+ ttk::spinbox .w -style customStyle.TSpinbox
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.TSpinbox customStyle.TSpinbox TSpinbox}
+
tcltest::cleanupTests
# Local variables:
diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test
index 4243fd6..428212b 100644
--- a/tests/ttk/treetags.test
+++ b/tests/ttk/treetags.test
@@ -1,5 +1,5 @@
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -12,12 +12,11 @@ proc assert {expr {message ""}} {
error "PANIC: $message ($expr failed)"
}
}
-proc in {e l} { expr {[lsearch -exact $l $e] >= 0} }
proc itemConstraints {tv item} {
# $tag in [$tv item $item -tags] <==> [$tv tag has $tag $item]
foreach tag [$tv item $item -tags] {
- assert {[in $item [$tv tag has $tag]]}
+ assert {$item in [$tv tag has $tag]}
}
foreach child [$tv children $item] {
itemConstraints $tv $child
@@ -29,7 +28,7 @@ proc treeConstraints {tv} {
#
foreach tag [$tv tag names] {
foreach item [$tv tag has $tag] {
- assert {[in $tag [$tv item $item -tags]]}
+ assert {$tag in [$tv item $item -tags]}
}
}
@@ -115,6 +114,12 @@ test treetags-1.10 "tag names - tag configured" -body {
lsort [$tv tag names]
} -result [list tag1 tag2 tag3 tag4 tag5]
+test treetags-1.11 "tag delete" -body {
+ $tv tag delete tag5
+ $tv tag delete tag4
+ lsort [$tv tag names]
+} -result [list tag1 tag2 tag3]
+
test treetags-1.end "cleanup" -body {
$tv item item1 -tags tag1
$tv item item2 -tags tag2
@@ -124,28 +129,28 @@ test treetags-1.end "cleanup" -body {
} -result [list [list item1] [list item2] [list]]
test treetags-2.0 "tag bind" -body {
- $tv tag bind tag1 <KeyPress> {set ::KEY %A}
- $tv tag bind tag1 <KeyPress>
+ $tv tag bind tag1 <Key> {set ::KEY %A}
+ $tv tag bind tag1 <Key>
} -cleanup {
treeConstraints $tv
} -result {set ::KEY %A}
test treetags-2.1 "Events delivered to tags" -body {
- focus -force $tv ; update ;# needed so [event generate] delivers KeyPress
+ focus -force $tv ; update ;# needed so [event generate] delivers Key
$tv focus item1
- event generate $tv <KeyPress-a>
+ event generate $tv <a>
set ::KEY
} -cleanup {
treeConstraints $tv
} -result a
test treetags-2.2 "Events delivered to correct tags" -body {
- $tv tag bind tag2 <KeyPress> [list set ::KEY2 %A]
+ $tv tag bind tag2 <Key> [list set ::KEY2 %A]
$tv focus item1
- event generate $tv <KeyPress-b>
+ event generate $tv <b>
$tv focus item2
- event generate $tv <KeyPress-c>
+ event generate $tv <c>
list $::KEY $::KEY2
} -cleanup {
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index e936fca..3d186e1 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -3,7 +3,7 @@
# what it currently does)
#
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -467,7 +467,7 @@ test treeview-8.6 "Selection - <<TreeviewSelect>> on selection add" -body {
.tv selection add newnode.n1
update
set res
-} -result {1}
+} -result 1
test treeview-8.7 "<<TreeviewSelect>> on selected item deletion" -body {
.tv selection set {}
@@ -561,7 +561,7 @@ test treeview-9.3 {scrolling on see command, requested item is closed} -setup {
expr $after < $before
} -cleanup {
destroy .top
-} -result {1}
+} -result 1
### identify tests:
#
@@ -700,9 +700,9 @@ test treeview-10.1 "Root node properly initialized (#1541739)" -setup {
test treeview-3006842 "Null bindings" -setup {
ttk::treeview .tv -show tree
} -body {
- .tv tag bind empty <ButtonPress-1> {}
+ .tv tag bind empty <Button-1> {}
.tv insert {} end -text "Click me" -tags empty
- event generate .tv <ButtonPress-1> -x 10 -y 10
+ event generate .tv <Button-1> -x 10 -y 10
.tv tag bind empty
} -result {} -cleanup {
destroy .tv
@@ -737,7 +737,7 @@ test treeview-368fa4561e "indicators cannot be clicked on leafs" -setup {
set res [.tv item foo -open]
# using $h even for x computation is intentional here in order to simulate
# a mouse click on the (invisible since we're on a leaf) indicator
- event generate .tv <ButtonPress-1> \
+ event generate .tv <Button-1> \
-x [expr {$x + $h / 2}] \
-y [expr {$y + $h / 2}]
lappend res [.tv item foo -open]
@@ -835,4 +835,18 @@ test treeview-ce470f20fd-4 "changing -stretch resizes columns" -setup {
destroy .tv
} -result {60 50 60 50 60 50 1}
+test treeview-11.1 "style command" -body {
+ ttk::treeview .w
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {{} Treeview Treeview}
+test treeview-11.2 "style command" -body {
+ ttk::style configure customStyle.Treeview
+ ttk::treeview .w -style customStyle.Treeview
+ list [.w cget -style] [.w style] [winfo class .w]
+} -cleanup {
+ destroy .w
+} -result {customStyle.Treeview customStyle.Treeview Treeview}
+
tcltest::cleanupTests
diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test
index 322917c..e8093a9 100644
--- a/tests/ttk/ttk.test
+++ b/tests/ttk/ttk.test
@@ -1,5 +1,5 @@
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
@@ -135,8 +135,8 @@ test ttk-selfdestruct-ok-1 "Intentional self-destruction" -body {
#
# Basic tests.
#
-test ttk-1.1 "Create button" -body {
- pack [ttk::button .t] -expand true -fill both
+test ttk-1.1 "Create multiline button showing justified text" -body {
+ pack [ttk::button .t -text "Hello\nWorld!!" -justify center] -expand true -fill both
update
}
@@ -209,8 +209,8 @@ test ttk-2.8 "bug 3223850: button state disabled during click" -setup {
pack [ttk::button .b -command {set ::ttk28 failed}]
update
} -body {
- bind .b <ButtonPress-1> {after 0 {.b configure -state disabled}}
- after 1 {event generate .b <ButtonPress-1>}
+ bind .b <Button-1> {after 0 {.b configure -state disabled}}
+ after 1 {event generate .b <Button-1>}
after 20 {event generate .b <ButtonRelease-1>}
set aid [after 100 {set ::ttk28 [.b instate {disabled !pressed}]}]
vwait ::ttk28
@@ -655,6 +655,17 @@ test ttk-ensemble-5 "style element create: valid" -body {
ttk::style element create plain.background from default
} -returnCodes 0 -result ""
+test ttk-16.1 {ttk::style theme styles - no such theme} -body {
+ ttk::style theme styles noSuchTheme
+} -returnCodes 1 -result {theme "noSuchTheme" doesn't exist}
+test ttk-16.2 {ttk::style theme styles - theme exists} -body {
+ # simply check this produces a list with some style names,
+ # without checking exact content (not needed, and may vary
+ # depending on platform, versions, improvements...)
+ expr {[llength [ttk::style theme styles alt]] > 0}
+} -result 1
+
+
eval destroy [winfo children .]
tcltest::cleanupTests
diff --git a/tests/ttk/validate.test b/tests/ttk/validate.test
index 61e7c2c..90b09f7 100644
--- a/tests/ttk/validate.test
+++ b/tests/ttk/validate.test
@@ -3,7 +3,7 @@
## Derived from core test suite entry-19.1 through entry-19.20
##
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
diff --git a/tests/ttk/vsapi.test b/tests/ttk/vsapi.test
index ec4e9e7..076a815 100644
--- a/tests/ttk/vsapi.test
+++ b/tests/ttk/vsapi.test
@@ -1,7 +1,7 @@
# -*- tcl -*-
#
-package require Tk
+package require tk
package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
diff --git a/tests/unixButton.test b/tests/unixButton.test
index f0dcde5..1b1ff04 100644
--- a/tests/unixButton.test
+++ b/tests/unixButton.test
@@ -3,9 +3,9 @@
# widgets defined in tkUnixButton.c). It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test
index d5f6ee3..d4f7259 100644
--- a/tests/unixEmbed.test
+++ b/tests/unixEmbed.test
@@ -2,8 +2,8 @@
# tkUnixEmbed.c. It is organized in the standard fashion for Tcl
# tests.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -117,7 +117,7 @@ test unixEmbed-1.3 {TkpUseWindow procedure, inheriting colormap} -constraints {
colorsFree .x
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test unixEmbed-1.4 {TkpUseWindow procedure, inheriting colormap} -constraints {
unix nonPortable
} -setup {
@@ -130,7 +130,7 @@ test unixEmbed-1.4 {TkpUseWindow procedure, inheriting colormap} -constraints {
colorsFree .x
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test unixEmbed-1.5 {TkpUseWindow procedure, creating Container records} -constraints {
unix testembed notAqua
@@ -973,20 +973,20 @@ test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constrain
toplevel .t1 -use $w1
}
focus -force .
- bind . <KeyPress> {lappend x {key %A %E}}
+ bind . <Key> {lappend x {key %A %E}}
set x {}
set y [dobg {
update
- bind .t1 <KeyPress> {lappend y {key %A}}
+ bind .t1 <Key> {lappend y {key %A}}
set y {}
- event generate .t1 <KeyPress> -keysym a
+ event generate .t1 <Key> -keysym a
set y
}]
update
list $x $y
} -cleanup {
deleteWindows
- bind . <KeyPress> {}
+ bind . <Key> {}
} -result {{{key a 1}} {}}
# TkpRedirectKeyEvent is not implemented in win or aqua. If someone
# implements it they should change the constraints for this test.
@@ -1007,13 +1007,13 @@ test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constrai
toplevel .t1 -use [w1]
}
focus -force .
- bind . <KeyPress> {lappend x {key %A %E}}
+ bind . <Key> {lappend x {key %A %E}}
set x {}
set y [child eval {
update
- bind .t1 <KeyPress> {lappend y {key %A}}
+ bind .t1 <Key> {lappend y {key %A}}
set y {}
- event generate .t1 <KeyPress> -keysym a
+ event generate .t1 <Key> -keysym a
set y
}]
update
@@ -1021,7 +1021,7 @@ test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constrai
} -cleanup {
interp delete child
deleteWindows
- bind . <KeyPress> {}
+ bind . <Key> {}
} -result {{{key a 1}} {}}
test unixEmbed-7.2 {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints {
unix notAqua
@@ -1038,20 +1038,20 @@ test unixEmbed-7.2 {TkpRedirectKeyEvent procedure, don't forward keystroke width
update
focus -force .f1
update
- bind . <KeyPress> {lappend x {key %A}}
+ bind . <Key> {lappend x {key %A}}
set x {}
set y [dobg {
update
- bind .t1 <KeyPress> {lappend y {key %A}}
+ bind .t1 <Key> {lappend y {key %A}}
set y {}
- event generate .t1 <KeyPress> -keysym b
+ event generate .t1 <Key> -keysym b
set y
}]
update
list $x $y
} -cleanup {
deleteWindows
- bind . <KeyPress> {}
+ bind . <Key> {}
} -result {{} {{key b}}}
test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints {
unix
@@ -1071,13 +1071,13 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt
update
focus -force .f1
update
- bind . <KeyPress> {lappend x {key %A}}
+ bind . <Key> {lappend x {key %A}}
set x {}
set y [child eval {
update
- bind .t1 <KeyPress> {lappend y {key %A}}
+ bind .t1 <Key> {lappend y {key %A}}
set y {}
- event generate .t1 <KeyPress> -keysym b
+ event generate .t1 <Key> -keysym b
set y
}]
update
@@ -1085,7 +1085,7 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt
} -cleanup {
interp delete child
deleteWindows
- bind . <KeyPress> {}
+ bind . <Key> {}
} -result {{} {{key b}}}
test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints {
diff --git a/tests/unixFont.test b/tests/unixFont.test
index ff16750..ee3d36a 100644
--- a/tests/unixFont.test
+++ b/tests/unixFont.test
@@ -8,8 +8,8 @@
# fonts having or not having certain properties, which may not be valid
# at all sites.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -75,7 +75,7 @@ test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11 noExceed} {
} {1 {font "" doesn't exist}}
test unixfont-1.2 {TkpGetNativeFont procedure: native} {x11 failsOnUbuntu} {
font measure fixed 0
-} {6}
+} 6
test unixfont-2.1 {TkpGetFontFromAttributes procedure: no family} x11 {
font actual {-size 10}
@@ -120,7 +120,7 @@ test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {
} {courier}
test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 failsOnUbuntuNoXft} {
lindex [font actual {-family courier -size 37}] 3
-} {37}
+} 37
test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 {
# On Linux, XListFonts() was returning names for fonts that do not
# actually exist, causing the subsequent XLoadQueryFont() to fail
@@ -178,7 +178,7 @@ test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} {x11 failsOnUbuntu}
.b.c dchars $t 0 end
.b.c insert $t 0 "0000"
.b.c index $t @[expr int($ax*2.5)],1
-} {2}
+} 2
test unixfont-5.10 {Tk_MeasureChars procedure: TK_AT_LEAST_ONE} x11 {
.b.l config -text "000000000000"
getsize
@@ -247,7 +247,7 @@ test unixfont-8.1 {AllocFont procedure: use old font} x11 {
} {}
test unixfont-8.2 {AllocFont procedure: parse information from XLFD} x11 {
expr {[lindex [font actual {-family times -size 0}] 3] == 0}
-} {0}
+} 0
test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 {
catch {unset fontArray}
# check that font actual returns the correct attributes.
@@ -259,7 +259,7 @@ test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 {
} {-family -overstrike -size -slant -underline -weight}
test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu failsOnXQuarz} {
set x 0
- incr x [font measure $courier "\u4000"] ;# 6
+ incr x [font measure $courier "䀀"] ;# 6
incr x [font measure $courier "\002"] ;# 4
incr x [font measure $courier "\012"] ;# 2
incr x [font measure $courier "\101"] ;# 1
@@ -267,7 +267,7 @@ test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu
} [expr $cx*13]
test unixfont-8.5 {AllocFont procedure: setup widths of normal chars} x11 {
font metrics $courier -fixed
-} {1}
+} 1
test unixfont-8.6 {AllocFont procedure: setup widths of special chars} {x11 failsOnUbuntu failsOnXQuarz} {
set x 0
incr x [font measure $courier "\001"] ;# 4
diff --git a/tests/unixMenu.test b/tests/unixMenu.test
index 63e4849..dafae08 100644
--- a/tests/unixMenu.test
+++ b/tests/unixMenu.test
@@ -3,8 +3,8 @@
# file tests the Macintosh-specific features of the menu
# system.
#
-# Copyright (c) 1995-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/unixSelect.test b/tests/unixSelect.test
index a702587..cb1908b 100644
--- a/tests/unixSelect.test
+++ b/tests/unixSelect.test
@@ -4,7 +4,7 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1999 by Scriptics Corporation.
+# Copyright © 1999 Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -115,13 +115,13 @@ test unixSelect-1.1 {TkSelGetSelection procedure: simple i18n text} -constraints
} -body {
pack [entry .e]
update
- .e insert 0 \u00fcber
+ .e insert 0 über
.e selection range 0 end
dobg {string length [selection get]}
} -cleanup {
cleanupbg
destroy .e
-} -result {4}
+} -result 4
test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} -constraints {
x11
@@ -131,13 +131,13 @@ test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} -
dobg {
pack [entry .e]
update
- .e insert 0 \u00fc\u0444
+ .e insert 0 üф
.e selection range 0 end
}
selection get
} -cleanup {
cleanupbg
-} -result \u00fc?
+} -result ü?
test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -constraints {
x11
@@ -148,11 +148,11 @@ test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -co
selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \
{handler COMPOUND_TEXT}
selection own .
- set selValue \u00fc\u0444
+ set selValue üф
set selInfo {}
set result [dobg {
set x [selection get -type COMPOUND_TEXT]
- list [string equal \u00fc\u0444 $x] [string length $x]
+ list [string equal üф $x] [string length $x]
}]
lappend result $selInfo
} -cleanup {
@@ -172,12 +172,12 @@ test unixSelect-1.4 {TkSelGetSelection procedure: INCR i18n text, iso2022} -cons
selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \
{handler COMPOUND_TEXT}
selection own .
- set selValue [string repeat x 3999]\u00fc\u0444[string repeat x 3999]
+ set selValue [string repeat x 3999]üф[string repeat x 3999]
set selInfo {}
set result [dobg {
set x [selection get -type COMPOUND_TEXT]
list [string equal \
- [string repeat x 3999]\u00fc\u0444[string repeat x 3999] $x] \
+ [string repeat x 3999]üф[string repeat x 3999] $x] \
[string length $x]
}]
lappend result $selInfo
@@ -194,11 +194,11 @@ test unixSelect-1.5 {TkSelGetSelection procedure: simple i18n text, iso2022} -co
selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \
{handler COMPOUND_TEXT}
selection own .
- set selValue \u00fc\u0444
+ set selValue üф
set selInfo {}
set result [dobg {
set x [selection get -type COMPOUND_TEXT]
- list [string equal \u00fc\u0444 $x] [string length $x]
+ list [string equal üф $x] [string length $x]
}]
lappend result $selInfo
} -cleanup {
@@ -211,7 +211,7 @@ test unixSelect-1.6 {TkSelGetSelection procedure: INCR i18n text} -constraints {
setupbg
} -body {
dobg [subst -nobackslashes {entry .e; pack .e; update
- .e insert 0 \u00fcber$longValue
+ .e insert 0 über$longValue
.e selection range 0 end}]
string length [selection get]
} -cleanup {
@@ -226,13 +226,13 @@ test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} -constraints {
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat x 3999]\u00fc
+ .e insert 0 [string repeat x 3999]ü
.e selection range 0 end
}
selection get
} -cleanup {
cleanupbg
-} -result [string repeat x 3999]\u00fc
+} -result [string repeat x 3999]ü
test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints {
x11
@@ -242,13 +242,13 @@ test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints {
dobg {
pack [entry .e]
update
- .e insert 0 \u00fc[string repeat x 3999]
+ .e insert 0 ü[string repeat x 3999]
.e selection range 0 end
}
selection get
} -cleanup {
cleanupbg
-} -result \u00fc[string repeat x 3999]
+} -result ü[string repeat x 3999]
test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints {
x11
@@ -258,13 +258,13 @@ test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints {
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000]
+ .e insert 0 [string repeat x 3999]ü[string repeat x 4000]
.e selection range 0 end
}
selection get
} -cleanup {
cleanupbg
-} -result [string repeat x 3999]\u00fc[string repeat x 4000]
+} -result [string repeat x 3999]ü[string repeat x 4000]
# Now some tests to make sure that the right thing is done when
# transferring UTF8 selections, to prevent [Bug 614650] and its ilk
# from rearing its ugly head again.
@@ -277,13 +277,13 @@ test unixSelect-1.10 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat x 3999]\u00fc
+ .e insert 0 [string repeat x 3999]ü
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result [string repeat x 3999]\u00fc
+} -result [string repeat x 3999]ü
test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -293,13 +293,13 @@ test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 \u00fc[string repeat x 3999]
+ .e insert 0 ü[string repeat x 3999]
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result \u00fc[string repeat x 3999]
+} -result ü[string repeat x 3999]
test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -309,13 +309,13 @@ test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000]
+ .e insert 0 [string repeat x 3999]ü[string repeat x 4000]
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result [string repeat x 3999]\u00fc[string repeat x 4000]
+} -result [string repeat x 3999]ü[string repeat x 4000]
test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints {
x11
@@ -325,13 +325,13 @@ test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -con
} -body {
pack [entry .e]
update
- .e insert 0 \u00fcber\u0444
+ .e insert 0 überф
.e selection range 0 end
dobg {string length [selection get -type UTF8_STRING]}
} -cleanup {
destroy .e
cleanupbg
-} -result {5}
+} -result 5
test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints {
x11
@@ -341,13 +341,13 @@ test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} -con
dobg {
pack [entry .e]
update
- .e insert 0 \u00fc\u0444
+ .e insert 0 üф
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result \u00fc\u0444
+} -result üф
test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -357,13 +357,13 @@ test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat [string repeat \u00c4\u00e4 50]\n 21]
+ .e insert 0 [string repeat [string repeat Ää 50]\n 21]
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21]
+} -result [string repeat [string repeat Ää 50]\n 21]
test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -373,13 +373,13 @@ test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
+ .e insert 0 i[string repeat [string repeat Ää 50]\n 21]
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
+} -result i[string repeat [string repeat Ää 50]\n 21]
test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -389,7 +389,7 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [text .t]
update
- .t insert 1.0 [string repeat [string repeat \u00c4\u00e4 50]\n 21]
+ .t insert 1.0 [string repeat [string repeat Ää 50]\n 21]
# Has to be selected in a separate stage
.t tag add sel 1.0 21.end+1c
}
@@ -397,7 +397,7 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21]
+} -result [string repeat [string repeat Ää 50]\n 21]
test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -407,7 +407,7 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [text .t]
update
- .t insert 1.0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
+ .t insert 1.0 i[string repeat [string repeat Ää 50]\n 21]
# Has to be selected in a separate stage
.t tag add sel 1.0 21.end+1c
}
@@ -415,7 +415,7 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
+} -result i[string repeat [string repeat Ää 50]\n 21]
test unixSelect-1.19 {Automatic UTF8_STRING support for selection handle} -constraints {
unix
diff --git a/tests/unixWm.test b/tests/unixWm.test
index 4f94cc1..d54bc69 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -2,9 +2,9 @@
# the window manager, including the "wm" command. It is organized
# in the standard fashion for Tcl tests.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -418,7 +418,7 @@ test unixWm-9.3 {TkWmMapWindow procedure, iconic windows} unix {
wm geom .t +0+0
wm iconify .t
winfo ismapped .t
-} {0}
+} 0
test unixWm-9.4 {TkWmMapWindow procedure, icon windows} unix {
destroy .t
toplevel .t -width 100 -height 50 -bg blue
@@ -426,14 +426,14 @@ test unixWm-9.4 {TkWmMapWindow procedure, icon windows} unix {
wm iconwindow . .t
update
set result [winfo ismapped .t]
-} {0}
+} 0
test unixWm-9.5 {TkWmMapWindow procedure, normal windows} unix {
destroy .t
toplevel .t -width 200 -height 20
wm geom .t +0+0
update
winfo ismapped .t
-} {1}
+} 1
test unixWm-10.1 {TkWmDeadWindow procedure, canceling UpdateGeometry idle handler} unix {
destroy .t
@@ -667,7 +667,7 @@ test unixWm-18.1 {Tk_WmCmd procedure, "frame" option} unix {
} {1 {wrong # args: should be "wm frame window"}}
test unixWm-18.2 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
expr [wm frame .t] == [winfo id .t]
-} {0}
+} 0
test unixWm-18.3 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
destroy .t2
toplevel .t2
@@ -677,7 +677,7 @@ test unixWm-18.3 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
set result [expr [wm frame .t2] == [winfo id .t2]]
destroy .t2
set result
-} {1}
+} 1
test unixWm-19.1 {Tk_WmCmd procedure, "geometry" option} unix {
list [catch {wm geometry .t 12 13} msg] $msg
@@ -788,7 +788,7 @@ test unixWm-21.4 {Tk_WmCmd procedure, "group" option, make window exist} {unix t
set result [expr [testwrapper .t2] - [lindex $hints 8]]
destroy .t2
set result
-} {0}
+} 0
test unixWm-21.5 {Tk_WmCmd procedure, "group" option, create leader wrapper} {unix testwrapper} {
destroy .t2
destroy .t3
@@ -856,7 +856,7 @@ test unixWm-23.4 {Tk_WmCmd procedure, "iconify" option} unix {
set result [list [catch {wm iconify .t2} msg] $msg]
destroy .t2
set result
-} {1 {can't iconify .t2: it is an icon for .t}}
+} {1 {can't iconify ".t2": it is an icon for ".t"}}
test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu failsOnXQuarz} {
destroy .t2
toplevel .t2
@@ -867,7 +867,7 @@ test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu fail
set result [winfo ismapped .t2]
destroy .t2
set result
-} {0}
+} 0
test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu failsOnXQuarz} {
destroy .t2
toplevel .t2
@@ -1740,10 +1740,10 @@ test unixWm-48.10 {ParseGeometry procedure} unix {
} {1 {bad geometry specifier "+20+10z"}}
test unixWm-48.11 {ParseGeometry procedure} unix {
catch {wm geometry .t +-10+20}
-} {0}
+} 0
test unixWm-48.12 {ParseGeometry procedure} unix {
catch {wm geometry .t +30+-10}
-} {0}
+} 0
test unixWm-48.13 {ParseGeometry procedure, resize causes window to move} unix {
destroy .t
toplevel .t -width 200 -height 200
@@ -2241,7 +2241,7 @@ test unixWm-54.2 {TkpMakeMenuWindow procedure, setting override_redirect} {unix
set result [wm overrideredirect .m]
destroy .m
set result
-} {1}
+} 1
# No tests for TkGetPointerCoords, CreateWrapper, or GetMaxSize.
diff --git a/tests/util.test b/tests/util.test
index c1ec6a5..c2baa38 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the procedures in the file
# tkUtil.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -28,36 +28,36 @@ test util-1.3 {Tk_GetScrollInfo procedure} -body {
} -result {0.5 0.75}
test util-1.4 {Tk_GetScrollInfo procedure} -body {
.l yview scroll a
-} -returnCodes error -result {wrong # args: should be ".l yview scroll number units|pages"}
+} -returnCodes error -result {wrong # args: should be ".l yview scroll number pages|units"}
test util-1.5 {Tk_GetScrollInfo procedure} -body {
.l yview scroll a b c
-} -returnCodes error -result {wrong # args: should be ".l yview scroll number units|pages"}
+} -returnCodes error -result {wrong # args: should be ".l yview scroll number pages|units"}
test util-1.6 {Tk_GetScrollInfo procedure} -body {
.l yview scroll xyz units
-} -returnCodes error -result {expected integer but got "xyz"}
+} -returnCodes error -result {expected floating-point number but got "xyz"}
test util-1.7 {Tk_GetScrollInfo procedure} -body {
.l yview 0
.l yview scroll 2 pages
.l nearest 0
-} -result {6}
+} -result 6
test util-1.8 {Tk_GetScrollInfo procedure} -body {
.l yview 15
.l yview scroll -2 pages
.l nearest 0
-} -result {9}
+} -result 9
test util-1.9 {Tk_GetScrollInfo procedure} -body {
.l yview 0
.l yview scroll 2 units
.l nearest 0
-} -result {2}
+} -result 2
test util-1.10 {Tk_GetScrollInfo procedure} -body {
.l yview 15
.l yview scroll -2 units
.l nearest 0
-} -result {13}
+} -result 13
test util-1.11 {Tk_GetScrollInfo procedure} -body {
.l yview scroll 3 zips
-} -returnCodes error -result {bad argument "zips": must be units or pages}
+} -returnCodes error -result {bad argument "zips": must be pages or units}
test util-1.12 {Tk_GetScrollInfo procedure} -body {
.l yview dropdead 3 times
} -returnCodes error -result {unknown option "dropdead": must be moveto or scroll}
diff --git a/tests/visual.test b/tests/visual.test
index 13d6fd2..da6c41a 100644
--- a/tests/visual.test
+++ b/tests/visual.test
@@ -2,9 +2,9 @@
# procedures in the file tkVisual.c. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -455,7 +455,7 @@ test visual-7.1 {Tk_GetColormap, "new"} -constraints {
colorsFree .t2
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test visual-7.2 {Tk_GetColormap, "new"} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -468,7 +468,7 @@ test visual-7.2 {Tk_GetColormap, "new"} -constraints {
colorsFree .t2
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test visual-7.3 {Tk_GetColormap, copy from other window} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -484,7 +484,7 @@ test visual-7.3 {Tk_GetColormap, copy from other window} -constraints {
colorsFree .t2
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test visual-7.4 {Tk_GetColormap, copy from other window} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -500,7 +500,7 @@ test visual-7.4 {Tk_GetColormap, copy from other window} -constraints {
colorsFree .t2
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test visual-7.5 {Tk_GetColormap, copy from other window} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
diff --git a/tests/visual_bb.test b/tests/visual_bb.test
index 030a369..36612a9 100644
--- a/tests/visual_bb.test
+++ b/tests/visual_bb.test
@@ -23,7 +23,7 @@ proc runTest {file} {
global testNum
test "2.$testNum" "testing $file" {userInteraction} {
- uplevel \#0 source [file join [testsDirectory] $file]
+ uplevel #0 [list source -encoding utf-8 [file join [testsDirectory] $file]]
concat ""
} {}
incr testNum
@@ -94,7 +94,7 @@ test 1.1 {running visual tests} -constraints userInteraction -body {
# Set up for keyboard-based menu traversal
- bind . <Any-FocusIn> {
+ bind . <FocusIn> {
if {("%d" == "NotifyVirtual") && ("%m" == "NotifyNormal")} {
focus .menu
}
@@ -104,7 +104,7 @@ test 1.1 {running visual tests} -constraints userInteraction -body {
# Set up a class binding to allow objects to be deleted from a canvas
# by clicking with mouse button 1:
- bind Canvas <1> {%W delete [%W find closest %x %y]}
+ bind Canvas <Button-1> {%W delete [%W find closest %x %y]}
concat ""
} -result {}
diff --git a/tests/winButton.test b/tests/winButton.test
index 88b4345..a19f4e7 100644
--- a/tests/winButton.test
+++ b/tests/winButton.test
@@ -3,9 +3,9 @@
# widgets defined in tkWinButton.c). It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/winClipboard.test b/tests/winClipboard.test
index 2f72966..28e508b 100644
--- a/tests/winClipboard.test
+++ b/tests/winClipboard.test
@@ -6,8 +6,8 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1997 by Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -70,24 +70,23 @@ test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} -constraints {
clipboard clear
} -body {
set map [list "\r" "\\r" "\n" "\\n"]
- clipboard append "line 1\u00c7\nline 2"
+ clipboard append "line 1Ç\nline 2"
list [string map $map [selection get -selection CLIPBOARD]]\
[string map $map [testclipboard]]
} -cleanup {
clipboard clear
-} -result [list "line 1\u00c7\\nline 2" "line 1\u00c7\\nline 2"]
+} -result [list "line 1Ç\\nline 2" "line 1Ç\\nline 2"]
test winClipboard-1.6 {TkSelGetSelection & TkWinClipboardRender} -constraints {
win testclipboard
} -setup {
clipboard clear
} -body {
- clipboard append "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"
+ clipboard append "привет миф"
list [selection get -selection CLIPBOARD] [testclipboard]
} -cleanup {
clipboard clear
-} -result [list "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"\
- "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"]
+} -result [list "привет миф" "привет миф"]
test winClipboard-2.1 {TkSelUpdateClipboard reentrancy problem} -constraints {
win testclipboard
diff --git a/tests/winDialog.test b/tests/winDialog.test
index 1384770..a2414ec 100755
--- a/tests/winDialog.test
+++ b/tests/winDialog.test
@@ -3,9 +3,9 @@
# the common dialog boxes. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 1998-1999 ActiveState Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 1998-1999 ActiveState Corporation.
package require tcltest 2.2
namespace import ::tcltest::*
@@ -118,7 +118,7 @@ test winDialog-1.1 {Tk_ChooseColorObjCmd} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-1.2 {Tk_ChooseColorObjCmd} -constraints {
testwinevent
} -body {
@@ -161,7 +161,7 @@ test winDialog-1.5 {Tk_ChooseColorObjCmd: -title} -constraints {
set x {}
start {
set clr [tk_chooseColor -initialcolor "#ff9933" \
- -title "\u041f\u0440\u0438\u0432\u0435\u0442"]
+ -title "Привет"]
}
then {
if {[catch {
@@ -171,7 +171,7 @@ test winDialog-1.5 {Tk_ChooseColorObjCmd: -title} -constraints {
lappend x [Click ok]
}
lappend x $clr
-} -result [list "\u041f\u0440\u0438\u0432\u0435\u0442" 0 "#ff9933"]
+} -result [list "Привет" 0 "#ff9933"]
test winDialog-1.6 {Tk_ChooseColorObjCmd: -parent} -constraints {
testwinevent
} -setup {
@@ -229,7 +229,7 @@ test winDialog-5.1 {GetFileName: no arguments} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-5.2 {GetFileName: one argument} -constraints {
nt
} -body {
@@ -242,7 +242,7 @@ test winDialog-5.3 {GetFileName: many arguments} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-5.4 {GetFileName: Tcl_GetIndexFromObj() != TCL_OK} -constraints {
nt
} -body {
@@ -259,7 +259,7 @@ test winDialog-5.5 {GetFileName: Tcl_GetIndexFromObj() == TCL_OK} -constraints {
# https://core.tcl-lang.org/tk/tktview/4a0451f5291b3c9168cc560747dae9264e1d2ef6
# $x is expected to be empty
append x $y
-} -result {0}
+} -result 0
test winDialog-5.6 {GetFileName: valid option, but missing value} -constraints {
nt
} -body {
@@ -545,7 +545,7 @@ test winDialog-5.12.3 {tk_getSaveFile: initial directory: .} -constraints {
test winDialog-5.12.4 {tk_getSaveFile: initial directory: unicode} -constraints {
nt testwinevent
} -body {
- set dir [tcltest::makeDirectory "\u0167\u00e9\u015d\u0167"]
+ set dir [tcltest::makeDirectory "ŧéŝŧ"]
unset -nocomplain x
start {set x [tk_getSaveFile \
-initialdir $dir \
@@ -646,7 +646,7 @@ test winDialog-5.12.8 {tk_getOpenFile: initial directory: .} -constraints {
test winDialog-5.12.9 {tk_getOpenFile: initial directory: unicode} -constraints {
nt testwinevent
} -body {
- set dir [tcltest::makeDirectory "\u0167\u00e9\u015d\u0167"]
+ set dir [tcltest::makeDirectory "ŧéŝŧ"]
set path [tcltest::makeFile "" testfile $dir]
unset -nocomplain x
start {set x [tk_getOpenFile \
@@ -741,7 +741,7 @@ test winDialog-5.16 {GetFileName: parent} -constraints {
destroy .t
}
return $x
-} -result {1}
+} -result 1
test winDialog-5.17 {GetFileName: title} -constraints {
nt testwinevent
} -body {
@@ -751,7 +751,7 @@ test winDialog-5.17 {GetFileName: title} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
if {[vista?]} {
# In the newer file dialogs, the file type widget does not even exist
# if no file types specified
@@ -856,18 +856,18 @@ test winDialog-5.24 {GetFileName: file types: MakeFilter() succeeds} -constraint
Click cancel
}
return $x
-} -result {0}
+} -result 0
test winDialog-5.25 {GetFileName: file types: MakeFilter() succeeds} -constraints {
nt
} -body {
# MacOS type that is correct, but has embedded high-bit chars.
- start {set x [catch {tk_getSaveFile -filetypes {{"foo" .foo {\u2022\u2022\u2022\u2022}}}}]}
+ start {set x [catch {tk_getSaveFile -filetypes {{"foo" .foo {••••}}}}]}
then {
Click cancel
}
return $x
-} -result {0}
+} -result 0
test winDialog-6.1 {MakeFilter} -constraints {emptyTest nt} -body {}
@@ -892,7 +892,7 @@ test winDialog-9.1 {Tk_ChooseDirectoryObjCmd: no arguments} -constraints {
}]
# $x should be "" on a Cancel
append x $y
-} -result {0}
+} -result 0
test winDialog-9.2 {Tk_ChooseDirectoryObjCmd: one argument} -constraints {
nt
} -body {
@@ -907,7 +907,7 @@ test winDialog-9.3 {Tk_ChooseDirectoryObjCmd: many arguments} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-9.4 {Tk_ChooseDirectoryObjCmd: Tcl_GetIndexFromObj() != TCL_OK} -constraints {
nt
} -body {
@@ -920,7 +920,7 @@ test winDialog-9.5 {Tk_ChooseDirectoryObjCmd: Tcl_GetIndexFromObj() == TCL_OK} -
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-9.6 {Tk_ChooseDirectoryObjCmd: valid option, but missing value} -constraints {
nt
} -body {
@@ -1048,7 +1048,7 @@ test winDialog-10.9 {Tk_FontchooserObjCmd: -title} -constraints {
} -body {
start {
tk fontchooser configure -command ApplyFont \
- -title "\u041f\u0440\u0438\u0432\u0435\u0442"
+ -title "Привет"
tk fontchooser show
}
then {
@@ -1056,7 +1056,7 @@ test winDialog-10.9 {Tk_FontchooserObjCmd: -title} -constraints {
Click cancel
}
set a(text)
-} -result "\u041f\u0440\u0438\u0432\u0435\u0442"
+} -result "Привет"
if {[testConstraint testwinevent]} {
catch {testwinevent debug 0}
diff --git a/tests/winFont.test b/tests/winFont.test
index 4a394cf..bddc69e 100644
--- a/tests/winFont.test
+++ b/tests/winFont.test
@@ -6,8 +6,8 @@
# underlined?"); these tests attempt to exercise the code in question,
# but there are no results that can be checked.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -37,12 +37,12 @@ test winfont-2.1 {TkpGetFontFromAttributes procedure: pointsize} -constraints {
win
} -body {
expr {[font actual {-size -10} -size] > 0}
-} -result {1}
+} -result 1
test winfont-2.2 {TkpGetFontFromAttributes procedure: pointsize} -constraints {
win
} -body {
expr {[font actual {-family Arial} -size] > 0}
-} -result {1}
+} -result 1
test winfont-2.3 {TkpGetFontFromAttributes procedure: normal weight} -constraints {
win
} -body {
@@ -71,7 +71,7 @@ test winfont-2.7 {TkpGetFontFromAttributes procedure: Times fonts} -constraints
lappend x [font actual {-family "Times"} -family]
lappend x [font actual {-family "New York"} -family]
lappend x [font actual {-family "Times New Roman"} -family]
-} -result {{Times New Roman} {Times New Roman} {Times New Roman}}
+} -result {Times Times {Times New Roman}}
test winfont-2.8 {TkpGetFontFromAttributes procedure: Courier fonts} -constraints {
win
} -setup {
@@ -80,7 +80,7 @@ test winfont-2.8 {TkpGetFontFromAttributes procedure: Courier fonts} -constraint
lappend x [font actual {-family "Courier"} -family]
lappend x [font actual {-family "Monaco"} -family]
lappend x [font actual {-family "Courier New"} -family]
-} -result {{Courier New} {Courier New} {Courier New}}
+} -match regexp -result {Courier (Courier|Monaco) {Courier New}}
test winfont-2.9 {TkpGetFontFromAttributes procedure: Helvetica fonts} -constraints {
win
} -setup {
@@ -89,7 +89,7 @@ test winfont-2.9 {TkpGetFontFromAttributes procedure: Helvetica fonts} -constrai
lappend x [font actual {-family "Helvetica"} -family]
lappend x [font actual {-family "Geneva"} -family]
lappend x [font actual {-family "Arial"} -family]
-} -result {Arial Arial Arial}
+} -match regexp -result {Helvetica (Helvetica|Geneva) Arial}
test winfont-2.10 {TkpGetFontFromAttributes procedure: fallback} -constraints {
win
} -body {
@@ -221,7 +221,7 @@ test winfont-5.5 {Tk_MeasureChars procedure: include last partial char} -constra
.t.c index $t @[expr {int($cx*2.5)}],1
} -cleanup {
destroy .t.c
-} -result {2}
+} -result 2
test winfont-5.6 {Tk_MeasureChars procedure: at least one char on line} -constraints {
win
@@ -337,7 +337,7 @@ test winfont-5.11 {Tk_MeasureChars procedure: check for kerning} -constraints {
expr {$x < ($width*10)}
} -cleanup {
destroy .t.l
-} -result {1}
+} -result 1
test winfont-6.1 {Tk_DrawChars procedure: loop test} -constraints win -setup {
@@ -375,12 +375,12 @@ test winfont-7.3 {AllocFont procedure: extract info from textmetric} -constraint
win
} -body {
font metric {arial 10 bold italic underline overstrike} -fixed
-} -result {0}
+} -result 0
test winfont-7.4 {AllocFont procedure: extract info from textmetric} -constraints {
win
} -body {
font metric systemfixed -fixed
-} -result {1}
+} -result 1
# cleanup
cleanupTests
diff --git a/tests/winMenu.test b/tests/winMenu.test
index b77e9a9..3b7dbec 100644
--- a/tests/winMenu.test
+++ b/tests/winMenu.test
@@ -3,8 +3,8 @@
# file tests the Macintosh-specific features of the menu
# system.
#
-# Copyright (c) 1995-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/winMsgbox.test b/tests/winMsgbox.test
index 0181103..cf7a05f 100644
--- a/tests/winMsgbox.test
+++ b/tests/winMsgbox.test
@@ -1,6 +1,6 @@
# This file is a Tcl script to test the Windows specific message box
#
-# Copyright (c) 2007 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 2007 Pat Thoyts <patthoyts@users.sourceforge.net>
package require tcltest 2.2
namespace import ::tcltest::*
@@ -224,14 +224,14 @@ test winMsgbox-2.3 {tk_messageBox message (unicode)} -constraints {
} -body {
global windowInfo
set title "winMsgbox-2.2 [pid]"
- set message "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446"
+ set message "Поиск страниц"
after 100 [list GetWindowInfo $title 2]
set r [tk_messageBox -type ok -title $title -message $message]
array set info $windowInfo
lappend r $info(childtext)
} -cleanup {
wm deiconify .
-} -result [list ok "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446"]
+} -result [list ok "Поиск страниц"]
test winMsgbox-2.4 {tk_messageBox message (empty)} -constraints {
win getwindowinfo
@@ -276,15 +276,15 @@ test winMsgbox-3.2 {tk_messageBox detail (unicode)} -constraints {
} -body {
global windowInfo
set title "winMsgbox-3.1 [pid]"
- set message "\u041f\u043e\u0438\u0441\u043a"
- set detail "\u0441\u0442\u0440\u0430\u043d\u0438\u0446"
+ set message "Поиск"
+ set detail "страниц"
after 100 [list GetWindowInfo $title 2]
set r [tk_messageBox -type ok -title $title -message $message -detail $detail]
array set info $windowInfo
lappend r $info(childtext)
} -cleanup {
wm deiconify .
-} -result [list ok "\u041f\u043e\u0438\u0441\u043a\n\n\u0441\u0442\u0440\u0430\u043d\u0438\u0446"]
+} -result [list ok "Поиск\n\nстраниц"]
# -------------------------------------------------------------------------
diff --git a/tests/winSend.test b/tests/winSend.test
index d4860b4..4a7f81d 100644
--- a/tests/winSend.test
+++ b/tests/winSend.test
@@ -2,9 +2,9 @@
# other procedures in the file tkSend.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -152,7 +152,7 @@ test winSend-3.1 {TkGetInterpNames} winSend {
set origLength [llength $currentInterps]
set newLength [llength [winfo interps]]
expr {($newLength - 2) == $origLength}
-} {1}
+} 1
test winSend-4.1 {DeleteProc - changing name of app} winSend {
newApp a
@@ -171,7 +171,7 @@ test winSend-5.1 {ExecuteRemoteObject - no error} winSend {
}
}
list [send $interp {send [tk appname] {expr {2 / 1}}}]
-} {2}
+} 2
test winSend-5.2 {ExecuteRemoteObject - error} winSend {
set newInterps [winfo interps]
foreach interp $newInterps {
@@ -268,7 +268,7 @@ test winSend-6.8 {SendDDEServer - XTYP_WILDCONNECT} winSend {
}
set command "dde services Tk {}"
list [catch "send \{$interp\} \{$command\}"]
-} {0}
+} 0
test winSend-7.1 {DDEExitProc} winSend {
newApp testApp
@@ -312,10 +312,10 @@ test winSend-10.7 {Tk_DDEObjCmd - services wrong num args} winSend {
} {1 {wrong # args: should be "dde services serviceName topicName"}}
test winSend-10.8 {Tk_DDEObjCmd - null service name} winSend {
list [catch {dde services {} {tktest #2}}]
-} {0}
+} 0
test winSend-10.9 {Tk_DDEObjCmd - null topic name} winSend {
list [catch {dde services {Tk} {}}]
-} {0}
+} 0
test winSend-10.10 {Tk_DDEObjCmd - execute - nothing to execute} winSend {
set newInterps [winfo interps]
foreach interp $newInterps {
diff --git a/tests/winWm.test b/tests/winWm.test
index 030d11a..1e2c02e 100644
--- a/tests/winWm.test
+++ b/tests/winWm.test
@@ -5,8 +5,8 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1996 by Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -14,6 +14,7 @@ namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
test winWm-1.1 {TkWmMapWindow} -constraints win -setup {
@@ -246,7 +247,7 @@ test winWm-5.2 {UpdateGeometryInfo: menu resizing} -constraints win -setup {
update
set y [winfo rooty .t]
lappend result [winfo height .t]
- menu .t.m
+ menu .t.m -tearoff 1
.t configure -menu .t.m
.t.m add command -label foo
.t.m add command -label "thisisreallylong"
@@ -275,7 +276,7 @@ test winWm-6.2 {wm attributes} -constraints win -setup {
wm attributes .t -disabled
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test winWm-6.3 {wm attributes} -constraints win -setup {
destroy .t
} -body {
@@ -448,7 +449,7 @@ test winWm-9.0 "Bug #2799589 - delayed activation of destroyed window" -constrai
if {![winfo ismapped $w]} { update }
event generate $w <Enter>
focus -force $w
- event generate $w <ButtonPress-1> -x 5 -y 5
+ event generate $w <Button-1> -x 5 -y 5
event generate $w <ButtonRelease-1> -x 5 -y 5
}
proc winwm90proc3 {} {
@@ -492,7 +493,7 @@ test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win
if {![winfo ismapped $w]} { update }
event generate $w <Enter>
focus -force $w
- event generate $w <ButtonPress-1> -x 5 -y 5
+ event generate $w <Button-1> -x 5 -y 5
event generate $w <ButtonRelease-1> -x 5 -y 5
}
proc winwm91proc3 {} {
diff --git a/tests/window.test b/tests/window.test
index c3b507d..8a56d5a 100644
--- a/tests/window.test
+++ b/tests/window.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test the procedures in the file
# tkWindow.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/winfo.test b/tests/winfo.test
index 750444f..ae0af64 100644
--- a/tests/winfo.test
+++ b/tests/winfo.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "winfo" command. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -177,7 +177,7 @@ test winfo-4.7 {"winfo containing" command} -setup {
expr {($x == ".") || ($x == "")}
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test winfo-5.1 {"winfo interps" command} -body {
@@ -191,10 +191,10 @@ test winfo-5.3 {"winfo interps" command} -body {
} -returnCodes error -result {bad window path name "geek"}
test winfo-5.4 {"winfo interps" command} -constraints unix -body {
expr {[lsearch -exact [winfo interps] [tk appname]] >= 0}
-} -result {1}
+} -result 1
test winfo-5.5 {"winfo interps" command} -constraints unix -body {
expr {[lsearch -exact [winfo interps -displayof .] [tk appname]] >= 0}
-} -result {1}
+} -result 1
test winfo-6.1 {"winfo exists" command} -body {
@@ -205,10 +205,10 @@ test winfo-6.2 {"winfo exists" command} -body {
} -returnCodes error -result {wrong # args: should be "winfo exists window"}
test winfo-6.3 {"winfo exists" command} -body {
winfo exists gorp
-} -result {0}
+} -result 0
test winfo-6.4 {"winfo exists" command} -body {
winfo exists .
-} -result {1}
+} -result 1
test winfo-6.5 {"winfo exists" command} -setup {
destroy .b
} -body {
@@ -293,13 +293,13 @@ test winfo-9.2 {"winfo viewable" command} -body {
} -returnCodes error -result {bad window path name "foo"}
test winfo-9.3 {"winfo viewable" command} -body {
winfo viewable .
-} -result {1}
+} -result 1
test winfo-9.4 {"winfo viewable" command} -constraints {failsOnUbuntu failsOnXQuarz} -body {
wm iconify .
winfo viewable .
} -cleanup {
wm deiconify .
-} -result {0}
+} -result 0
test winfo-9.5 {"winfo viewable" command} -setup {
deleteWindows
} -body {
@@ -347,7 +347,7 @@ test winfo-10.2 {"winfo visualid" command} -body {
} -returnCodes error -result {bad window path name "gorp"}
test winfo-10.3 {"winfo visualid" command} -body {
expr {2 + [winfo visualid .] - [winfo visualid .]}
-} -result {2}
+} -result 2
test winfo-11.1 {"winfo visualid" command} -body {
@@ -361,14 +361,14 @@ test winfo-11.3 {"winfo visualid" command} -body {
} -returnCodes error -result {wrong # args: should be "winfo visualsavailable window ?includeids?"}
test winfo-11.4 {"winfo visualid" command} -body {
llength [lindex [winfo visualsa .] 0]
-} -result {2}
+} -result 2
test winfo-11.5 {"winfo visualid" command} -body {
llength [lindex [winfo visualsa . includeids] 0]
-} -result {3}
+} -result 3
test winfo-11.6 {"winfo visualid" command} -body {
set x [lindex [lindex [winfo visualsa . includeids] 0] 2]
expr {$x + 2 - $x}
-} -result {2}
+} -result 2
test winfo-12.1 {GetDisplayOf procedure} -body {
diff --git a/tests/wm.test b/tests/wm.test
index 52a2422..dd198b8 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -2,9 +2,9 @@
# manager, including the "wm" command. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
# This file tests window manager interactions that work across platforms.
@@ -784,7 +784,7 @@ test wm-iconify-2.3 {Misc errors} -body {
wm iconify .t2
} -returnCodes error -cleanup {
destroy .t2
-} -result {can't iconify .t2: it is an icon for .t}
+} -result {can't iconify ".t2": it is an icon for ".t"}
# test embedded window for Windows
test wm-iconify-2.4.1 {Misc errors} -constraints win -setup {
destroy .t2
@@ -794,7 +794,7 @@ test wm-iconify-2.4.1 {Misc errors} -constraints win -setup {
wm iconify .t2
} -returnCodes error -cleanup {
destroy .t2 .r.f
-} -result {can't iconify .t2: the container does not support the request}
+} -result {can't iconify ".t2": the container does not support the request}
# test embedded window for other platforms
test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup {
destroy .t2
@@ -804,7 +804,7 @@ test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup {
wm iconify .t2
} -returnCodes error -cleanup {
destroy .t2 .r.f
-} -result {can't iconify .t2: it is an embedded window}
+} -result {can't iconify ".t2": it is an embedded window}
test wm-iconify-3.1 {iconify behavior} -constraints {failsOnUbuntu failsOnXQuarz} -body {
toplevel .t2
@@ -1485,14 +1485,14 @@ test wm-stackorder-4.1 {wm stackorder isabove|isbelow} -body {
wm stackorder . isabove .t
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test wm-stackorder-4.2 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .t
wm stackorder . isbelow .t
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test wm-stackorder-4.3 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .
@@ -1500,7 +1500,7 @@ test wm-stackorder-4.3 {wm stackorder isabove|isbelow} -body {
wm stackorder .t isa .
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test wm-stackorder-4.4 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .
@@ -1508,7 +1508,7 @@ test wm-stackorder-4.4 {wm stackorder isabove|isbelow} -body {
wm stackorder .t isb .
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
deleteWindows
test wm-stackorder-5.1 {a menu is not a toplevel} -body {
@@ -1596,7 +1596,7 @@ test wm-title-2.1 {setting and reading values} -setup {
test wm-transient-1.1 {usage} -returnCodes error -body {
catch {destroy .t} ; toplevel .t
wm transient .t 1 2
-} -result {wrong # args: should be "wm transient window ?master?"}
+} -result {wrong # args: should be "wm transient window ?window?"}
test wm-transient-1.2 {usage} -returnCodes error -body {
catch {destroy .t} ; toplevel .t
wm transient .t foo
@@ -1631,13 +1631,13 @@ test wm-transient-1.6 {usage} -returnCodes error -body {
wm transient .dummy .icon
} -cleanup {
deleteWindows
-} -result {can't make ".icon" a master: it is an icon for .top}
+} -result {can't make ".icon" a container: it is an icon for .top}
test wm-transient-1.7 {usage} -returnCodes error -body {
toplevel .top
wm transient .top .top
} -cleanup {
deleteWindows
-} -result {setting ".top" as master creates a transient/master cycle}
+} -result {can't set ".top" as container: would cause management loop}
test wm-transient-1.8 {usage} -returnCodes error -body {
toplevel .t1
toplevel .t2
@@ -1647,14 +1647,14 @@ test wm-transient-1.8 {usage} -returnCodes error -body {
wm transient .t1 .t3
} -cleanup {
deleteWindows
-} -result {setting ".t3" as master creates a transient/master cycle}
+} -result {can't set ".t3" as container: would cause management loop}
test wm-transient-1.9 {usage} -returnCodes error -body {
toplevel .top
frame .top.f
wm transient .top .top.f
} -cleanup {
deleteWindows
-} -result {setting ".top" as master creates a transient/master cycle}
+} -result {can't set ".top" as container: would cause management loop}
test wm-transient-2.1 {basic get/set of toplevel} -setup {
set results [list]
@@ -2278,7 +2278,7 @@ test wm-forget-1.1 "bug #2009788: forget toplevel can cause crash" -body {
winfo exists .parent.child
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test wm-forget-1.2 "bug #2009788: forget toplevel can cause crash" -body {
toplevel .parent
update
@@ -2287,7 +2287,7 @@ test wm-forget-1.2 "bug #2009788: forget toplevel can cause crash" -body {
winfo exists .parent.child
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test wm-forget-1.3 "bug #2009788: forget toplevel can cause crash" -body {
toplevel .parent
toplevel .parent.child
@@ -2296,7 +2296,7 @@ test wm-forget-1.3 "bug #2009788: forget toplevel can cause crash" -body {
winfo exists .parent.child
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test wm-forget-1.4 "pack into unmapped toplevel causes crash" -body {
toplevel .parent
toplevel .parent.child
diff --git a/tests/xmfbox.test b/tests/xmfbox.test
index f50329c..a6426ec 100644
--- a/tests/xmfbox.test
+++ b/tests/xmfbox.test
@@ -5,8 +5,8 @@
# runs in a modal loop, the only way to test it sufficiently is
# to call the internal Tcl procedures in xmfbox.tcl directly.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
# Contributions from Don Porter, NIST, 2002. (not subject to US copyright)
# All rights reserved.
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 010ba48..89298fc 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -96,7 +96,7 @@ HTML_INSTALL_DIR = $(INSTALL_ROOT)$(HTML_DIR)
CONFIG_INSTALL_DIR = $(INSTALL_ROOT)$(libdir)
# Directory in which to install the demo files:
-DEMO_INSTALL_DIR = $(INSTALL_ROOT)$(TK_LIBRARY)/demos
+DEMO_INSTALL_DIR = $(INSTALL_ROOT)@DEMO_DIR@
# The directory containing the Tcl sources and headers appropriate
# for this version of Tk ("srcdir" will be replaced or has already
@@ -112,7 +112,7 @@ TCL_PLATFORM_DIR = $(TCLDIR)/unix
# for this version of Tk:
TCL_BIN_DIR = @TCL_BIN_DIR@
-# The linker flags needed to link in the Tcl library (ex: -ltcl8.2)
+# The linker flags needed to link in the Tcl library (ex: -ltcl8.7)
TCL_LIB_FLAG = @TCL_LIB_FLAG@
# Flag, 1: we're building a shared lib, 0 we're not
@@ -189,8 +189,8 @@ KEYSYM_FLAGS =
# Tk does not used deprecated Tcl constructs so it should
# compile fine with -DTCL_NO_DEPRECATED. To remove its own
# set of deprecated code uncomment the second line.
-NO_DEPRECATED_FLAGS =
-#NO_DEPRECATED_FLAGS = -DTK_NO_DEPRECATED
+NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED
+#NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED
# Some versions of make, like SGI's, use the following variable to
# determine which shell to use for executing commands:
@@ -229,7 +229,7 @@ INSTALL_DATA = ${INSTALL} -m 644
INSTALL_DATA_DIR = ${INSTALL} -d -m 755
# The symbol below provides support for dynamic loading and shared
-# libraries. See configure.in for a description of what it means.
+# libraries. See configure.ac for a description of what it means.
# The value of the symbol is normally set by the configure script.
SHLIB_CFLAGS = @SHLIB_CFLAGS@ -DBUILD_tk
@@ -247,6 +247,8 @@ TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
#TK_STUB_LIB_FLAG = -ltkstub
TK_LIB_FILE = @TK_LIB_FILE@
+TK_LIB_FILE_TCL8 = @TK_LIB_FILE_TCL8@
+TK_LIB_FILE_TCL9 = @TK_LIB_FILE_TCL9@
#TK_LIB_FILE = libtk.a
# Generic lib name used in rules that apply to tcl and tk
@@ -268,7 +270,7 @@ LIBS = @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@
WISH_LIBS = $(TCL_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ @EXTRA_WISH_LIBS@
# The symbols below provide support for dynamic loading and shared
-# libraries. See configure.in for a description of what the
+# libraries. See configure.ac for a description of what the
# symbols mean. The values of the symbols are normally set by the
# configure script. You shouldn't normally need to modify any of
# these definitions by hand.
@@ -358,7 +360,7 @@ CANV_OBJS = tkCanvas.o tkCanvArc.o tkCanvBmap.o tkCanvImg.o \
tkCanvUtil.o tkCanvWind.o tkRectOval.o tkTrig.o
IMAGE_OBJS = tkImage.o tkImgBmap.o tkImgGIF.o tkImgPNG.o tkImgPPM.o \
- tkImgPhoto.o tkImgPhInstance.o
+ tkImgPhoto.o tkImgPhInstance.o tkImgListFormat.o tkImgSVGnano.o
TEXT_OBJS = tkText.o tkTextBTree.o tkTextDisp.o tkTextImage.o tkTextIndex.o \
tkTextMark.o tkTextTag.o tkTextWind.o
@@ -371,8 +373,9 @@ GENERIC_OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkBusy.o \
tkClipboard.o \
tkCmds.o tkColor.o tkConfig.o tkConsole.o tkCursor.o tkError.o \
tkEvent.o tkFocus.o tkFont.o tkGet.o tkGC.o tkGeometry.o tkGrab.o \
- tkGrid.o tkMain.o tkObj.o tkOldConfig.o tkOption.o tkPack.o tkPlace.o \
- tkSelect.o tkStyle.o tkUndo.o tkUtil.o tkVisual.o tkWindow.o
+ tkGrid.o tkMain.o tkObj.o tkOldConfig.o tkOption.o tkPack.o \
+ tkPkgConfig.o tkPlace.o tkSelect.o tkStyle.o tkUndo.o tkUtil.o \
+ tkVisual.o tkWindow.o
TTK_OBJS = \
ttkBlink.o ttkButton.o ttkCache.o ttkClamTheme.o ttkClassicTheme.o \
@@ -391,7 +394,7 @@ X11_OBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \
tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o \
tkUnixFocus.o $(FONT_OBJS) tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
- tkUnixSend.o tkUnixWm.o tkUnixXId.o
+ tkUnixSend.o tkUnixSysNotify.o tkUnixSysTray.o tkUnixWm.o tkUnixXId.o
AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \
tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \
@@ -400,9 +403,10 @@ AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \
tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o \
tkMacOSXMenu.o \
tkMacOSXMenubutton.o tkMacOSXMenus.o tkMacOSXMouseEvent.o \
- tkMacOSXNotify.o tkMacOSXRegion.o tkMacOSXScrlbr.o tkMacOSXSend.o \
+ tkMacOSXNotify.o tkMacOSXPrint.o tkMacOSXRegion.o \
+ tkMacOSXScrlbr.o tkMacOSXSend.o \
tkMacOSXServices.o tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \
- tkMacOSXWm.o tkMacOSXXStubs.o \
+ tkMacOSXWm.o tkMacOSXXStubs.o tkMacOSXSysTray.o\
tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o tkUnixScale.o \
xcolors.o xdraw.o xgc.o ximage.o xutil.o \
ttkMacOSXTheme.o
@@ -434,6 +438,7 @@ GENERIC_SRCS = \
$(GENERIC_DIR)/tkGrid.c $(GENERIC_DIR)/tkConsole.c \
$(GENERIC_DIR)/tkMain.c $(GENERIC_DIR)/tkOption.c \
$(GENERIC_DIR)/tkPack.c $(GENERIC_DIR)/tkPlace.c \
+ $(GENERIC_DIR)/tkPkgConfig.c \
$(GENERIC_DIR)/tkSelect.c $(GENERIC_DIR)/tkStyle.c \
$(GENERIC_DIR)/tkUndo.c $(GENERIC_DIR)/tkUtil.c \
$(GENERIC_DIR)/tkVisual.c $(GENERIC_DIR)/tkWindow.c \
@@ -452,8 +457,9 @@ GENERIC_SRCS = \
$(GENERIC_DIR)/tkTrig.c $(GENERIC_DIR)/tkImage.c \
$(GENERIC_DIR)/tkImgBmap.c $(GENERIC_DIR)/tkImgGIF.c \
$(GENERIC_DIR)/tkImgPNG.c $(GENERIC_DIR)/tkImgPPM.c \
+ $(GENERIC_DIR)/tkImgSVGnano.c $(GENERIC_DIR)/tkImgSVGnano.c \
$(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhInstance.c \
- $(GENERIC_DIR)/tkText.c \
+ $(GENERIC_DIR)/tkImgListFormat.c $(GENERIC_DIR)/tkText.c \
$(GENERIC_DIR)/tkTextBTree.c $(GENERIC_DIR)/tkTextDisp.c \
$(GENERIC_DIR)/tkTextImage.c \
$(GENERIC_DIR)/tkTextIndex.c $(GENERIC_DIR)/tkTextMark.c \
@@ -510,9 +516,9 @@ X11_SRCS = \
$(UNIX_DIR)/tkUnixKey.c \
$(UNIX_DIR)/tkUnixMenu.c $(UNIX_DIR)/tkUnixMenubu.c \
$(UNIX_DIR)/tkUnixScale.c $(UNIX_DIR)/tkUnixScrlbr.c \
- $(UNIX_DIR)/tkUnixSelect.c \
- $(UNIX_DIR)/tkUnixSend.c $(UNIX_DIR)/tkUnixWm.c \
- $(UNIX_DIR)/tkUnixXId.c
+ $(UNIX_DIR)/tkUnixSelect.c $(UNIX_DIR)/tkUnixSend.c \
+ $(UNIX_DIR)/tkUnixSysNotify $(UNIX_DIR)/tkUnixSysTray.c \
+ $(UNIX_DIR)/tkUnixWm.c $(UNIX_DIR)/tkUnixXId.c
AQUA_SRCS = \
$(MAC_OSX_DIR)/tkMacOSXBitmap.c $(MAC_OSX_DIR)/tkMacOSXButton.c \
@@ -529,7 +535,7 @@ AQUA_SRCS = \
$(MAC_OSX_DIR)/tkMacOSXMenubutton.c $(MAC_OSX_DIR)/tkMacOSXMenus.c \
$(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(MAC_OSX_DIR)/tkMacOSXNotify.c \
$(MAC_OSX_DIR)/tkMacOSXRegion.c $(MAC_OSX_DIR)/tkMacOSXScrlbr.c \
- $(MAC_OSX_DIR)/tkMacOSXServices.c \
+ $(MAC_OSX_DIR)/tkMacOSXServices.c $(MAC_OSX_DIR)/tkMacOSXSysTray.c \
$(MAC_OSX_DIR)/tkMacOSXSend.c $(MAC_OSX_DIR)/tkMacOSXSubwindows.c \
$(MAC_OSX_DIR)/tkMacOSXTest.c $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c \
$(MAC_OSX_DIR)/tkMacOSXWm.c $(MAC_OSX_DIR)/tkMacOSXXStubs.c \
@@ -541,6 +547,28 @@ AQUA_SRCS = \
SRCS = $(GENERIC_SRCS) $(@TK_WINDOWINGSYSTEM@_SRCS) @PLAT_SRCS@
+###
+# Tip 430 - ZipFS Modifications
+###
+
+TK_ZIP_FILE = @TK_ZIP_FILE@
+TK_VFS_ROOT = libtk.vfs
+TK_VFS_PATH = ${TK_VFS_ROOT}/tk_library
+
+HOST_CC = @CC_FOR_BUILD@
+HOST_EXEEXT = @EXEEXT_FOR_BUILD@
+HOST_OBJEXT = @OBJEXT_FOR_BUILD@
+ZIPFS_BUILD = @ZIPFS_BUILD@
+NATIVE_ZIP = @ZIP_PROG@
+ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@
+ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@
+SHARED_BUILD = @SHARED_BUILD@
+INSTALL_LIBRARIES = @INSTALL_LIBRARIES@
+INSTALL_MSGS = @INSTALL_MSGS@
+
+ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@
+
+
AQUA_RESOURCES = \
$(MAC_OSX_DIR)/tkAboutDlg.r $(MAC_OSX_DIR)/tkMacOSXCursors.r \
$(MAC_OSX_DIR)/tkMacOSXXCursors.r
@@ -574,22 +602,52 @@ SHELL_ENV = \
TCL_LIBRARY=$(TCLDIR)/library; export TCL_LIBRARY; \
TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY;
-all: binaries libraries doc
+all: binaries libraries
binaries: ${LIB_FILE} ${WISH_EXE}
libraries:
-$(TOP_DIR)/doc/man.macros:
- $(INSTALL_DATA) $(TCLDIR)/doc/man.macros $(TOP_DIR)/doc/man.macros
+tkzipfile: ${TK_ZIP_FILE}
-doc: $(TOP_DIR)/doc/man.macros
+${TK_ZIP_FILE}: ${ZIP_INSTALL_OBJS}
+ @rm -rf ${TK_VFS_ROOT}
+ @mkdir -p ${TK_VFS_PATH}
+ @echo "creating ${TK_VFS_PATH} (prepare compression)"
+ @if \
+ ln -s $(TOP_DIR)/library/* ${TK_VFS_PATH}/; \
+ then : ; else \
+ cp -a $(TOP_DIR)/library/* ${TK_VFS_PATH}; \
+ fi
+ rm -rf ${TK_VFS_PATH}/demos
+ @find ${TK_VFS_ROOT} -type d -empty -delete
+ @echo "creating ${TK_ZIP_FILE} from ${TK_VFS_PATH}"
+ -@if test "${ZIPFS_BUILD}" = "2" ; then \
+ cp ${TCL_BIN_DIR}/tclsh ${TK_VFS_ROOT}/../${TK_ZIP_FILE} || cp ${TCL_BIN_DIR}/../bin/tclsh${TCLVERSION} ${TK_VFS_ROOT}/../${TK_ZIP_FILE}; \
+ (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \
+ (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \
+ cd ${TK_VFS_ROOT} && $$zip -J ../${TK_ZIP_FILE}) \
+ fi
+ @(zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}' || \
+ echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?") 2>/dev/null`; \
+ echo 'cd ${TK_VFS_ROOT} &&' $$zip '${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH}'; \
+ cd ${TK_VFS_ROOT} && \
+ $$zip ${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} >/dev/null)
# The following target is configured by autoconf to generate either
# a shared library or non-shared library for Tk.
-${LIB_FILE}: ${STUB_LIB_FILE} @LIB_RSRC_FILE@ ${OBJS}
+${LIB_FILE}: ${STUB_LIB_FILE} @LIB_RSRC_FILE@ ${OBJS} ${TK_ZIP_FILE}
rm -f $@
@MAKE_LIB@
+ @if test "${ZIPFS_BUILD}" = "1" ; then \
+ if test "x$(MACHER)" = "x" ; then \
+ cat ${TK_ZIP_FILE} >> ${LIB_FILE}; \
+ else $(MACHER) append ${LIB_FILE} ${TK_ZIP_FILE} /tmp/macher_output; \
+ mv /tmp/macher_output ${LIB_FILE}; chmod u+x ${LIB_FILE}; \
+ fi; \
+ ${NATIVE_ZIP} -A ${LIB_FILE} \
+ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \
+ fi
${STUB_LIB_FILE}: ${STUB_LIB_OBJS}
@if test "x${LIB_FILE}" = "xlibtk${MAJOR_VERSION}.${MINOR_VERSION}.dll"; then \
@@ -623,6 +681,16 @@ objs: ${OBJS}
${WISH_EXE}: $(TK_STUB_LIB_FILE) $(WISH_OBJS) $(TK_LIB_FILE) @APP_RSRC_FILE@
${CC} ${CFLAGS} ${LDFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ \
$(WISH_LIBS) $(CC_SEARCH_FLAGS) -o ${WISH_EXE}
+ @if test "${ZIPFS_BUILD}" = "2" ; then \
+ cat ${TK_ZIP_FILE} >> ${WISH_EXE}; \
+ if test "x$(MACHER)" = "x" ; then \
+ cat ${TK_ZIP_FILE} >> ${WISH_EXE}; \
+ else $(MACHER) append ${WISH_EXE} ${TK_ZIP_FILE} /tmp/macher_output; \
+ mv /tmp/macher_output ${LIB_FILE}; chmod u+x ${LIB_FILE}; \
+ fi; \
+ ${NATIVE_ZIP} -A ${WISH_EXE} \
+ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \
+ fi
# Resetting the LIB_RUNTIME_DIR below is required so that
# the generated tktest executable gets the build directory
@@ -700,7 +768,7 @@ valgrind: $(TKTEST_EXE)
valgrindshell: $(TKTEST_EXE)
$(SHELL_ENV) valgrind $(VALGRINDARGS) ./$(TKTEST_EXE) $(SCRIPT)
-INSTALL_BASE_TARGETS = install-binaries install-libraries
+INSTALL_BASE_TARGETS = install-binaries ${INSTALL_LIBRARIES}
INSTALL_DOC_TARGETS = install-doc
INSTALL_DEV_TARGETS = install-headers
INSTALL_DEMO_TARGETS = install-demos
@@ -729,18 +797,31 @@ install-binaries: $(TK_STUB_LIB_FILE) $(TK_LIB_FILE) ${WISH_EXE}
echo "Creating package index $(PKG_INDEX)"; \
rm -f "$(PKG_INDEX)"; \
(\
- echo "if {![package vsatisfies [package provide Tcl] 8.6.0]} return";\
+ echo "if {![package vsatisfies [package provide Tcl] 8.6-]} return";\
relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\
if test "x$(DLL_INSTALL_DIR)" != "x$(BIN_INSTALL_DIR)"; then \
- echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}$(TK_LIB_FILE)]]]";\
+ echo "if {[package vsatisfies [package provide Tcl] 9.0]} {";\
+ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}$(TK_LIB_FILE_TCL9)]]]";\
+ echo "} else {";\
+ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}$(TK_LIB_FILE_TCL8)]]]";\
+ echo "}";\
else \
echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\
echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\
- echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)]]]";\
+ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\
+ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE_TCL9)]]]";\
+ echo " } else {";\
+ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE_TCL8)]]]";\
+ echo " }";\
echo "} else {";\
- echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll]]]";\
+ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\
+ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin tcl9tk${MAJOR_VERSION}${MINOR_VERSION}.dll]]]";\
+ echo " } else {";\
+ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll]]]";\
+ echo " }";\
echo "}";\
- fi \
+ fi; \
+ echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list package require -exact tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL)]"\
) > "$(PKG_INDEX)"; \
fi
@echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/"
@@ -1017,6 +1098,33 @@ tkOption.o: $(GENERIC_DIR)/tkOption.c
tkPack.o: $(GENERIC_DIR)/tkPack.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkPack.c
+# TIP #59, embedding of configuration information into the binary library.
+#
+# Part of Tk's configuration information are the paths where it was installed
+# and where it will look for its libraries (which can be different). We derive
+# this information from the variables which can be overridden by the user. As
+# every path can be configured separately we do not remember one general
+# prefix/exec_prefix but all the different paths individually.
+
+tkPkgConfig.o: $(GENERIC_DIR)/tkPkgConfig.c
+ $(CC) -c $(CC_SWITCHES) \
+ -DCFG_INSTALL_LIBDIR="\"$(LIB_INSTALL_DIR)\"" \
+ -DCFG_INSTALL_BINDIR="\"$(BIN_INSTALL_DIR)\"" \
+ -DCFG_INSTALL_SCRDIR="\"$(SCRIPT_INSTALL_DIR)\"" \
+ -DCFG_INSTALL_INCDIR="\"$(INCLUDE_INSTALL_DIR)\"" \
+ -DCFG_INSTALL_DOCDIR="\"$(MAN_INSTALL_DIR)\"" \
+ -DCFG_INSTALL_DEMODIR="\"$(DEMO_INSTALL_DIR)\"" \
+ \
+ -DCFG_RUNTIME_LIBDIR="\"$(libdir)\"" \
+ -DCFG_RUNTIME_BINDIR="\"$(bindir)\"" \
+ -DCFG_RUNTIME_SCRDIR="\"$(TK_LIBRARY)\"" \
+ -DCFG_RUNTIME_INCDIR="\"$(includedir)\"" \
+ -DCFG_RUNTIME_DOCDIR="\"$(mandir)\"" \
+ -DCFG_RUNTIME_DLLFILE="\"$(TK_LIB_FILE)\"" \
+ -DCFG_RUNTIME_DEMODIR="\"$(DEMO_INSTALL_DIR)\"" \
+ \
+ $(GENERIC_DIR)/tkPkgConfig.c
+
tkPlace.o: $(GENERIC_DIR)/tkPlace.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkPlace.c
@@ -1113,6 +1221,9 @@ tkImage.o: $(GENERIC_DIR)/tkImage.c
tkImgBmap.o: $(GENERIC_DIR)/tkImgBmap.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgBmap.c
+tkImgListFormat.o: $(GENERIC_DIR)/tkImgListFormat.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgListFormat.c
+
tkImgGIF.o: $(GENERIC_DIR)/tkImgGIF.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgGIF.c
@@ -1122,6 +1233,9 @@ tkImgPNG.o: $(GENERIC_DIR)/tkImgPNG.c
tkImgPPM.o: $(GENERIC_DIR)/tkImgPPM.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPPM.c
+tkImgSVGnano.o: $(GENERIC_DIR)/tkImgSVGnano.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgSVGnano.c
+
tkImgPhoto.o: $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhoto.h
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c
@@ -1232,6 +1346,12 @@ tkUnixSelect.o: $(UNIX_DIR)/tkUnixSelect.c
tkUnixSend.o: $(UNIX_DIR)/tkUnixSend.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixSend.c
+tkUnixSysNotify.o: $(UNIX_DIR)/tkUnixSysNotify.c
+ $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixSysNotify.c
+
+tkUnixSysTray.o: $(UNIX_DIR)/tkUnixSysTray.c
+ $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixSysTray.c
+
tkUnixWm.o: $(UNIX_DIR)/tkUnixWm.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixWm.c
@@ -1308,6 +1428,9 @@ tkMacOSXMouseEvent.o: $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c
tkMacOSXNotify.o: $(MAC_OSX_DIR)/tkMacOSXNotify.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXNotify.c
+tkMacOSXPrint.o: $(MAC_OSX_DIR)/tkMacOSXPrint.c
+ $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXPrint.c
+
tkMacOSXRegion.o: $(MAC_OSX_DIR)/tkMacOSXRegion.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXRegion.c
@@ -1338,6 +1461,9 @@ tkMacOSXWm.o: $(MAC_OSX_DIR)/tkMacOSXWm.c
tkMacOSXXStubs.o: $(MAC_OSX_DIR)/tkMacOSXXStubs.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXXStubs.c
+tkMacOSXSysTray.o: $(MAC_OSX_DIR)/tkMacOSXSysTray.c
+ $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSysTray.c
+
tkFileFilter.o: $(GENERIC_DIR)/tkFileFilter.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkFileFilter.c
@@ -1479,7 +1605,7 @@ $(TTK_DIR)/ttkStubInit.c: $(TTK_DIR)/ttk.decls
genstubs:
$(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(GENERIC_DIR) \
$(GENERIC_DIR)/tk.decls $(GENERIC_DIR)/tkInt.decls
- $(TCL_EXE) $(TTK_DIR)/ttkGenStubs.tcl $(TTK_DIR) $(TTK_DIR)/ttk.decls
+ $(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(TTK_DIR) $(TTK_DIR)/ttk.decls
#
# Target to check that all exported functions have an entry in the stubs
@@ -1541,7 +1667,10 @@ DISTROOT = /tmp/dist
DISTNAME = tk${VERSION}${PATCH_LEVEL}
ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip
DISTDIR = $(DISTROOT)/$(DISTNAME)
-$(UNIX_DIR)/configure: $(UNIX_DIR)/configure.in $(UNIX_DIR)/tcl.m4 \
+DIST_INSTALL_DATA = CPPROG='cp -p' $(INSTALL) -m 644
+DIST_INSTALL_SCRIPT = CPPROG='cp -p' $(INSTALL) -m 755
+
+$(UNIX_DIR)/configure: $(UNIX_DIR)/configure.ac $(UNIX_DIR)/tcl.m4 \
$(UNIX_DIR)/aclocal.m4
cd $(UNIX_DIR); autoconf
$(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure
@@ -1553,96 +1682,95 @@ $(TOP_DIR)/manifest.uuid:
printf "git." >$(TOP_DIR)/manifest.uuid
git rev-parse HEAD >>$(TOP_DIR)/manifest.uuid
-dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure $(TOP_DIR)/doc/man.macros $(TOP_DIR)/manifest.uuid
+dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure $(TOP_DIR)/doc/man.macros $(TOP_DIR)/manifest.uuid
rm -rf $(DISTDIR)
- mkdir -p $(DISTDIR)/unix
- cp -p $(TOP_DIR)/manifest.uuid $(DISTDIR)
- cp -p $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix
- cp $(TOP_DIR)/license.terms $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix
- chmod 664 $(DISTDIR)/unix/Makefile.in
- cp $(UNIX_DIR)/configure $(UNIX_DIR)/configure.in $(UNIX_DIR)/tk.spec \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/unix
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/manifest.uuid $(DISTDIR)
+ $(DIST_INSTALL_DATA) $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix
+ $(DIST_INSTALL_DATA) $(UNIX_DIR)/configure.ac $(UNIX_DIR)/tk.spec \
$(UNIX_DIR)/aclocal.m4 $(UNIX_DIR)/tcl.m4 \
$(UNIX_DIR)/tkConfig.sh.in $(UNIX_DIR)/install-sh \
$(UNIX_DIR)/README $(UNIX_DIR)/installManPage \
$(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(DISTDIR)/unix
- chmod 775 $(DISTDIR)/unix/configure
- mkdir $(DISTDIR)/bitmaps
+ $(DIST_INSTALL_SCRIPT) $(UNIX_DIR)/configure $(DISTDIR)/unix
+ $(INSTALL_DATA_DIR) $(DISTDIR)/bitmaps
@(cd $(TOP_DIR); for i in bitmaps/* ; do \
if [ -f $$i ] ; then \
sed -e 's/static char/static unsigned char/' \
$$i > $(DISTDIR)/$$i; \
fi; \
done;)
- mkdir $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/*.[ch] $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/*.decls $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/README $(DISTDIR)/generic
- cp -p $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/generic
+ $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.[ch] $(DISTDIR)/generic
+ $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.decls $(DISTDIR)/generic
+ $(DIST_INSTALL_DATA) $(GENERIC_DIR)/README $(DISTDIR)/generic
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog \
$(TOP_DIR)/ChangeLog.2??? $(TOP_DIR)/README.md \
$(TOP_DIR)/license.terms $(DISTDIR)
rm -f $(DISTDIR)/generic/blt*.[ch]
- mkdir $(DISTDIR)/generic/ttk
- cp -p $(TTK_DIR)/*.[ch] $(TTK_DIR)/ttk.decls \
- $(TTK_DIR)/ttkGenStubs.tcl $(DISTDIR)/generic/ttk
- mkdir $(DISTDIR)/win
- cp $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win
- cp $(TOP_DIR)/win/configure.in \
- $(TOP_DIR)/win/configure \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/generic/ttk
+ $(DIST_INSTALL_DATA) $(TTK_DIR)/*.[ch] $(TTK_DIR)/ttk.decls \
+ $(DISTDIR)/generic/ttk
+ $(INSTALL_DATA_DIR) $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/configure.ac \
$(TOP_DIR)/win/tkConfig.sh.in \
$(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \
$(DISTDIR)/win
- cp -p $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/*.vc $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/README $(DISTDIR)/win
- cp -p $(TOP_DIR)/license.terms $(DISTDIR)/win
- mkdir $(DISTDIR)/win/rc
- cp -p $(TOP_DIR)/win/wish.exe.manifest.in $(DISTDIR)/win/
- cp -p $(TOP_DIR)/win/rc/*.{rc,cur,ico,bmp} $(DISTDIR)/win/rc
- mkdir $(DISTDIR)/macosx
- cp -p $(MAC_OSX_DIR)/GNUmakefile $(MAC_OSX_DIR)/README \
+ $(DIST_INSTALL_SCRIPT) $(TOP_DIR)/win/configure $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/*.vc $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/README $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/win
+ $(INSTALL_DATA_DIR) $(DISTDIR)/win/rc
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/wish.exe.manifest.in $(DISTDIR)/win/
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/rc/*.{rc,cur,ico,bmp} $(DISTDIR)/win/rc
+ $(INSTALL_DATA_DIR) $(DISTDIR)/macosx
+ $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/GNUmakefile $(MAC_OSX_DIR)/README \
$(MAC_OSX_DIR)/*.icns $(MAC_OSX_DIR)/*.tiff \
$(MAC_OSX_DIR)/*.[ch] $(MAC_OSX_DIR)/*.in \
$(MAC_OSX_DIR)/*.ac $(MAC_OSX_DIR)/*.xcconfig \
- $(MAC_OSX_DIR)/*.sdef $(MAC_OSX_DIR)/configure \
+ $(MAC_OSX_DIR)/*.sdef \
$(DISTDIR)/macosx
- cp -p $(TOP_DIR)/license.terms $(DISTDIR)/macosx
- mkdir $(DISTDIR)/macosx/Tk.xcode
- cp -p $(MAC_OSX_DIR)/Tk.xcode/project.pbxproj \
+ $(DIST_INSTALL_SCRIPT) $(MAC_OSX_DIR)/configure $(DISTDIR)/macosx
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/macosx
+ $(INSTALL_DATA_DIR) $(DISTDIR)/macosx/Tk.xcode
+ $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/Tk.xcode/project.pbxproj \
$(MAC_OSX_DIR)/Tk.xcode/default.pbxuser \
$(DISTDIR)/macosx/Tk.xcode
- mkdir $(DISTDIR)/macosx/Tk.xcodeproj
- cp -p $(MAC_OSX_DIR)/Tk.xcodeproj/project.pbxproj \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/macosx/Tk.xcodeproj
+ $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/Tk.xcodeproj/project.pbxproj \
$(MAC_OSX_DIR)/Tk.xcodeproj/default.pbxuser \
$(DISTDIR)/macosx/Tk.xcodeproj
- mkdir $(DISTDIR)/compat
- cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/compat/unistd.h \
- $(TOP_DIR)/compat/stdlib.h \
- $(DISTDIR)/compat
- mkdir $(DISTDIR)/xlib
- cp -p $(XLIB_DIR)/*.[ch] $(DISTDIR)/xlib
- cp -p $(TOP_DIR)/license.terms $(DISTDIR)/xlib
- mkdir $(DISTDIR)/xlib/X11
- cp -p $(XLIB_DIR)/X11/*.h $(DISTDIR)/xlib/X11
- cp -p $(TOP_DIR)/license.terms $(DISTDIR)/xlib/X11
- mkdir $(DISTDIR)/library
- cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/compat
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/compat/stdint.h \
+ $(TOP_DIR)/compat/stdbool.h $(DISTDIR)/compat
+ $(INSTALL_DATA_DIR) $(DISTDIR)/xlib
+ $(DIST_INSTALL_DATA) $(XLIB_DIR)/*.[ch] $(DISTDIR)/xlib
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/xlib
+ $(INSTALL_DATA_DIR) $(DISTDIR)/xlib/X11
+ $(DIST_INSTALL_DATA) $(XLIB_DIR)/X11/*.h $(DISTDIR)/xlib/X11
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/xlib/X11
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \
$(TOP_DIR)/library/tclIndex \
$(DISTDIR)/library
- mkdir $(DISTDIR)/library/ttk
- cp -p $(TOP_DIR)/library/ttk/*.tcl $(DISTDIR)/library/ttk
- mkdir $(DISTDIR)/library/images
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library/ttk
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/library/ttk/*.tcl $(DISTDIR)/library/ttk
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library/images
@(cd $(TOP_DIR); for i in library/images/* ; do \
if [ -f $$i ] ; then \
- cp $$i $(DISTDIR)/$$i; \
+ $(DIST_INSTALL_DATA) $$i $(DISTDIR)/$$i; \
fi; \
done;)
- mkdir $(DISTDIR)/library/msgs
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library/msgs
@(cd $(TOP_DIR); for i in library/msgs/*.msg ; do \
if [ -f $$i ] ; then \
- cp $$i $(DISTDIR)/$$i; \
+ $(DIST_INSTALL_DATA) $$i $(DISTDIR)/$$i; \
fi; \
done;)
- mkdir $(DISTDIR)/library/demos
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library/demos
cp -pr $(TOP_DIR)/library/demos/*.tcl \
$(TOP_DIR)/library/demos/*.msg \
$(TOP_DIR)/library/demos/tclIndex \
@@ -1655,21 +1783,21 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(M
$(TOP_DIR)/library/demos/widget \
$(TOP_DIR)/library/demos/README \
$(TOP_DIR)/license.terms $(DISTDIR)/library/demos
- mkdir $(DISTDIR)/library/demos/images
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library/demos/images
@(cd $(TOP_DIR); for i in library/demos/images/* ; do \
if [ -f $$i ] ; then \
- cp $$i $(DISTDIR)/$$i; \
+ $(DIST_INSTALL_DATA) $$i $(DISTDIR)/$$i; \
fi; \
done;)
- mkdir $(DISTDIR)/doc
- cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/doc
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \
$(TOP_DIR)/doc/man.macros $(DISTDIR)/doc
- mkdir $(DISTDIR)/tests
- cp -p $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/tests
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \
$(TEST_DIR)/README $(TEST_DIR)/*.{gif,png,ppm,xbm} \
$(TEST_DIR)/option.file* $(DISTDIR)/tests
- mkdir $(DISTDIR)/tests/ttk
- cp -p $(TEST_DIR)/ttk/*.{test,tcl} $(DISTDIR)/tests/ttk
+ $(INSTALL_DATA_DIR) $(DISTDIR)/tests/ttk
+ $(DIST_INSTALL_DATA) $(TEST_DIR)/ttk/*.{test,tcl} $(DISTDIR)/tests/ttk
cp -p $(TOP_DIR)/.travis.yml $(DISTDIR)
mkdir -p $(DISTDIR)/.github/workflows
cp -p $(TOP_DIR)/.github/workflows/*.yml $(DISTDIR)/.github/workflows
diff --git a/unix/configure b/unix/configure
index ecff290..bd4b7d8 100755
--- a/unix/configure
+++ b/unix/configure
@@ -1,81 +1,479 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for tk 8.6.
+# Generated by GNU Autoconf 2.71 for tk 8.7.
+#
+#
+# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
+# Inc.
+#
#
-# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+as_nop=:
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
emulate sh
NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else $as_nop
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
fi
-DUALCASE=1; export DUALCASE # for MKS sh
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
+as_nl='
+'
+export as_nl
+IFS=" "" $as_nl"
+
PS1='$ '
PS2='> '
PS4='+ '
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
+
+# The user is always right.
+if ${PATH_SEPARATOR+false} :; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ test -r "$as_dir$0" && as_myself=$as_dir$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="as_nop=:
+if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else \$as_nop
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" )
+then :
+
+else \$as_nop
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+blah=\$(echo \$(echo blah))
+test x\"\$blah\" = xblah || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null
+then :
+ as_have_required=yes
+else $as_nop
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null
+then :
+
+else $as_nop
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null
+then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
done
+IFS=$as_save_IFS
+if $as_found
+then :
+
+else $as_nop
+ if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi
+fi
+
+
+ if test "x$CONFIG_SHELL" != x
+then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno
+then :
+ printf "%s\n" "$0: This script requires a shell more modern than all"
+ printf "%s\n" "$0: the shells that I found on your system."
+ if test ${ZSH_VERSION+y} ; then
+ printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+# as_fn_nop
+# ---------
+# Do nothing but, unlike ":", preserve the value of $?.
+as_fn_nop ()
+{
+ return $?
+}
+as_nop=as_fn_nop
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else $as_nop
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else $as_nop
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+# as_fn_nop
+# ---------
+# Do nothing but, unlike ":", preserve the value of $?.
+as_fn_nop ()
+{
+ return $?
+}
+as_nop=as_fn_nop
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ printf "%s\n" "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
-# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
-# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -83,146 +481,102 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
+ s/-\n.*//
' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
+ chmod +x "$as_me.lineno" ||
+ { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n. New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
+
rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-as_executable_p="test -f"
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -231,89 +585,262 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-exec 6>&1
-
#
# Initializations.
#
ac_default_prefix=/usr/local
+ac_clean_files=
ac_config_libobj_dir=.
+LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
# Identity of this package.
PACKAGE_NAME='tk'
PACKAGE_TARNAME='tk'
-PACKAGE_VERSION='8.6'
-PACKAGE_STRING='tk 8.6'
+PACKAGE_VERSION='8.7'
+PACKAGE_STRING='tk 8.7'
PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
# Factoring default headers for most tests.
ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
+#include <stddef.h>
+#ifdef HAVE_STDIO_H
+# include <stdio.h>
#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
+#ifdef HAVE_STDLIB_H
# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
+#ifdef HAVE_STRING_H
# include <string.h>
#endif
-#if HAVE_STRINGS_H
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
#endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCLSH_PROG BUILD_TCLSH MAN_FLAGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP TCL_THREADS SHARED_BUILD RANLIB ac_ct_RANLIB AR ac_ct_AR LIBOBJS TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS PLAT_SRCS LDAIX_SRC CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING CFLAGS_NOLTO LDFLAGS_DEBUG LDFLAGS_OPTIMIZE CC_SEARCH_FLAGS LD_SEARCH_FLAGS STLIB_LD SHLIB_LD TCL_SHLIB_LD_EXTRAS TK_SHLIB_LD_EXTRAS SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX MAKE_LIB MAKE_STUB_LIB INSTALL_LIB DLL_INSTALL_DIR INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT XFT_CFLAGS XFT_LIBS UNIX_FONT_OBJS TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_YEAR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_INCLUDE_SPEC TK_BUILD_STUB_LIB_SPEC TK_BUILD_STUB_LIB_PATH TK_SRC_DIR TK_SHARED_BUILD LD_LIBRARY_PATH_VAR TK_BUILD_LIB_SPEC TCL_STUB_FLAGS XINCLUDES XLIBSW LOCALES TK_WINDOWINGSYSTEM TK_PKG_DIR TK_LIBRARY LIB_RUNTIME_DIR PRIVATE_INCLUDE_DIR HTML_DIR EXTRA_CC_SWITCHES EXTRA_APP_CC_SWITCHES EXTRA_INSTALL EXTRA_INSTALL_BINARIES EXTRA_BUILD_HTML EXTRA_WISH_LIBS CFBUNDLELOCALIZATIONS TK_RSRC_FILE WISH_RSRC_FILE LIB_RSRC_FILE APP_RSRC_FILE REZ REZ_FLAGS LTLIBOBJS'
+ac_header_c_list=
+ac_subst_vars='LTLIBOBJS
+REZ_FLAGS
+REZ
+APP_RSRC_FILE
+LIB_RSRC_FILE
+WISH_RSRC_FILE
+TK_RSRC_FILE
+CFBUNDLELOCALIZATIONS
+EXTRA_WISH_LIBS
+EXTRA_BUILD_HTML
+EXTRA_INSTALL_BINARIES
+EXTRA_INSTALL
+EXTRA_APP_CC_SWITCHES
+EXTRA_CC_SWITCHES
+HTML_DIR
+PRIVATE_INCLUDE_DIR
+LIB_RUNTIME_DIR
+TK_LIBRARY
+TK_PKG_DIR
+TK_WINDOWINGSYSTEM
+LOCALES
+XLIBSW
+XINCLUDES
+TCL_STUB_FLAGS
+TK_BUILD_LIB_SPEC
+LD_LIBRARY_PATH_VAR
+TK_SHARED_BUILD
+TK_SRC_DIR
+TK_BUILD_STUB_LIB_PATH
+TK_BUILD_STUB_LIB_SPEC
+TK_INCLUDE_SPEC
+TK_STUB_LIB_PATH
+TK_STUB_LIB_SPEC
+TK_STUB_LIB_FLAG
+TK_STUB_LIB_FILE
+TK_LIB_SPEC
+TK_LIB_FLAG
+TK_LIB_FILE_TCL9
+TK_LIB_FILE_TCL8
+TK_LIB_FILE
+TK_YEAR
+TK_PATCH_LEVEL
+TK_MINOR_VERSION
+TK_MAJOR_VERSION
+TK_VERSION
+TK_DEMO_DIR
+DEMO_DIR
+INSTALL_MSGS
+INSTALL_LIBRARIES
+TK_ZIP_FILE
+ZIPFS_BUILD
+ZIP_INSTALL_OBJS
+ZIP_PROG_VFSSEARCH
+ZIP_PROG_OPTIONS
+ZIP_PROG
+MACHER_PROG
+EXEEXT_FOR_BUILD
+CC_FOR_BUILD
+UNIX_FONT_OBJS
+XFT_LIBS
+XFT_CFLAGS
+XMKMF
+EGREP
+GREP
+CPP
+LDFLAGS_DEFAULT
+CFLAGS_DEFAULT
+INSTALL_STUB_LIB
+DLL_INSTALL_DIR
+INSTALL_LIB
+MAKE_STUB_LIB
+MAKE_LIB
+SHLIB_SUFFIX
+SHLIB_CFLAGS
+SHLIB_LD_LIBS
+TK_SHLIB_LD_EXTRAS
+TCL_SHLIB_LD_EXTRAS
+SHLIB_LD
+STLIB_LD
+LD_SEARCH_FLAGS
+CC_SEARCH_FLAGS
+LDFLAGS_OPTIMIZE
+LDFLAGS_DEBUG
+CFLAGS_NOLTO
+CFLAGS_WARNING
+CFLAGS_OPTIMIZE
+CFLAGS_DEBUG
+LDAIX_SRC
+PLAT_SRCS
+PLAT_OBJS
+DL_OBJS
+DL_LIBS
+TCL_LIBS
+LIBOBJS
+AR
+RANLIB
+SHARED_BUILD
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+MAN_FLAGS
+BUILD_TCLSH
+TCLSH_PROG
+TCL_STUB_LIB_SPEC
+TCL_STUB_LIB_FLAG
+TCL_STUB_LIB_FILE
+TCL_LIB_SPEC
+TCL_LIB_FLAG
+TCL_LIB_FILE
+TCL_SRC_DIR
+TCL_BIN_DIR
+TCL_PATCH_LEVEL
+TCL_VERSION
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+runstatedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL
+OBJEXT_FOR_BUILD'
ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+with_tcl
+enable_man_symlinks
+enable_man_compression
+enable_man_suffix
+with_encoding
+enable_shared
+enable_64bit
+enable_64bit_vis
+enable_rpath
+enable_corefoundation
+enable_load
+enable_symbols
+enable_aqua
+with_x
+enable_xft
+enable_xss
+enable_framework
+enable_zipfs
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+XMKMF'
+
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
@@ -336,34 +863,48 @@ x_libraries=NONE
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
ac_prev=
+ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
+ eval $ac_prev=\$ac_option
ac_prev=
continue
fi
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
@@ -385,33 +926,59 @@ do
--config-cache | -C)
cache_file=config.cache ;;
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ -datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
-disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: \`$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
-enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: \`$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
+ eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -438,6 +1005,12 @@ do
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
@@ -462,13 +1035,16 @@ do
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
-localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
+ | --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -533,10 +1109,29 @@ do
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -583,26 +1178,36 @@ do
ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: \`$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
esac
- eval "with_$ac_package='$ac_optarg'" ;;
+ eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: \`$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
@@ -622,27 +1227,26 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -650,31 +1254,36 @@ done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "missing argument to $ac_option"
fi
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
-done
+fi
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir runstatedir
do
- eval ac_val=$`echo $ac_var`
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
@@ -688,8 +1297,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -701,74 +1308,72 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
+ if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
-fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
- { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
#
# Report the --help message.
@@ -777,7 +1382,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tk 8.6 to adapt to many kinds of systems.
+\`configure' configures tk 8.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -791,20 +1396,17 @@ Configuration:
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
+ -q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
-_ACEOF
-
- cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
+ [$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
+ [PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
@@ -814,18 +1416,26 @@ for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/tk]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
@@ -838,11 +1448,12 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tk 8.6:";;
+ short | recursive ) echo "Configuration of tk 8.7:";;
esac
cat <<\_ACEOF
Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-man-symlinks use symlinks for the manpages (default: off)
@@ -852,7 +1463,6 @@ Optional Features:
use STRING as a suffix to manpage file names
(default: no, tk if enabled without
specifying STRING)
- --enable-threads build with threads (default: on)
--enable-shared build and link with shared libraries (default: on)
--enable-64bit enable 64bit support (default: off)
--enable-64bit-vis enable 64bit Sparc VIS support (default: off)
@@ -866,12 +1476,14 @@ Optional Features:
--enable-xss use XScreenSaver for activity timer (default: on)
--enable-framework package shared libraries in MacOSX frameworks
(default: off)
+ --enable-zipfs build with Zipfs support (default: on)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-tcl directory containing tcl configuration
(tclConfig.sh)
+ --with-encoding encoding for configuration values (default: utf-8)
--with-x use the X Window System
Some influential environment variables:
@@ -879,128 +1491,442 @@ Some influential environment variables:
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
CPP C preprocessor
+ XMKMF Path to xmkmf, Makefile generator for X Window System
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
+Report bugs to the package provider.
_ACEOF
+ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
ac_builddir=.
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for configure.gnu first; this name is used for a wrapper for
+ # Metaconfig's "Configure" on case-insensitive file systems.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
+ printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
-test -n "$ac_init_help" && exit 0
+test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tk configure 8.6
-generated by GNU Autoconf 2.59
+tk configure 8.7
+generated by GNU Autoconf 2.71
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 2021 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
- exit 0
+ exit
fi
-exec 5>config.log
-cat >&5 <<_ACEOF
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest.beam
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext
+then :
+ ac_retval=0
+else $as_nop
+ printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }
+then :
+ ac_retval=0
+else $as_nop
+ printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ eval "$3=yes"
+else $as_nop
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below. */
+
+#include <limits.h>
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main (void)
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+ eval "$3=yes"
+else $as_nop
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that
+# executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+then :
+ ac_retval=0
+else $as_nop
+ printf "%s\n" "$as_me: program exited with status $ac_status" >&5
+ printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }
+then :
+ ac_retval=0
+else $as_nop
+ printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main (void)
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main (void)
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+
+else $as_nop
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+ac_configure_args_raw=
+for ac_arg
+do
+ case $ac_arg in
+ *\'*)
+ ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append ac_configure_args_raw " '$ac_arg'"
+done
+
+case $ac_configure_args_raw in
+ *$as_nl*)
+ ac_safe_unquote= ;;
+ *)
+ ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab.
+ ac_unsafe_a="$ac_unsafe_z#~"
+ ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g"
+ ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;;
+esac
+
+cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tk $as_me 8.6, which was
-generated by GNU Autoconf 2.59. Invocation command line was
+It was created by tk $as_me 8.7, which was
+generated by GNU Autoconf 2.71. Invocation command line was
- $ $0 $@
+ $ $0$ac_configure_args_raw
_ACEOF
+exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
@@ -1019,7 +1945,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
@@ -1030,9 +1956,14 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ printf "%s\n" "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
} >&5
@@ -1054,7 +1985,6 @@ _ACEOF
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
-ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
@@ -1065,13 +1995,13 @@ do
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*)
+ ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
@@ -1087,217 +2017,559 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
+ as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
+ # Sanitize IFS.
+ IFS=" "" $as_nl"
# Save into config.log some information that might help in debugging.
{
echo
- cat <<\_ASBOX
-## ---------------- ##
+ printf "%s\n" "## ---------------- ##
## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
(set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
*)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-}
+ esac |
+ sort
+)
echo
- cat <<\_ASBOX
-## ----------------- ##
+ printf "%s\n" "## ----------------- ##
## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
+ printf "%s\n" "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
+ printf "%s\n" "## ----------- ##
## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
echo
- sed "/^$/d" confdefs.h | sort
+ cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
+ printf "%s\n" "$as_me: caught signal $ac_signal"
+ printf "%s\n" "$as_me: exit $exit_status"
} >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
- ' 0
+' 0
for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
+rm -f -r conftest* confdefs.h
+printf "%s\n" "/* confdefs.h */" > confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
+# Predefined preprocessor variables.
+printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
+printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h
+printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
+printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h
+printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
+printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h
# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
+# Prefer an explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ ac_site_files="$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
+else
+ ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
+
+for ac_site_file in $ac_site_files
+do
+ case $ac_site_file in #(
+ */*) :
+ ;; #(
+ *) :
+ ac_site_file=./$ac_site_file ;;
+esac
+ if test -f "$ac_site_file" && test -r "$ac_site_file"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
+ . "$ac_site_file" \
+ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
fi
done
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+printf "%s\n" "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
esac
fi
else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+printf "%s\n" "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
+# Test code for whether the C compiler supports C89 (global declarations)
+ac_c_conftest_c89_globals='
+/* Does the compiler advertise C89 conformance?
+ Do not test the value of __STDC__, because some compilers set it to 0
+ while being otherwise adequately conformant. */
+#if !defined __STDC__
+# error "Compiler does not advertise C89 conformance"
+#endif
+
+#include <stddef.h>
+#include <stdarg.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */
+struct buf { int x; };
+struct buf * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not \xHH hex character constants.
+ These do not provoke an error unfortunately, instead are silently treated
+ as an "x". The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously \x00 != x always comes out true, for an
+ array size at least. It is necessary to write \x00 == 0 to get something
+ that is true only with -std. */
+int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) '\''x'\''
+int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),
+ int, int);'
+
+# Test code for whether the C compiler supports C89 (body of main).
+ac_c_conftest_c89_main='
+ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);
+'
+
+# Test code for whether the C compiler supports C99 (global declarations)
+ac_c_conftest_c99_globals='
+// Does the compiler advertise C99 conformance?
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
+# error "Compiler does not advertise C99 conformance"
+#endif
+
+#include <stdbool.h>
+extern int puts (const char *);
+extern int printf (const char *, ...);
+extern int dprintf (int, const char *, ...);
+extern void *malloc (size_t);
+
+// Check varargs macros. These examples are taken from C99 6.10.3.5.
+// dprintf is used instead of fprintf to avoid needing to declare
+// FILE and stderr.
+#define debug(...) dprintf (2, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+ int x = 1234;
+ int y = 5678;
+ debug ("Flag");
+ debug ("X = %d\n", x);
+ showlist (The first, second, and third items.);
+ report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+ #error "your preprocessor is broken"
+#endif
+#if BIG_OK
+#else
+ #error "your preprocessor is broken"
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+ int datasize;
+ double data[];
+};
+
+struct named_init {
+ int number;
+ const wchar_t *name;
+ double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+ // See if C++-style comments work.
+ // Iterate through items via the restricted pointer.
+ // Also check for declarations in for loops.
+ for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i)
+ continue;
+ return 0;
+}
+
+// Check varargs and va_copy.
+static bool
+test_varargs (const char *format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ va_list args_copy;
+ va_copy (args_copy, args);
+
+ const char *str = "";
+ int number = 0;
+ float fnumber = 0;
+
+ while (*format)
+ {
+ switch (*format++)
+ {
+ case '\''s'\'': // string
+ str = va_arg (args_copy, const char *);
+ break;
+ case '\''d'\'': // int
+ number = va_arg (args_copy, int);
+ break;
+ case '\''f'\'': // float
+ fnumber = va_arg (args_copy, double);
+ break;
+ default:
+ break;
+ }
+ }
+ va_end (args_copy);
+ va_end (args);
+
+ return *str && number && fnumber;
+}
+'
+
+# Test code for whether the C compiler supports C99 (body of main).
+ac_c_conftest_c99_main='
+ // Check bool.
+ _Bool success = false;
+ success |= (argc != 0);
+
+ // Check restrict.
+ if (test_restrict ("String literal") == 0)
+ success = true;
+ char *restrict newvar = "Another string";
+
+ // Check varargs.
+ success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234);
+ test_varargs_macros ();
+
+ // Check flexible array members.
+ struct incomplete_array *ia =
+ malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+ ia->datasize = 10;
+ for (int i = 0; i < ia->datasize; ++i)
+ ia->data[i] = i * 1.234;
+
+ // Check named initializers.
+ struct named_init ni = {
+ .number = 34,
+ .name = L"Test wide string",
+ .average = 543.34343,
+ };
+
+ ni.number = 58;
+
+ int dynamic_array[ni.number];
+ dynamic_array[0] = argv[0][0];
+ dynamic_array[ni.number - 1] = 543;
+
+ // work around unused variable warnings
+ ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
+ || dynamic_array[ni.number - 1] != 543);
+'
+
+# Test code for whether the C compiler supports C11 (global declarations)
+ac_c_conftest_c11_globals='
+// Does the compiler advertise C11 conformance?
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
+# error "Compiler does not advertise C11 conformance"
+#endif
+
+// Check _Alignas.
+char _Alignas (double) aligned_as_double;
+char _Alignas (0) no_special_alignment;
+extern char aligned_as_int;
+char _Alignas (0) _Alignas (int) aligned_as_int;
+
+// Check _Alignof.
+enum
+{
+ int_alignment = _Alignof (int),
+ int_array_alignment = _Alignof (int[100]),
+ char_alignment = _Alignof (char)
+};
+_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
+
+// Check _Noreturn.
+int _Noreturn does_not_return (void) { for (;;) continue; }
+
+// Check _Static_assert.
+struct test_static_assert
+{
+ int x;
+ _Static_assert (sizeof (int) <= sizeof (long int),
+ "_Static_assert does not work in struct");
+ long int y;
+};
+
+// Check UTF-8 literals.
+#define u8 syntax error!
+char const utf8_literal[] = u8"happens to be ASCII" "another string";
+
+// Check duplicate typedefs.
+typedef long *long_ptr;
+typedef long int *long_ptr;
+typedef long_ptr long_ptr;
+
+// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
+struct anonymous
+{
+ union {
+ struct { int i; int j; };
+ struct { int k; long int l; } w;
+ };
+ int m;
+} v1;
+'
+
+# Test code for whether the C compiler supports C11 (body of main).
+ac_c_conftest_c11_main='
+ _Static_assert ((offsetof (struct anonymous, i)
+ == offsetof (struct anonymous, w.k)),
+ "Anonymous union alignment botch");
+ v1.i = 2;
+ v1.w.k = 5;
+ ok |= v1.i != 5;
+'
+
+# Test code for whether the C compiler supports C11 (complete).
+ac_c_conftest_c11_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+${ac_c_conftest_c11_globals}
+
+int
+main (int argc, char **argv)
+{
+ int ok = 0;
+ ${ac_c_conftest_c89_main}
+ ${ac_c_conftest_c99_main}
+ ${ac_c_conftest_c11_main}
+ return ok;
+}
+"
+
+# Test code for whether the C compiler supports C99 (complete).
+ac_c_conftest_c99_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+
+int
+main (int argc, char **argv)
+{
+ int ok = 0;
+ ${ac_c_conftest_c89_main}
+ ${ac_c_conftest_c99_main}
+ return ok;
+}
+"
+
+# Test code for whether the C compiler supports C89 (complete).
+ac_c_conftest_c89_program="${ac_c_conftest_c89_globals}
+
+int
+main (int argc, char **argv)
+{
+ int ok = 0;
+ ${ac_c_conftest_c89_main}
+ return ok;
+}
+"
+
+as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H"
+as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H"
+as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H"
+as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H"
+as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H"
+as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H"
+as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H"
+as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H"
+as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"
+as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H"
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file'
+ and start over" "$LINENO" 5
fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -1310,35 +2582,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TK_VERSION=8.6
+TK_VERSION=8.7
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=6
-TK_PATCH_LEVEL=".11"
+TK_MINOR_VERSION=7
+TK_PATCH_LEVEL="a6"
VERSION=${TK_VERSION}
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
@@ -1357,16 +2604,18 @@ LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
# we reset no_tcl in case something fails here
no_tcl=true
-# Check whether --with-tcl or --without-tcl was given.
-if test "${with_tcl+set}" = set; then
- withval="$with_tcl"
- with_tclconfig="${withval}"
-fi;
- echo "$as_me:$LINENO: checking for Tcl configuration" >&5
-echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6
- if test "${ac_cv_c_tclconfig+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+# Check whether --with-tcl was given.
+if test ${with_tcl+y}
+then :
+ withval=$with_tcl; with_tclconfig="${withval}"
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5
+printf %s "checking for Tcl configuration... " >&6; }
+ if test ${ac_cv_c_tclconfig+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
# First check to see if --with-tcl was specified.
@@ -1374,17 +2623,15 @@ else
case "${with_tclconfig}" in
*/tclConfig.sh )
if test -f "${with_tclconfig}"; then
- { echo "$as_me:$LINENO: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5
-echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5
+printf "%s\n" "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;}
with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
fi ;;
esac
if test -f "${with_tclconfig}/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
else
- { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5
-echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5
fi
fi
@@ -1431,11 +2678,11 @@ echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >
`ls -d /usr/local/lib 2>/dev/null` \
`ls -d /usr/contrib/lib 2>/dev/null` \
`ls -d /usr/pkg/lib 2>/dev/null` \
- `ls -d /usr/lib/tcl8.6 2>/dev/null` \
+ `ls -d /usr/lib/tcl8.7 2>/dev/null` \
`ls -d /usr/lib 2>/dev/null` \
`ls -d /usr/lib64 2>/dev/null` \
- `ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
- `ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \
+ `ls -d /usr/local/lib/tcl8.7 2>/dev/null` \
+ `ls -d /usr/local/lib/tcl/tcl8.7 2>/dev/null` \
; do
if test -f "$i/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i; pwd)`"
@@ -1463,28 +2710,26 @@ fi
if test x"${ac_cv_c_tclconfig}" = x ; then
TCL_BIN_DIR="# no Tcl configs found"
- { { echo "$as_me:$LINENO: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&5
-echo "$as_me: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" "$LINENO" 5
else
no_tcl=
TCL_BIN_DIR="${ac_cv_c_tclconfig}"
- echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
-echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
+printf "%s\n" "found ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
fi
fi
- echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
-echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
+printf %s "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... " >&6; }
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
- echo "$as_me:$LINENO: result: loading" >&5
-echo "${ECHO_T}loading" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: loading" >&5
+printf "%s\n" "loading" >&6; }
. "${TCL_BIN_DIR}/tclConfig.sh"
else
- echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
-echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
+printf "%s\n" "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
fi
# If the TCL_BIN_DIR is the build directory (not the install directory),
@@ -1534,27 +2779,24 @@ echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
+if test "${TCL_MAJOR_VERSION}" -lt 9 ; then
if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
- { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
-Found config for Tcl ${TCL_VERSION}" >&5
-echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
-Found config for Tcl ${TCL_VERSION}" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
+Found config for Tcl ${TCL_VERSION}" "$LINENO" 5
fi
if test "${TCL_MINOR_VERSION}" -lt 6 ; then
- { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
-Found config for Tcl ${TCL_VERSION}" >&5
-echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
-Found config for Tcl ${TCL_VERSION}" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
+Found config for Tcl ${TCL_VERSION}" "$LINENO" 5
+fi
fi
- echo "$as_me:$LINENO: checking for tclsh" >&5
-echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
- if test "${ac_cv_path_tclsh+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5
+printf %s "checking for tclsh... " >&6; }
+ if test ${ac_cv_path_tclsh+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
@@ -1574,22 +2816,22 @@ fi
if test -f "$ac_cv_path_tclsh" ; then
TCLSH_PROG="$ac_cv_path_tclsh"
- echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
-echo "${ECHO_T}$TCLSH_PROG" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5
+printf "%s\n" "$TCLSH_PROG" >&6; }
else
# It is not an error if an installed version of Tcl can't be located.
TCLSH_PROG=""
- echo "$as_me:$LINENO: result: No tclsh found on PATH" >&5
-echo "${ECHO_T}No tclsh found on PATH" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5
+printf "%s\n" "No tclsh found on PATH" >&6; }
fi
- echo "$as_me:$LINENO: checking for tclsh in Tcl build directory" >&5
-echo $ECHO_N "checking for tclsh in Tcl build directory... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5
+printf %s "checking for tclsh in Tcl build directory... " >&6; }
BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh
- echo "$as_me:$LINENO: result: $BUILD_TCLSH" >&5
-echo "${ECHO_T}$BUILD_TCLSH" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5
+printf "%s\n" "$BUILD_TCLSH" >&6; }
@@ -1612,62 +2854,63 @@ TK_SRC_DIR="`cd "$srcdir"/..; pwd`"
#------------------------------------------------------------------------
- echo "$as_me:$LINENO: checking whether to use symlinks for manpages" >&5
-echo $ECHO_N "checking whether to use symlinks for manpages... $ECHO_C" >&6
- # Check whether --enable-man-symlinks or --disable-man-symlinks was given.
-if test "${enable_man_symlinks+set}" = set; then
- enableval="$enable_man_symlinks"
- test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks"
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use symlinks for manpages" >&5
+printf %s "checking whether to use symlinks for manpages... " >&6; }
+ # Check whether --enable-man-symlinks was given.
+if test ${enable_man_symlinks+y}
+then :
+ enableval=$enable_man_symlinks; test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks"
+else $as_nop
enableval="no"
-fi;
- echo "$as_me:$LINENO: result: $enableval" >&5
-echo "${ECHO_T}$enableval" >&6
-
- echo "$as_me:$LINENO: checking whether to compress the manpages" >&5
-echo $ECHO_N "checking whether to compress the manpages... $ECHO_C" >&6
- # Check whether --enable-man-compression or --disable-man-compression was given.
-if test "${enable_man_compression+set}" = set; then
- enableval="$enable_man_compression"
- case $enableval in
- yes) { { echo "$as_me:$LINENO: error: missing argument to --enable-man-compression" >&5
-echo "$as_me: error: missing argument to --enable-man-compression" >&2;}
- { (exit 1); exit 1; }; };;
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5
+printf "%s\n" "$enableval" >&6; }
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to compress the manpages" >&5
+printf %s "checking whether to compress the manpages... " >&6; }
+ # Check whether --enable-man-compression was given.
+if test ${enable_man_compression+y}
+then :
+ enableval=$enable_man_compression; case $enableval in
+ yes) as_fn_error $? "missing argument to --enable-man-compression" "$LINENO" 5;;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
esac
-else
+else $as_nop
enableval="no"
-fi;
- echo "$as_me:$LINENO: result: $enableval" >&5
-echo "${ECHO_T}$enableval" >&6
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5
+printf "%s\n" "$enableval" >&6; }
if test "$enableval" != "no"; then
- echo "$as_me:$LINENO: checking for compressed file suffix" >&5
-echo $ECHO_N "checking for compressed file suffix... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compressed file suffix" >&5
+printf %s "checking for compressed file suffix... " >&6; }
touch TeST
$enableval TeST
Z=`ls TeST* | sed 's/^....//'`
rm -f TeST*
MAN_FLAGS="$MAN_FLAGS --extension $Z"
- echo "$as_me:$LINENO: result: $Z" >&5
-echo "${ECHO_T}$Z" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $Z" >&5
+printf "%s\n" "$Z" >&6; }
fi
- echo "$as_me:$LINENO: checking whether to add a package name suffix for the manpages" >&5
-echo $ECHO_N "checking whether to add a package name suffix for the manpages... $ECHO_C" >&6
- # Check whether --enable-man-suffix or --disable-man-suffix was given.
-if test "${enable_man_suffix+set}" = set; then
- enableval="$enable_man_suffix"
- case $enableval in
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to add a package name suffix for the manpages" >&5
+printf %s "checking whether to add a package name suffix for the manpages... " >&6; }
+ # Check whether --enable-man-suffix was given.
+if test ${enable_man_suffix+y}
+then :
+ enableval=$enable_man_suffix; case $enableval in
yes) enableval="tk" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
esac
-else
+else $as_nop
enableval="no"
-fi;
- echo "$as_me:$LINENO: result: $enableval" >&5
-echo "${ECHO_T}$enableval" >&6
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5
+printf "%s\n" "$enableval" >&6; }
@@ -1682,6 +2925,15 @@ if test "${CFLAGS+set}" != "set" ; then
CFLAGS=""
fi
+
+
+
+
+
+
+
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -1690,11 +2942,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
@@ -1702,37 +2955,44 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
@@ -1740,41 +3000,57 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
@@ -1782,79 +3058,44 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
+ fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
@@ -1863,19 +3104,24 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
@@ -1886,32 +3132,34 @@ if test $ac_prog_rejected = yes; then
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
@@ -1919,41 +3167,48 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
@@ -1961,71 +3216,191 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
test -n "$ac_ct_CC" && break
done
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
fi
fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args.
+set dummy ${ac_tool_prefix}clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}clang"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "clang", so it can be a program name with args.
+set dummy clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="clang"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+
+
+test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
+printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion -version; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -2033,112 +3408,111 @@ main ()
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+printf %s "checking whether the C compiler works... " >&6; }
+ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
+ if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
break;;
* )
break;;
esac
done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+test "$ac_cv_exeext" = no && ac_cv_exeext=
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
+else $as_nop
+ ac_file=''
fi
+if test -z "$ac_file"
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+printf %s "checking for C compiler default output file name... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+printf "%s\n" "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+printf %s "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+then :
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -2146,42 +3520,95 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
break;;
* ) break;;
esac
done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+else $as_nop
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
+rm -f conftest conftest$ac_cv_exeext
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+printf "%s\n" "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main (void)
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+printf %s "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+printf "%s\n" "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+printf %s "checking for suffix of object files... " >&6; }
+if test ${ac_cv_objext+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -2189,49 +3616,52 @@ main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
-else
- echo "$as_me: failed program was:" >&5
+else $as_nop
+ printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
fi
-
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+printf "%s\n" "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5
+printf %s "checking whether the compiler supports GNU C... " >&6; }
+if test ${ac_cv_c_compiler_gnu+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
#ifndef __GNUC__
choke me
@@ -2241,99 +3671,95 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
+else $as_nop
+ ac_compiler_gnu=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; }
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+y}
+ac_save_CFLAGS=$CFLAGS
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+printf %s "checking whether $CC accepts -g... " >&6; }
+if test ${ac_cv_prog_cc_g+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+else $as_nop
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
-ac_cv_prog_cc_g=no
+else $as_nop
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_g=yes
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
-if test "$ac_test_CFLAGS" = set; then
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+printf "%s\n" "$ac_cv_prog_cc_g" >&6; }
+if test $ac_test_CFLAGS; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
@@ -2348,264 +3774,146 @@ else
CFLAGS=
fi
fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
+ac_prog_cc_stdc=no
+if test x$ac_prog_cc_stdc = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5
+printf %s "checking for $CC option to enable C11 features... " >&6; }
+if test ${ac_cv_prog_cc_c11+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_cv_prog_cc_c11=no
ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
+$ac_c_conftest_c11_program
_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -std=gnu11
do
CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+ if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_c11=$ac_arg
fi
-rm -f conftest.err conftest.$ac_objext
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+ test "x$ac_cv_prog_cc_c11" != "xno" && break
done
-rm -f conftest.$ac_ext conftest.$ac_objext
+rm -f conftest.$ac_ext
CC=$ac_save_CC
-
fi
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if test "x$ac_cv_prog_cc_c11" = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else $as_nop
+ if test "x$ac_cv_prog_cc_c11" = x
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5
+printf "%s\n" "$ac_cv_prog_cc_c11" >&6; }
+ CC="$CC $ac_cv_prog_cc_c11"
+fi
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11
+ ac_prog_cc_stdc=c11
+fi
+fi
+if test x$ac_prog_cc_stdc = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5
+printf %s "checking for $CC option to enable C99 features... " >&6; }
+if test ${ac_cv_prog_cc_c99+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
+$ac_c_conftest_c99_program
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99=
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_c99=$ac_arg
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+ test "x$ac_cv_prog_cc_c99" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+fi
+
+if test "x$ac_cv_prog_cc_c99" = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else $as_nop
+ if test "x$ac_cv_prog_cc_c99" = x
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
+printf "%s\n" "$ac_cv_prog_cc_c99" >&6; }
+ CC="$CC $ac_cv_prog_cc_c99"
+fi
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
+ ac_prog_cc_stdc=c99
+fi
+fi
+if test x$ac_prog_cc_stdc = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5
+printf %s "checking for $CC option to enable C89 features... " >&6; }
+if test ${ac_cv_prog_cc_c89+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
+$ac_c_conftest_c89_program
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_c89=$ac_arg
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+if test "x$ac_cv_prog_cc_c89" = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else $as_nop
+ if test "x$ac_cv_prog_cc_c89" = x
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+printf "%s\n" "$ac_cv_prog_cc_c89" >&6; }
+ CC="$CC $ac_cv_prog_cc_c89"
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
+ ac_prog_cc_stdc=c89
+fi
+fi
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2613,61 +3921,34 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking for inline" >&5
-echo $ECHO_N "checking for inline... $ECHO_C" >&6
-if test "${ac_cv_c_inline+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+printf %s "checking for inline... " >&6; }
+if test ${ac_cv_c_inline+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef __cplusplus
typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
+static $ac_kw foo_t static_foo (void) {return 0; }
+$ac_kw foo_t foo (void) {return 0; }
#endif
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_inline=$ac_kw; break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_c_inline=$ac_kw
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
done
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6
-
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+printf "%s\n" "$ac_cv_c_inline" >&6; }
case $ac_cv_c_inline in
inline | yes) ;;
@@ -2685,1353 +3966,92 @@ _ACEOF
esac
-#--------------------------------------------------------------------
-# Supply a substitute for stdlib.h if it doesn't define strtol,
-# strtoul, or strtod (which it doesn't in some versions of SunOS).
-#--------------------------------------------------------------------
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_stdc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-if test "${ac_cv_header_stdlib_h+set}" = set; then
- echo "$as_me:$LINENO: checking for stdlib.h" >&5
-echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
-if test "${ac_cv_header_stdlib_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
-echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking stdlib.h usability" >&5
-echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <stdlib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking stdlib.h presence" >&5
-echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: stdlib.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: stdlib.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: stdlib.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: stdlib.h: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------- ##
-## Report this to the tk lists. ##
-## ----------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for stdlib.h" >&5
-echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
-if test "${ac_cv_header_stdlib_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_header_stdlib_h=$ac_header_preproc
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
-echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
-
-fi
-if test $ac_cv_header_stdlib_h = yes; then
- tk_ok=1
-else
- tk_ok=0
-fi
-
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "strtol" >/dev/null 2>&1; then
- :
-else
- tk_ok=0
-fi
-rm -f conftest*
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "strtoul" >/dev/null 2>&1; then
- :
-else
- tk_ok=0
-fi
-rm -f conftest*
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "strtod" >/dev/null 2>&1; then
- :
-else
- tk_ok=0
-fi
-rm -f conftest*
-
-if test $tk_ok = 0; then
-
-cat >>confdefs.h <<\_ACEOF
-#define NO_STDLIB_H 1
-_ACEOF
-
-fi
-
#------------------------------------------------------------------------
# If we're using GCC, see if the compiler understands -pipe. If so, use it.
# It makes compiling go faster. (This is only a performance feature.)
#------------------------------------------------------------------------
if test -z "$no_pipe" && test -n "$GCC"; then
- echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5
-echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6
-if test "${tcl_cv_cc_pipe+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -pipe" >&5
+printf %s "checking if the compiler understands -pipe... " >&6; }
+if test ${tcl_cv_cc_pipe+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_cc_pipe=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cc_pipe=no
+else $as_nop
+ tcl_cv_cc_pipe=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cc_pipe" >&5
-echo "${ECHO_T}$tcl_cv_cc_pipe" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_pipe" >&5
+printf "%s\n" "$tcl_cv_cc_pipe" >&6; }
if test $tcl_cv_cc_pipe = yes; then
CFLAGS="$CFLAGS -pipe"
fi
fi
#------------------------------------------------------------------------
-# Threads support - this auto-enables if Tcl was compiled threaded
+# Embedded configuration information, encoding to use for the values, TIP #59
#------------------------------------------------------------------------
- # Check whether --enable-threads or --disable-threads was given.
-if test "${enable_threads+set}" = set; then
- enableval="$enable_threads"
- tcl_ok=$enableval
-else
- tcl_ok=yes
-fi;
-
- if test "${TCL_THREADS}" = 1; then
- tcl_threaded_core=1;
- fi
-
- if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
- TCL_THREADS=1
- # USE_THREAD_ALLOC tells us to try the special thread-based
- # allocator that significantly reduces lock contention
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_THREAD_ALLOC 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define _REENTRANT 1
-_ACEOF
-
- if test "`uname -s`" = "SunOS" ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_PTHREAD_SEMANTICS 1
-_ACEOF
-
- fi
-
-cat >>confdefs.h <<\_ACEOF
-#define _THREAD_SAFE 1
-_ACEOF
-
- echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5
-echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6
-if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init ();
-int
-main ()
-{
-pthread_mutex_init ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_pthread_pthread_mutex_init=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_pthread_pthread_mutex_init=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+# Check whether --with-encoding was given.
+if test ${with_encoding+y}
+then :
+ withval=$with_encoding; with_tcencoding=${withval}
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6
-if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then
- tcl_ok=yes
-else
- tcl_ok=no
-fi
-
- if test "$tcl_ok" = "no"; then
- # Check a little harder for __pthread_mutex_init in the same
- # library, as some systems hide it there until pthread.h is
- # defined. We could alternatively do an AC_TRY_COMPILE with
- # pthread.h, but that will work with libpthread really doesn't
- # exist, like AIX 4.2. [Bug: 4359]
- echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5
-echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6
-if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char __pthread_mutex_init ();
-int
-main ()
-{
-__pthread_mutex_init ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_pthread___pthread_mutex_init=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_pthread___pthread_mutex_init=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6
-if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then
- tcl_ok=yes
-else
- tcl_ok=no
-fi
- fi
+ if test x"${with_tcencoding}" != x ; then
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -lpthread"
- else
- echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5
-echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6
-if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthreads $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
+printf "%s\n" "#define TCL_CFGVAL_ENCODING \"${with_tcencoding}\"" >>confdefs.h
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init ();
-int
-main ()
-{
-pthread_mutex_init ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_pthreads_pthread_mutex_init=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_pthreads_pthread_mutex_init=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5
-echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6
-if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then
- tcl_ok=yes
-else
- tcl_ok=no
-fi
-
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -lpthreads"
- else
- echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5
-echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init ();
-int
-main ()
-{
-pthread_mutex_init ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_c_pthread_mutex_init=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_c_pthread_mutex_init=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5
-echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6
-if test $ac_cv_lib_c_pthread_mutex_init = yes; then
- tcl_ok=yes
-else
- tcl_ok=no
-fi
-
- if test "$tcl_ok" = "no"; then
- echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5
-echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6
-if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc_r $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init ();
-int
-main ()
-{
-pthread_mutex_init ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_c_r_pthread_mutex_init=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_c_r_pthread_mutex_init=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5
-echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6
-if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then
- tcl_ok=yes
-else
- tcl_ok=no
-fi
-
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -pthread"
- else
- TCL_THREADS=0
- { echo "$as_me:$LINENO: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&5
-echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&2;}
- fi
- fi
- fi
- fi
-
- # Does the pthread-implementation provide
- # 'pthread_attr_setstacksize' ?
-
- ac_saved_libs=$LIBS
- LIBS="$LIBS $THREADS_LIBS"
-
-
-for ac_func in pthread_attr_setstacksize pthread_atfork
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
- LIBS=$ac_saved_libs
else
- TCL_THREADS=0
- fi
- # Do checking message here to not mess up interleaved configure output
- echo "$as_me:$LINENO: checking for building with threads" >&5
-echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
- if test "${TCL_THREADS}" = 1; then
-cat >>confdefs.h <<\_ACEOF
-#define TCL_THREADS 1
-_ACEOF
+printf "%s\n" "#define TCL_CFGVAL_ENCODING \"utf-8\"" >>confdefs.h
- if test "${tcl_threaded_core}" = 1; then
- echo "$as_me:$LINENO: result: yes (threaded core)" >&5
-echo "${ECHO_T}yes (threaded core)" >&6
- else
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
- fi
- else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
fi
-
-# Add the threads support libraries
-LIBS="$LIBS$THREADS_LIBS"
-
-
- echo "$as_me:$LINENO: checking how to build libraries" >&5
-echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6
- # Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- tcl_ok=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
+printf %s "checking how to build libraries... " >&6; }
+ # Check whether --enable-shared was given.
+if test ${enable_shared+y}
+then :
+ enableval=$enable_shared; tcl_ok=$enableval
+else $as_nop
tcl_ok=yes
-fi;
+fi
+
if test "$tcl_ok" = "yes" ; then
- echo "$as_me:$LINENO: result: shared" >&5
-echo "${ECHO_T}shared" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: shared" >&5
+printf "%s\n" "shared" >&6; }
SHARED_BUILD=1
else
- echo "$as_me:$LINENO: result: static" >&5
-echo "${ECHO_T}static" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: static" >&5
+printf "%s\n" "static" >&6; }
SHARED_BUILD=0
-cat >>confdefs.h <<\_ACEOF
-#define STATIC_BUILD 1
-_ACEOF
+printf "%s\n" "#define STATIC_BUILD 1" >>confdefs.h
fi
@@ -4046,11 +4066,12 @@ _ACEOF
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_RANLIB+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
@@ -4058,37 +4079,44 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+printf "%s\n" "$RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_RANLIB+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$ac_ct_RANLIB"; then
ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
else
@@ -4096,185 +4124,196 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+printf "%s\n" "$ac_ct_RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- RANLIB=$ac_ct_RANLIB
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
else
RANLIB="$ac_cv_prog_RANLIB"
fi
+ac_header= ac_cache=
+for ac_item in $ac_header_c_list
+do
+ if test $ac_cache; then
+ ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
+ if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
+ printf "%s\n" "#define $ac_item 1" >> confdefs.h
+ fi
+ ac_header= ac_cache=
+ elif test $ac_header; then
+ ac_cache=$ac_item
+ else
+ ac_header=$ac_item
+ fi
+done
+
+
+
+
+
+
+
+
+if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
+then :
+
+printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
# Step 0.a: Enable 64 bit support?
- echo "$as_me:$LINENO: checking if 64bit support is requested" >&5
-echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6
- # Check whether --enable-64bit or --disable-64bit was given.
-if test "${enable_64bit+set}" = set; then
- enableval="$enable_64bit"
- do64bit=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5
+printf %s "checking if 64bit support is requested... " >&6; }
+ # Check whether --enable-64bit was given.
+if test ${enable_64bit+y}
+then :
+ enableval=$enable_64bit; do64bit=$enableval
+else $as_nop
do64bit=no
-fi;
- echo "$as_me:$LINENO: result: $do64bit" >&5
-echo "${ECHO_T}$do64bit" >&6
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5
+printf "%s\n" "$do64bit" >&6; }
# Step 0.b: Enable Solaris 64 bit VIS support?
- echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5
-echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6
- # Check whether --enable-64bit-vis or --disable-64bit-vis was given.
-if test "${enable_64bit_vis+set}" = set; then
- enableval="$enable_64bit_vis"
- do64bitVIS=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if 64bit Sparc VIS support is requested" >&5
+printf %s "checking if 64bit Sparc VIS support is requested... " >&6; }
+ # Check whether --enable-64bit-vis was given.
+if test ${enable_64bit_vis+y}
+then :
+ enableval=$enable_64bit_vis; do64bitVIS=$enableval
+else $as_nop
do64bitVIS=no
-fi;
- echo "$as_me:$LINENO: result: $do64bitVIS" >&5
-echo "${ECHO_T}$do64bitVIS" >&6
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $do64bitVIS" >&5
+printf "%s\n" "$do64bitVIS" >&6; }
# Force 64bit on with VIS
- if test "$do64bitVIS" = "yes"; then
+ if test "$do64bitVIS" = "yes"
+then :
do64bit=yes
fi
-
# Step 0.c: Check if visibility support is available. Do this here so
# that platform specific alternatives can be used below if this fails.
- echo "$as_me:$LINENO: checking if compiler supports visibility \"hidden\"" >&5
-echo $ECHO_N "checking if compiler supports visibility \"hidden\"... $ECHO_C" >&6
-if test "${tcl_cv_cc_visibility_hidden+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler supports visibility \"hidden\"" >&5
+printf %s "checking if compiler supports visibility \"hidden\"... " >&6; }
+if test ${tcl_cv_cc_visibility_hidden+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern __attribute__((__visibility__("hidden"))) void f(void);
void f(void) {}
int
-main ()
+main (void)
{
f();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_cc_visibility_hidden=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cc_visibility_hidden=no
+else $as_nop
+ tcl_cv_cc_visibility_hidden=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5
-echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6
- if test $tcl_cv_cc_visibility_hidden = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5
+printf "%s\n" "$tcl_cv_cc_visibility_hidden" >&6; }
+ if test $tcl_cv_cc_visibility_hidden = yes
+then :
-cat >>confdefs.h <<\_ACEOF
-#define MODULE_SCOPE extern __attribute__((__visibility__("hidden")))
-_ACEOF
+printf "%s\n" "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_HIDDEN 1
-_ACEOF
+printf "%s\n" "#define HAVE_HIDDEN 1" >>confdefs.h
fi
-
# Step 0.d: Disable -rpath support?
- echo "$as_me:$LINENO: checking if rpath support is requested" >&5
-echo $ECHO_N "checking if rpath support is requested... $ECHO_C" >&6
- # Check whether --enable-rpath or --disable-rpath was given.
-if test "${enable_rpath+set}" = set; then
- enableval="$enable_rpath"
- doRpath=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5
+printf %s "checking if rpath support is requested... " >&6; }
+ # Check whether --enable-rpath was given.
+if test ${enable_rpath+y}
+then :
+ enableval=$enable_rpath; doRpath=$enableval
+else $as_nop
doRpath=yes
-fi;
- echo "$as_me:$LINENO: result: $doRpath" >&5
-echo "${ECHO_T}$doRpath" >&6
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $doRpath" >&5
+printf "%s\n" "$doRpath" >&6; }
# Step 1: set the variable "system" to hold the name and version number
# for the system.
- echo "$as_me:$LINENO: checking system version" >&5
-echo $ECHO_N "checking system version... $ECHO_C" >&6
-if test "${tcl_cv_sys_version+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking system version" >&5
+printf %s "checking system version... " >&6; }
+if test ${tcl_cv_sys_version+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
- if test -f /usr/lib/NextStep/software_version; then
- tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ if test "${TEA_PLATFORM}" = "windows" ; then
+ tcl_cv_sys_version=windows
else
tcl_cv_sys_version=`uname -s`-`uname -r`
if test "$?" -ne 0 ; then
- { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5
-echo "$as_me: WARNING: can't find uname command" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: can't find uname command" >&5
+printf "%s\n" "$as_me: WARNING: can't find uname command" >&2;}
tcl_cv_sys_version=unknown
else
- # Special check for weird MP-RAS system (uname returns weird
- # results, and the version is kept in special file).
-
- if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- tcl_cv_sys_version=MP-RAS-`awk '{print $3}' /etc/.relid`
- fi
if test "`uname -s`" = "AIX" ; then
tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
fi
@@ -4285,81 +4324,53 @@ echo "$as_me: WARNING: can't find uname command" >&2;}
fi
fi
-echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5
-echo "${ECHO_T}$tcl_cv_sys_version" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_sys_version" >&5
+printf "%s\n" "$tcl_cv_sys_version" >&6; }
system=$tcl_cv_sys_version
# Step 2: check for existence of -ldl library. This is needed because
# Linux can use either -ldl or -ldld for dynamic loading.
- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+printf %s "checking for dlopen in -ldl... " >&6; }
+if test ${ac_cv_lib_dl_dlopen+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char dlopen ();
int
-main ()
+main (void)
{
-dlopen ();
+return dlopen ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_dl_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dl_dlopen=no
+else $as_nop
+ ac_cv_lib_dl_dlopen=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
-if test $ac_cv_lib_dl_dlopen = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes
+then :
have_dl=yes
-else
+else $as_nop
have_dl=no
fi
@@ -4383,26 +4394,35 @@ fi
ECHO_VERSION='`echo ${VERSION}`'
TCL_LIB_VERSIONS_OK=ok
CFLAGS_DEBUG=-g
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
+ case "${CC}" in
+ *++|*++-*)
+ ;;
+ *)
+ CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers"
+ ;;
+ esac
-else
+
+else $as_nop
CFLAGS_OPTIMIZE=-O
CFLAGS_WARNING=""
fi
-
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_AR+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_AR+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
@@ -4410,37 +4430,44 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+printf "%s\n" "$AR" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_AR+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$ac_ct_AR"; then
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
else
@@ -4448,28 +4475,43 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
- echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+printf "%s\n" "$ac_ct_AR" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- AR=$ac_ct_AR
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
else
AR="$ac_cv_prog_AR"
fi
@@ -4479,15 +4521,14 @@ fi
PLAT_OBJS=""
PLAT_SRCS=""
LDAIX_SRC=""
- if test "x${SHLIB_VERSION}" = x; then
- SHLIB_VERSION=".1.0"
-else
- SHLIB_VERSION=".${SHLIB_VERSION}"
+ if test "x${SHLIB_VERSION}" = x
+then :
+ SHLIB_VERSION="1.0"
fi
-
case $system in
AIX-*)
- if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then
+ if test "$GCC" != "yes"
+then :
# AIX requires the _r compiler when gcc isn't being used
case "${CC}" in
@@ -4499,11 +4540,10 @@ fi
CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'`
;;
esac
- echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5
-echo "${ECHO_T}Using $CC for compiling with threads" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using $CC for compiling with threads" >&5
+printf "%s\n" "Using $CC for compiling with threads" >&6; }
fi
-
LIBS="$LIBS -lc"
SHLIB_CFLAGS=""
SHLIB_SUFFIX=".so"
@@ -4516,14 +4556,16 @@ fi
LDAIX_SRC='$(UNIX_DIR)/ldAix'
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = yes; then
+ if test "$do64bit" = yes
+then :
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
- { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
-echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5
+printf "%s\n" "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
-else
+else $as_nop
do64bit_ok=yes
CFLAGS="$CFLAGS -q64"
@@ -4534,48 +4576,46 @@ else
fi
-
fi
-
- if test "`uname -m`" = ia64; then
+ if test "`uname -m`" = ia64
+then :
# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
# AIX-5 has dl* in libc.so
DL_LIBS=""
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
-else
+else $as_nop
CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
fi
-
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
-else
+else $as_nop
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
SHLIB_LD='${CC} -shared -Wl,-bexpall'
-else
+else $as_nop
SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
LDFLAGS="$LDFLAGS -brtl"
fi
-
SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
DL_LIBS="-ldl"
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
fi
-
;;
BeOS*)
SHLIB_CFLAGS="-fPIC"
@@ -4589,71 +4629,43 @@ fi
# -lsocket, even if the network functions are in -lnet which
# is always linked to, for compatibility.
#-----------------------------------------------------------
- echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5
-echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6
-if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lbind" >&5
+printf %s "checking for inet_ntoa in -lbind... " >&6; }
+if test ${ac_cv_lib_bind_inet_ntoa+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lbind $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char inet_ntoa ();
int
-main ()
+main (void)
{
-inet_ntoa ();
+return inet_ntoa ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_bind_inet_ntoa=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_bind_inet_ntoa=no
+else $as_nop
+ ac_cv_lib_bind_inet_ntoa=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5
-echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6
-if test $ac_cv_lib_bind_inet_ntoa = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind_inet_ntoa" >&5
+printf "%s\n" "$ac_cv_lib_bind_inet_ntoa" >&6; }
+if test "x$ac_cv_lib_bind_inet_ntoa" = xyes
+then :
LIBS="$LIBS -lbind -lsocket"
fi
@@ -4678,7 +4690,7 @@ fi
LD_SEARCH_FLAGS=""
;;
CYGWIN_*|MINGW32_*|MSYS_*)
- SHLIB_CFLAGS=""
+ SHLIB_CFLAGS="-fno-common"
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".dll"
DL_OBJS="tclLoadDl.o"
@@ -4690,16 +4702,13 @@ fi
TCL_NEEDS_EXP_FILE=1
TCL_EXPORT_FILE_SUFFIX='${VERSION}.dll.a'
SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$@.a"
- echo "$as_me:$LINENO: checking for Cygwin version of gcc" >&5
-echo $ECHO_N "checking for Cygwin version of gcc... $ECHO_C" >&6
-if test "${ac_cv_cygwin+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Cygwin version of gcc" >&5
+printf %s "checking for Cygwin version of gcc... " >&6; }
+if test ${ac_cv_cygwin+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __CYGWIN__
@@ -4707,56 +4716,26 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_cygwin=no
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_cygwin=yes
+else $as_nop
+ ac_cv_cygwin=yes
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_cygwin" >&5
-echo "${ECHO_T}$ac_cv_cygwin" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cygwin" >&5
+printf "%s\n" "$ac_cv_cygwin" >&6; }
if test "$ac_cv_cygwin" = "no"; then
- { { echo "$as_me:$LINENO: error: ${CC} is not a cygwin compiler." >&5
-echo "$as_me: error: ${CC} is not a cygwin compiler." >&2;}
- { (exit 1); exit 1; }; }
- fi
- if test "x${TCL_THREADS}" = "x0"; then
- { { echo "$as_me:$LINENO: error: CYGWIN compile is only supported with --enable-threads" >&5
-echo "$as_me: error: CYGWIN compile is only supported with --enable-threads" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${CC} is not a cygwin compiler." "$LINENO" 5
fi
do64bit_ok=yes
if test "x${SHARED_BUILD}" = "x1"; then
@@ -4786,71 +4765,43 @@ echo "$as_me: error: CYGWIN compile is only supported with --enable-threads" >&2
SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
DL_OBJS="tclLoadDl.o"
DL_LIBS="-lroot"
- echo "$as_me:$LINENO: checking for inet_ntoa in -lnetwork" >&5
-echo $ECHO_N "checking for inet_ntoa in -lnetwork... $ECHO_C" >&6
-if test "${ac_cv_lib_network_inet_ntoa+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lnetwork" >&5
+printf %s "checking for inet_ntoa in -lnetwork... " >&6; }
+if test ${ac_cv_lib_network_inet_ntoa+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnetwork $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char inet_ntoa ();
int
-main ()
+main (void)
{
-inet_ntoa ();
+return inet_ntoa ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_network_inet_ntoa=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_network_inet_ntoa=no
+else $as_nop
+ ac_cv_lib_network_inet_ntoa=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_network_inet_ntoa" >&5
-echo "${ECHO_T}$ac_cv_lib_network_inet_ntoa" >&6
-if test $ac_cv_lib_network_inet_ntoa = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_inet_ntoa" >&5
+printf "%s\n" "$ac_cv_lib_network_inet_ntoa" >&6; }
+if test "x$ac_cv_lib_network_inet_ntoa" = xyes
+then :
LIBS="$LIBS -lnetwork"
fi
@@ -4858,98 +4809,67 @@ fi
HP-UX-*.11.*)
# Use updated header definitions where possible
-cat >>confdefs.h <<\_ACEOF
-#define _XOPEN_SOURCE_EXTENDED 1
-_ACEOF
+printf "%s\n" "#define _XOPEN_SOURCE_EXTENDED 1" >>confdefs.h
-cat >>confdefs.h <<\_ACEOF
-#define _XOPEN_SOURCE 1
-_ACEOF
+printf "%s\n" "#define _XOPEN_SOURCE 1" >>confdefs.h
LIBS="$LIBS -lxnet" # Use the XOPEN network library
- if test "`uname -m`" = ia64; then
+ if test "`uname -m`" = ia64
+then :
SHLIB_SUFFIX=".so"
-else
+else $as_nop
SHLIB_SUFFIX=".sl"
fi
-
- echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+printf %s "checking for shl_load in -ldld... " >&6; }
+if test ${ac_cv_lib_dld_shl_load+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char shl_load ();
int
-main ()
+main (void)
{
-shl_load ();
+return shl_load ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_dld_shl_load=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dld_shl_load=no
+else $as_nop
+ ac_cv_lib_dld_shl_load=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
-if test $ac_cv_lib_dld_shl_load = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes
+then :
tcl_ok=yes
-else
+else $as_nop
tcl_ok=no
fi
- if test "$tcl_ok" = yes; then
+ if test "$tcl_ok" = yes
+then :
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
@@ -4961,46 +4881,47 @@ fi
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
fi
-
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
SHLIB_LD='${CC} -shared'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
-else
+else $as_nop
CFLAGS="$CFLAGS -z"
fi
-
# Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
#CFLAGS="$CFLAGS +DAportable"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes"; then
+ if test "$do64bit" = "yes"
+then :
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
case `${CC} -dumpmachine` in
hppa64*)
# 64-bit gcc in use. Fix flags for GNU ld.
do64bit_ok=yes
SHLIB_LD='${CC} -shared'
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
-
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
;;
*)
- { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
-echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5
+printf "%s\n" "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
;;
esac
-else
+else $as_nop
do64bit_ok=yes
CFLAGS="$CFLAGS +DD64"
@@ -5008,82 +4929,53 @@ else
fi
-
-fi
- ;;
+fi ;;
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
SHLIB_SUFFIX=".sl"
- echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+printf %s "checking for shl_load in -ldld... " >&6; }
+if test ${ac_cv_lib_dld_shl_load+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char shl_load ();
int
-main ()
+main (void)
{
-shl_load ();
+return shl_load ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_dld_shl_load=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dld_shl_load=no
+else $as_nop
+ ac_cv_lib_dld_shl_load=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
-if test $ac_cv_lib_dld_shl_load = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes
+then :
tcl_ok=yes
-else
+else $as_nop
tcl_ok=no
fi
- if test "$tcl_ok" = yes; then
+ if test "$tcl_ok" = yes
+then :
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
@@ -5095,28 +4987,25 @@ fi
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
-fi
- ;;
+fi ;;
IRIX-5.*)
SHLIB_CFLAGS=""
SHLIB_LD="ld -shared -rdata_shared"
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- case $LIBOBJS in
- "mkstemp.$ac_objext" | \
- *" mkstemp.$ac_objext" | \
- "mkstemp.$ac_objext "* | \
+ case " $LIBOBJS " in
*" mkstemp.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;;
+ *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext"
+ ;;
esac
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
-
;;
IRIX-6.*)
SHLIB_CFLAGS=""
@@ -5124,26 +5013,25 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- case $LIBOBJS in
- "mkstemp.$ac_objext" | \
- *" mkstemp.$ac_objext" | \
- "mkstemp.$ac_objext "* | \
+ case " $LIBOBJS " in
*" mkstemp.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;;
+ *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext"
+ ;;
esac
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
-
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
CFLAGS="$CFLAGS -mabi=n32"
LDFLAGS="$LDFLAGS -mabi=n32"
-else
+else $as_nop
case $system in
IRIX-6.3)
@@ -5157,7 +5045,6 @@ else
LDFLAGS="$LDFLAGS -n32"
fi
-
;;
IRIX64-6.*)
SHLIB_CFLAGS=""
@@ -5165,31 +5052,31 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- case $LIBOBJS in
- "mkstemp.$ac_objext" | \
- *" mkstemp.$ac_objext" | \
- "mkstemp.$ac_objext "* | \
+ case " $LIBOBJS " in
*" mkstemp.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;;
+ *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext"
+ ;;
esac
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
-
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = yes; then
+ if test "$do64bit" = yes
+then :
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
- { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5
-echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported by gcc" >&5
+printf "%s\n" "$as_me: WARNING: 64bit mode not supported by gcc" >&2;}
-else
+else $as_nop
do64bit_ok=yes
SHLIB_LD="ld -64 -shared -rdata_shared"
@@ -5198,12 +5085,10 @@ else
fi
-
fi
-
;;
Linux*|GNU*|NetBSD-Debian)
- SHLIB_CFLAGS="-fPIC"
+ SHLIB_CFLAGS="-fPIC -fno-common"
SHLIB_SUFFIX=".so"
CFLAGS_OPTIMIZE="-O2"
@@ -5216,97 +5101,71 @@ fi
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
-
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "`uname -m`" = "alpha"; then
+ if test "`uname -m`" = "alpha"
+then :
CFLAGS="$CFLAGS -mieee"
fi
+ if test $do64bit = yes
+then :
- if test $do64bit = yes; then
-
- echo "$as_me:$LINENO: checking if compiler accepts -m64 flag" >&5
-echo $ECHO_N "checking if compiler accepts -m64 flag... $ECHO_C" >&6
-if test "${tcl_cv_cc_m64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -m64 flag" >&5
+printf %s "checking if compiler accepts -m64 flag... " >&6; }
+if test ${tcl_cv_cc_m64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -m64"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_cc_m64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cc_m64=no
+else $as_nop
+ tcl_cv_cc_m64=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cc_m64" >&5
-echo "${ECHO_T}$tcl_cv_cc_m64" >&6
- if test $tcl_cv_cc_m64 = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_m64" >&5
+printf "%s\n" "$tcl_cv_cc_m64" >&6; }
+ if test $tcl_cv_cc_m64 = yes
+then :
CFLAGS="$CFLAGS -m64"
do64bit_ok=yes
fi
-
fi
-
# The combo of gcc + glibc has a bug related to inlining of
- # functions like strtod(). The -fno-builtin flag should address
+ # functions like strtol()/strtoul(). The -fno-builtin flag should address
# this problem but it does not work. The -fno-inline flag is kind
# of overkill but it works. Disable inlining only when one of the
# files in compat/*.c is being linked in.
- if test x"${USE_COMPAT}" != x; then
+ if test x"${USE_COMPAT}" != x
+then :
CFLAGS="$CFLAGS -fno-inline"
fi
-
;;
Lynx*)
SHLIB_CFLAGS="-fPIC"
@@ -5316,33 +5175,12 @@ fi
DL_OBJS="tclLoadDl.o"
DL_LIBS="-mshared -ldl"
LD_FLAGS="-Wl,--export-dynamic"
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
-
- ;;
- MP-RAS-02*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD='${CC} -G'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- MP-RAS-*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD='${CC} -G'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,-Bexport"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
;;
OpenBSD-*)
arch=`arch -s`
@@ -5358,24 +5196,19 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
-
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
LDFLAGS="-Wl,-export-dynamic"
CFLAGS_OPTIMIZE="-O2"
- if test "${TCL_THREADS}" = "1"; then
-
- # On OpenBSD: Compile with -pthread
- # Don't link with -lpthread
- LIBS=`echo $LIBS | sed s/-lpthread//`
- CFLAGS="$CFLAGS -pthread"
-
-fi
-
+ # On OpenBSD: Compile with -pthread
+ # Don't link with -lpthread
+ LIBS=`echo $LIBS | sed s/-lpthread//`
+ CFLAGS="$CFLAGS -pthread"
# OpenBSD doesn't do version numbers with dots.
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
@@ -5388,21 +5221,16 @@ fi
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LDFLAGS="$LDFLAGS -export-dynamic"
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
-
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "${TCL_THREADS}" = "1"; then
-
- # The -pthread needs to go in the CFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- CFLAGS="$CFLAGS -pthread"
- LDFLAGS="$LDFLAGS -pthread"
-
-fi
-
+ # The -pthread needs to go in the CFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
;;
DragonFly-*|FreeBSD-*)
# This configuration from FreeBSD Ports.
@@ -5411,20 +5239,16 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
-
- if test "${TCL_THREADS}" = "1"; then
-
- # The -pthread needs to go in the LDFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
-fi
-
+ # The -pthread needs to go in the LDFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
case $system in
FreeBSD-3.*)
# Version numbers are dot-stripped by system policy.
@@ -5447,333 +5271,229 @@ fi
CFLAGS="`echo " ${CFLAGS}" | \
awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`"
- if test $do64bit = yes; then
+ if test $do64bit = yes
+then :
case `arch` in
ppc)
- echo "$as_me:$LINENO: checking if compiler accepts -arch ppc64 flag" >&5
-echo $ECHO_N "checking if compiler accepts -arch ppc64 flag... $ECHO_C" >&6
-if test "${tcl_cv_cc_arch_ppc64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch ppc64 flag" >&5
+printf %s "checking if compiler accepts -arch ppc64 flag... " >&6; }
+if test ${tcl_cv_cc_arch_ppc64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_cc_arch_ppc64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cc_arch_ppc64=no
+else $as_nop
+ tcl_cv_cc_arch_ppc64=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_ppc64" >&5
-echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6
- if test $tcl_cv_cc_arch_ppc64 = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_ppc64" >&5
+printf "%s\n" "$tcl_cv_cc_arch_ppc64" >&6; }
+ if test $tcl_cv_cc_arch_ppc64 = yes
+then :
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
do64bit_ok=yes
-fi
-;;
+fi;;
i386)
- echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5
-echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6
-if test "${tcl_cv_cc_arch_x86_64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch x86_64 flag" >&5
+printf %s "checking if compiler accepts -arch x86_64 flag... " >&6; }
+if test ${tcl_cv_cc_arch_x86_64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch x86_64"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_cc_arch_x86_64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cc_arch_x86_64=no
+else $as_nop
+ tcl_cv_cc_arch_x86_64=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_x86_64" >&5
-echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6
- if test $tcl_cv_cc_arch_x86_64 = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_x86_64" >&5
+printf "%s\n" "$tcl_cv_cc_arch_x86_64" >&6; }
+ if test $tcl_cv_cc_arch_x86_64 = yes
+then :
CFLAGS="$CFLAGS -arch x86_64"
do64bit_ok=yes
-fi
-;;
+fi;;
*)
- { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5
-echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};;
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5
+printf "%s\n" "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};;
esac
-else
+else $as_nop
# Check for combined 32-bit and 64-bit fat build
if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
- && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then
+ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '
+then :
fat_32_64=yes
fi
-
fi
-
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
- echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5
-echo $ECHO_N "checking if ld accepts -single_module flag... $ECHO_C" >&6
-if test "${tcl_cv_ld_single_module+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -single_module flag" >&5
+printf %s "checking if ld accepts -single_module flag... " >&6; }
+if test ${tcl_cv_ld_single_module+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
int i;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_ld_single_module=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_ld_single_module=no
+else $as_nop
+ tcl_cv_ld_single_module=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_ld_single_module" >&5
-echo "${ECHO_T}$tcl_cv_ld_single_module" >&6
- if test $tcl_cv_ld_single_module = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_single_module" >&5
+printf "%s\n" "$tcl_cv_ld_single_module" >&6; }
+ if test $tcl_cv_ld_single_module = yes
+then :
SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
fi
-
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
- echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5
-echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6
-if test "${tcl_cv_ld_search_paths_first+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -search_paths_first flag" >&5
+printf %s "checking if ld accepts -search_paths_first flag... " >&6; }
+if test ${tcl_cv_ld_search_paths_first+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
int i;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_ld_search_paths_first=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_ld_search_paths_first=no
+else $as_nop
+ tcl_cv_ld_search_paths_first=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_ld_search_paths_first" >&5
-echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6
- if test $tcl_cv_ld_search_paths_first = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_search_paths_first" >&5
+printf "%s\n" "$tcl_cv_ld_search_paths_first" >&6; }
+ if test $tcl_cv_ld_search_paths_first = yes
+then :
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
fi
-
- if test "$tcl_cv_cc_visibility_hidden" != yes; then
+ if test "$tcl_cv_cc_visibility_hidden" != yes
+then :
-cat >>confdefs.h <<\_ACEOF
-#define MODULE_SCOPE __private_extern__
-_ACEOF
+printf "%s\n" "#define MODULE_SCOPE __private_extern__" >>confdefs.h
tcl_cv_cc_visibility_hidden=yes
fi
-
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
-cat >>confdefs.h <<\_ACEOF
-#define MAC_OSX_TCL 1
-_ACEOF
+printf "%s\n" "#define MAC_OSX_TCL 1" >>confdefs.h
PLAT_OBJS='${MAC_OSX_OBJS}'
PLAT_SRCS='${MAC_OSX_SRCS}'
- echo "$as_me:$LINENO: checking whether to use CoreFoundation" >&5
-echo $ECHO_N "checking whether to use CoreFoundation... $ECHO_C" >&6
- # Check whether --enable-corefoundation or --disable-corefoundation was given.
-if test "${enable_corefoundation+set}" = set; then
- enableval="$enable_corefoundation"
- tcl_corefoundation=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use CoreFoundation" >&5
+printf %s "checking whether to use CoreFoundation... " >&6; }
+ # Check whether --enable-corefoundation was given.
+if test ${enable_corefoundation+y}
+then :
+ enableval=$enable_corefoundation; tcl_corefoundation=$enableval
+else $as_nop
tcl_corefoundation=yes
-fi;
- echo "$as_me:$LINENO: result: $tcl_corefoundation" >&5
-echo "${ECHO_T}$tcl_corefoundation" >&6
- if test $tcl_corefoundation = yes; then
-
- echo "$as_me:$LINENO: checking for CoreFoundation.framework" >&5
-echo $ECHO_N "checking for CoreFoundation.framework... $ECHO_C" >&6
-if test "${tcl_cv_lib_corefoundation+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_corefoundation" >&5
+printf "%s\n" "$tcl_corefoundation" >&6; }
+ if test $tcl_corefoundation = yes
+then :
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CoreFoundation.framework" >&5
+printf %s "checking for CoreFoundation.framework... " >&6; }
+if test ${tcl_cv_lib_corefoundation+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_libs=$LIBS
- if test "$fat_32_64" = yes; then
+ if test "$fat_32_64" = yes
+then :
for v in CFLAGS CPPFLAGS LDFLAGS; do
# On Tiger there is no 64-bit CF, so remove 64-bit
@@ -5783,262 +5503,155 @@ else
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
done
fi
-
LIBS="$LIBS -framework CoreFoundation"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <CoreFoundation/CoreFoundation.h>
int
-main ()
+main (void)
{
CFBundleRef b = CFBundleGetMainBundle();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_lib_corefoundation=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_lib_corefoundation=no
+else $as_nop
+ tcl_cv_lib_corefoundation=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- if test "$fat_32_64" = yes; then
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$fat_32_64" = yes
+then :
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done
fi
-
LIBS=$hold_libs
fi
-echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation" >&5
-echo "${ECHO_T}$tcl_cv_lib_corefoundation" >&6
- if test $tcl_cv_lib_corefoundation = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation" >&5
+printf "%s\n" "$tcl_cv_lib_corefoundation" >&6; }
+ if test $tcl_cv_lib_corefoundation = yes
+then :
LIBS="$LIBS -framework CoreFoundation"
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_COREFOUNDATION 1
-_ACEOF
+printf "%s\n" "#define HAVE_COREFOUNDATION 1" >>confdefs.h
-else
+else $as_nop
tcl_corefoundation=no
fi
+ if test "$fat_32_64" = yes -a $tcl_corefoundation = yes
+then :
- if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
-
- echo "$as_me:$LINENO: checking for 64-bit CoreFoundation" >&5
-echo $ECHO_N "checking for 64-bit CoreFoundation... $ECHO_C" >&6
-if test "${tcl_cv_lib_corefoundation_64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit CoreFoundation" >&5
+printf %s "checking for 64-bit CoreFoundation... " >&6; }
+if test ${tcl_cv_lib_corefoundation_64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
done
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <CoreFoundation/CoreFoundation.h>
int
-main ()
+main (void)
{
CFBundleRef b = CFBundleGetMainBundle();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_lib_corefoundation_64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_lib_corefoundation_64=no
+else $as_nop
+ tcl_cv_lib_corefoundation_64=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done
fi
-echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation_64" >&5
-echo "${ECHO_T}$tcl_cv_lib_corefoundation_64" >&6
- if test $tcl_cv_lib_corefoundation_64 = no; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation_64" >&5
+printf "%s\n" "$tcl_cv_lib_corefoundation_64" >&6; }
+ if test $tcl_cv_lib_corefoundation_64 = no
+then :
-cat >>confdefs.h <<\_ACEOF
-#define NO_COREFOUNDATION_64 1
-_ACEOF
+printf "%s\n" "#define NO_COREFOUNDATION_64 1" >>confdefs.h
LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
fi
-
fi
-
fi
-
- ;;
- NEXTSTEP-*)
- SHLIB_CFLAGS=""
- SHLIB_LD='${CC} -nostdlib -r'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadNext.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
;;
OS/390-*)
SHLIB_LD_LIBS=""
CFLAGS_OPTIMIZE="" # Optimizer is buggy
-cat >>confdefs.h <<\_ACEOF
-#define _OE_SOCKETS 1
-_ACEOF
+printf "%s\n" "#define _OE_SOCKETS 1" >>confdefs.h
;;
- OSF1-1.0|OSF1-1.1|OSF1-1.2)
- # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
- SHLIB_CFLAGS=""
- # Hack: make package name same as library name
- SHLIB_LD='ld -R -export :'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadOSF.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- OSF1-1.*)
- # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
- SHLIB_CFLAGS="-fPIC"
- if test "$SHARED_BUILD" = 1; then
- SHLIB_LD="ld -shared"
-else
-
- SHLIB_LD="ld -non_shared"
-
-fi
-
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
OSF1-V*)
# Digital OSF/1
SHLIB_CFLAGS=""
- if test "$SHARED_BUILD" = 1; then
+ if test "$SHARED_BUILD" = 1
+then :
SHLIB_LD='ld -shared -expect_unresolved "*"'
-else
+else $as_nop
SHLIB_LD='ld -non_shared -expect_unresolved "*"'
fi
-
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes; then
+ if test $doRpath = yes
+then :
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
-
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
CFLAGS="$CFLAGS -mieee"
-else
+else $as_nop
CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
fi
-
# see pthread_intro(3) for pthread support on osf1, k.furukawa
- if test "${TCL_THREADS}" = 1; then
-
- CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
- CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
- LIBS=`echo $LIBS | sed s/-lpthreads//`
- if test "$GCC" = yes; then
-
- LIBS="$LIBS -lpthread -lmach -lexc"
-
-else
+ CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
+ CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
+ LIBS=`echo $LIBS | sed s/-lpthreads//`
+ if test "$GCC" = yes
+then :
- CFLAGS="$CFLAGS -pthread"
- LDFLAGS="$LDFLAGS -pthread"
+ LIBS="$LIBS -lpthread -lmach -lexc"
-fi
+else $as_nop
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
fi
-
;;
QNX-6*)
# QNX RTP
# This may work for all QNX, but it was only reported for v6.
- SHLIB_CFLAGS="-fPIC"
SHLIB_LD="ld -Bshareable -x"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
@@ -6052,18 +5665,18 @@ fi
# Note, dlopen is available only on SCO 3.2.5 and greater. However,
# this test works, since "uname -s" was non-standard in 3.2.4 and
# below.
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
- SHLIB_CFLAGS="-fPIC -melf"
- LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
+ SHLIB_CFLAGS="-fPIC -melf"
+ LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
-else
+else $as_nop
- SHLIB_CFLAGS="-Kpic -belf"
- LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
+ SHLIB_CFLAGS="-Kpic -belf"
+ LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
fi
-
SHLIB_LD="ld -G"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
@@ -6072,35 +5685,6 @@ fi
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
- SINIX*5.4*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD='${CC} -G'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- SunOS-4*)
- SHLIB_CFLAGS="-PIC"
- SHLIB_LD="ld"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
-
- # SunOS can't handle version numbers with dots in them in library
- # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
- # requires an extra version number at the end of .so file names.
- # So, the library has to have a name like libtcl75.so.1.0
-
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
SunOS-5.[0-6])
# Careful to not let 5.10+ fall into this case
@@ -6108,66 +5692,62 @@ fi
# won't define thread-safe library routines.
-cat >>confdefs.h <<\_ACEOF
-#define _REENTRANT 1
-_ACEOF
+printf "%s\n" "#define _REENTRANT 1" >>confdefs.h
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_PTHREAD_SEMANTICS 1
-_ACEOF
+printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
SHLIB_CFLAGS="-KPIC"
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
-else
+else $as_nop
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
fi
-
;;
SunOS-5*)
# Note: If _REENTRANT isn't defined, then Solaris
# won't define thread-safe library routines.
-cat >>confdefs.h <<\_ACEOF
-#define _REENTRANT 1
-_ACEOF
+printf "%s\n" "#define _REENTRANT 1" >>confdefs.h
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_PTHREAD_SEMANTICS 1
-_ACEOF
+printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
SHLIB_CFLAGS="-KPIC"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = yes; then
+ if test "$do64bit" = yes
+then :
arch=`isainfo`
- if test "$arch" = "sparcv9 sparc"; then
+ if test "$arch" = "sparcv9 sparc"
+then :
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
- if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then
+ if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3
+then :
- { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5
-echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5
+printf "%s\n" "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;}
-else
+else $as_nop
do64bit_ok=yes
CFLAGS="$CFLAGS -m64 -mcpu=v9"
@@ -6176,32 +5756,32 @@ else
fi
-
-else
+else $as_nop
do64bit_ok=yes
- if test "$do64bitVIS" = yes; then
+ if test "$do64bitVIS" = yes
+then :
CFLAGS="$CFLAGS -xarch=v9a"
LDFLAGS_ARCH="-xarch=v9a"
-else
+else $as_nop
CFLAGS="$CFLAGS -xarch=v9"
LDFLAGS_ARCH="-xarch=v9"
fi
-
# Solaris 64 uses this as well
#LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
fi
+else $as_nop
+ if test "$arch" = "amd64 i386"
+then :
-else
- if test "$arch" = "amd64 i386"; then
-
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
case $system in
SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*)
@@ -6209,11 +5789,11 @@ else
CFLAGS="$CFLAGS -m64"
LDFLAGS="$LDFLAGS -m64";;
*)
- { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
-echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;};;
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5
+printf "%s\n" "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;};;
esac
-else
+else $as_nop
do64bit_ok=yes
case $system in
@@ -6227,197 +5807,63 @@ else
fi
-
-else
- { echo "$as_me:$LINENO: WARNING: 64bit mode not supported for $arch" >&5
-echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;}
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported for $arch" >&5
+printf "%s\n" "$as_me: WARNING: 64bit mode not supported for $arch" >&2;}
fi
-
fi
-
fi
-
#--------------------------------------------------------------------
# On Solaris 5.x i386 with the sunpro compiler we need to link
# with sunmath to get floating point rounding control
#--------------------------------------------------------------------
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
use_sunmath=no
-else
+else $as_nop
arch=`isainfo`
- echo "$as_me:$LINENO: checking whether to use -lsunmath for fp rounding control" >&5
-echo $ECHO_N "checking whether to use -lsunmath for fp rounding control... $ECHO_C" >&6
- if test "$arch" = "amd64 i386" -o "$arch" = "i386"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use -lsunmath for fp rounding control" >&5
+printf %s "checking whether to use -lsunmath for fp rounding control... " >&6; }
+ if test "$arch" = "amd64 i386" -o "$arch" = "i386"
+then :
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
MATH_LIBS="-lsunmath $MATH_LIBS"
- if test "${ac_cv_header_sunmath_h+set}" = set; then
- echo "$as_me:$LINENO: checking for sunmath.h" >&5
-echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6
-if test "${ac_cv_header_sunmath_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5
-echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking sunmath.h usability" >&5
-echo $ECHO_N "checking sunmath.h usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <sunmath.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ ac_fn_c_check_header_compile "$LINENO" "sunmath.h" "ac_cv_header_sunmath_h" "$ac_includes_default"
+if test "x$ac_cv_header_sunmath_h" = xyes
+then :
-ac_header_compiler=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking sunmath.h presence" >&5
-echo $ECHO_N "checking sunmath.h presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sunmath.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: sunmath.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: sunmath.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: sunmath.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: sunmath.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: sunmath.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: sunmath.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: sunmath.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: sunmath.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: sunmath.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: sunmath.h: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------- ##
-## Report this to the tk lists. ##
-## ----------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for sunmath.h" >&5
-echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6
-if test "${ac_cv_header_sunmath_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_header_sunmath_h=$ac_header_preproc
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5
-echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6
-
-fi
-
use_sunmath=yes
-else
+else $as_nop
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
use_sunmath=no
fi
-
fi
-
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = yes; then
+ if test "$GCC" = yes
+then :
SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$do64bit_ok" = yes; then
+ if test "$do64bit_ok" = yes
+then :
- if test "$arch" = "sparcv9 sparc"; then
+ if test "$arch" = "sparcv9 sparc"
+then :
# We need to specify -static-libgcc or we need to
# add the path to the sparv9 libgcc.
@@ -6427,27 +5873,25 @@ fi
#v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
#CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
-else
- if test "$arch" = "amd64 i386"; then
+else $as_nop
+ if test "$arch" = "amd64 i386"
+then :
SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
fi
-
fi
-
fi
+else $as_nop
-else
-
- if test "$use_sunmath" = yes; then
+ if test "$use_sunmath" = yes
+then :
textmode=textoff
-else
+else $as_nop
textmode=text
fi
-
case $system in
SunOS-5.[1-9][0-9]*|SunOS-5.[7-9])
SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";;
@@ -6458,7 +5902,6 @@ fi
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
fi
-
;;
UNIX_SV* | UnixWare-5*)
SHLIB_CFLAGS="-KPIC"
@@ -6469,116 +5912,90 @@ fi
DL_LIBS="-ldl"
# Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
# that don't grok the -Bexport option. Test that it does.
- echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5
-echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6
-if test "${tcl_cv_ld_Bexport+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld accepts -Bexport flag" >&5
+printf %s "checking for ld accepts -Bexport flag... " >&6; }
+if test ${tcl_cv_ld_Bexport+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-Bexport"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
int i;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_ld_Bexport=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_ld_Bexport=no
+else $as_nop
+ tcl_cv_ld_Bexport=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5
-echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6
- if test $tcl_cv_ld_Bexport = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_Bexport" >&5
+printf "%s\n" "$tcl_cv_ld_Bexport" >&6; }
+ if test $tcl_cv_ld_Bexport = yes
+then :
LDFLAGS="$LDFLAGS -Wl,-Bexport"
fi
-
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
esac
- if test "$do64bit" = yes -a "$do64bit_ok" = no; then
+ if test "$do64bit" = yes -a "$do64bit_ok" = no
+then :
- { echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5
-echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5
+printf "%s\n" "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;}
fi
-
- if test "$do64bit" = yes -a "$do64bit_ok" = yes; then
+ if test "$do64bit" = yes -a "$do64bit_ok" = yes
+then :
-cat >>confdefs.h <<\_ACEOF
-#define TCL_CFG_DO64BIT 1
-_ACEOF
+printf "%s\n" "#define TCL_CFG_DO64BIT 1" >>confdefs.h
fi
-
# Step 4: disable dynamic loading if requested via a command-line switch.
- # Check whether --enable-load or --disable-load was given.
-if test "${enable_load+set}" = set; then
- enableval="$enable_load"
- tcl_ok=$enableval
-else
+ # Check whether --enable-load was given.
+if test ${enable_load+y}
+then :
+ enableval=$enable_load; tcl_ok=$enableval
+else $as_nop
tcl_ok=yes
-fi;
- if test "$tcl_ok" = no; then
- DL_OBJS=""
fi
+ if test "$tcl_ok" = no
+then :
+ DL_OBJS=""
+fi
- if test "x$DL_OBJS" != x; then
+ if test "x$DL_OBJS" != x
+then :
BUILD_DLTEST="\$(DLTEST_TARGETS)"
-else
+else $as_nop
- { echo "$as_me:$LINENO: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5
-echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5
+printf "%s\n" "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;}
SHLIB_CFLAGS=""
SHLIB_LD=""
SHLIB_SUFFIX=""
@@ -6590,14 +6007,14 @@ echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libr
BUILD_DLTEST=""
fi
-
LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
# If we're running gcc, then change the C flags for compiling shared
# libraries to the right flags for gcc, instead of those for the
# standard manufacturer compiler.
- if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then
+ if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes
+then :
case $system in
AIX-*) ;;
@@ -6606,6 +6023,7 @@ fi
HP-UX*) ;;
Darwin-*) ;;
IRIX*) ;;
+ Linux*|GNU*) ;;
NetBSD-*|OpenBSD-*) ;;
OSF1-*) ;;
SCO_SV-3.2*) ;;
@@ -6613,217 +6031,202 @@ fi
esac
fi
+ if test "$tcl_cv_cc_visibility_hidden" != yes
+then :
- if test "$tcl_cv_cc_visibility_hidden" != yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define MODULE_SCOPE extern
-_ACEOF
+printf "%s\n" "#define MODULE_SCOPE extern" >>confdefs.h
fi
-
- if test "$SHARED_LIB_SUFFIX" = ""; then
+ if test "$SHARED_LIB_SUFFIX" = ""
+then :
SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'
fi
-
- if test "$UNSHARED_LIB_SUFFIX" = ""; then
+ if test "$UNSHARED_LIB_SUFFIX" = ""
+then :
UNSHARED_LIB_SUFFIX='${VERSION}.a'
fi
-
DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
- if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""; then
+ if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""
+then :
LIB_SUFFIX=${SHARED_LIB_SUFFIX}
MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
- if test "${SHLIB_SUFFIX}" = ".dll"; then
+ if test "${SHLIB_SUFFIX}" = ".dll"
+then :
INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;'
DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
-else
+else $as_nop
INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
fi
-
-else
+else $as_nop
LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
- if test "$RANLIB" = ""; then
+ if test "$RANLIB" = ""
+then :
MAKE_LIB='$(STLIB_LD) $@ ${OBJS}'
-else
+else $as_nop
MAKE_LIB='${STLIB_LD} $@ ${OBJS} ; ${RANLIB} $@'
fi
-
INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
fi
-
# Stub lib does not depend on shared/static configuration
- if test "$RANLIB" = ""; then
+ if test "$RANLIB" = ""
+then :
MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS}'
-else
+else $as_nop
MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS} ; ${RANLIB} $@'
fi
-
INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
# Define TCL_LIBS now that we know what DL_LIBS is.
# The trick here is that we don't want to change the value of TCL_LIBS if
# it is already set when tclConfig.sh had been loaded by Tk.
- if test "x${TCL_LIBS}" = x; then
+ if test "x${TCL_LIBS}" = x
+then :
TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"
fi
+ # See if the compiler supports casting to a union type.
+ # This is used to stop gcc from printing a compiler
+ # warning when initializing a union member.
- # See if the compiler supports casting to a union type.
- # This is used to stop gcc from printing a compiler
- # warning when initializing a union member.
-
- echo "$as_me:$LINENO: checking for cast to union support" >&5
-echo $ECHO_N "checking for cast to union support... $ECHO_C" >&6
-if test "${tcl_cv_cast_to_union+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5
+printf %s "checking for cast to union support... " >&6; }
+if test ${tcl_cv_cast_to_union+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
- union foo { int i; double d; };
- union foo f = (union foo) (int) 0;
+ union foo { int i; double d; };
+ union foo f = (union foo) (int) 0;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_cast_to_union=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cast_to_union=no
+else $as_nop
+ tcl_cv_cast_to_union=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cast_to_union" >&5
-echo "${ECHO_T}$tcl_cv_cast_to_union" >&6
- if test "$tcl_cv_cast_to_union" = "yes"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5
+printf "%s\n" "$tcl_cv_cast_to_union" >&6; }
+ if test "$tcl_cv_cast_to_union" = "yes"; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CAST_TO_UNION 1
-_ACEOF
+printf "%s\n" "#define HAVE_CAST_TO_UNION 1" >>confdefs.h
- fi
- hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto"
- echo "$as_me:$LINENO: checking for working -fno-lto" >&5
-echo $ECHO_N "checking for working -fno-lto... $ECHO_C" >&6
-if test "${ac_cv_nolto+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ fi
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -fno-lto" >&5
+printf %s "checking for working -fno-lto... " >&6; }
+if test ${ac_cv_nolto+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_nolto=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+else $as_nop
+ ac_cv_nolto=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
-ac_cv_nolto=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_nolto" >&5
+printf "%s\n" "$ac_cv_nolto" >&6; }
+ CFLAGS=$hold_cflags
+ if test "$ac_cv_nolto" = "yes" ; then
+ CFLAGS_NOLTO="-fno-lto"
+ else
+ CFLAGS_NOLTO=""
+ fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -finput-charset" >&5
+printf %s "checking if the compiler understands -finput-charset... " >&6; }
+if test ${tcl_cv_cc_input_charset+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ tcl_cv_cc_input_charset=yes
+else $as_nop
+ tcl_cv_cc_input_charset=no
fi
-echo "$as_me:$LINENO: result: $ac_cv_nolto" >&5
-echo "${ECHO_T}$ac_cv_nolto" >&6
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$hold_cflags
- if test "$ac_cv_nolto" = "yes" ; then
- CFLAGS_NOLTO="-fno-lto"
- else
- CFLAGS_NOLTO=""
- fi
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_input_charset" >&5
+printf "%s\n" "$tcl_cv_cc_input_charset" >&6; }
+ if test $tcl_cv_cc_input_charset = yes; then
+ CFLAGS="$CFLAGS -finput-charset=UTF-8"
+ fi
+
+ ac_fn_c_check_header_compile "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdbool_h" = xyes
+then :
+
+printf "%s\n" "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+fi
+
# FIXME: This subst was left in only because the TCL_DL_LIBS
# entry in tclConfig.sh uses it. It is not clear why someone
@@ -6854,9 +6257,7 @@ echo "${ECHO_T}$ac_cv_nolto" >&6
-cat >>confdefs.h <<_ACEOF
-#define TCL_SHLIB_EXT "${SHLIB_SUFFIX}"
-_ACEOF
+printf "%s\n" "#define TCL_SHLIB_EXT \"${SHLIB_SUFFIX}\"" >>confdefs.h
@@ -6868,37 +6269,34 @@ _ACEOF
- echo "$as_me:$LINENO: checking for build with symbols" >&5
-echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6
- # Check whether --enable-symbols or --disable-symbols was given.
-if test "${enable_symbols+set}" = set; then
- enableval="$enable_symbols"
- tcl_ok=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5
+printf %s "checking for build with symbols... " >&6; }
+ # Check whether --enable-symbols was given.
+if test ${enable_symbols+y}
+then :
+ enableval=$enable_symbols; tcl_ok=$enableval
+else $as_nop
tcl_ok=no
-fi;
+fi
+
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
-cat >>confdefs.h <<\_ACEOF
-#define NDEBUG 1
-_ACEOF
+printf "%s\n" "#define NDEBUG 1" >>confdefs.h
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
-cat >>confdefs.h <<\_ACEOF
-#define TCL_CFG_OPTIMIZED 1
-_ACEOF
+printf "%s\n" "#define TCL_CFG_OPTIMIZED 1" >>confdefs.h
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
if test "$tcl_ok" = "yes"; then
- echo "$as_me:$LINENO: result: yes (standard debugging)" >&5
-echo "${ECHO_T}yes (standard debugging)" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5
+printf "%s\n" "yes (standard debugging)" >&6; }
fi
fi
@@ -6906,9 +6304,7 @@ echo "${ECHO_T}yes (standard debugging)" >&6
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
-cat >>confdefs.h <<\_ACEOF
-#define TCL_MEM_DEBUG 1
-_ACEOF
+printf "%s\n" "#define TCL_MEM_DEBUG 1" >>confdefs.h
fi
@@ -6916,11 +6312,11 @@ _ACEOF
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
if test "$tcl_ok" = "all"; then
- echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5
-echo "${ECHO_T}enabled symbols mem debugging" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem debugging" >&5
+printf "%s\n" "enabled symbols mem debugging" >&6; }
else
- echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5
-echo "${ECHO_T}enabled $tcl_ok debugging" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5
+printf "%s\n" "enabled $tcl_ok debugging" >&6; }
fi
fi
@@ -6930,535 +6326,256 @@ echo "${ECHO_T}enabled $tcl_ok debugging" >&6
#--------------------------------------------------------------------
- echo "$as_me:$LINENO: checking for required early compiler flags" >&5
-echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for required early compiler flags" >&5
+printf %s "checking for required early compiler flags... " >&6; }
tcl_flags=""
- if test "${tcl_cv_flag__isoc99_source+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ if test ${tcl_cv_flag__isoc99_source+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
int
-main ()
+main (void)
{
char *p = (char *)strtoll; char *q = (char *)strtoull;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_flag__isoc99_source=no
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _ISOC99_SOURCE 1
#include <stdlib.h>
int
-main ()
+main (void)
{
char *p = (char *)strtoll; char *q = (char *)strtoull;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_flag__isoc99_source=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_flag__isoc99_source=no
+else $as_nop
+ tcl_cv_flag__isoc99_source=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then
-cat >>confdefs.h <<\_ACEOF
-#define _ISOC99_SOURCE 1
-_ACEOF
+printf "%s\n" "#define _ISOC99_SOURCE 1" >>confdefs.h
tcl_flags="$tcl_flags _ISOC99_SOURCE"
fi
- if test "${tcl_cv_flag__largefile64_source+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ if test ${tcl_cv_flag__largefile64_source+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/stat.h>
int
-main ()
+main (void)
{
struct stat64 buf; int i = stat64("/", &buf);
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_flag__largefile64_source=no
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _LARGEFILE64_SOURCE 1
#include <sys/stat.h>
int
-main ()
+main (void)
{
struct stat64 buf; int i = stat64("/", &buf);
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_flag__largefile64_source=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_flag__largefile64_source=no
+else $as_nop
+ tcl_cv_flag__largefile64_source=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then
-cat >>confdefs.h <<\_ACEOF
-#define _LARGEFILE64_SOURCE 1
-_ACEOF
+printf "%s\n" "#define _LARGEFILE64_SOURCE 1" >>confdefs.h
tcl_flags="$tcl_flags _LARGEFILE64_SOURCE"
fi
- if test "${tcl_cv_flag__largefile_source64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ if test ${tcl_cv_flag__largefile_source64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/stat.h>
int
-main ()
+main (void)
{
char *p = (char *)open64;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_flag__largefile_source64=no
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _LARGEFILE_SOURCE64 1
#include <sys/stat.h>
int
-main ()
+main (void)
{
char *p = (char *)open64;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_flag__largefile_source64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_flag__largefile_source64=no
+else $as_nop
+ tcl_cv_flag__largefile_source64=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then
-cat >>confdefs.h <<\_ACEOF
-#define _LARGEFILE_SOURCE64 1
-_ACEOF
+printf "%s\n" "#define _LARGEFILE_SOURCE64 1" >>confdefs.h
tcl_flags="$tcl_flags _LARGEFILE_SOURCE64"
fi
if test "x${tcl_flags}" = "x" ; then
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5
+printf "%s\n" "none" >&6; }
else
- echo "$as_me:$LINENO: result: ${tcl_flags}" >&5
-echo "${ECHO_T}${tcl_flags}" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${tcl_flags}" >&5
+printf "%s\n" "${tcl_flags}" >&6; }
fi
- echo "$as_me:$LINENO: checking for 64-bit integer type" >&5
-echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6
- if test "${tcl_cv_type_64bit+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit integer type" >&5
+printf %s "checking for 64-bit integer type... " >&6; }
+ if test ${tcl_cv_type_64bit+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
tcl_cv_type_64bit=none
- # See if the compiler knows natively about __int64
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-__int64 value = (__int64) 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- tcl_type_64bit=__int64
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_type_64bit="long long"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- # See if we should use long anyway Note that we substitute in the
+ # See if we could use long anyway Note that we substitute in the
# type that is our current guess for a 64-bit type inside this check
# program, so it should be modified only carefully...
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
switch (0) {
- case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
+ case 1: case (sizeof(long long)==sizeof(long)): ;
}
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- tcl_cv_type_64bit=${tcl_type_64bit}
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+if ac_fn_c_try_compile "$LINENO"
+then :
+ tcl_cv_type_64bit="long long"
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
if test "${tcl_cv_type_64bit}" = none ; then
-cat >>confdefs.h <<\_ACEOF
-#define TCL_WIDE_INT_IS_LONG 1
-_ACEOF
+printf "%s\n" "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h
- echo "$as_me:$LINENO: result: using long" >&5
-echo "${ECHO_T}using long" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
else
-
-cat >>confdefs.h <<_ACEOF
-#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit}
-_ACEOF
-
- echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5
-echo "${ECHO_T}${tcl_cv_type_64bit}" >&6
-
# Now check for auxiliary declarations
- echo "$as_me:$LINENO: checking for struct dirent64" >&5
-echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6
-if test "${tcl_cv_struct_dirent64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent64" >&5
+printf %s "checking for struct dirent64... " >&6; }
+if test ${tcl_cv_struct_dirent64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <dirent.h>
int
-main ()
+main (void)
{
struct dirent64 p;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_struct_dirent64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_struct_dirent64=no
+else $as_nop
+ tcl_cv_struct_dirent64=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5
-echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_dirent64" >&5
+printf "%s\n" "$tcl_cv_struct_dirent64" >&6; }
if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRUCT_DIRENT64 1
-_ACEOF
+printf "%s\n" "#define HAVE_STRUCT_DIRENT64 1" >>confdefs.h
fi
- echo "$as_me:$LINENO: checking for DIR64" >&5
-echo $ECHO_N "checking for DIR64... $ECHO_C" >&6
-if test "${tcl_cv_DIR64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for DIR64" >&5
+printf %s "checking for DIR64... " >&6; }
+if test ${tcl_cv_DIR64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <dirent.h>
int
-main ()
+main (void)
{
struct dirent64 *p; DIR64 d = opendir64(".");
p = readdir64(d); rewinddir64(d); closedir64(d);
@@ -7466,62 +6583,34 @@ struct dirent64 *p; DIR64 d = opendir64(".");
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_DIR64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_DIR64=no
+else $as_nop
+ tcl_cv_DIR64=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_DIR64" >&5
-echo "${ECHO_T}$tcl_cv_DIR64" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_DIR64" >&5
+printf "%s\n" "$tcl_cv_DIR64" >&6; }
if test "x${tcl_cv_DIR64}" = "xyes" ; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DIR64 1
-_ACEOF
+printf "%s\n" "#define HAVE_DIR64 1" >>confdefs.h
fi
- echo "$as_me:$LINENO: checking for struct stat64" >&5
-echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6
-if test "${tcl_cv_struct_stat64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct stat64" >&5
+printf %s "checking for struct stat64... " >&6; }
+if test ${tcl_cv_struct_stat64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/stat.h>
int
-main ()
+main (void)
{
struct stat64 p;
@@ -7529,165 +6618,47 @@ struct stat64 p;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_struct_stat64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_struct_stat64=no
+else $as_nop
+ tcl_cv_struct_stat64=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5
-echo "${ECHO_T}$tcl_cv_struct_stat64" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_stat64" >&5
+printf "%s\n" "$tcl_cv_struct_stat64" >&6; }
if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRUCT_STAT64 1
-_ACEOF
+printf "%s\n" "#define HAVE_STRUCT_STAT64 1" >>confdefs.h
fi
+ ac_fn_c_check_func "$LINENO" "open64" "ac_cv_func_open64"
+if test "x$ac_cv_func_open64" = xyes
+then :
+ printf "%s\n" "#define HAVE_OPEN64 1" >>confdefs.h
-
-for ac_func in open64 lseek64
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+ac_fn_c_check_func "$LINENO" "lseek64" "ac_cv_func_lseek64"
+if test "x$ac_cv_func_lseek64" = xyes
+then :
+ printf "%s\n" "#define HAVE_LSEEK64 1" >>confdefs.h
fi
-done
- echo "$as_me:$LINENO: checking for off64_t" >&5
-echo $ECHO_N "checking for off64_t... $ECHO_C" >&6
- if test "${tcl_cv_type_off64_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5
+printf %s "checking for off64_t... " >&6; }
+ if test ${tcl_cv_type_off64_t+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
int
-main ()
+main (void)
{
off64_t offset;
@@ -7695,51 +6666,26 @@ off64_t offset;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_type_off64_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_type_off64_t=no
+else $as_nop
+ tcl_cv_type_off64_t=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
if test "x${tcl_cv_type_off64_t}" = "xyes" && \
test "x${ac_cv_func_lseek64}" = "xyes" && \
test "x${ac_cv_func_open64}" = "xyes" ; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TYPE_OFF64_T 1
-_ACEOF
+printf "%s\n" "#define HAVE_TYPE_OFF64_T 1" >>confdefs.h
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
fi
@@ -7748,235 +6694,238 @@ echo "${ECHO_T}no" >&6
# Check endianness because we can optimize some operations
#--------------------------------------------------------------------
-echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
-echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
-if test "${ac_cv_c_bigendian+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # See if sys/param.h defines the BYTE_ORDER macro.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+printf %s "checking whether byte ordering is bigendian... " >&6; }
+if test ${ac_cv_c_bigendian+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_cv_c_bigendian=unknown
+ # See if we're dealing with a universal compiler.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __APPLE_CC__
+ not a universal capable compiler
+ #endif
+ typedef int dummy;
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+
+ # Check for potential -arch flags. It is not universal unless
+ # there are at least two -arch flags with different values.
+ ac_arch=
+ ac_prev=
+ for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+ if test -n "$ac_prev"; then
+ case $ac_word in
+ i?86 | x86_64 | ppc | ppc64)
+ if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+ ac_arch=$ac_word
+ else
+ ac_cv_c_bigendian=universal
+ break
+ fi
+ ;;
+ esac
+ ac_prev=
+ elif test "x$ac_word" = "x-arch"; then
+ ac_prev=arch
+ fi
+ done
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if sys/param.h defines the BYTE_ORDER macro.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
-#include <sys/param.h>
+ #include <sys/param.h>
int
-main ()
+main (void)
{
-#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
- bogus endian macros
-#endif
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+ && LITTLE_ENDIAN)
+ bogus endian macros
+ #endif
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
# It does; now see whether it defined to BIG_ENDIAN or not.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
-#include <sys/param.h>
+ #include <sys/param.h>
int
-main ()
+main (void)
{
#if BYTE_ORDER != BIG_ENDIAN
- not big endian
-#endif
+ not big endian
+ #endif
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_c_bigendian=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_bigendian=no
+else $as_nop
+ ac_cv_c_bigendian=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
-# It does not; compile a test program.
-if test "$cross_compiling" = yes; then
- # try to guess the endianness by grepping values into an object file
- ac_cv_c_bigendian=unknown
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
+int
+main (void)
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ # It does; now see whether it defined to _BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
-short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+#include <limits.h>
+
int
-main ()
+main (void)
{
- _ascii (); _ebcdic ();
+#ifndef _BIG_ENDIAN
+ not big endian
+ #endif
+
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_c_bigendian=yes
+else $as_nop
+ ac_cv_c_bigendian=no
fi
-if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
- if test "$ac_cv_c_bigendian" = unknown; then
- ac_cv_c_bigendian=no
- else
- # finding both strings is unlikely to happen, but who knows?
- ac_cv_c_bigendian=unknown
- fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # Compile a test program.
+ if test "$cross_compiling" = yes
+then :
+ # Try to guess by grepping values from an object file.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+unsigned short int ascii_mm[] =
+ { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+ unsigned short int ascii_ii[] =
+ { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+ int use_ascii (int i) {
+ return ascii_mm[i] + ascii_ii[i];
+ }
+ unsigned short int ebcdic_ii[] =
+ { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+ unsigned short int ebcdic_mm[] =
+ { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+ int use_ebcdic (int i) {
+ return ebcdic_mm[i] + ebcdic_ii[i];
+ }
+ extern int foo;
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
+int
+main (void)
+{
+return use_ascii (foo) == use_ebcdic (foo);
+ ;
+ return 0;
+}
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+ ac_cv_c_bigendian=yes
+ fi
+ if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+$ac_includes_default
int
-main ()
+main (void)
{
- /* Are we little or big endian? From Harbison&Steele. */
- union
- {
- long l;
- char c[sizeof (long)];
- } u;
- u.l = 1;
- exit (u.c[sizeof (long) - 1] == 1);
+
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long int l;
+ char c[sizeof (long int)];
+ } u;
+ u.l = 1;
+ return u.c[sizeof (long int) - 1] == 1;
+
+ ;
+ return 0;
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"
+then :
ac_cv_c_bigendian=no
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_c_bigendian=yes
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+else $as_nop
+ ac_cv_c_bigendian=yes
fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ fi
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
-echo "${ECHO_T}$ac_cv_c_bigendian" >&6
-case $ac_cv_c_bigendian in
- yes)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+printf "%s\n" "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+ yes)
+ printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+ no)
+ ;; #(
+ universal)
-cat >>confdefs.h <<\_ACEOF
-#define WORDS_BIGENDIAN 1
-_ACEOF
- ;;
- no)
- ;;
- *)
- { { echo "$as_me:$LINENO: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&5
-echo "$as_me: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
- { (exit 1); exit 1; }; } ;;
-esac
+printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+
+ ;; #(
+ *)
+ as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
#------------------------------------------------------------------------
@@ -7991,12 +6940,12 @@ if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
fi
if test "$TCL_PREFIX" != "$prefix"; then
- { echo "$as_me:$LINENO: WARNING:
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING:
Different --prefix selected for Tk and Tcl!
- [package require Tk] may not work correctly in tclsh." >&5
-echo "$as_me: WARNING:
+ [package require tk] may not work correctly in tclsh." >&5
+printf "%s\n" "$as_me: WARNING:
Different --prefix selected for Tk and Tcl!
- [package require Tk] may not work correctly in tclsh." >&2;}
+ [package require tk] may not work correctly in tclsh." >&2;}
fi
#--------------------------------------------------------------------
@@ -8009,835 +6958,438 @@ fi
# special flag.
#--------------------------------------------------------------------
-echo "$as_me:$LINENO: checking for fd_set in sys/types" >&5
-echo $ECHO_N "checking for fd_set in sys/types... $ECHO_C" >&6
-if test "${tcl_cv_type_fd_set+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fd_set in sys/types" >&5
+printf %s "checking for fd_set in sys/types... " >&6; }
+if test ${tcl_cv_type_fd_set+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
int
-main ()
+main (void)
{
fd_set readMask, writeMask;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_type_fd_set=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_type_fd_set=no
+else $as_nop
+ tcl_cv_type_fd_set=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_type_fd_set" >&5
-echo "${ECHO_T}$tcl_cv_type_fd_set" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_type_fd_set" >&5
+printf "%s\n" "$tcl_cv_type_fd_set" >&6; }
tk_ok=$tcl_cv_type_fd_set
if test $tk_ok = no; then
- echo "$as_me:$LINENO: checking for fd_mask in sys/select" >&5
-echo $ECHO_N "checking for fd_mask in sys/select... $ECHO_C" >&6
-if test "${tcl_cv_grep_fd_mask+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+printf %s "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test ${ac_cv_prog_CPP+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ # Double quotes because $CC needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <sys/select.h>
-
+#include <limits.h>
+ Syntax error
_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "fd_mask" >/dev/null 2>&1; then
- tcl_cv_grep_fd_mask=present
-else
- tcl_cv_grep_fd_mask=missing
-fi
-rm -f conftest*
+if ac_fn_c_try_cpp "$LINENO"
+then :
+else $as_nop
+ # Broken: fails on valid input.
+continue
fi
-echo "$as_me:$LINENO: result: $tcl_cv_grep_fd_mask" >&5
-echo "${ECHO_T}$tcl_cv_grep_fd_mask" >&6
- if test $tcl_cv_grep_fd_mask = present; then
+rm -f conftest.err conftest.i conftest.$ac_ext
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_SELECT_H 1
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
_ACEOF
-
- tk_ok=yes
- fi
+if ac_fn_c_try_cpp "$LINENO"
+then :
+ # Broken: success on invalid input.
+continue
+else $as_nop
+ # Passes both tests.
+ac_preproc_ok=:
+break
fi
-if test $tk_ok = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define NO_FD_SET 1
-_ACEOF
+rm -f conftest.err conftest.i conftest.$ac_ext
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok
+then :
+ break
fi
-#------------------------------------------------------------------------------
-# Find out all about time handling differences.
-#------------------------------------------------------------------------------
-
+ done
+ ac_cv_prog_CPP=$CPP
-for ac_header in sys/time.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+fi
+ CPP=$ac_cv_prog_CPP
else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ ac_cv_prog_CPP=$CPP
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+printf "%s\n" "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
+#include <limits.h>
+ Syntax error
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"
+then :
-ac_header_compiler=no
+else $as_nop
+ # Broken: fails on valid input.
+continue
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+rm -f conftest.err conftest.i conftest.$ac_ext
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <$ac_header>
+#include <ac_nonexistent.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
+if ac_fn_c_try_cpp "$LINENO"
+then :
+ # Broken: success on invalid input.
+continue
+else $as_nop
+ # Passes both tests.
+ac_preproc_ok=:
+break
fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+rm -f conftest.err conftest.i conftest.$ac_ext
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------- ##
-## Report this to the tk lists. ##
-## ----------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok
+then :
+else $as_nop
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-done
-echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
-if test "${ac_cv_header_time+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+printf %s "checking for grep that handles long lines and -e... " >&6; }
+if test ${ac_cv_path_GREP+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_prog in grep ggrep
+ do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ printf %s 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ printf "%s\n" 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_time=yes
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_time=no
+ ac_cv_path_GREP=$GREP
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6
-if test $ac_cv_header_time = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define TIME_WITH_SYS_TIME 1
-_ACEOF
fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+printf "%s\n" "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
-#--------------------------------------------------------------------
-# Check for various typedefs and provide substitutes if
-# they don't exist.
-#--------------------------------------------------------------------
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+printf %s "checking for egrep... " >&6; }
+if test ${ac_cv_path_EGREP+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_prog in egrep
+ do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ printf %s 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ printf "%s\n" 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
-echo "$as_me:$LINENO: checking for mode_t" >&5
-echo $ECHO_N "checking for mode_t... $ECHO_C" >&6
-if test "${ac_cv_type_mode_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((mode_t *) 0)
- return 0;
-if (sizeof (mode_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_mode_t=yes
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_mode_t=no
+ ac_cv_path_EGREP=$EGREP
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ fi
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
-echo "${ECHO_T}$ac_cv_type_mode_t" >&6
-if test $ac_cv_type_mode_t = yes; then
- :
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+printf "%s\n" "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
-cat >>confdefs.h <<_ACEOF
-#define mode_t int
-_ACEOF
-fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fd_mask in sys/select" >&5
+printf %s "checking for fd_mask in sys/select... " >&6; }
+if test ${tcl_cv_grep_fd_mask+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
-echo "$as_me:$LINENO: checking for pid_t" >&5
-echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
-if test "${ac_cv_type_pid_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((pid_t *) 0)
- return 0;
-if (sizeof (pid_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_pid_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_pid_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-echo "${ECHO_T}$ac_cv_type_pid_t" >&6
-if test $ac_cv_type_pid_t = yes; then
- :
-else
+#include <sys/select.h>
-cat >>confdefs.h <<_ACEOF
-#define pid_t int
_ACEOF
-
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "fd_mask" >/dev/null 2>&1
+then :
+ tcl_cv_grep_fd_mask=present
+else $as_nop
+ tcl_cv_grep_fd_mask=missing
fi
+rm -rf conftest*
-echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6
-if test "${ac_cv_type_size_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((size_t *) 0)
- return 0;
-if (sizeof (size_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_size_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_size_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6
-if test $ac_cv_type_size_t = yes; then
- :
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_fd_mask" >&5
+printf "%s\n" "$tcl_cv_grep_fd_mask" >&6; }
+ if test $tcl_cv_grep_fd_mask = present; then
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned
-_ACEOF
+printf "%s\n" "#define HAVE_SYS_SELECT_H 1" >>confdefs.h
+ tk_ok=yes
+ fi
fi
+if test $tk_ok = no; then
-echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
-echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6
-if test "${ac_cv_type_uid_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
+printf "%s\n" "#define NO_FD_SET 1" >>confdefs.h
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "uid_t" >/dev/null 2>&1; then
- ac_cv_type_uid_t=yes
-else
- ac_cv_type_uid_t=no
fi
-rm -f conftest*
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
-echo "${ECHO_T}$ac_cv_type_uid_t" >&6
-if test $ac_cv_type_uid_t = no; then
+#------------------------------------------------------------------------------
+# Find out all about time handling differences.
+#------------------------------------------------------------------------------
-cat >>confdefs.h <<\_ACEOF
-#define uid_t int
-_ACEOF
-cat >>confdefs.h <<\_ACEOF
-#define gid_t int
-_ACEOF
-fi
+#--------------------------------------------------------------------
+# Check for various typedefs and provide substitutes if
+# they don't exist.
+#--------------------------------------------------------------------
+ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
+if test "x$ac_cv_type_mode_t" = xyes
+then :
-echo "$as_me:$LINENO: checking for intptr_t" >&5
-echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6
-if test "${ac_cv_type_intptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((intptr_t *) 0)
- return 0;
-if (sizeof (intptr_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_intptr_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+else $as_nop
+
+printf "%s\n" "#define mode_t int" >>confdefs.h
-ac_cv_type_intptr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
-echo "${ECHO_T}$ac_cv_type_intptr_t" >&6
-if test $ac_cv_type_intptr_t = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_INTPTR_T 1
-_ACEOF
+ ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default
+"
+if test "x$ac_cv_type_pid_t" = xyes
+then :
-else
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
- echo "$as_me:$LINENO: checking for pointer-size signed integer type" >&5
-echo $ECHO_N "checking for pointer-size signed integer type... $ECHO_C" >&6
-if test "${tcl_cv_intptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ #if defined _WIN64 && !defined __CYGWIN__
+ LLP64
+ #endif
- for tcl_cv_intptr_t in "int" "long" "long long" none; do
- if test "$tcl_cv_intptr_t" != none; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
int
-main ()
+main (void)
{
-static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))];
-test_array [0] = 0
;
return 0;
}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- tcl_ok=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-tcl_ok=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- test "$tcl_ok" = yes && break; fi
- done
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_pid_type='int'
+else $as_nop
+ ac_pid_type='__int64'
fi
-echo "$as_me:$LINENO: result: $tcl_cv_intptr_t" >&5
-echo "${ECHO_T}$tcl_cv_intptr_t" >&6
- if test "$tcl_cv_intptr_t" != none; then
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
-cat >>confdefs.h <<_ACEOF
-#define intptr_t $tcl_cv_intptr_t
-_ACEOF
+printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h
- fi
fi
-echo "$as_me:$LINENO: checking for uintptr_t" >&5
-echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
-if test "${ac_cv_type_uintptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((uintptr_t *) 0)
- return 0;
-if (sizeof (uintptr_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_uintptr_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_type_uintptr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
-echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
-if test $ac_cv_type_uintptr_t = yes; then
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes
+then :
+else $as_nop
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_UINTPTR_T 1
-_ACEOF
+printf "%s\n" "#define size_t unsigned int" >>confdefs.h
-else
+fi
- echo "$as_me:$LINENO: checking for pointer-size unsigned integer type" >&5
-echo $ECHO_N "checking for pointer-size unsigned integer type... $ECHO_C" >&6
-if test "${tcl_cv_uintptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
- none; do
- if test "$tcl_cv_uintptr_t" != none; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))];
-test_array [0] = 0
+ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "
+#include <stdint.h>
+
+"
+if test "x$ac_cv_type_intptr_t" = xyes
+then :
+
+printf "%s\n" "#define HAVE_INTPTR_T 1" >>confdefs.h
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- tcl_ok=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-tcl_ok=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- test "$tcl_ok" = yes && break; fi
- done
fi
-echo "$as_me:$LINENO: result: $tcl_cv_uintptr_t" >&5
-echo "${ECHO_T}$tcl_cv_uintptr_t" >&6
- if test "$tcl_cv_uintptr_t" != none; then
+ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "
+#include <stdint.h>
-cat >>confdefs.h <<_ACEOF
-#define uintptr_t $tcl_cv_uintptr_t
-_ACEOF
+"
+if test "x$ac_cv_type_uintptr_t" = xyes
+then :
+
+printf "%s\n" "#define HAVE_UINTPTR_T 1" >>confdefs.h
- fi
fi
@@ -8846,65 +7398,37 @@ fi
# In OS/390 struct pwd has no pw_gecos field
#-------------------------------------------
-echo "$as_me:$LINENO: checking pw_gecos in struct pwd" >&5
-echo $ECHO_N "checking pw_gecos in struct pwd... $ECHO_C" >&6
-if test "${tcl_cv_pwd_pw_gecos+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pw_gecos in struct pwd" >&5
+printf %s "checking pw_gecos in struct pwd... " >&6; }
+if test ${tcl_cv_pwd_pw_gecos+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pwd.h>
int
-main ()
+main (void)
{
struct passwd pwd; (void)pwd.pw_gecos;
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_pwd_pw_gecos=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_pwd_pw_gecos=no
+else $as_nop
+ tcl_cv_pwd_pw_gecos=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_pwd_pw_gecos" >&5
-echo "${ECHO_T}$tcl_cv_pwd_pw_gecos" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_pwd_pw_gecos" >&5
+printf "%s\n" "$tcl_cv_pwd_pw_gecos" >&6; }
if test $tcl_cv_pwd_pw_gecos = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PW_GECOS 1
-_ACEOF
+printf "%s\n" "#define HAVE_PW_GECOS 1" >>confdefs.h
fi
@@ -8913,106 +7437,81 @@ fi
#--------------------------------------------------------------------
if test "`uname -s`" = "Darwin" ; then
- echo "$as_me:$LINENO: checking whether to use Aqua" >&5
-echo $ECHO_N "checking whether to use Aqua... $ECHO_C" >&6
- # Check whether --enable-aqua or --disable-aqua was given.
-if test "${enable_aqua+set}" = set; then
- enableval="$enable_aqua"
- tk_aqua=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use Aqua" >&5
+printf %s "checking whether to use Aqua... " >&6; }
+ # Check whether --enable-aqua was given.
+if test ${enable_aqua+y}
+then :
+ enableval=$enable_aqua; tk_aqua=$enableval
+else $as_nop
tk_aqua=no
-fi;
+fi
+
if test $tk_aqua = yes -o $tk_aqua = cocoa; then
tk_aqua=yes
if test $tcl_corefoundation = no; then
- { echo "$as_me:$LINENO: WARNING: Aqua can only be used when CoreFoundation is available" >&5
-echo "$as_me: WARNING: Aqua can only be used when CoreFoundation is available" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Aqua can only be used when CoreFoundation is available" >&5
+printf "%s\n" "$as_me: WARNING: Aqua can only be used when CoreFoundation is available" >&2;}
tk_aqua=no
fi
if test ! -d /System/Library/Frameworks/Cocoa.framework; then
- { echo "$as_me:$LINENO: WARNING: Aqua can only be used when Cocoa is available" >&5
-echo "$as_me: WARNING: Aqua can only be used when Cocoa is available" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Aqua can only be used when Cocoa is available" >&5
+printf "%s\n" "$as_me: WARNING: Aqua can only be used when Cocoa is available" >&2;}
tk_aqua=no
fi
if test "`uname -r | awk -F. '{print $1}'`" -lt 9; then
- { echo "$as_me:$LINENO: WARNING: Aqua requires Mac OS X 10.5 or later" >&5
-echo "$as_me: WARNING: Aqua requires Mac OS X 10.5 or later" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Aqua requires Mac OS X 10.5 or later" >&5
+printf "%s\n" "$as_me: WARNING: Aqua requires Mac OS X 10.5 or later" >&2;}
tk_aqua=no
fi
fi
- echo "$as_me:$LINENO: result: $tk_aqua" >&5
-echo "${ECHO_T}$tk_aqua" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tk_aqua" >&5
+printf "%s\n" "$tk_aqua" >&6; }
if test "$fat_32_64" = yes; then
if test $tk_aqua = no; then
- echo "$as_me:$LINENO: checking for 64-bit X11" >&5
-echo $ECHO_N "checking for 64-bit X11... $ECHO_C" >&6
-if test "${tcl_cv_lib_x11_64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit X11" >&5
+printf %s "checking for 64-bit X11... " >&6; }
+if test ${tcl_cv_lib_x11_64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
done
CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <X11/Xlib.h>
int
-main ()
+main (void)
{
XrmInitialize();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_lib_x11_64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_lib_x11_64=no
+else $as_nop
+ tcl_cv_lib_x11_64=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done
fi
-echo "$as_me:$LINENO: result: $tcl_cv_lib_x11_64" >&5
-echo "${ECHO_T}$tcl_cv_lib_x11_64" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_x11_64" >&5
+printf "%s\n" "$tcl_cv_lib_x11_64" >&6; }
fi
# remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit
# fat builds if configuration does not support 64-bit.
if test "$tcl_cv_lib_x11_64" = no; then
- { echo "$as_me:$LINENO: Removing 64-bit architectures from compiler & linker flags" >&5
-echo "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Removing 64-bit architectures from compiler & linker flags" >&5
+printf "%s\n" "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;}
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
done
@@ -9020,228 +7519,56 @@ echo "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;}
fi
if test $tk_aqua = no; then
# check if weak linking whole libraries is possible.
- echo "$as_me:$LINENO: checking if ld accepts -weak-l flag" >&5
-echo $ECHO_N "checking if ld accepts -weak-l flag... $ECHO_C" >&6
-if test "${tcl_cv_ld_weak_l+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -weak-l flag" >&5
+printf %s "checking if ld accepts -weak-l flag... " >&6; }
+if test ${tcl_cv_ld_weak_l+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-weak-lm"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <math.h>
int
-main ()
+main (void)
{
double f = sin(1.0);
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_ld_weak_l=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_ld_weak_l=no
+else $as_nop
+ tcl_cv_ld_weak_l=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_ld_weak_l" >&5
-echo "${ECHO_T}$tcl_cv_ld_weak_l" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_weak_l" >&5
+printf "%s\n" "$tcl_cv_ld_weak_l" >&6; }
fi
+ ac_fn_c_check_header_compile "$LINENO" "AvailabilityMacros.h" "ac_cv_header_AvailabilityMacros_h" "$ac_includes_default"
+if test "x$ac_cv_header_AvailabilityMacros_h" = xyes
+then :
+ printf "%s\n" "#define HAVE_AVAILABILITYMACROS_H 1" >>confdefs.h
-for ac_header in AvailabilityMacros.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------- ##
-## Report this to the tk lists. ##
-## ----------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
- echo "$as_me:$LINENO: checking if weak import is available" >&5
-echo $ECHO_N "checking if weak import is available... $ECHO_C" >&6
-if test "${tcl_cv_cc_weak_import+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if weak import is available" >&5
+printf %s "checking if weak import is available... " >&6; }
+if test ${tcl_cv_cc_weak_import+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
@@ -9254,67 +7581,39 @@ cat >>conftest.$ac_ext <<_ACEOF
int rand(void) __attribute__((weak_import));
int
-main ()
+main (void)
{
rand();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_cc_weak_import=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cc_weak_import=no
+else $as_nop
+ tcl_cv_cc_weak_import=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cc_weak_import" >&5
-echo "${ECHO_T}$tcl_cv_cc_weak_import" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_weak_import" >&5
+printf "%s\n" "$tcl_cv_cc_weak_import" >&6; }
if test $tcl_cv_cc_weak_import = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_WEAK_IMPORT 1
-_ACEOF
+printf "%s\n" "#define HAVE_WEAK_IMPORT 1" >>confdefs.h
fi
- echo "$as_me:$LINENO: checking if Darwin SUSv3 extensions are available" >&5
-echo $ECHO_N "checking if Darwin SUSv3 extensions are available... $ECHO_C" >&6
-if test "${tcl_cv_cc_darwin_c_source+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if Darwin SUSv3 extensions are available" >&5
+printf %s "checking if Darwin SUSv3 extensions are available... " >&6; }
+if test ${tcl_cv_cc_darwin_c_source+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
@@ -9328,52 +7627,27 @@ cat >>conftest.$ac_ext <<_ACEOF
#include <sys/cdefs.h>
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_cc_darwin_c_source=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cc_darwin_c_source=no
+else $as_nop
+ tcl_cv_cc_darwin_c_source=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cc_darwin_c_source" >&5
-echo "${ECHO_T}$tcl_cv_cc_darwin_c_source" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_darwin_c_source" >&5
+printf "%s\n" "$tcl_cv_cc_darwin_c_source" >&6; }
if test $tcl_cv_cc_darwin_c_source = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define _DARWIN_C_SOURCE 1
-_ACEOF
+printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h
fi
fi
@@ -9383,18 +7657,17 @@ fi
if test $tk_aqua = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define MAC_OSX_TK 1
-_ACEOF
+printf "%s\n" "#define MAC_OSX_TK 1" >>confdefs.h
- LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore"
+ LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore -framework Security"
+ if test -d /System/Library/Frameworks/UserNotifications.framework; then
+ LIBS="$LIBS -framework UserNotifications"
+ fi
EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c'
TK_WINDOWINGSYSTEM=AQUA
if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then
-cat >>confdefs.h <<\_ACEOF
-#define TK_MAC_DEBUG 1
-_ACEOF
+printf "%s\n" "#define TK_MAC_DEBUG 1" >>confdefs.h
fi
else
@@ -9408,44 +7681,77 @@ else
#--------------------------------------------------------------------
- echo "$as_me:$LINENO: checking for X" >&5
-echo $ECHO_N "checking for X... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X" >&5
+printf %s "checking for X... " >&6; }
-# Check whether --with-x or --without-x was given.
-if test "${with_x+set}" = set; then
- withval="$with_x"
+# Check whether --with-x was given.
+if test ${with_x+y}
+then :
+ withval=$with_x;
+fi
-fi;
# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
if test "x$with_x" = xno; then
# The user explicitly disabled X.
have_x=disabled
else
- if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
- # Both variables are already set.
- have_x=yes
- else
- if test "${ac_cv_have_x+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ case $x_includes,$x_libraries in #(
+ *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
+ *,NONE | NONE,*) if test ${ac_cv_have_x+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
# One or both of the vars are not set, and there is no cached value.
-ac_x_includes=no ac_x_libraries=no
-rm -fr conftest.dir
+ac_x_includes=no
+ac_x_libraries=no
+# Do we need to do anything special at all?
+ac_save_LIBS=$LIBS
+LIBS="-lX11 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <X11/Xlib.h>
+int
+main (void)
+{
+XrmInitialize ()
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+ # We can compile and link X programs with no special options.
+ ac_x_includes=
+ ac_x_libraries=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS="$ac_save_LIBS"
+# If that didn't work, only try xmkmf and file system searches
+# for native compilation.
+if test x"$ac_x_includes" = xno && test "$cross_compiling" = no
+then :
+ rm -f -r conftest.dir
if mkdir conftest.dir; then
cd conftest.dir
- # Make sure to not put "make" in the Imakefile rules, since we grep it out.
cat >Imakefile <<'_ACEOF'
-acfindx:
- @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
-_ACEOF
- if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
- # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
- eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+incroot:
+ @echo incroot='${INCROOT}'
+usrlibdir:
+ @echo usrlibdir='${USRLIBDIR}'
+libdir:
+ @echo libdir='${LIBDIR}'
+_ACEOF
+ if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
+ # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+ for ac_var in incroot usrlibdir libdir; do
+ eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
+ done
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
- for ac_extension in a so sl; do
- if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
- test -f $ac_im_libdir/libX11.$ac_extension; then
+ for ac_extension in a so sl dylib la dll; do
+ if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
+ test -f "$ac_im_libdir/libX11.$ac_extension"; then
ac_im_usrlibdir=$ac_im_libdir; break
fi
done
@@ -9453,41 +7759,47 @@ _ACEOF
# bogus both because they are the default anyway, and because
# using them would break gcc on systems where it needs fixed includes.
case $ac_im_incroot in
- /usr/include) ;;
+ /usr/include) ac_x_includes= ;;
*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
esac
case $ac_im_usrlibdir in
- /usr/lib | /lib) ;;
+ /usr/lib | /usr/lib64 | /lib | /lib64) ;;
*) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
esac
fi
cd ..
- rm -fr conftest.dir
+ rm -f -r conftest.dir
fi
-# Standard set of common directories for X headers.
+ # Standard set of common directories for X headers.
# Check X11 before X11Rn because it is often a symlink to the current release.
ac_x_header_dirs='
/usr/X11/include
+/usr/X11R7/include
/usr/X11R6/include
/usr/X11R5/include
/usr/X11R4/include
/usr/include/X11
+/usr/include/X11R7
/usr/include/X11R6
/usr/include/X11R5
/usr/include/X11R4
/usr/local/X11/include
+/usr/local/X11R7/include
/usr/local/X11R6/include
/usr/local/X11R5/include
/usr/local/X11R4/include
/usr/local/include/X11
+/usr/local/include/X11R7
/usr/local/include/X11R6
/usr/local/include/X11R5
/usr/local/include/X11R4
+/opt/X11/include
+
/usr/X386/include
/usr/x386/include
/usr/XFree86/include/X11
@@ -9505,38 +7817,15 @@ ac_x_header_dirs='
if test "$ac_x_includes" = no; then
# Guess where to find include files, by looking for Xlib.h.
# First, try using that file with no special directory specified.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <X11/Xlib.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+if ac_fn_c_try_cpp "$LINENO"
+then :
# We can compile using X headers with no special include directory.
ac_x_includes=
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+else $as_nop
for ac_dir in $ac_x_header_dirs; do
if test -r "$ac_dir/X11/Xlib.h"; then
ac_x_includes=$ac_dir
@@ -9544,7 +7833,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi
done
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
fi # $ac_x_includes = no
if test "$ac_x_libraries" = no; then
@@ -9553,132 +7842,88 @@ if test "$ac_x_libraries" = no; then
# Don't add to $LIBS permanently.
ac_save_LIBS=$LIBS
LIBS="-lX11 $LIBS"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <X11/Xlib.h>
int
-main ()
+main (void)
{
XrmInitialize ()
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
LIBS=$ac_save_LIBS
# We can link X programs with no special library path.
ac_x_libraries=
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-LIBS=$ac_save_LIBS
-for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
+else $as_nop
+ LIBS=$ac_save_LIBS
+for ac_dir in `printf "%s\n" "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
# Don't even attempt the hair of trying to link an X program!
- for ac_extension in a so sl; do
- if test -r $ac_dir/libXt.$ac_extension; then
+ for ac_extension in a so sl dylib la dll; do
+ if test -r "$ac_dir/libX11.$ac_extension"; then
ac_x_libraries=$ac_dir
break 2
fi
done
done
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
fi # $ac_x_libraries = no
-if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
- # Didn't find X anywhere. Cache the known absence of X.
- ac_cv_have_x="have_x=no"
-else
- # Record where we found X for the cache.
- ac_cv_have_x="have_x=yes \
- ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi
+# Record the results.
+case $ac_x_includes,$ac_x_libraries in #(
+ no,* | *,no | *\'*) :
+ # Didn't find X, or a directory has "'" in its name.
+ ac_cv_have_x="have_x=no" ;; #(
+ *) :
+ # Record where we found X for the cache.
+ ac_cv_have_x="have_x=yes\
+ ac_x_includes='$ac_x_includes'\
+ ac_x_libraries='$ac_x_libraries'" ;;
+esac
fi
-
- fi
+;; #(
+ *) have_x=yes;;
+ esac
eval "$ac_cv_have_x"
fi # $with_x != no
if test "$have_x" != yes; then
- echo "$as_me:$LINENO: result: $have_x" >&5
-echo "${ECHO_T}$have_x" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5
+printf "%s\n" "$have_x" >&6; }
no_x=yes
else
# If each of the values was on the command line, it overrides each guess.
test "x$x_includes" = xNONE && x_includes=$ac_x_includes
test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
# Update the cache value to reflect the command line values.
- ac_cv_have_x="have_x=yes \
- ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
- echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
-echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
+ ac_cv_have_x="have_x=yes\
+ ac_x_includes='$x_includes'\
+ ac_x_libraries='$x_libraries'"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5
+printf "%s\n" "libraries $x_libraries, headers $x_includes" >&6; }
fi
not_really_there=""
if test "$no_x" = ""; then
if test "$x_includes" = ""; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <X11/Xlib.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"
+then :
+else $as_nop
not_really_there="yes"
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
else
if test ! -r $x_includes/X11/Xlib.h; then
not_really_there="yes"
@@ -9686,49 +7931,26 @@ rm -f conftest.err conftest.$ac_ext
fi
fi
if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
- echo "$as_me:$LINENO: checking for X11 header files" >&5
-echo $ECHO_N "checking for X11 header files... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X11 header files" >&5
+printf %s "checking for X11 header files... " >&6; }
found_xincludes="no"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <X11/Xlib.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+if ac_fn_c_try_cpp "$LINENO"
+then :
found_xincludes="yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+else $as_nop
found_xincludes="no"
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
if test "$found_xincludes" = "no"; then
dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
for i in $dirs ; do
if test -r $i/X11/Xlib.h; then
- echo "$as_me:$LINENO: result: $i" >&5
-echo "${ECHO_T}$i" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $i" >&5
+printf "%s\n" "$i" >&6; }
XINCLUDES=" -I$i"
found_xincludes="yes"
break
@@ -9742,19 +7964,19 @@ echo "${ECHO_T}$i" >&6
fi
fi
if test "$found_xincludes" = "no"; then
- echo "$as_me:$LINENO: result: couldn't find any!" >&5
-echo "${ECHO_T}couldn't find any!" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: couldn't find any!" >&5
+printf "%s\n" "couldn't find any!" >&6; }
fi
if test "$no_x" = yes; then
- echo "$as_me:$LINENO: checking for X11 libraries" >&5
-echo $ECHO_N "checking for X11 libraries... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X11 libraries" >&5
+printf %s "checking for X11 libraries... " >&6; }
XLIBSW=nope
dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
for i in $dirs ; do
if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
- echo "$as_me:$LINENO: result: $i" >&5
-echo "${ECHO_T}$i" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $i" >&5
+printf "%s\n" "$i" >&6; }
XLIBSW="-L$i -lX11"
x_libraries="$i"
break
@@ -9768,78 +7990,50 @@ echo "${ECHO_T}$i" >&6
fi
fi
if test "$XLIBSW" = nope ; then
- echo "$as_me:$LINENO: checking for XCreateWindow in -lXwindow" >&5
-echo $ECHO_N "checking for XCreateWindow in -lXwindow... $ECHO_C" >&6
-if test "${ac_cv_lib_Xwindow_XCreateWindow+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XCreateWindow in -lXwindow" >&5
+printf %s "checking for XCreateWindow in -lXwindow... " >&6; }
+if test ${ac_cv_lib_Xwindow_XCreateWindow+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lXwindow $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char XCreateWindow ();
int
-main ()
+main (void)
{
-XCreateWindow ();
+return XCreateWindow ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_Xwindow_XCreateWindow=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_Xwindow_XCreateWindow=no
+else $as_nop
+ ac_cv_lib_Xwindow_XCreateWindow=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xwindow_XCreateWindow" >&5
-echo "${ECHO_T}$ac_cv_lib_Xwindow_XCreateWindow" >&6
-if test $ac_cv_lib_Xwindow_XCreateWindow = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xwindow_XCreateWindow" >&5
+printf "%s\n" "$ac_cv_lib_Xwindow_XCreateWindow" >&6; }
+if test "x$ac_cv_lib_Xwindow_XCreateWindow" = xyes
+then :
XLIBSW=-lXwindow
fi
fi
if test "$XLIBSW" = nope ; then
- echo "$as_me:$LINENO: result: could not find any! Using -lX11." >&5
-echo "${ECHO_T}could not find any! Using -lX11." >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find any! Using -lX11." >&5
+printf "%s\n" "could not find any! Using -lX11." >&6; }
XLIBSW=-lX11
fi
@@ -9888,65 +8082,40 @@ fi
#--------------------------------------------------------------------
if test $tk_aqua = no; then
- echo "$as_me:$LINENO: checking for main in -lXbsd" >&5
-echo $ECHO_N "checking for main in -lXbsd... $ECHO_C" >&6
-if test "${ac_cv_lib_Xbsd_main+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lXbsd" >&5
+printf %s "checking for main in -lXbsd... " >&6; }
+if test ${ac_cv_lib_Xbsd_main+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lXbsd $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
-main ();
+return main ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_Xbsd_main=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_Xbsd_main=no
+else $as_nop
+ ac_cv_lib_Xbsd_main=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xbsd_main" >&5
-echo "${ECHO_T}$ac_cv_lib_Xbsd_main" >&6
-if test $ac_cv_lib_Xbsd_main = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xbsd_main" >&5
+printf "%s\n" "$ac_cv_lib_Xbsd_main" >&6; }
+if test "x$ac_cv_lib_Xbsd_main" = xyes
+then :
LIBS="$LIBS -lXbsd"
fi
@@ -9964,23 +8133,19 @@ fi
#--------------------------------------------------------------------
if test -d /usr/include/mit -a $tk_aqua = no; then
- echo "$as_me:$LINENO: checking MIT X libraries" >&5
-echo $ECHO_N "checking MIT X libraries... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking MIT X libraries" >&5
+printf %s "checking MIT X libraries... " >&6; }
tk_oldCFlags=$CFLAGS
CFLAGS="$CFLAGS -I/usr/include/mit"
tk_oldLibs=$LIBS
LIBS="$LIBS -lX11-mit"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <X11/Xlib.h>
int
-main ()
+main (void)
{
XOpenDisplay(0);
@@ -9989,43 +8154,20 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
XLIBSW="-lX11-mit"
XINCLUDES="-I/usr/include/mit"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$tk_oldCFlags
LIBS=$tk_oldLibs
fi
@@ -10035,20 +8177,21 @@ fi
#--------------------------------------------------------------------
if test $tk_aqua = no; then
- echo "$as_me:$LINENO: checking whether to use xft" >&5
-echo $ECHO_N "checking whether to use xft... $ECHO_C" >&6
- # Check whether --enable-xft or --disable-xft was given.
-if test "${enable_xft+set}" = set; then
- enableval="$enable_xft"
- enable_xft=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use xft" >&5
+printf %s "checking whether to use xft... " >&6; }
+ # Check whether --enable-xft was given.
+if test ${enable_xft+y}
+then :
+ enableval=$enable_xft; enable_xft=$enableval
+else $as_nop
enable_xft="default"
-fi;
+fi
+
XFT_CFLAGS=""
XFT_LIBS=""
if test "$enable_xft" = "no" ; then
- echo "$as_me:$LINENO: result: $enable_xft" >&5
-echo "${ECHO_T}$enable_xft" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_xft" >&5
+printf "%s\n" "$enable_xft" >&6; }
else
found_xft="yes"
XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no"
@@ -10058,70 +8201,24 @@ echo "${ECHO_T}$enable_xft" >&6
XFT_CFLAGS=`pkg-config --cflags xft fontconfig 2>/dev/null` || found_xft="no"
XFT_LIBS=`pkg-config --libs xft fontconfig 2>/dev/null` || found_xft="no"
fi
- echo "$as_me:$LINENO: result: $found_xft" >&5
-echo "${ECHO_T}$found_xft" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $found_xft" >&5
+printf "%s\n" "$found_xft" >&6; }
if test "$found_xft" = "yes" ; then
tk_oldCFlags=$CFLAGS
CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
tk_oldLibs=$LIBS
LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
- echo "$as_me:$LINENO: checking for X11/Xft/Xft.h" >&5
-echo $ECHO_N "checking for X11/Xft/Xft.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_Xft_Xft_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <X11/Xlib.h>
+ ac_fn_c_check_header_compile "$LINENO" "X11/Xft/Xft.h" "ac_cv_header_X11_Xft_Xft_h" "#include <X11/Xlib.h>
+"
+if test "x$ac_cv_header_X11_Xft_Xft_h" = xyes
+then :
-#include <X11/Xft/Xft.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_X11_Xft_Xft_h=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_X11_Xft_Xft_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xft_Xft_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_Xft_Xft_h" >&6
-if test $ac_cv_header_X11_Xft_Xft_h = yes; then
- :
-else
+else $as_nop
found_xft=no
fi
-
CFLAGS=$tk_oldCFlags
LIBS=$tk_oldLibs
fi
@@ -10130,79 +8227,48 @@ fi
CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
tk_oldLibs=$LIBS
LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
-
-echo "$as_me:$LINENO: checking for XftFontOpen in -lXft" >&5
-echo $ECHO_N "checking for XftFontOpen in -lXft... $ECHO_C" >&6
-if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XftFontOpen in -lXft" >&5
+printf %s "checking for XftFontOpen in -lXft... " >&6; }
+if test ${ac_cv_lib_Xft_XftFontOpen+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lXft $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char XftFontOpen ();
int
-main ()
+main (void)
{
-XftFontOpen ();
+return XftFontOpen ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_Xft_XftFontOpen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_Xft_XftFontOpen=no
+else $as_nop
+ ac_cv_lib_Xft_XftFontOpen=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftFontOpen" >&5
-echo "${ECHO_T}$ac_cv_lib_Xft_XftFontOpen" >&6
-if test $ac_cv_lib_Xft_XftFontOpen = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBXFT 1
-_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xft_XftFontOpen" >&5
+printf "%s\n" "$ac_cv_lib_Xft_XftFontOpen" >&6; }
+if test "x$ac_cv_lib_Xft_XftFontOpen" = xyes
+then :
+ printf "%s\n" "#define HAVE_LIBXFT 1" >>confdefs.h
LIBS="-lXft $LIBS"
-else
+else $as_nop
found_xft=no
@@ -10216,71 +8282,43 @@ fi
CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
tk_oldLibs=$LIBS
LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW -lfontconfig"
- echo "$as_me:$LINENO: checking for FcFontSort in -lfontconfig" >&5
-echo $ECHO_N "checking for FcFontSort in -lfontconfig... $ECHO_C" >&6
-if test "${ac_cv_lib_fontconfig_FcFontSort+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FcFontSort in -lfontconfig" >&5
+printf %s "checking for FcFontSort in -lfontconfig... " >&6; }
+if test ${ac_cv_lib_fontconfig_FcFontSort+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lfontconfig $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char FcFontSort ();
int
-main ()
+main (void)
{
-FcFontSort ();
+return FcFontSort ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_fontconfig_FcFontSort=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_fontconfig_FcFontSort=no
+else $as_nop
+ ac_cv_lib_fontconfig_FcFontSort=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_fontconfig_FcFontSort" >&5
-echo "${ECHO_T}$ac_cv_lib_fontconfig_FcFontSort" >&6
-if test $ac_cv_lib_fontconfig_FcFontSort = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fontconfig_FcFontSort" >&5
+printf "%s\n" "$ac_cv_lib_fontconfig_FcFontSort" >&6; }
+if test "x$ac_cv_lib_fontconfig_FcFontSort" = xyes
+then :
XFT_LIBS="$XFT_LIBS -lfontconfig"
@@ -10291,8 +8329,8 @@ fi
fi
if test "$found_xft" = "no" ; then
if test "$enable_xft" = "yes" ; then
- { echo "$as_me:$LINENO: WARNING: Can't find xft configuration, or xft is unusable" >&5
-echo "$as_me: WARNING: Can't find xft configuration, or xft is unusable" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Can't find xft configuration, or xft is unusable" >&5
+printf "%s\n" "$as_me: WARNING: Can't find xft configuration, or xft is unusable" >&2;}
fi
enable_xft=no
XFT_CFLAGS=""
@@ -10304,9 +8342,7 @@ echo "$as_me: WARNING: Can't find xft configuration, or xft is unusable" >&2;}
if test $enable_xft = "yes" ; then
UNIX_FONT_OBJS=tkUnixRFont.o
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XFT 1
-_ACEOF
+printf "%s\n" "#define HAVE_XFT 1" >>confdefs.h
else
UNIX_FONT_OBJS=tkUnixFont.o
@@ -10317,236 +8353,6 @@ _ACEOF
fi
#--------------------------------------------------------------------
-# Check for XkbKeycodeToKeysym.
-#--------------------------------------------------------------------
-
-if test $tk_aqua = no; then
- tk_oldCFlags=$CFLAGS
- tk_oldLibs=$LIBS
- CFLAGS="$CFLAGS $XINCLUDES"
- LIBS="$LIBS $XLIBSW"
- echo "$as_me:$LINENO: checking for X11/XKBlib.h" >&5
-echo $ECHO_N "checking for X11/XKBlib.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_XKBlib_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <X11/Xlib.h>
-
-#include <X11/XKBlib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_X11_XKBlib_h=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_X11_XKBlib_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_XKBlib_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_XKBlib_h" >&6
-if test $ac_cv_header_X11_XKBlib_h = yes; then
-
- xkblib_header_found=yes
-
-else
-
- xkblib_header_found=no
-
-fi
-
-
- if test $xkblib_header_found = "yes" ; then
- echo "$as_me:$LINENO: checking for XkbKeycodeToKeysym in -lX11" >&5
-echo $ECHO_N "checking for XkbKeycodeToKeysym in -lX11... $ECHO_C" >&6
-if test "${ac_cv_lib_X11_XkbKeycodeToKeysym+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lX11 $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char XkbKeycodeToKeysym ();
-int
-main ()
-{
-XkbKeycodeToKeysym ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_X11_XkbKeycodeToKeysym=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_X11_XkbKeycodeToKeysym=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XkbKeycodeToKeysym" >&5
-echo "${ECHO_T}$ac_cv_lib_X11_XkbKeycodeToKeysym" >&6
-if test $ac_cv_lib_X11_XkbKeycodeToKeysym = yes; then
-
- xkbkeycodetokeysym_found=yes
-
-else
-
- xkbkeycodetokeysym_found=no
-
-fi
-
- else
- xkbkeycodetokeysym_found=no
- fi
- if test $xkbkeycodetokeysym_found = "yes" ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XKBKEYCODETOKEYSYM 1
-_ACEOF
-
- fi
- CFLAGS=$tk_oldCFlags
- LIBS=$tk_oldLibs
-fi
-
-#--------------------------------------------------------------------
-# Check whether XKeycodeToKeysym is deprecated in X11 headers.
-#--------------------------------------------------------------------
-
-if test $tk_aqua = no && test "$GCC" = yes; then
- echo "$as_me:$LINENO: checking whether XKeycodeToKeysym is deprecated" >&5
-echo $ECHO_N "checking whether XKeycodeToKeysym is deprecated... $ECHO_C" >&6
- tk_oldCFlags=$CFLAGS
- CFLAGS="$CFLAGS -Werror"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <X11/Xlib.h>
-
-int
-main ()
-{
-
- XKeycodeToKeysym(0,0,0);
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
-
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-cat >>confdefs.h <<\_ACEOF
-#define XKEYCODETOKEYSYM_IS_DEPRECATED 1
-_ACEOF
-
-
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- CFLAGS=$tk_oldCFlags
-fi
-
-#--------------------------------------------------------------------
# XXX Do this last.
# It might modify XLIBSW which could affect other tests.
#
@@ -10562,306 +8368,117 @@ if test $tk_aqua = no; then
LIBS="$tk_oldLibs $XLIBSW"
xss_header_found=no
xss_lib_found=no
- echo "$as_me:$LINENO: checking whether to try to use XScreenSaver" >&5
-echo $ECHO_N "checking whether to try to use XScreenSaver... $ECHO_C" >&6
- # Check whether --enable-xss or --disable-xss was given.
-if test "${enable_xss+set}" = set; then
- enableval="$enable_xss"
- enable_xss=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to try to use XScreenSaver" >&5
+printf %s "checking whether to try to use XScreenSaver... " >&6; }
+ # Check whether --enable-xss was given.
+if test ${enable_xss+y}
+then :
+ enableval=$enable_xss; enable_xss=$enableval
+else $as_nop
enable_xss=yes
-fi;
+fi
+
if test "$enable_xss" = "no" ; then
- echo "$as_me:$LINENO: result: $enable_xss" >&5
-echo "${ECHO_T}$enable_xss" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_xss" >&5
+printf "%s\n" "$enable_xss" >&6; }
else
- echo "$as_me:$LINENO: result: $enable_xss" >&5
-echo "${ECHO_T}$enable_xss" >&6
- echo "$as_me:$LINENO: checking for X11/extensions/scrnsaver.h" >&5
-echo $ECHO_N "checking for X11/extensions/scrnsaver.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_extensions_scrnsaver_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <X11/Xlib.h>
-
-#include <X11/extensions/scrnsaver.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_X11_extensions_scrnsaver_h=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_X11_extensions_scrnsaver_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_scrnsaver_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_extensions_scrnsaver_h" >&6
-if test $ac_cv_header_X11_extensions_scrnsaver_h = yes; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_xss" >&5
+printf "%s\n" "$enable_xss" >&6; }
+ ac_fn_c_check_header_compile "$LINENO" "X11/extensions/scrnsaver.h" "ac_cv_header_X11_extensions_scrnsaver_h" "#include <X11/Xlib.h>
+"
+if test "x$ac_cv_header_X11_extensions_scrnsaver_h" = xyes
+then :
xss_header_found=yes
fi
+ ac_fn_c_check_func "$LINENO" "XScreenSaverQueryInfo" "ac_cv_func_XScreenSaverQueryInfo"
+if test "x$ac_cv_func_XScreenSaverQueryInfo" = xyes
+then :
- echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo" >&5
-echo $ECHO_N "checking for XScreenSaverQueryInfo... $ECHO_C" >&6
-if test "${ac_cv_func_XScreenSaverQueryInfo+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define XScreenSaverQueryInfo to an innocuous variant, in case <limits.h> declares XScreenSaverQueryInfo.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define XScreenSaverQueryInfo innocuous_XScreenSaverQueryInfo
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char XScreenSaverQueryInfo (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef XScreenSaverQueryInfo
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char XScreenSaverQueryInfo ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_XScreenSaverQueryInfo) || defined (__stub___XScreenSaverQueryInfo)
-choke me
-#else
-char (*f) () = XScreenSaverQueryInfo;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != XScreenSaverQueryInfo;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_XScreenSaverQueryInfo=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_XScreenSaverQueryInfo=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_XScreenSaverQueryInfo" >&5
-echo "${ECHO_T}$ac_cv_func_XScreenSaverQueryInfo" >&6
-if test $ac_cv_func_XScreenSaverQueryInfo = yes; then
- :
-else
+else $as_nop
- echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXext" >&5
-echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXext... $ECHO_C" >&6
-if test "${ac_cv_lib_Xext_XScreenSaverQueryInfo+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverQueryInfo in -lXext" >&5
+printf %s "checking for XScreenSaverQueryInfo in -lXext... " >&6; }
+if test ${ac_cv_lib_Xext_XScreenSaverQueryInfo+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lXext $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char XScreenSaverQueryInfo ();
int
-main ()
+main (void)
{
-XScreenSaverQueryInfo ();
+return XScreenSaverQueryInfo ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_Xext_XScreenSaverQueryInfo=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_Xext_XScreenSaverQueryInfo=no
+else $as_nop
+ ac_cv_lib_Xext_XScreenSaverQueryInfo=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XScreenSaverQueryInfo" >&5
-echo "${ECHO_T}$ac_cv_lib_Xext_XScreenSaverQueryInfo" >&6
-if test $ac_cv_lib_Xext_XScreenSaverQueryInfo = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XScreenSaverQueryInfo" >&5
+printf "%s\n" "$ac_cv_lib_Xext_XScreenSaverQueryInfo" >&6; }
+if test "x$ac_cv_lib_Xext_XScreenSaverQueryInfo" = xyes
+then :
XLIBSW="$XLIBSW -lXext"
xss_lib_found=yes
-else
+else $as_nop
- echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXss" >&5
-echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXss... $ECHO_C" >&6
-if test "${ac_cv_lib_Xss_XScreenSaverQueryInfo+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverQueryInfo in -lXss" >&5
+printf %s "checking for XScreenSaverQueryInfo in -lXss... " >&6; }
+if test ${ac_cv_lib_Xss_XScreenSaverQueryInfo+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lXss -lXext $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char XScreenSaverQueryInfo ();
int
-main ()
+main (void)
{
-XScreenSaverQueryInfo ();
+return XScreenSaverQueryInfo ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_lib_Xss_XScreenSaverQueryInfo=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_Xss_XScreenSaverQueryInfo=no
+else $as_nop
+ ac_cv_lib_Xss_XScreenSaverQueryInfo=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xss_XScreenSaverQueryInfo" >&5
-echo "${ECHO_T}$ac_cv_lib_Xss_XScreenSaverQueryInfo" >&6
-if test $ac_cv_lib_Xss_XScreenSaverQueryInfo = yes; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xss_XScreenSaverQueryInfo" >&5
+printf "%s\n" "$ac_cv_lib_Xss_XScreenSaverQueryInfo" >&6; }
+if test "x$ac_cv_lib_Xss_XScreenSaverQueryInfo" = xyes
+then :
if test "$tcl_cv_ld_weak_l" = yes; then
# On Darwin, weak link libXss if possible,
@@ -10883,9 +8500,7 @@ fi
fi
if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XSS 1
-_ACEOF
+printf "%s\n" "#define HAVE_XSS 1" >>confdefs.h
fi
CFLAGS=$tk_oldCFlags
@@ -10897,66 +8512,38 @@ fi
# #define for __CHAR_UNSIGNED__.
#--------------------------------------------------------------------
-
-echo "$as_me:$LINENO: checking whether char is unsigned" >&5
-echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6
-if test "${ac_cv_c_char_unsigned+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5
+printf %s "checking whether char is unsigned... " >&6; }
+if test ${ac_cv_c_char_unsigned+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(((char) -1) < 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_c_char_unsigned=no
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_char_unsigned=yes
+else $as_nop
+ ac_cv_c_char_unsigned=yes
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5
-echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6
-if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
- cat >>confdefs.h <<\_ACEOF
-#define __CHAR_UNSIGNED__ 1
-_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5
+printf "%s\n" "$ac_cv_c_char_unsigned" >&6; }
+if test $ac_cv_c_char_unsigned = yes; then
+ printf "%s\n" "#define __CHAR_UNSIGNED__ 1" >>confdefs.h
fi
@@ -10968,7 +8555,13 @@ fi
eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}"
eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
+eval "TK_LIB_FILE_TCL8=libtk${LIB_SUFFIX}"
+if test ${TCL_MAJOR_VERSION} = 8 ; then
eval "TK_LIB_FILE=libtk${LIB_SUFFIX}"
+else
+eval "TK_LIB_FILE=libtcl9tk${LIB_SUFFIX}"
+fi
+eval "TK_LIB_FILE_TCL9=libtcl9tk${LIB_SUFFIX}"
# tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
# since on some platforms TK_LIB_FILE contains shell escapes.
@@ -10995,38 +8588,39 @@ WISH_RSRC_FILE='wish$(VERSION).rsrc'
if test "`uname -s`" = "Darwin" ; then
if test "`uname -s`" = "Darwin" ; then
- echo "$as_me:$LINENO: checking how to package libraries" >&5
-echo $ECHO_N "checking how to package libraries... $ECHO_C" >&6
- # Check whether --enable-framework or --disable-framework was given.
-if test "${enable_framework+set}" = set; then
- enableval="$enable_framework"
- enable_framework=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to package libraries" >&5
+printf %s "checking how to package libraries... " >&6; }
+ # Check whether --enable-framework was given.
+if test ${enable_framework+y}
+then :
+ enableval=$enable_framework; enable_framework=$enableval
+else $as_nop
enable_framework=no
-fi;
+fi
+
if test $enable_framework = yes; then
if test $SHARED_BUILD = 0; then
- { echo "$as_me:$LINENO: WARNING: Frameworks can only be built if --enable-shared is yes" >&5
-echo "$as_me: WARNING: Frameworks can only be built if --enable-shared is yes" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Frameworks can only be built if --enable-shared is yes" >&5
+printf "%s\n" "$as_me: WARNING: Frameworks can only be built if --enable-shared is yes" >&2;}
enable_framework=no
fi
if test $tcl_corefoundation = no; then
- { echo "$as_me:$LINENO: WARNING: Frameworks can only be used when CoreFoundation is available" >&5
-echo "$as_me: WARNING: Frameworks can only be used when CoreFoundation is available" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Frameworks can only be used when CoreFoundation is available" >&5
+printf "%s\n" "$as_me: WARNING: Frameworks can only be used when CoreFoundation is available" >&2;}
enable_framework=no
fi
fi
if test $enable_framework = yes; then
- echo "$as_me:$LINENO: result: framework" >&5
-echo "${ECHO_T}framework" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: framework" >&5
+printf "%s\n" "framework" >&6; }
FRAMEWORK_BUILD=1
else
if test $SHARED_BUILD = 1; then
- echo "$as_me:$LINENO: result: shared library" >&5
-echo "${ECHO_T}shared library" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: shared library" >&5
+printf "%s\n" "shared library" >&6; }
else
- echo "$as_me:$LINENO: result: static library" >&5
-echo "${ECHO_T}static library" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: static library" >&5
+printf "%s\n" "static library" >&6; }
fi
FRAMEWORK_BUILD=0
fi
@@ -11042,7 +8636,7 @@ echo "${ECHO_T}static library" >&6
EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -ObjC'
fi
EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic'
- ac_config_files="$ac_config_files Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in Credits.html:../macosx/Credits.html.in"
+ ac_config_files="$ac_config_files Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in Credits.html:../macosx/Credits.html.in"
for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done
TK_YEAR="`date +%Y`"
@@ -11050,20 +8644,24 @@ fi
if test "$FRAMEWORK_BUILD" = "1" ; then
-cat >>confdefs.h <<\_ACEOF
-#define TK_FRAMEWORK 1
-_ACEOF
+printf "%s\n" "#define TK_FRAMEWORK 1" >>confdefs.h
# Construct a fake local framework structure to make linking with
# '-framework Tk' and running of tktest work
- ac_config_commands="$ac_config_commands Tk.framework"
+ ac_config_commands="$ac_config_commands Tk.framework"
LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
if test "${libdir}" = '${exec_prefix}/lib'; then
# override libdir default
libdir="/Library/Frameworks"
fi
- TK_LIB_FILE="Tk"
+ if test ${TCL_MAJOR_VERSION} = 8 ; then
+ TK_LIB_FILE="Tk"
+ else
+ TK_LIB_FILE="Tk"
+ fi
+ TK_LIB_FILE_TCL8="Tk"
+ TK_LIB_FILE_TCL9="Tk"
TK_LIB_FLAG="-framework Tk"
TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk"
TK_LIB_SPEC="-F${libdir} -framework Tk"
@@ -11102,14 +8700,18 @@ else
fi
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
+ TK_LIB_FLAG="-l"
+ if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ TK_LIB_FLAG="${TK_LIB_FLAG}tcl9"
+ fi
if test "${ac_cv_cygwin}" = "yes" -a "$SHARED_BUILD" = "1"; then
- TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`"
+ TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`"
TK_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win ${TK_LIB_FLAG}"
else
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- TK_LIB_FLAG="-ltk${TK_VERSION}"
+ TK_LIB_FLAG="${TK_LIB_FLAG}tk${TK_VERSION}"
else
- TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`"
+ TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`"
fi
TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}"
fi
@@ -11117,6 +8719,206 @@ else
fi
#--------------------------------------------------------------------
+# Zipfs support - Tip 430
+#--------------------------------------------------------------------
+# Check whether --enable-zipfs was given.
+if test ${enable_zipfs+y}
+then :
+ enableval=$enable_zipfs; tcl_ok=$enableval
+else $as_nop
+ tcl_ok=yes
+fi
+
+if test "$tcl_ok" = "yes" -a "x$enable_framework" != "xyes"; then
+ #
+ # Find a native compiler
+ #
+ # Put a plausible default for CC_FOR_BUILD in Makefile.
+ if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5
+printf %s "checking for gcc... " >&6; }
+ if test ${ac_cv_path_cc+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+
+fi
+
+ fi
+ fi
+
+ # Also set EXEEXT_FOR_BUILD.
+ if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+ OBJEXT_FOR_BUILD='$(OBJEXT)'
+ else
+ OBJEXT_FOR_BUILD='.no'
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5
+printf %s "checking for build system executable suffix... " >&6; }
+if test ${bfd_cv_build_exeext+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5
+printf "%s\n" "$bfd_cv_build_exeext" >&6; }
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+ fi
+
+ #
+ # Find a native zip implementation
+ #
+
+ MACHER_PROG=""
+ ZIP_PROG=""
+ ZIP_PROG_OPTIONS=""
+ ZIP_PROG_VFSSEARCH=""
+ ZIP_INSTALL_OBJS=""
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macher" >&5
+printf %s "checking for macher... " >&6; }
+ if test ${ac_cv_path_macher+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/macher 2> /dev/null` \
+ `ls -r $dir/macher 2> /dev/null` ; do
+ if test x"$ac_cv_path_macher" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_macher=$j
+ break
+ fi
+ fi
+ done
+ done
+
+fi
+
+ if test -f "$ac_cv_path_macher" ; then
+ MACHER_PROG="$ac_cv_path_macher"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MACHER_PROG" >&5
+printf "%s\n" "$MACHER_PROG" >&6; }
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found macher in environment" >&5
+printf "%s\n" "Found macher in environment" >&6; }
+ fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zip" >&5
+printf %s "checking for zip... " >&6; }
+ if test ${ac_cv_path_zip+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
+ done
+
+fi
+
+ if test -f "$ac_cv_path_zip" ; then
+ ZIP_PROG="$ac_cv_path_zip"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5
+printf "%s\n" "$ZIP_PROG" >&6; }
+ ZIP_PROG_OPTIONS="-rq"
+ ZIP_PROG_VFSSEARCH="*"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5
+printf "%s\n" "Found INFO Zip in environment" >&6; }
+ # Use standard arguments for zip
+ else
+ # It is not an error if an installed version of Zip can't be located.
+ # We can use the locally distributed minizip instead
+ ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
+ ZIP_PROG_OPTIONS="-o -r"
+ ZIP_PROG_VFSSEARCH="*"
+ ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH. Building minizip" >&5
+printf "%s\n" "No zip found on PATH. Building minizip" >&6; }
+ fi
+
+
+
+
+
+
+ ZIPFS_BUILD=1
+ TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip
+else
+ ZIPFS_BUILD=0
+ TK_ZIP_FILE=
+fi
+# Do checking message here to not mess up interleaved configure output
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5
+printf %s "checking for building with zipfs... " >&6; }
+if test "${ZIPFS_BUILD}" = 1; then
+ if test "${SHARED_BUILD}" = 0; then
+ ZIPFS_BUILD=2;
+
+printf "%s\n" "#define ZIPFS_BUILD 2" >>confdefs.h
+
+ INSTALL_LIBRARIES=install-demos
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+ else
+
+printf "%s\n" "#define ZIPFS_BUILD 1" >>confdefs.h
+\
+ INSTALL_LIBRARIES=install-demos
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+ fi
+else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+INSTALL_LIBRARIES=install-libraries
+INSTALL_MSGS=install-msgs
+fi
+
+
+
+
+
+
+#--------------------------------------------------------------------
# The statements below define various symbols relating to Tk
# stub support.
#--------------------------------------------------------------------
@@ -11140,6 +8942,19 @@ TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}"
eval "TK_INCLUDE_SPEC=\"-I${includedir}\""
#------------------------------------------------------------------------
+# Demo dir
+#------------------------------------------------------------------------
+
+if test x"${DEMO_DIR}" = x
+then :
+ DEMO_DIR='$(TK_LIBRARY)/demos'
+fi
+eval "TK_DEMO_DIR=\"`echo ${DEMO_DIR} | tr '()' '{}'`\""
+eval "TK_DEMO_DIR=\"`echo ${TK_DEMO_DIR} | tr '()' '{}'`\""
+
+
+
+#------------------------------------------------------------------------
# tkConfig.sh refers to this by a different name
#------------------------------------------------------------------------
@@ -11196,7 +9011,9 @@ TK_SHARED_BUILD=${SHARED_BUILD}
- ac_config_files="$ac_config_files Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in tk.pc:../unix/tk.pc.in"
+
+
+ac_config_files="$ac_config_files Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in tk.pc:../unix/tk.pc.in"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -11216,39 +9033,70 @@ _ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
+# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
+ ;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-} |
+ esac |
+ sort
+) |
sed '
+ /^ac_cv_env_/b end
t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/
t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+printf "%s\n" "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
- echo "not updating unwritable cache $cache_file"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
@@ -11257,63 +9105,55 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
#
# If the first sed substitution is executed (which looks for macros that
-# take arguments), then we branch to the quote section. Otherwise,
+# take arguments), then branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
-cat >confdef2opt.sed <<\_ACEOF
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
t quote
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
t quote
-d
-: quote
-s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
-s,\[,\\&,g
-s,\],\\&,g
-s,\$,$$,g
-p
-_ACEOF
-# We use echo to avoid assuming a particular line-breaking character.
-# The extra dot is to prevent the shell from consuming trailing
-# line-breaks from the sub-command output. A line-break within
-# single-quotes doesn't work because, if this script is created in a
-# platform that uses two characters for line-breaks (e.g., DOS), tr
-# would break.
-ac_LF_and_DOT=`echo; echo .`
-DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
-rm -f confdef2opt.sed
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
@@ -11322,12 +9162,15 @@ LTLIBOBJS=$ac_ltlibobjs
CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""
-: ${CONFIG_STATUS=./config.status}
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
@@ -11337,81 +9180,236 @@ cat >$CONFIG_STATUS <<_ACEOF
debug=false
ac_cs_recheck=false
ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+as_nop=:
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
emulate sh
NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else $as_nop
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
fi
-DUALCASE=1; export DUALCASE # for MKS sh
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
+as_nl='
+'
+export as_nl
+IFS=" "" $as_nl"
+
PS1='$ '
PS2='> '
PS4='+ '
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
+
+# The user is always right.
+if ${PATH_SEPARATOR+false} :; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ test -r "$as_dir$0" && as_myself=$as_dir$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
-done
+ printf "%s\n" "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else $as_nop
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else $as_nop
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
-# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
-# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -11419,148 +9417,121 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n. New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-as_executable_p="test -f"
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -11569,31 +9540,20 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by tk $as_me 8.6, which was
-generated by GNU Autoconf 2.59. Invocation command line was
+# values after options handling.
+ac_log="
+This file was extended by tk $as_me 8.7, which was
+generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -11601,43 +9561,41 @@ generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
_ACEOF
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_commands="$ac_config_commands"
-cat >>$CONFIG_STATUS <<\_ACEOF
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
-Usage: $0 [OPTIONS] [FILE]...
+Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
Configuration files:
$config_files
@@ -11645,83 +9603,80 @@ $config_files
Configuration commands:
$config_commands
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
+Report bugs to the package provider."
-cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
+ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"`
+ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"`
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-tk config.status 8.6
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+tk config.status 8.7
+configured by $0, generated by GNU Autoconf 2.71,
+ with options \\"\$ac_cs_config\\"
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 2021 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+test -n "\$AWK" || AWK=awk
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
- -*)
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ printf "%s\n" "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ printf "%s\n" "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ case $ac_optarg in
+ *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ printf "%s\n" "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
- *) ac_config_targets="$ac_config_targets $1" ;;
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
esac
shift
@@ -11735,572 +9690,468 @@ if $ac_cs_silent; then
fi
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
fi
_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ printf "%s\n" "$ac_log"
+} >&5
-cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
-# INIT-COMMANDS section.
+# INIT-COMMANDS
#
-
VERSION=${TK_VERSION} && tk_aqua=${tk_aqua}
_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<\_ACEOF
+# Handling of arguments.
for ac_config_target in $ac_config_targets
do
- case "$ac_config_target" in
- # Handling of arguments.
- "Tk-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Tk-Info.plist:../macosx/Tk-Info.plist.in" ;;
- "Wish-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Wish-Info.plist:../macosx/Wish-Info.plist.in" ;;
- "Credits.html" ) CONFIG_FILES="$CONFIG_FILES Credits.html:../macosx/Credits.html.in" ;;
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;;
- "tkConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tkConfig.sh:../unix/tkConfig.sh.in" ;;
- "tk.pc" ) CONFIG_FILES="$CONFIG_FILES tk.pc:../unix/tk.pc.in" ;;
- "Tk.framework" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Tk.framework" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
+ case $ac_config_target in
+ "Tk-Info.plist") CONFIG_FILES="$CONFIG_FILES Tk-Info.plist:../macosx/Tk-Info.plist.in" ;;
+ "Wish-Info.plist") CONFIG_FILES="$CONFIG_FILES Wish-Info.plist:../macosx/Wish-Info.plist.in" ;;
+ "Credits.html") CONFIG_FILES="$CONFIG_FILES Credits.html:../macosx/Credits.html.in" ;;
+ "Tk.framework") CONFIG_COMMANDS="$CONFIG_COMMANDS Tk.framework" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;;
+ "tkConfig.sh") CONFIG_FILES="$CONFIG_FILES tkConfig.sh:../unix/tkConfig.sh.in" ;;
+ "tk.pc") CONFIG_FILES="$CONFIG_FILES tk.pc:../unix/tk.pc.in" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
+
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
- test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+ test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files
+ test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
+# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
}
-
# Create a (secure) tmp directory for tmp files.
{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
} ||
{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
}
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
-#
-# CONFIG_FILES section.
-#
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@TCL_VERSION@,$TCL_VERSION,;t t
-s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t
-s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t
-s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t
-s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t
-s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t
-s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t
-s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t
-s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t
-s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t
-s,@TCLSH_PROG@,$TCLSH_PROG,;t t
-s,@BUILD_TCLSH@,$BUILD_TCLSH,;t t
-s,@MAN_FLAGS@,$MAN_FLAGS,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@TCL_THREADS@,$TCL_THREADS,;t t
-s,@SHARED_BUILD@,$SHARED_BUILD,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@AR@,$AR,;t t
-s,@ac_ct_AR@,$ac_ct_AR,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@TCL_LIBS@,$TCL_LIBS,;t t
-s,@DL_LIBS@,$DL_LIBS,;t t
-s,@DL_OBJS@,$DL_OBJS,;t t
-s,@PLAT_OBJS@,$PLAT_OBJS,;t t
-s,@PLAT_SRCS@,$PLAT_SRCS,;t t
-s,@LDAIX_SRC@,$LDAIX_SRC,;t t
-s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t
-s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t
-s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t
-s,@CFLAGS_NOLTO@,$CFLAGS_NOLTO,;t t
-s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t
-s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t
-s,@CC_SEARCH_FLAGS@,$CC_SEARCH_FLAGS,;t t
-s,@LD_SEARCH_FLAGS@,$LD_SEARCH_FLAGS,;t t
-s,@STLIB_LD@,$STLIB_LD,;t t
-s,@SHLIB_LD@,$SHLIB_LD,;t t
-s,@TCL_SHLIB_LD_EXTRAS@,$TCL_SHLIB_LD_EXTRAS,;t t
-s,@TK_SHLIB_LD_EXTRAS@,$TK_SHLIB_LD_EXTRAS,;t t
-s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t
-s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t
-s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t
-s,@MAKE_LIB@,$MAKE_LIB,;t t
-s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t
-s,@INSTALL_LIB@,$INSTALL_LIB,;t t
-s,@DLL_INSTALL_DIR@,$DLL_INSTALL_DIR,;t t
-s,@INSTALL_STUB_LIB@,$INSTALL_STUB_LIB,;t t
-s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t
-s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t
-s,@XFT_CFLAGS@,$XFT_CFLAGS,;t t
-s,@XFT_LIBS@,$XFT_LIBS,;t t
-s,@UNIX_FONT_OBJS@,$UNIX_FONT_OBJS,;t t
-s,@TK_VERSION@,$TK_VERSION,;t t
-s,@TK_MAJOR_VERSION@,$TK_MAJOR_VERSION,;t t
-s,@TK_MINOR_VERSION@,$TK_MINOR_VERSION,;t t
-s,@TK_PATCH_LEVEL@,$TK_PATCH_LEVEL,;t t
-s,@TK_YEAR@,$TK_YEAR,;t t
-s,@TK_LIB_FILE@,$TK_LIB_FILE,;t t
-s,@TK_LIB_FLAG@,$TK_LIB_FLAG,;t t
-s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;t t
-s,@TK_STUB_LIB_FILE@,$TK_STUB_LIB_FILE,;t t
-s,@TK_STUB_LIB_FLAG@,$TK_STUB_LIB_FLAG,;t t
-s,@TK_STUB_LIB_SPEC@,$TK_STUB_LIB_SPEC,;t t
-s,@TK_STUB_LIB_PATH@,$TK_STUB_LIB_PATH,;t t
-s,@TK_INCLUDE_SPEC@,$TK_INCLUDE_SPEC,;t t
-s,@TK_BUILD_STUB_LIB_SPEC@,$TK_BUILD_STUB_LIB_SPEC,;t t
-s,@TK_BUILD_STUB_LIB_PATH@,$TK_BUILD_STUB_LIB_PATH,;t t
-s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t
-s,@TK_SHARED_BUILD@,$TK_SHARED_BUILD,;t t
-s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t
-s,@TK_BUILD_LIB_SPEC@,$TK_BUILD_LIB_SPEC,;t t
-s,@TCL_STUB_FLAGS@,$TCL_STUB_FLAGS,;t t
-s,@XINCLUDES@,$XINCLUDES,;t t
-s,@XLIBSW@,$XLIBSW,;t t
-s,@LOCALES@,$LOCALES,;t t
-s,@TK_WINDOWINGSYSTEM@,$TK_WINDOWINGSYSTEM,;t t
-s,@TK_PKG_DIR@,$TK_PKG_DIR,;t t
-s,@TK_LIBRARY@,$TK_LIBRARY,;t t
-s,@LIB_RUNTIME_DIR@,$LIB_RUNTIME_DIR,;t t
-s,@PRIVATE_INCLUDE_DIR@,$PRIVATE_INCLUDE_DIR,;t t
-s,@HTML_DIR@,$HTML_DIR,;t t
-s,@EXTRA_CC_SWITCHES@,$EXTRA_CC_SWITCHES,;t t
-s,@EXTRA_APP_CC_SWITCHES@,$EXTRA_APP_CC_SWITCHES,;t t
-s,@EXTRA_INSTALL@,$EXTRA_INSTALL,;t t
-s,@EXTRA_INSTALL_BINARIES@,$EXTRA_INSTALL_BINARIES,;t t
-s,@EXTRA_BUILD_HTML@,$EXTRA_BUILD_HTML,;t t
-s,@EXTRA_WISH_LIBS@,$EXTRA_WISH_LIBS,;t t
-s,@CFBUNDLELOCALIZATIONS@,$CFBUNDLELOCALIZATIONS,;t t
-s,@TK_RSRC_FILE@,$TK_RSRC_FILE,;t t
-s,@WISH_RSRC_FILE@,$WISH_RSRC_FILE,;t t
-s,@LIB_RSRC_FILE@,$LIB_RSRC_FILE,;t t
-s,@APP_RSRC_FILE@,$APP_RSRC_FILE,;t t
-s,@REZ@,$REZ,;t t
-s,@REZ_FLAGS@,$REZ_FLAGS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-_ACEOF
+eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+printf "%s\n" "$as_me: creating $ac_file" >&6;}
fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`printf "%s\n" "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
esac
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+ ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+_ACEOF
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_COMMANDS section.
-#
-for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
- ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
- ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
-$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_dest" : 'X\(//\)[^/]' \| \
- X"$ac_dest" : 'X\(//\)$' \| \
- X"$ac_dest" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_dest" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
+ :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+printf "%s\n" "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
- { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
-echo "$as_me: executing $ac_dest commands" >&6;}
- case $ac_dest in
- Tk.framework ) n=Tk &&
+ case $ac_file$ac_mode in
+ "Tk.framework":C) n=Tk &&
f=$n.framework && v=Versions/$VERSION &&
rm -rf $f && mkdir -p $f/$v/Resources &&
ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
@@ -12308,17 +10159,18 @@ echo "$as_me: executing $ac_dest commands" >&6;}
if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
unset n f v
;;
+
esac
-done
-_ACEOF
+done # for ac_tag
-cat >>$CONFIG_STATUS <<\_ACEOF
-{ (exit 0); exit 0; }
+as_fn_exit 0
_ACEOF
-chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
@@ -12338,7 +10190,12 @@ if test "$no_create" != yes; then
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
diff --git a/unix/configure.in b/unix/configure.ac
index 9720b91..58edbce 100644
--- a/unix/configure.in
+++ b/unix/configure.ac
@@ -1,10 +1,10 @@
-#! /bin/bash -norc
+! /bin/bash -norc
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tk installation
dnl to configure the system for the local environment.
-AC_INIT([tk],[8.6])
-AC_PREREQ(2.59)
+AC_INIT([tk],[8.7])
+AC_PREREQ([2.69])
dnl This is only used when included from macosx/configure.ac
m4_ifdef([SC_USE_CONFIG_HEADERS], [
@@ -23,10 +23,10 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [
#endif /* _TKCONFIG */])
])
-TK_VERSION=8.6
+TK_VERSION=8.7
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=6
-TK_PATCH_LEVEL=".11"
+TK_MINOR_VERSION=7
+TK_PATCH_LEVEL="a6"
VERSION=${TK_VERSION}
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
@@ -37,6 +37,7 @@ LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
SC_PATH_TCLCONFIG
SC_LOAD_TCLCONFIG
+if test "${TCL_MAJOR_VERSION}" -lt 9 ; then
if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
Found config for Tcl ${TCL_VERSION}])
@@ -45,6 +46,7 @@ if test "${TCL_MINOR_VERSION}" -lt 6 ; then
AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
Found config for Tcl ${TCL_VERSION}])
fi
+fi
SC_PROG_TCLSH
SC_BUILD_TCLSH
@@ -82,19 +84,6 @@ fi
AC_PROG_CC
AC_C_INLINE
-#--------------------------------------------------------------------
-# Supply a substitute for stdlib.h if it doesn't define strtol,
-# strtoul, or strtod (which it doesn't in some versions of SunOS).
-#--------------------------------------------------------------------
-
-AC_CHECK_HEADER(stdlib.h, tk_ok=1, tk_ok=0)
-AC_EGREP_HEADER(strtol, stdlib.h, , tk_ok=0)
-AC_EGREP_HEADER(strtoul, stdlib.h, , tk_ok=0)
-AC_EGREP_HEADER(strtod, stdlib.h, , tk_ok=0)
-if test $tk_ok = 0; then
- AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
-fi
-
#------------------------------------------------------------------------
# If we're using GCC, see if the compiler understands -pipe. If so, use it.
# It makes compiling go faster. (This is only a performance feature.)
@@ -104,7 +93,7 @@ if test -z "$no_pipe" && test -n "$GCC"; then
AC_CACHE_CHECK([if the compiler understands -pipe],
tcl_cv_cc_pipe, [
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
- AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_pipe=yes],[tcl_cv_cc_pipe=no])
CFLAGS=$hold_cflags])
if test $tcl_cv_cc_pipe = yes; then
CFLAGS="$CFLAGS -pipe"
@@ -112,13 +101,10 @@ if test -z "$no_pipe" && test -n "$GCC"; then
fi
#------------------------------------------------------------------------
-# Threads support - this auto-enables if Tcl was compiled threaded
+# Embedded configuration information, encoding to use for the values, TIP #59
#------------------------------------------------------------------------
-SC_ENABLE_THREADS
-
-# Add the threads support libraries
-LIBS="$LIBS$THREADS_LIBS"
+SC_TCL_CFG_ENCODING
SC_ENABLE_SHARED
@@ -160,7 +146,7 @@ fi
if test "$TCL_PREFIX" != "$prefix"; then
AC_MSG_WARN([
Different --prefix selected for Tk and Tcl!
- [[package require Tk]] may not work correctly in tclsh.])
+ [[package require tk]] may not work correctly in tclsh.])
fi
#--------------------------------------------------------------------
@@ -174,8 +160,7 @@ fi
#--------------------------------------------------------------------
AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, [
- AC_TRY_COMPILE([#include <sys/types.h>],[fd_set readMask, writeMask;],
- tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no)])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[fd_set readMask, writeMask;]])],[tcl_cv_type_fd_set=yes],[tcl_cv_type_fd_set=no])])
tk_ok=$tcl_cv_type_fd_set
if test $tk_ok = no; then
AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, [
@@ -194,8 +179,7 @@ fi
# Find out all about time handling differences.
#------------------------------------------------------------------------------
-AC_CHECK_HEADERS(sys/time.h)
-AC_HEADER_TIME
+AC_CHECK_HEADERS_ONCE([sys/time.h])
#--------------------------------------------------------------------
# Check for various typedefs and provide substitutes if
@@ -205,48 +189,17 @@ AC_HEADER_TIME
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
-AC_TYPE_UID_T
-
-AC_CHECK_TYPE([intptr_t], [
- AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [
- AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [
- for tcl_cv_intptr_t in "int" "long" "long long" none; do
- if test "$tcl_cv_intptr_t" != none; then
- AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
- [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])],
- [tcl_ok=yes], [tcl_ok=no])
- test "$tcl_ok" = yes && break; fi
- done])
- if test "$tcl_cv_intptr_t" != none; then
- AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer
- type wide enough to hold a pointer.])
- fi
-])
-AC_CHECK_TYPE([uintptr_t], [
- AC_DEFINE([HAVE_UINTPTR_T], 1, [Do we have the uintptr_t type?])], [
- AC_CACHE_CHECK([for pointer-size unsigned integer type], tcl_cv_uintptr_t, [
- for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
- none; do
- if test "$tcl_cv_uintptr_t" != none; then
- AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
- [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])],
- [tcl_ok=yes], [tcl_ok=no])
- test "$tcl_ok" = yes && break; fi
- done])
- if test "$tcl_cv_uintptr_t" != none; then
- AC_DEFINE_UNQUOTED([uintptr_t], [$tcl_cv_uintptr_t], [Unsigned integer
- type wide enough to hold a pointer.])
- fi
-])
+
+AC_CHECK_TYPES([intptr_t, uintptr_t],,,[[
+#include <stdint.h>
+]])
#-------------------------------------------
# In OS/390 struct pwd has no pw_gecos field
#-------------------------------------------
AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [
- AC_TRY_COMPILE([#include <pwd.h>],
- [struct passwd pwd; (void)pwd.pw_gecos;],
- tcl_cv_pwd_pw_gecos=yes, tcl_cv_pwd_pw_gecos=no)])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pwd.h>]], [[struct passwd pwd; (void)pwd.pw_gecos;]])],[tcl_cv_pwd_pw_gecos=yes],[tcl_cv_pwd_pw_gecos=no])])
if test $tcl_cv_pwd_pw_gecos = yes; then
AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?])
fi
@@ -258,8 +211,7 @@ fi
if test "`uname -s`" = "Darwin" ; then
AC_MSG_CHECKING([whether to use Aqua])
AC_ARG_ENABLE(aqua,
- AC_HELP_STRING([--enable-aqua=yes|no],
- [use Aqua windowingsystem on Mac OS X (default: no)]),
+ AS_HELP_STRING([--enable-aqua=yes|no],[use Aqua windowingsystem on Mac OS X (default: no)]),
[tk_aqua=$enableval], [tk_aqua=no])
if test $tk_aqua = yes -o $tk_aqua = cocoa; then
tk_aqua=yes
@@ -285,8 +237,7 @@ if test "`uname -s`" = "Darwin" ; then
done
CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
- AC_TRY_LINK([#include <X11/Xlib.h>], [XrmInitialize();],
- tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize();]])],[tcl_cv_lib_x11_64=yes],[tcl_cv_lib_x11_64=no])
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done])
@@ -305,15 +256,14 @@ if test "`uname -s`" = "Darwin" ; then
AC_CACHE_CHECK([if ld accepts -weak-l flag], tcl_cv_ld_weak_l, [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-weak-lm"
- AC_TRY_LINK([#include <math.h>], [double f = sin(1.0);],
- tcl_cv_ld_weak_l=yes, tcl_cv_ld_weak_l=no)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[double f = sin(1.0);]])],[tcl_cv_ld_weak_l=yes],[tcl_cv_ld_weak_l=no])
LDFLAGS=$hold_ldflags])
fi
AC_CHECK_HEADERS(AvailabilityMacros.h)
if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
- AC_TRY_LINK([
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
#error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
@@ -322,8 +272,7 @@ if test "`uname -s`" = "Darwin" ; then
#error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
#endif
int rand(void) __attribute__((weak_import));
- ], [rand();],
- tcl_cv_cc_weak_import=yes, tcl_cv_cc_weak_import=no)
+ ]], [[rand();]])],[tcl_cv_cc_weak_import=yes],[tcl_cv_cc_weak_import=no])
CFLAGS=$hold_cflags])
if test $tcl_cv_cc_weak_import = yes; then
AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?])
@@ -331,7 +280,7 @@ if test "`uname -s`" = "Darwin" ; then
AC_CACHE_CHECK([if Darwin SUSv3 extensions are available],
tcl_cv_cc_darwin_c_source, [
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
- AC_TRY_COMPILE([
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
#error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
@@ -341,7 +290,7 @@ if test "`uname -s`" = "Darwin" ; then
#endif
#define _DARWIN_C_SOURCE 1
#include <sys/cdefs.h>
- ],,tcl_cv_cc_darwin_c_source=yes, tcl_cv_cc_darwin_c_source=no)
+ ]], [[]])],[tcl_cv_cc_darwin_c_source=yes],[tcl_cv_cc_darwin_c_source=no])
CFLAGS=$hold_cflags])
if test $tcl_cv_cc_darwin_c_source = yes; then
AC_DEFINE(_DARWIN_C_SOURCE, 1,
@@ -354,7 +303,10 @@ fi
if test $tk_aqua = yes; then
AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?])
- LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore"
+ LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore -framework Security"
+ if test -d /System/Library/Frameworks/UserNotifications.framework; then
+ LIBS="$LIBS -framework UserNotifications"
+ fi
EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c'
TK_WINDOWINGSYSTEM=AQUA
if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then
@@ -436,15 +388,15 @@ if test -d /usr/include/mit -a $tk_aqua = no; then
CFLAGS="$CFLAGS -I/usr/include/mit"
tk_oldLibs=$LIBS
LIBS="$LIBS -lX11-mit"
- AC_TRY_LINK([
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <X11/Xlib.h>
- ], [
+ ]], [[
XOpenDisplay(0);
- ], [
+ ]])],[
AC_MSG_RESULT([yes])
XLIBSW="-lX11-mit"
XINCLUDES="-I/usr/include/mit"
- ], AC_MSG_RESULT([no]))
+ ],[AC_MSG_RESULT(no)])
CFLAGS=$tk_oldCFlags
LIBS=$tk_oldLibs
fi
@@ -456,8 +408,7 @@ fi
if test $tk_aqua = no; then
AC_MSG_CHECKING([whether to use xft])
AC_ARG_ENABLE(xft,
- AC_HELP_STRING([--enable-xft],
- [use freetype/fontconfig/xft (default: on)]),
+ AS_HELP_STRING([--enable-xft],[use freetype/fontconfig/xft (default: on)]),
[enable_xft=$enableval], [enable_xft="default"])
XFT_CFLAGS=""
XFT_LIBS=""
@@ -535,57 +486,6 @@ if test $tk_aqua = no; then
fi
#--------------------------------------------------------------------
-# Check for XkbKeycodeToKeysym.
-#--------------------------------------------------------------------
-
-if test $tk_aqua = no; then
- tk_oldCFlags=$CFLAGS
- tk_oldLibs=$LIBS
- CFLAGS="$CFLAGS $XINCLUDES"
- LIBS="$LIBS $XLIBSW"
- AC_CHECK_HEADER(X11/XKBlib.h, [
- xkblib_header_found=yes
- ], [
- xkblib_header_found=no
- ], [#include <X11/Xlib.h>])
- if test $xkblib_header_found = "yes" ; then
- AC_CHECK_LIB(X11, XkbKeycodeToKeysym, [
- xkbkeycodetokeysym_found=yes
- ], [
- xkbkeycodetokeysym_found=no
- ])
- else
- xkbkeycodetokeysym_found=no
- fi
- if test $xkbkeycodetokeysym_found = "yes" ; then
- AC_DEFINE(HAVE_XKBKEYCODETOKEYSYM, 1, [Do we have XkbKeycodeToKeysym?])
- fi
- CFLAGS=$tk_oldCFlags
- LIBS=$tk_oldLibs
-fi
-
-#--------------------------------------------------------------------
-# Check whether XKeycodeToKeysym is deprecated in X11 headers.
-#--------------------------------------------------------------------
-
-if test $tk_aqua = no && test "$GCC" = yes; then
- AC_MSG_CHECKING([whether XKeycodeToKeysym is deprecated])
- tk_oldCFlags=$CFLAGS
- CFLAGS="$CFLAGS -Werror"
- AC_TRY_LINK([
- #include <X11/Xlib.h>
- ], [
- XKeycodeToKeysym(0,0,0);
- ], [
- AC_MSG_RESULT([no])
- ], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(XKEYCODETOKEYSYM_IS_DEPRECATED, 1, [Is XKeycodeToKeysym deprecated?])
- ])
- CFLAGS=$tk_oldCFlags
-fi
-
-#--------------------------------------------------------------------
# XXX Do this last.
# It might modify XLIBSW which could affect other tests.
#
@@ -603,8 +503,7 @@ if test $tk_aqua = no; then
xss_lib_found=no
AC_MSG_CHECKING([whether to try to use XScreenSaver])
AC_ARG_ENABLE(xss,
- AC_HELP_STRING([--enable-xss],
- [use XScreenSaver for activity timer (default: on)]),
+ AS_HELP_STRING([--enable-xss],[use XScreenSaver for activity timer (default: on)]),
[enable_xss=$enableval], [enable_xss=yes])
if test "$enable_xss" = "no" ; then
AC_MSG_RESULT([$enable_xss])
@@ -652,7 +551,13 @@ AC_C_CHAR_UNSIGNED
eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}"
eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
+eval "TK_LIB_FILE_TCL8=libtk${LIB_SUFFIX}"
+if test ${TCL_MAJOR_VERSION} = 8 ; then
eval "TK_LIB_FILE=libtk${LIB_SUFFIX}"
+else
+eval "TK_LIB_FILE=libtcl9tk${LIB_SUFFIX}"
+fi
+eval "TK_LIB_FILE_TCL9=libtcl9tk${LIB_SUFFIX}"
# tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
# since on some platforms TK_LIB_FILE contains shell escapes.
@@ -710,7 +615,13 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
# override libdir default
libdir="/Library/Frameworks"
fi
- TK_LIB_FILE="Tk"
+ if test ${TCL_MAJOR_VERSION} = 8 ; then
+ TK_LIB_FILE="Tk"
+ else
+ TK_LIB_FILE="Tk"
+ fi
+ TK_LIB_FILE_TCL8="Tk"
+ TK_LIB_FILE_TCL9="Tk"
TK_LIB_FLAG="-framework Tk"
TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk"
TK_LIB_SPEC="-F${libdir} -framework Tk"
@@ -749,14 +660,18 @@ else
fi
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
+ TK_LIB_FLAG="-l"
+ if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ TK_LIB_FLAG="${TK_LIB_FLAG}tcl9"
+ fi
if test "${ac_cv_cygwin}" = "yes" -a "$SHARED_BUILD" = "1"; then
- TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`"
+ TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`"
TK_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win ${TK_LIB_FLAG}"
else
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- TK_LIB_FLAG="-ltk${TK_VERSION}"
+ TK_LIB_FLAG="${TK_LIB_FLAG}tk${TK_VERSION}"
else
- TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`"
+ TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`"
fi
TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}"
fi
@@ -764,6 +679,51 @@ else
fi
#--------------------------------------------------------------------
+# Zipfs support - Tip 430
+#--------------------------------------------------------------------
+AC_ARG_ENABLE(zipfs,
+ AS_HELP_STRING([--enable-zipfs],[build with Zipfs support (default: on)]),
+ [tcl_ok=$enableval], [tcl_ok=yes])
+if test "$tcl_ok" = "yes" -a "x$enable_framework" != "xyes"; then
+ #
+ # Find a native compiler
+ #
+ AX_CC_FOR_BUILD
+ #
+ # Find a native zip implementation
+ #
+ SC_ZIPFS_SUPPORT
+ ZIPFS_BUILD=1
+ TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip
+else
+ ZIPFS_BUILD=0
+ TK_ZIP_FILE=
+fi
+# Do checking message here to not mess up interleaved configure output
+AC_MSG_CHECKING([for building with zipfs])
+if test "${ZIPFS_BUILD}" = 1; then
+ if test "${SHARED_BUILD}" = 0; then
+ ZIPFS_BUILD=2;
+ AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?])
+ INSTALL_LIBRARIES=install-demos
+ AC_MSG_RESULT([yes])
+ else
+ AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\
+ INSTALL_LIBRARIES=install-demos
+ AC_MSG_RESULT([yes])
+ fi
+else
+AC_MSG_RESULT([no])
+INSTALL_LIBRARIES=install-libraries
+INSTALL_MSGS=install-msgs
+fi
+AC_SUBST(ZIPFS_BUILD)
+AC_SUBST(TK_ZIP_FILE)
+AC_SUBST(INSTALL_LIBRARIES)
+AC_SUBST(INSTALL_MSGS)
+
+
+#--------------------------------------------------------------------
# The statements below define various symbols relating to Tk
# stub support.
#--------------------------------------------------------------------
@@ -787,6 +747,16 @@ TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}"
eval "TK_INCLUDE_SPEC=\"-I${includedir}\""
#------------------------------------------------------------------------
+# Demo dir
+#------------------------------------------------------------------------
+
+AS_IF([test x"${DEMO_DIR}" = x], [DEMO_DIR='$(TK_LIBRARY)/demos'])
+eval "TK_DEMO_DIR=\"`echo ${DEMO_DIR} | tr '()' '{}'`\""
+eval "TK_DEMO_DIR=\"`echo ${TK_DEMO_DIR} | tr '()' '{}'`\""
+AC_SUBST(DEMO_DIR)
+AC_SUBST(TK_DEMO_DIR)
+
+#------------------------------------------------------------------------
# tkConfig.sh refers to this by a different name
#------------------------------------------------------------------------
@@ -799,6 +769,8 @@ AC_SUBST(TK_PATCH_LEVEL)
AC_SUBST(TK_YEAR)
AC_SUBST(TK_LIB_FILE)
+AC_SUBST(TK_LIB_FILE_TCL8)
+AC_SUBST(TK_LIB_FILE_TCL9)
AC_SUBST(TK_LIB_FLAG)
AC_SUBST(TK_LIB_SPEC)
AC_SUBST(TK_STUB_LIB_FILE)
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 9b0363c..9cfec6b 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -93,11 +93,11 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
`ls -d /usr/local/lib 2>/dev/null` \
`ls -d /usr/contrib/lib 2>/dev/null` \
`ls -d /usr/pkg/lib 2>/dev/null` \
- `ls -d /usr/lib/tcl8.6 2>/dev/null` \
+ `ls -d /usr/lib/tcl8.7 2>/dev/null` \
`ls -d /usr/lib 2>/dev/null` \
`ls -d /usr/lib64 2>/dev/null` \
- `ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
- `ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \
+ `ls -d /usr/local/lib/tcl8.7 2>/dev/null` \
+ `ls -d /usr/local/lib/tcl/tcl8.7 2>/dev/null` \
; do
if test -f "$i/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i; pwd)`"
@@ -226,11 +226,11 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
`ls -d /usr/local/lib 2>/dev/null` \
`ls -d /usr/contrib/lib 2>/dev/null` \
`ls -d /usr/pkg/lib 2>/dev/null` \
- `ls -d /usr/lib/tk8.6 2>/dev/null` \
+ `ls -d /usr/lib/tk8.7 2>/dev/null` \
`ls -d /usr/lib 2>/dev/null` \
`ls -d /usr/lib64 2>/dev/null` \
- `ls -d /usr/local/lib/tk8.6 2>/dev/null` \
- `ls -d /usr/local/lib/tcl/tk8.6 2>/dev/null` \
+ `ls -d /usr/local/lib/tk8.7 2>/dev/null` \
+ `ls -d /usr/local/lib/tcl/tk8.7 2>/dev/null` \
; do
if test -f "$i/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd $i; pwd)`"
@@ -571,114 +571,6 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [
])
#------------------------------------------------------------------------
-# SC_ENABLE_THREADS --
-#
-# Specify if thread support should be enabled
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-threads
-#
-# Sets the following vars:
-# THREADS_LIBS Thread library(s)
-#
-# Defines the following vars:
-# TCL_THREADS
-# _REENTRANT
-# _THREAD_SAFE
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN([SC_ENABLE_THREADS], [
- AC_ARG_ENABLE(threads,
- AS_HELP_STRING([--enable-threads],
- [build with threads (default: on)]),
- [tcl_ok=$enableval], [tcl_ok=yes])
-
- if test "${TCL_THREADS}" = 1; then
- tcl_threaded_core=1;
- fi
-
- if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
- TCL_THREADS=1
- # USE_THREAD_ALLOC tells us to try the special thread-based
- # allocator that significantly reduces lock contention
- AC_DEFINE(USE_THREAD_ALLOC, 1,
- [Do we want to use the threaded memory allocator?])
- AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
- if test "`uname -s`" = "SunOS" ; then
- AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
- [Do we really want to follow the standard? Yes we do!])
- fi
- AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
- AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- if test "$tcl_ok" = "no"; then
- # Check a little harder for __pthread_mutex_init in the same
- # library, as some systems hide it there until pthread.h is
- # defined. We could alternatively do an AC_TRY_COMPILE with
- # pthread.h, but that will work with libpthread really doesn't
- # exist, like AIX 4.2. [Bug: 4359]
- AC_CHECK_LIB(pthread, __pthread_mutex_init,
- tcl_ok=yes, tcl_ok=no)
- fi
-
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -lpthread"
- else
- AC_CHECK_LIB(pthreads, pthread_mutex_init,
- tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -lpthreads"
- else
- AC_CHECK_LIB(c, pthread_mutex_init,
- tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = "no"; then
- AC_CHECK_LIB(c_r, pthread_mutex_init,
- tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -pthread"
- else
- TCL_THREADS=0
- AC_MSG_WARN([Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...])
- fi
- fi
- fi
- fi
-
- # Does the pthread-implementation provide
- # 'pthread_attr_setstacksize' ?
-
- ac_saved_libs=$LIBS
- LIBS="$LIBS $THREADS_LIBS"
- AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork)
- LIBS=$ac_saved_libs
- else
- TCL_THREADS=0
- fi
- # Do checking message here to not mess up interleaved configure output
- AC_MSG_CHECKING([for building with threads])
- if test "${TCL_THREADS}" = 1; then
- AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
- if test "${tcl_threaded_core}" = 1; then
- AC_MSG_RESULT([yes (threaded core)])
- else
- AC_MSG_RESULT([yes])
- fi
- else
- AC_MSG_RESULT([no])
- fi
-
- AC_SUBST(TCL_THREADS)
-])
-
-#------------------------------------------------------------------------
# SC_ENABLE_SYMBOLS --
#
# Specify if debugging symbols should be used.
@@ -867,8 +759,7 @@ AC_DEFUN([SC_CONFIG_MANPAGES], [
#
# Determine what the system is (some things cannot be easily checked
# on a feature-driven basis, alas). This can usually be done via the
-# "uname" command, but there are a few systems, like Next, where
-# this doesn't work.
+# "uname" command.
#
# Arguments:
# none
@@ -882,20 +773,14 @@ AC_DEFUN([SC_CONFIG_MANPAGES], [
AC_DEFUN([SC_CONFIG_SYSTEM], [
AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
- if test -f /usr/lib/NextStep/software_version; then
- tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ if test "${TEA_PLATFORM}" = "windows" ; then
+ tcl_cv_sys_version=windows
else
tcl_cv_sys_version=`uname -s`-`uname -r`
if test "$?" -ne 0 ; then
AC_MSG_WARN([can't find uname command])
tcl_cv_sys_version=unknown
else
- # Special check for weird MP-RAS system (uname returns weird
- # results, and the version is kept in special file).
-
- if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
- fi
if test "`uname -s`" = "AIX" ; then
tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
fi
@@ -958,8 +843,8 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [
# shared libraries. The value of the symbol defaults to
# "${LIBS}" if all of the dependent libraries should
# be specified when creating a shared library. If
-# dependent libraries should not be specified (as on
-# SunOS 4.x, where they cause the link to fail, or in
+# dependent libraries should not be specified (as on some
+# SunOS systems, where they cause the link to fail, or in
# general if Tcl and Tk aren't themselves shared
# libraries), then this symbol has an empty string
# as its value.
@@ -1075,7 +960,15 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
AS_IF([test "$GCC" = yes], [
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
+ case "${CC}" in
+ *++|*++-*)
+ ;;
+ *)
+ CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers"
+ ;;
+ esac
+
], [
CFLAGS_OPTIMIZE=-O
CFLAGS_WARNING=""
@@ -1086,10 +979,10 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
PLAT_OBJS=""
PLAT_SRCS=""
LDAIX_SRC=""
- AS_IF([test "x${SHLIB_VERSION}" = x],[SHLIB_VERSION=".1.0"],[SHLIB_VERSION=".${SHLIB_VERSION}"])
+ AS_IF([test "x${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"])
case $system in
AIX-*)
- AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
+ AS_IF([test "$GCC" != "yes"], [
# AIX requires the _r compiler when gcc isn't being used
case "${CC}" in
*_r|*_r\ *)
@@ -1185,7 +1078,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LD_SEARCH_FLAGS=""
;;
CYGWIN_*|MINGW32_*|MSYS_*)
- SHLIB_CFLAGS=""
+ SHLIB_CFLAGS="-fno-common"
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".dll"
DL_OBJS="tclLoadDl.o"
@@ -1210,9 +1103,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
if test "$ac_cv_cygwin" = "no"; then
AC_MSG_ERROR([${CC} is not a cygwin compiler.])
fi
- if test "x${TCL_THREADS}" = "x0"; then
- AC_MSG_ERROR([CYGWIN compile is only supported with --enable-threads])
- fi
do64bit_ok=yes
if test "x${SHARED_BUILD}" = "x1"; then
echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args"
@@ -1373,7 +1263,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
])
;;
Linux*|GNU*|NetBSD-Debian)
- SHLIB_CFLAGS="-fPIC"
+ SHLIB_CFLAGS="-fPIC -fno-common"
SHLIB_SUFFIX=".so"
CFLAGS_OPTIMIZE="-O2"
@@ -1403,7 +1293,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
])
# The combo of gcc + glibc has a bug related to inlining of
- # functions like strtod(). The -fno-builtin flag should address
+ # functions like strtol()/strtoul(). The -fno-builtin flag should address
# this problem but it does not work. The -fno-inline flag is kind
# of overkill but it works. Disable inlining only when one of the
# files in compat/*.c is being linked in.
@@ -1422,27 +1312,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
;;
- MP-RAS-02*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD='${CC} -G'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- MP-RAS-*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD='${CC} -G'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,-Bexport"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
OpenBSD-*)
arch=`arch -s`
case "$arch" in
@@ -1460,15 +1329,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
LDFLAGS="-Wl,-export-dynamic"
CFLAGS_OPTIMIZE="-O2"
- AS_IF([test "${TCL_THREADS}" = "1"], [
- # On OpenBSD: Compile with -pthread
- # Don't link with -lpthread
- LIBS=`echo $LIBS | sed s/-lpthread//`
- CFLAGS="$CFLAGS -pthread"
- ])
+ # On OpenBSD: Compile with -pthread
+ # Don't link with -lpthread
+ LIBS=`echo $LIBS | sed s/-lpthread//`
+ CFLAGS="$CFLAGS -pthread"
# OpenBSD doesn't do version numbers with dots.
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
@@ -1484,12 +1351,10 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- AS_IF([test "${TCL_THREADS}" = "1"], [
- # The -pthread needs to go in the CFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- CFLAGS="$CFLAGS -pthread"
- LDFLAGS="$LDFLAGS -pthread"
- ])
+ # The -pthread needs to go in the CFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
;;
DragonFly-*|FreeBSD-*)
# This configuration from FreeBSD Ports.
@@ -1501,11 +1366,10 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
- AS_IF([test "${TCL_THREADS}" = "1"], [
- # The -pthread needs to go in the LDFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
+ # The -pthread needs to go in the LDFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
case $system in
FreeBSD-3.*)
# Version numbers are dot-stripped by system policy.
@@ -1583,7 +1447,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
tcl_cv_ld_search_paths_first, [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_search_paths_first=yes],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
+ [tcl_cv_ld_search_paths_first=yes],
[tcl_cv_ld_search_paths_first=no])
LDFLAGS=$hold_ldflags])
AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
@@ -1654,47 +1519,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
])
])
;;
- NEXTSTEP-*)
- SHLIB_CFLAGS=""
- SHLIB_LD='${CC} -nostdlib -r'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadNext.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
OS/390-*)
SHLIB_LD_LIBS=""
CFLAGS_OPTIMIZE="" # Optimizer is buggy
AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
[Should OS/390 do the right thing with sockets?])
;;
- OSF1-1.0|OSF1-1.1|OSF1-1.2)
- # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
- SHLIB_CFLAGS=""
- # Hack: make package name same as library name
- SHLIB_LD='ld -R -export $@:'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadOSF.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- OSF1-1.*)
- # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
- SHLIB_CFLAGS="-fPIC"
- AS_IF([test "$SHARED_BUILD" = 1], [SHLIB_LD="ld -shared"], [
- SHLIB_LD="ld -non_shared"
- ])
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
OSF1-V*)
# Digital OSF/1
SHLIB_CFLAGS=""
@@ -1712,22 +1542,19 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
# see pthread_intro(3) for pthread support on osf1, k.furukawa
- AS_IF([test "${TCL_THREADS}" = 1], [
- CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
- CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
- LIBS=`echo $LIBS | sed s/-lpthreads//`
- AS_IF([test "$GCC" = yes], [
- LIBS="$LIBS -lpthread -lmach -lexc"
- ], [
- CFLAGS="$CFLAGS -pthread"
- LDFLAGS="$LDFLAGS -pthread"
- ])
+ CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
+ CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
+ LIBS=`echo $LIBS | sed s/-lpthreads//`
+ AS_IF([test "$GCC" = yes], [
+ LIBS="$LIBS -lpthread -lmach -lexc"
+ ], [
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
])
;;
QNX-6*)
# QNX RTP
# This may work for all QNX, but it was only reported for v6.
- SHLIB_CFLAGS="-fPIC"
SHLIB_LD="ld -Bshareable -x"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
@@ -1742,11 +1569,11 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# this test works, since "uname -s" was non-standard in 3.2.4 and
# below.
AS_IF([test "$GCC" = yes], [
- SHLIB_CFLAGS="-fPIC -melf"
- LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
+ SHLIB_CFLAGS="-fPIC -melf"
+ LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
], [
- SHLIB_CFLAGS="-Kpic -belf"
- LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
+ SHLIB_CFLAGS="-Kpic -belf"
+ LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
])
SHLIB_LD="ld -G"
SHLIB_LD_LIBS=""
@@ -1756,35 +1583,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
- SINIX*5.4*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD='${CC} -G'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- SunOS-4*)
- SHLIB_CFLAGS="-PIC"
- SHLIB_LD="ld"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
-
- # SunOS can't handle version numbers with dots in them in library
- # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
- # requires an extra version number at the end of .so file names.
- # So, the library has to have a name like libtcl75.so.1.0
-
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
SunOS-5.[[0-6]])
# Careful to not let 5.10+ fall into this case
@@ -1987,6 +1785,7 @@ dnl # preprocessing tests use only CPPFLAGS.
HP-UX*) ;;
Darwin-*) ;;
IRIX*) ;;
+ Linux*|GNU*) ;;
NetBSD-*|OpenBSD-*) ;;
OSF1-*) ;;
SCO_SV-3.2*) ;;
@@ -2039,36 +1838,46 @@ dnl # preprocessing tests use only CPPFLAGS.
TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"])
AC_SUBST(TCL_LIBS)
- # See if the compiler supports casting to a union type.
- # This is used to stop gcc from printing a compiler
- # warning when initializing a union member.
-
- AC_CACHE_CHECK(for cast to union support,
- tcl_cv_cast_to_union,
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
- union foo { int i; double d; };
- union foo f = (union foo) (int) 0;
- ]])],
- [tcl_cv_cast_to_union=yes],
- [tcl_cv_cast_to_union=no])
- )
- if test "$tcl_cv_cast_to_union" = "yes"; then
- AC_DEFINE(HAVE_CAST_TO_UNION, 1,
- [Defined when compiler supports casting to union type.])
- fi
- hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto"
- AC_CACHE_CHECK(for working -fno-lto,
- ac_cv_nolto,
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
- [ac_cv_nolto=yes],
- [ac_cv_nolto=no])
- )
- CFLAGS=$hold_cflags
- if test "$ac_cv_nolto" = "yes" ; then
- CFLAGS_NOLTO="-fno-lto"
- else
- CFLAGS_NOLTO=""
- fi
+ # See if the compiler supports casting to a union type.
+ # This is used to stop gcc from printing a compiler
+ # warning when initializing a union member.
+
+ AC_CACHE_CHECK(for cast to union support,
+ tcl_cv_cast_to_union,
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+ union foo { int i; double d; };
+ union foo f = (union foo) (int) 0;
+ ]])],
+ [tcl_cv_cast_to_union=yes],
+ [tcl_cv_cast_to_union=no])
+ )
+ if test "$tcl_cv_cast_to_union" = "yes"; then
+ AC_DEFINE(HAVE_CAST_TO_UNION, 1,
+ [Defined when compiler supports casting to union type.])
+ fi
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto"
+ AC_CACHE_CHECK(for working -fno-lto,
+ ac_cv_nolto,
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [ac_cv_nolto=yes],
+ [ac_cv_nolto=no])
+ )
+ CFLAGS=$hold_cflags
+ if test "$ac_cv_nolto" = "yes" ; then
+ CFLAGS_NOLTO="-fno-lto"
+ else
+ CFLAGS_NOLTO=""
+ fi
+ AC_CACHE_CHECK([if the compiler understands -finput-charset],
+ tcl_cv_cc_input_charset, [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_input_charset=yes],[tcl_cv_cc_input_charset=no])
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_input_charset = yes; then
+ CFLAGS="$CFLAGS -finput-charset=UTF-8"
+ fi
+
+ AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],)
# FIXME: This subst was left in only because the TCL_DL_LIBS
# entry in tclConfig.sh uses it. It is not clear why someone
@@ -2114,8 +1923,8 @@ dnl # preprocessing tests use only CPPFLAGS.
#
# Supply substitutes for missing POSIX header files. Special
# notes:
-# - stdlib.h doesn't define strtol, strtoul, or
-# strtod insome versions of SunOS
+# - stdlib.h doesn't define strtol or strtoul in some
+# versions of SunOS
# - some versions of string.h don't declare procedures such
# as strstr
#
@@ -2126,8 +1935,6 @@ dnl # preprocessing tests use only CPPFLAGS.
#
# Defines some of the following vars:
# NO_DIRENT_H
-# NO_FLOAT_H
-# NO_VALUES_H
# NO_STDLIB_H
# NO_STRING_H
# NO_SYS_WAIT_H
@@ -2164,12 +1971,9 @@ closedir(d);
AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
fi
- AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
- AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
- AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
if test $tcl_ok = 0; then
AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
fi
@@ -2308,10 +2112,6 @@ AC_DEFUN([SC_BLOCKING_STYLE], [
AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
AC_MSG_RESULT([FIONBIO])
;;
- SunOS-4*)
- AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
- AC_MSG_RESULT([FIONBIO])
- ;;
*)
AC_MSG_RESULT([O_NONBLOCK])
;;
@@ -2339,7 +2139,7 @@ AC_DEFUN([SC_BLOCKING_STYLE], [
AC_DEFUN([SC_TIME_HANDLER], [
AC_CHECK_HEADERS(sys/time.h)
- AC_HEADER_TIME
+ AC_CHECK_HEADERS_ONCE([sys/time.h])
AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
@@ -2392,13 +2192,21 @@ AC_DEFUN([SC_TIME_HANDLER], [
#
# Search for the libraries needed to link the Tcl shell.
# Things like the math library (-lm), socket stuff (-lsocket vs.
-# -lnsl), zlib (-lz) and libtommath (-ltommath) are dealt with here.
+# -lnsl), zlib (-lz) and libtommath (-ltommath) or thread library
+# (-lpthread) are dealt with here.
#
# Arguments:
# None.
#
# Results:
#
+# Sets the following vars:
+# THREADS_LIBS Thread library(s)
+#
+# Defines the following vars:
+# _REENTRANT
+# _THREAD_SAFE
+#
# Might append to the following vars:
# LIBS
# MATH_LIBS
@@ -2456,6 +2264,55 @@ AC_DEFUN([SC_TCL_LINK_LIBS], [
fi
AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
[LIBS="$LIBS -lnsl"])])
+
+ AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
+ AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
+ AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
+ if test "$tcl_ok" = "no"; then
+ # Check a little harder for __pthread_mutex_init in the same
+ # library, as some systems hide it there until pthread.h is
+ # defined. We could alternatively do an AC_TRY_COMPILE with
+ # pthread.h, but that will work with libpthread really doesn't
+ # exist, like AIX 4.2. [Bug: 4359]
+ AC_CHECK_LIB(pthread, __pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ fi
+
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthread"
+ else
+ AC_CHECK_LIB(pthreads, pthread_mutex_init,
+ _ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthreads"
+ else
+ AC_CHECK_LIB(c, pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = "no"; then
+ AC_CHECK_LIB(c_r, pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -pthread"
+ else
+ AC_MSG_WARN([Don't know how to find pthread lib on your system - you must edit the LIBS in the Makefile...])
+ fi
+ fi
+ fi
+ fi
+
+ # Does the pthread-implementation provide
+ # 'pthread_attr_setstacksize' ?
+
+ ac_saved_libs=$LIBS
+ LIBS="$LIBS $THREADS_LIBS"
+ AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork)
+ LIBS=$ac_saved_libs
+
+ # TIP #509
+ AC_CHECK_DECLS([PTHREAD_MUTEX_RECURSIVE],tcl_ok=yes,tcl_ok=no, [[#include <pthread.h>]])
])
#--------------------------------------------------------------------
@@ -2517,7 +2374,6 @@ AC_DEFUN([SC_TCL_EARLY_FLAGS],[
#
# Might define the following vars:
# TCL_WIDE_INT_IS_LONG
-# TCL_WIDE_INT_TYPE
# HAVE_STRUCT_DIRENT64, HAVE_DIR64
# HAVE_STRUCT_STAT64
# HAVE_TYPE_OFF64_T
@@ -2528,23 +2384,16 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [
AC_MSG_CHECKING([for 64-bit integer type])
AC_CACHE_VAL(tcl_cv_type_64bit,[
tcl_cv_type_64bit=none
- # See if the compiler knows natively about __int64
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__int64 value = (__int64) 0;]])],
- [tcl_type_64bit=__int64], [tcl_type_64bit="long long"])
- # See if we should use long anyway Note that we substitute in the
+ # See if we could use long anyway Note that we substitute in the
# type that is our current guess for a 64-bit type inside this check
# program, so it should be modified only carefully...
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) {
- case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
- }]])],[tcl_cv_type_64bit=${tcl_type_64bit}],[])])
+ case 1: case (sizeof(long long)==sizeof(long)): ;
+ }]])],[tcl_cv_type_64bit="long long"],[])])
if test "${tcl_cv_type_64bit}" = none ; then
- AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
- AC_MSG_RESULT([using long])
+ AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?])
+ AC_MSG_RESULT([yes])
else
- AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
- [What type should be used to define wide integers?])
- AC_MSG_RESULT([${tcl_cv_type_64bit}])
-
# Now check for auxiliary declarations
AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
@@ -2610,14 +2459,14 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [
AC_DEFUN([SC_TCL_CFG_ENCODING], [
AC_ARG_WITH(encoding,
AS_HELP_STRING([--with-encoding],
- [encoding for configuration values (default: iso8859-1)]),
+ [encoding for configuration values (default: utf-8)]),
[with_tcencoding=${withval}])
if test x"${with_tcencoding}" != x ; then
AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}",
[What encoding should be used for embedded configuration info?])
else
- AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1",
+ AC_DEFINE(TCL_CFGVAL_ENCODING,"utf-8",
[What encoding should be used for embedded configuration info?])
fi
])
@@ -3088,6 +2937,152 @@ if test "x$NEED_FAKE_RFC2553" = "x1"; then
AC_CHECK_FUNC(strlcpy)
fi
])
+
+#------------------------------------------------------------------------
+# SC_CC_FOR_BUILD
+# For cross compiles, locate a C compiler that can generate native binaries.
+#
+# Arguments:
+# none
+#
+# Results:
+# Substitutes the following vars:
+# CC_FOR_BUILD
+# EXEEXT_FOR_BUILD
+#------------------------------------------------------------------------
+
+dnl Get a default for CC_FOR_BUILD to put into Makefile.
+AC_DEFUN([AX_CC_FOR_BUILD],[# Put a plausible default for CC_FOR_BUILD in Makefile.
+ if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ AC_MSG_CHECKING([for gcc])
+ AC_CACHE_VAL(ac_cv_path_cc, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+ fi
+ fi
+ AC_SUBST(CC_FOR_BUILD)
+ # Also set EXEEXT_FOR_BUILD.
+ if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+ OBJEXT_FOR_BUILD='$(OBJEXT)'
+ else
+ OBJEXT_FOR_BUILD='.no'
+ AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
+ [rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+ fi
+ AC_SUBST(EXEEXT_FOR_BUILD)])dnl
+ AC_SUBST(OBJEXT_FOR_BUILD)])dnl
+])
+
+
+#------------------------------------------------------------------------
+# SC_ZIPFS_SUPPORT
+# Locate a zip encoder installed on the system path, or none.
+#
+# Arguments:
+# none
+#
+# Results:
+# Substitutes the following vars:
+# MACHER_PROG
+# ZIP_PROG
+# ZIP_PROG_OPTIONS
+# ZIP_PROG_VFSSEARCH
+# ZIP_INSTALL_OBJS
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_ZIPFS_SUPPORT], [
+ MACHER_PROG=""
+ ZIP_PROG=""
+ ZIP_PROG_OPTIONS=""
+ ZIP_PROG_VFSSEARCH=""
+ ZIP_INSTALL_OBJS=""
+
+ AC_MSG_CHECKING([for macher])
+ AC_CACHE_VAL(ac_cv_path_macher, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/macher 2> /dev/null` \
+ `ls -r $dir/macher 2> /dev/null` ; do
+ if test x"$ac_cv_path_macher" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_macher=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+ if test -f "$ac_cv_path_macher" ; then
+ MACHER_PROG="$ac_cv_path_macher"
+ AC_MSG_RESULT([$MACHER_PROG])
+ AC_MSG_RESULT([Found macher in environment])
+ fi
+ AC_MSG_CHECKING([for zip])
+ AC_CACHE_VAL(ac_cv_path_zip, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+ if test -f "$ac_cv_path_zip" ; then
+ ZIP_PROG="$ac_cv_path_zip"
+ AC_MSG_RESULT([$ZIP_PROG])
+ ZIP_PROG_OPTIONS="-rq"
+ ZIP_PROG_VFSSEARCH="*"
+ AC_MSG_RESULT([Found INFO Zip in environment])
+ # Use standard arguments for zip
+ else
+ # It is not an error if an installed version of Zip can't be located.
+ # We can use the locally distributed minizip instead
+ ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
+ ZIP_PROG_OPTIONS="-o -r"
+ ZIP_PROG_VFSSEARCH="*"
+ ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
+ AC_MSG_RESULT([No zip found on PATH. Building minizip])
+ fi
+ AC_SUBST(MACHER_PROG)
+ AC_SUBST(ZIP_PROG)
+ AC_SUBST(ZIP_PROG_OPTIONS)
+ AC_SUBST(ZIP_PROG_VFSSEARCH)
+ AC_SUBST(ZIP_INSTALL_OBJS)
+])
+
# Local Variables:
# mode: autoconf
# End:
diff --git a/unix/tk.pc.in b/unix/tk.pc.in
index 378b6eb..940184e 100644
--- a/unix/tk.pc.in
+++ b/unix/tk.pc.in
@@ -4,6 +4,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
+demodir=@TK_DEMO_DIR@
Name: The Tk Toolkit
Description: Tk is a cross-platform graphical user interface toolkit, the standard GUI not only for Tcl, but for many other dynamic languages as well.
diff --git a/unix/tk.spec b/unix/tk.spec
index efa3b79..6a6924c 100644
--- a/unix/tk.spec
+++ b/unix/tk.spec
@@ -4,15 +4,15 @@
Name: tk
Summary: Tk graphical toolkit for the Tcl scripting language.
-Version: 8.6.11
+Version: 8.7a6
Release: 2
License: BSD
Group: Development/Languages
Source: http://prdownloads.sourceforge.net/tcl/tk%{version}-src.tar.gz
URL: https://www.tcl-lang.org/
Buildroot: /var/tmp/%{name}%{version}
-Buildrequires: XFree86-devel tcl >= %version
-Requires: tcl >= %version
+Buildrequires: XFree86-devel tcl >= 8.6.0
+Requires: tcl >= 8.6.0
%description
The Tcl (Tool Command Language) provides a powerful platform for
diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c
index 1a2421c..77f7330 100644
--- a/unix/tkAppInit.c
+++ b/unix/tkAppInit.c
@@ -88,6 +88,9 @@ main(
{
#ifdef TK_LOCAL_MAIN_HOOK
TK_LOCAL_MAIN_HOOK(&argc, &argv);
+#elif (TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION > 6)
+ /* This doesn't work with Tcl 8.6 */
+ TclZipfs_AppHook(&argc, &argv);
#endif
Tk_Main(argc, argv, TK_LOCAL_APPINIT);
diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in
index 03599a1..c0db42c 100644
--- a/unix/tkConfig.h.in
+++ b/unix/tkConfig.h.in
@@ -4,6 +4,9 @@
#ifndef _TKCONFIG
#define _TKCONFIG
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
/* Define to 1 if you have the <AvailabilityMacros.h> header file. */
#undef HAVE_AVAILABILITYMACROS_H
@@ -19,7 +22,7 @@
/* Compiler support for module scope symbols */
#undef HAVE_HIDDEN
-/* Do we have the intptr_t type? */
+/* Define to 1 if the system has the type `intptr_t'. */
#undef HAVE_INTPTR_T
/* Define to 1 if you have the <inttypes.h> header file. */
@@ -31,24 +34,21 @@
/* Define to 1 if you have the `lseek64' function. */
#undef HAVE_LSEEK64
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
/* Define to 1 if you have the `open64' function. */
#undef HAVE_OPEN64
-/* Define to 1 if you have the `pthread_atfork' function. */
-#undef HAVE_PTHREAD_ATFORK
-
-/* Define to 1 if you have the `pthread_attr_setstacksize' function. */
-#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
-
/* Does struct password have a pw_gecos field? */
#undef HAVE_PW_GECOS
+/* Do we have <stdbool.h>? */
+#undef HAVE_STDBOOL_H
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
+/* Define to 1 if you have the <stdio.h> header file. */
+#undef HAVE_STDIO_H
+
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
@@ -79,7 +79,7 @@
/* Is off64_t in <sys/types.h>? */
#undef HAVE_TYPE_OFF64_T
-/* Do we have the uintptr_t type? */
+/* Define to 1 if the system has the type `uintptr_t'. */
#undef HAVE_UINTPTR_T
/* Define to 1 if you have the <unistd.h> header file. */
@@ -91,9 +91,6 @@
/* Have we turned on XFT (antialiased fonts)? */
#undef HAVE_XFT
-/* Do we have XkbKeycodeToKeysym? */
-#undef HAVE_XKBKEYCODETOKEYSYM
-
/* Is XScreenSaver available? */
#undef HAVE_XSS
@@ -115,9 +112,6 @@
/* Do we have fd_set? */
#undef NO_FD_SET
-/* Do we have <stdlib.h>? */
-#undef NO_STDLIB_H
-
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
@@ -130,15 +124,23 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Is this a static build? */
#undef STATIC_BUILD
-/* Define to 1 if you have the ANSI C header files. */
+/* Define to 1 if all of the C90 standard headers exist (not just the ones
+ required in a freestanding environment). This macro is provided for
+ backward compatibility; new code need not use it. */
#undef STDC_HEADERS
+/* What encoding should be used for embedded configuration info? */
+#undef TCL_CFGVAL_ENCODING
+
/* Is this a 64-bit build? */
#undef TCL_CFG_DO64BIT
@@ -157,33 +159,29 @@
/* What is the default extension for shared libraries? */
#undef TCL_SHLIB_EXT
-/* Are we building with threads enabled? */
-#undef TCL_THREADS
-
-/* Are wide integers to be implemented with C 'long's? */
+/* Do 'long' and 'long long' have the same size (64-bit)? */
#undef TCL_WIDE_INT_IS_LONG
-/* What type should be used to define wide integers? */
-#undef TCL_WIDE_INT_TYPE
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
/* Is Tk built as a framework? */
#undef TK_FRAMEWORK
/* Are TkAqua debug messages enabled? */
#undef TK_MAC_DEBUG
-/* Do we want to use the threaded memory allocator? */
-#undef USE_THREAD_ALLOC
-
-/* Define to 1 if your processor stores words with the most significant byte
- first (like Motorola and SPARC, unlike Intel and VAX). */
-#undef WORDS_BIGENDIAN
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
-/* Is XKeycodeToKeysym deprecated? */
-#undef XKEYCODETOKEYSYM_IS_DEPRECATED
+/* Are we building with zipfs enabled? */
+#undef ZIPFS_BUILD
/* Are Darwin SUSv3 extensions available? */
#undef _DARWIN_C_SOURCE
@@ -206,47 +204,33 @@
/* Do we want the reentrant OS API? */
#undef _REENTRANT
-/* Do we want the thread-safe OS API? */
-#undef _THREAD_SAFE
-
/* Do we want to use the XOPEN network library? */
#undef _XOPEN_SOURCE
/* Do we want to use the XOPEN network library? */
#undef _XOPEN_SOURCE_EXTENDED
-/* Define to 1 if type `char' is unsigned and you are not using gcc. */
+/* Define to 1 if type `char' is unsigned and your compiler does not
+ predefine this macro. */
#ifndef __CHAR_UNSIGNED__
# undef __CHAR_UNSIGNED__
#endif
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef gid_t
-
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
-/* Signed integer type wide enough to hold a pointer. */
-#undef intptr_t
-
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
-/* Define to `int' if <sys/types.h> does not define. */
+/* Define as a signed integer type capable of holding a process identifier. */
#undef pid_t
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef uid_t
-
-/* Unsigned integer type wide enough to hold a pointer. */
-#undef uintptr_t
-
/* Undef unused package specific autoheader defines so that we can
* include both tclConfig.h and tkConfig.h at the same time: */
diff --git a/unix/tkConfig.sh.in b/unix/tkConfig.sh.in
index bb85ad0..e08861b 100644
--- a/unix/tkConfig.sh.in
+++ b/unix/tkConfig.sh.in
@@ -95,3 +95,6 @@ TK_BUILD_STUB_LIB_PATH='@TK_BUILD_STUB_LIB_PATH@'
# Path to the Tk stub library in the install directory.
TK_STUB_LIB_PATH='@TK_STUB_LIB_PATH@'
+
+# Top-level directory in which Tk's demo files are installed.
+TK_DEMO_DIR='@TK_DEMO_DIR@'
diff --git a/unix/tkUnix.c b/unix/tkUnix.c
index ed024d1..553d8fc 100644
--- a/unix/tkUnix.c
+++ b/unix/tkUnix.c
@@ -5,7 +5,7 @@
* probably have to be written differently for Windows or Macintosh
* platforms.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -108,6 +108,11 @@ Tk_UpdatePointer(
int x, int y, /* Pointer location in root coords. */
int state) /* Modifier state mask. */
{
+ (void)tkwin;
+ (void)x;
+ (void)y;
+ (void)state;
+
/*
* This function intentionally left blank
*/
diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c
index 7ea67a1..13bbf06 100644
--- a/unix/tkUnix3d.c
+++ b/unix/tkUnix3d.c
@@ -4,7 +4,7 @@
* This file contains the platform specific routines for drawing 3d
* borders in the Motif style.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -46,7 +46,7 @@ typedef struct {
TkBorder *
TkpGetBorder(void)
{
- UnixBorder *borderPtr = ckalloc(sizeof(UnixBorder));
+ UnixBorder *borderPtr = (UnixBorder *)ckalloc(sizeof(UnixBorder));
borderPtr->solidGC = NULL;
return (TkBorder *) borderPtr;
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index 8d293f6..0c752ce 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -3,7 +3,7 @@
*
* This file implements the Unix specific portion of the button widgets.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c
index 96e8937..9bcba0e 100644
--- a/unix/tkUnixColor.c
+++ b/unix/tkUnixColor.c
@@ -4,7 +4,7 @@
* This file contains the platform specific color routines needed for X
* support.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -185,7 +185,7 @@ TkpGetColor(
}
}
- tkColPtr = ckalloc(sizeof(TkColor));
+ tkColPtr = (TkColor *)ckalloc(sizeof(TkColor));
tkColPtr->color = color;
return tkColPtr;
@@ -220,7 +220,7 @@ TkpGetColorByValue(
{
Display *display = Tk_Display(tkwin);
Colormap colormap = Tk_Colormap(tkwin);
- TkColor *tkColPtr = ckalloc(sizeof(TkColor));
+ TkColor *tkColPtr = (TkColor *)ckalloc(sizeof(TkColor));
tkColPtr->color.red = colorPtr->red;
tkColPtr->color.green = colorPtr->green;
@@ -269,7 +269,7 @@ FindClosestColor(
XColor *colorPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
Colormap colormap = Tk_Colormap(tkwin);
- XVisualInfo template, *visInfoPtr;
+ XVisualInfo templ, *visInfoPtr;
/*
* Find the TkStressedCmap structure for this colormap, or create a new
@@ -278,19 +278,19 @@ FindClosestColor(
for (stressPtr = dispPtr->stressPtr; ; stressPtr = stressPtr->nextPtr) {
if (stressPtr == NULL) {
- stressPtr = ckalloc(sizeof(TkStressedCmap));
+ stressPtr = (TkStressedCmap *)ckalloc(sizeof(TkStressedCmap));
stressPtr->colormap = colormap;
- template.visualid = XVisualIDFromVisual(Tk_Visual(tkwin));
+ templ.visualid = XVisualIDFromVisual(Tk_Visual(tkwin));
visInfoPtr = XGetVisualInfo(Tk_Display(tkwin),
- VisualIDMask, &template, &numFound);
+ VisualIDMask, &templ, &numFound);
if (numFound < 1) {
Tcl_Panic("FindClosestColor couldn't lookup visual");
}
stressPtr->numColors = visInfoPtr->colormap_size;
XFree((char *) visInfoPtr);
- stressPtr->colorPtr =
+ stressPtr->colorPtr = (XColor *)
ckalloc(stressPtr->numColors * sizeof(XColor));
for (i = 0; i < stressPtr->numColors; i++) {
stressPtr->colorPtr[i].pixel = (unsigned long) i;
diff --git a/unix/tkUnixConfig.c b/unix/tkUnixConfig.c
index 3584494..922f127 100644
--- a/unix/tkUnixConfig.c
+++ b/unix/tkUnixConfig.c
@@ -4,7 +4,7 @@
* This module implements the Unix system defaults for the configuration
* package.
*
- * Copyright (c) 1997 by Sun Microsystems, Inc.
+ * Copyright © 1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -38,6 +38,10 @@ TkpGetSystemDefault(
const char *dbName, /* The option database name. */
const char *className) /* The name of the option class. */
{
+ (void)tkwin;
+ (void)dbName;
+ (void)className;
+
return NULL;
}
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c
index 4c58adf..30948bd 100644
--- a/unix/tkUnixCursor.c
+++ b/unix/tkUnixCursor.c
@@ -3,7 +3,7 @@
*
* This file contains X specific cursor manipulation routines.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -338,7 +338,7 @@ TkGetCursorByName(
}
if (cursor != None) {
- cursorPtr = ckalloc(sizeof(TkUnixCursor));
+ cursorPtr = (TkUnixCursor *)ckalloc(sizeof(TkUnixCursor));
cursorPtr->info.cursor = (Tk_Cursor) cursor;
cursorPtr->display = display;
}
@@ -608,7 +608,7 @@ TkCreateCursorFromData(
Tk_FreePixmap(display, maskPixmap);
if (cursor != None) {
- cursorPtr = ckalloc(sizeof(TkUnixCursor));
+ cursorPtr = (TkUnixCursor *)ckalloc(sizeof(TkUnixCursor));
cursorPtr->info.cursor = (Tk_Cursor) cursor;
cursorPtr->display = display;
}
diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h
index 3e9ef97..3cae17b 100644
--- a/unix/tkUnixDefault.h
+++ b/unix/tkUnixDefault.h
@@ -22,6 +22,7 @@
* TROUGH - Background color for troughs in scales and scrollbars.
* INDICATOR - Color for indicator when button is selected.
* DISABLED - Foreground color when widget is disabled.
+ * PLACEHOLDER_FG - Foreground color for placeholder text.
*/
#define BLACK "#000000"
@@ -33,6 +34,7 @@
#define TROUGH "#b3b3b3"
#define INDICATOR WHITE
#define DISABLED "#a3a3a3"
+#define PLACEHOLDER_FG "#b3b3b3" /* grey70 */
/*
* Defaults for labels, buttons, checkbuttons, and radiobuttons:
@@ -63,7 +65,7 @@
#define DEF_BUTTON_HIGHLIGHT BLACK
#define DEF_LABEL_HIGHLIGHT_WIDTH "0"
#define DEF_BUTTON_HIGHLIGHT_WIDTH "1"
-#define DEF_BUTTON_IMAGE ((char *) NULL)
+#define DEF_BUTTON_IMAGE NULL
#define DEF_BUTTON_INDICATOR "1"
#define DEF_BUTTON_JUSTIFY "center"
#define DEF_BUTTON_OFF_VALUE "0"
@@ -80,13 +82,12 @@
#define DEF_BUTTON_REPEAT_INTERVAL "0"
#define DEF_BUTTON_SELECT_COLOR INDICATOR
#define DEF_BUTTON_SELECT_MONO BLACK
-#define DEF_BUTTON_SELECT_IMAGE ((char *) NULL)
+#define DEF_BUTTON_SELECT_IMAGE NULL
#define DEF_BUTTON_STATE "normal"
#define DEF_LABEL_TAKE_FOCUS "0"
-#define DEF_BUTTON_TAKE_FOCUS ((char *) NULL)
+#define DEF_BUTTON_TAKE_FOCUS NULL
#define DEF_BUTTON_TEXT ""
#define DEF_BUTTON_TEXT_VARIABLE ""
-#define DEF_BUTTON_UNDERLINE "-1"
#define DEF_BUTTON_VALUE ""
#define DEF_BUTTON_WIDTH "0"
#define DEF_BUTTON_WRAP_LENGTH "0"
@@ -121,7 +122,7 @@
#define DEF_CANVAS_SELECT_BD_MONO "0"
#define DEF_CANVAS_SELECT_FG_COLOR BLACK
#define DEF_CANVAS_SELECT_FG_MONO WHITE
-#define DEF_CANVAS_TAKE_FOCUS ((char *) NULL)
+#define DEF_CANVAS_TAKE_FOCUS NULL
#define DEF_CANVAS_WIDTH "10c"
#define DEF_CANVAS_X_SCROLL_CMD ""
#define DEF_CANVAS_X_SCROLL_INCREMENT "0"
@@ -152,6 +153,8 @@
#define DEF_ENTRY_INSERT_ON_TIME "600"
#define DEF_ENTRY_INSERT_WIDTH "2"
#define DEF_ENTRY_JUSTIFY "left"
+#define DEF_ENTRY_PLACEHOLDER ""
+#define DEF_ENTRY_PLACEHOLDERFG PLACEHOLDER_FG
#define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG
#define DEF_ENTRY_READONLY_BG_MONO WHITE
#define DEF_ENTRY_RELIEF "sunken"
@@ -162,9 +165,9 @@
#define DEF_ENTRY_SELECT_BD_MONO "0"
#define DEF_ENTRY_SELECT_FG_COLOR BLACK
#define DEF_ENTRY_SELECT_FG_MONO WHITE
-#define DEF_ENTRY_SHOW ((char *) NULL)
+#define DEF_ENTRY_SHOW NULL
#define DEF_ENTRY_STATE "normal"
-#define DEF_ENTRY_TAKE_FOCUS ((char *) NULL)
+#define DEF_ENTRY_TAKE_FOCUS NULL
#define DEF_ENTRY_TEXT_VARIABLE ""
#define DEF_ENTRY_WIDTH "20"
@@ -173,7 +176,9 @@
*/
#define DEF_FRAME_BG_COLOR NORMAL_BG
+#define DEF_FRAME_BG_IMAGE NULL
#define DEF_FRAME_BG_MONO WHITE
+#define DEF_FRAME_BG_TILE "0"
#define DEF_FRAME_BORDER_WIDTH "0"
#define DEF_FRAME_CLASS "Frame"
#define DEF_FRAME_COLORMAP ""
@@ -232,37 +237,36 @@
#define DEF_LISTBOX_SELECT_MODE "browse"
#define DEF_LISTBOX_SET_GRID "0"
#define DEF_LISTBOX_STATE "normal"
-#define DEF_LISTBOX_TAKE_FOCUS ((char *) NULL)
+#define DEF_LISTBOX_TAKE_FOCUS NULL
#define DEF_LISTBOX_WIDTH "20"
/*
* Defaults for individual entries of menus:
*/
-#define DEF_MENU_ENTRY_ACTIVE_BG ((char *) NULL)
-#define DEF_MENU_ENTRY_ACTIVE_FG ((char *) NULL)
-#define DEF_MENU_ENTRY_ACCELERATOR ((char *) NULL)
-#define DEF_MENU_ENTRY_BG ((char *) NULL)
+#define DEF_MENU_ENTRY_ACTIVE_BG NULL
+#define DEF_MENU_ENTRY_ACTIVE_FG NULL
+#define DEF_MENU_ENTRY_ACCELERATOR NULL
+#define DEF_MENU_ENTRY_BG NULL
#define DEF_MENU_ENTRY_BITMAP NULL
#define DEF_MENU_ENTRY_COLUMN_BREAK "0"
-#define DEF_MENU_ENTRY_COMMAND ((char *) NULL)
+#define DEF_MENU_ENTRY_COMMAND NULL
#define DEF_MENU_ENTRY_COMPOUND "none"
-#define DEF_MENU_ENTRY_FG ((char *) NULL)
-#define DEF_MENU_ENTRY_FONT ((char *) NULL)
+#define DEF_MENU_ENTRY_FG NULL
+#define DEF_MENU_ENTRY_FONT NULL
#define DEF_MENU_ENTRY_HIDE_MARGIN "0"
-#define DEF_MENU_ENTRY_IMAGE ((char *) NULL)
+#define DEF_MENU_ENTRY_IMAGE NULL
#define DEF_MENU_ENTRY_INDICATOR "1"
-#define DEF_MENU_ENTRY_LABEL ((char *) NULL)
-#define DEF_MENU_ENTRY_MENU ((char *) NULL)
+#define DEF_MENU_ENTRY_LABEL NULL
+#define DEF_MENU_ENTRY_MENU NULL
#define DEF_MENU_ENTRY_OFF_VALUE "0"
#define DEF_MENU_ENTRY_ON_VALUE "1"
-#define DEF_MENU_ENTRY_SELECT_IMAGE ((char *) NULL)
+#define DEF_MENU_ENTRY_SELECT_IMAGE NULL
#define DEF_MENU_ENTRY_STATE "normal"
-#define DEF_MENU_ENTRY_VALUE ((char *) NULL)
-#define DEF_MENU_ENTRY_CHECK_VARIABLE ((char *) NULL)
+#define DEF_MENU_ENTRY_VALUE NULL
+#define DEF_MENU_ENTRY_CHECK_VARIABLE NULL
#define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
-#define DEF_MENU_ENTRY_SELECT ((char *) NULL)
-#define DEF_MENU_ENTRY_UNDERLINE "-1"
+#define DEF_MENU_ENTRY_SELECT NULL
/*
* Defaults for menus overall:
@@ -273,6 +277,7 @@
#define DEF_MENU_ACTIVE_BORDER_WIDTH "1"
#define DEF_MENU_ACTIVE_FG_COLOR BLACK
#define DEF_MENU_ACTIVE_FG_MONO WHITE
+#define DEF_MENU_ACTIVE_RELIEF "raised"
#define DEF_MENU_BG_COLOR NORMAL_BG
#define DEF_MENU_BG_MONO WHITE
#define DEF_MENU_BORDER_WIDTH "1"
@@ -286,8 +291,8 @@
#define DEF_MENU_SELECT_COLOR BLACK
#define DEF_MENU_SELECT_MONO BLACK
#define DEF_MENU_TAKE_FOCUS "0"
-#define DEF_MENU_TEAROFF "1"
-#define DEF_MENU_TEAROFF_CMD ((char *) NULL)
+#define DEF_MENU_TEAROFF "0"
+#define DEF_MENU_TEAROFF_CMD NULL
#define DEF_MENU_TITLE ""
#define DEF_MENU_TYPE "normal"
@@ -315,7 +320,7 @@
#define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
#define DEF_MENUBUTTON_HIGHLIGHT BLACK
#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
-#define DEF_MENUBUTTON_IMAGE ((char *) NULL)
+#define DEF_MENUBUTTON_IMAGE NULL
#define DEF_MENUBUTTON_INDICATOR "0"
#define DEF_MENUBUTTON_JUSTIFY "center"
#define DEF_MENUBUTTON_MENU ""
@@ -326,7 +331,6 @@
#define DEF_MENUBUTTON_TAKE_FOCUS "0"
#define DEF_MENUBUTTON_TEXT ""
#define DEF_MENUBUTTON_TEXT_VARIABLE ""
-#define DEF_MENUBUTTON_UNDERLINE "-1"
#define DEF_MENUBUTTON_WIDTH "0"
#define DEF_MENUBUTTON_WRAP_LENGTH "0"
@@ -425,7 +429,7 @@
#define DEF_SCALE_SLIDER_LENGTH "30"
#define DEF_SCALE_SLIDER_RELIEF "raised"
#define DEF_SCALE_STATE "normal"
-#define DEF_SCALE_TAKE_FOCUS ((char *) NULL)
+#define DEF_SCALE_TAKE_FOCUS NULL
#define DEF_SCALE_TICK_INTERVAL "0"
#define DEF_SCALE_TO "100"
#define DEF_SCALE_VARIABLE ""
@@ -452,7 +456,7 @@
#define DEF_SCROLLBAR_RELIEF "sunken"
#define DEF_SCROLLBAR_REPEAT_DELAY "300"
#define DEF_SCROLLBAR_REPEAT_INTERVAL "100"
-#define DEF_SCROLLBAR_TAKE_FOCUS ((char *) NULL)
+#define DEF_SCROLLBAR_TAKE_FOCUS NULL
#define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
#define DEF_SCROLLBAR_TROUGH_MONO WHITE
#define DEF_SCROLLBAR_WIDTH "11"
@@ -500,7 +504,7 @@
#define DEF_TEXT_STATE "normal"
#define DEF_TEXT_TABS ""
#define DEF_TEXT_TABSTYLE "tabular"
-#define DEF_TEXT_TAKE_FOCUS ((char *) NULL)
+#define DEF_TEXT_TAKE_FOCUS NULL
#define DEF_TEXT_UNDO "0"
#define DEF_TEXT_WIDTH "80"
#define DEF_TEXT_WRAP "char"
diff --git a/unix/tkUnixDialog.c b/unix/tkUnixDialog.c
index afe443f..66f88dc 100644
--- a/unix/tkUnixDialog.c
+++ b/unix/tkUnixDialog.c
@@ -3,7 +3,7 @@
*
* Contains the Unix implementation of the common dialog boxes:
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -46,7 +46,7 @@ EvalObjv(
cmdObj = Tcl_NewStringObj(cmdName, -1);
Tcl_IncrRefCount(cmdObj);
- objs = ckalloc(sizeof(Tcl_Obj *) * (objc+1));
+ objs = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc+1));
objs[0] = cmdObj;
memcpy(objs+1, objv, sizeof(Tcl_Obj *) * (unsigned)objc);
diff --git a/unix/tkUnixDraw.c b/unix/tkUnixDraw.c
index acc0565..a9d6d73 100644
--- a/unix/tkUnixDraw.c
+++ b/unix/tkUnixDraw.c
@@ -3,7 +3,7 @@
*
* This file contains X specific drawing routines.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -24,7 +24,7 @@ typedef struct ScrollInfo {
int done; /* Flag is 0 until filtering is done. */
Display *display; /* Display to filter. */
Window window; /* Window to filter. */
- TkRegion region; /* Region into which damage is accumulated. */
+ Region region; /* Region into which damage is accumulated. */
int dx, dy; /* Amount by which window was shifted. */
} ScrollInfo;
@@ -61,7 +61,7 @@ TkScrollWindow(
int x, int y, int width, int height,
/* Position rectangle to be scrolled. */
int dx, int dy, /* Distance rectangle should be moved. */
- TkRegion damageRgn) /* Region to accumulate damage in. */
+ Region damageRgn) /* Region to accumulate damage in. */
{
Tk_RestrictProc *prevProc;
ClientData prevArg;
@@ -90,7 +90,7 @@ TkScrollWindow(
}
Tk_RestrictEvents(prevProc, prevArg, &prevArg);
- if (XEmptyRegion((Region) damageRgn)) {
+ if (XEmptyRegion(damageRgn)) {
return 0;
} else {
return 1;
@@ -141,8 +141,8 @@ ScrollRestrictProc(
rect.y = eventPtr->xgraphicsexpose.y;
rect.width = eventPtr->xgraphicsexpose.width;
rect.height = eventPtr->xgraphicsexpose.height;
- XUnionRectWithRegion(&rect, (Region) info->region,
- (Region) info->region);
+ XUnionRectWithRegion(&rect, info->region,
+ info->region);
if (eventPtr->xgraphicsexpose.count == 0) {
info->done = 1;
@@ -160,12 +160,12 @@ ScrollRestrictProc(
rect.y = eventPtr->xexpose.y;
rect.width = eventPtr->xexpose.width;
rect.height = eventPtr->xexpose.height;
- XUnionRectWithRegion(&rect, (Region) info->region,
- (Region) info->region);
+ XUnionRectWithRegion(&rect, info->region,
+ info->region);
rect.x += info->dx;
rect.y += info->dy;
- XUnionRectWithRegion(&rect, (Region) info->region,
- (Region) info->region);
+ XUnionRectWithRegion(&rect, info->region,
+ info->region);
} else {
return TK_DEFER_EVENT;
}
@@ -202,13 +202,15 @@ TkpDrawHighlightBorder(
int highlightWidth,
Drawable drawable)
{
+ (void)bgGC;
+
TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
/*
*----------------------------------------------------------------------
*
- * TkpDrawFrame --
+ * TkpDrawFrameEx --
*
* This function draws the rectangular frame area.
*
@@ -222,14 +224,15 @@ TkpDrawHighlightBorder(
*/
void
-TkpDrawFrame(
+TkpDrawFrameEx(
Tk_Window tkwin,
+ Drawable drawable,
Tk_3DBorder border,
int highlightWidth,
int borderWidth,
int relief)
{
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, highlightWidth,
+ Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth,
highlightWidth, Tk_Width(tkwin) - 2*highlightWidth,
Tk_Height(tkwin) - 2*highlightWidth, borderWidth, relief);
}
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index ff7860b..bdb6950 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -6,7 +6,7 @@
* application can use as its main window an internal window from some
* other application). Also includes code to support busy windows.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -106,7 +106,7 @@ TkpUseWindow(
Tk_ErrorHandler handler;
Container *containerPtr;
XWindowAttributes parentAtts;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->window != None) {
@@ -178,7 +178,7 @@ TkpUseWindow(
}
}
if (containerPtr == NULL) {
- containerPtr = ckalloc(sizeof(Container));
+ containerPtr = (Container *)ckalloc(sizeof(Container));
containerPtr->parent = parent;
containerPtr->parentRoot = parentAtts.root;
containerPtr->parentPtr = NULL;
@@ -216,7 +216,7 @@ TkpMakeWindow(
* the window is to be created. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_EMBEDDED) {
@@ -272,7 +272,7 @@ TkpMakeContainer(
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -281,7 +281,7 @@ TkpMakeContainer(
*/
Tk_MakeWindowExist(tkwin);
- containerPtr = ckalloc(sizeof(Container));
+ containerPtr = (Container *)ckalloc(sizeof(Container));
containerPtr->parent = Tk_WindowId(tkwin);
containerPtr->parentRoot = RootWindowOfScreen(Tk_Screen(tkwin));
containerPtr->parentPtr = winPtr;
@@ -332,7 +332,8 @@ EmbedErrorProc(
XErrorEvent *errEventPtr) /* Points to information about error (not
* used). */
{
- int *iPtr = clientData;
+ int *iPtr = (int *)clientData;
+ (void)errEventPtr;
*iPtr = 1;
return 0;
@@ -362,7 +363,7 @@ EmbeddedEventProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- TkWindow *winPtr = clientData;
+ TkWindow *winPtr = (TkWindow *)clientData;
if (eventPtr->type == DestroyNotify) {
EmbedWindowDeleted(winPtr);
@@ -394,10 +395,10 @@ ContainerEventProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- TkWindow *winPtr = clientData;
+ TkWindow *winPtr = (TkWindow *)clientData;
Container *containerPtr;
Tk_ErrorHandler errHandler;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -499,7 +500,7 @@ EmbedStructureProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = clientData;
+ Container *containerPtr = (Container *)clientData;
Tk_ErrorHandler errHandler;
if (eventPtr->type == ConfigureNotify) {
@@ -507,7 +508,7 @@ EmbedStructureProc(
* Send a ConfigureNotify to the embedded application.
*/
- if (containerPtr->embeddedPtr != None) {
+ if (containerPtr->embeddedPtr != NULL) {
TkDoConfigureNotify(containerPtr->embeddedPtr);
}
if (containerPtr->wrapper != None) {
@@ -554,7 +555,7 @@ EmbedFocusProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = clientData;
+ Container *containerPtr = (Container *)clientData;
Tk_ErrorHandler errHandler;
Display *display;
@@ -712,7 +713,7 @@ TkpGetOtherWindow(
* window. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (containerPtr = tsdPtr->firstContainerPtr;
@@ -758,7 +759,7 @@ TkpRedirectKeyEvent(
{
Container *containerPtr;
Window saved;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -830,7 +831,7 @@ TkpClaimFocus(
{
XEvent event;
Container *containerPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(topLevelPtr->flags & TK_EMBEDDED)) {
@@ -872,7 +873,7 @@ TkpClaimFocus(
int
TkpTestembedCmd(
- ClientData clientData, /* Main window for application. */
+ ClientData dummy, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
@@ -882,8 +883,9 @@ TkpTestembedCmd(
Tcl_DString dString;
char buffer[50];
Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ (void)dummy;
if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) {
all = 1;
@@ -907,7 +909,7 @@ TkpTestembedCmd(
if (containerPtr->parent == None) {
Tcl_DStringAppendElement(&dString, "");
} else if (all) {
- sprintf(buffer, "0x%lx", containerPtr->parent);
+ sprintf(buffer, "0x%" TCL_Z_MODIFIER "x", (size_t) containerPtr->parent);
Tcl_DStringAppendElement(&dString, buffer);
} else {
Tcl_DStringAppendElement(&dString, "XXX");
@@ -924,7 +926,7 @@ TkpTestembedCmd(
if (containerPtr->wrapper == None) {
Tcl_DStringAppendElement(&dString, "");
} else if (all) {
- sprintf(buffer, "0x%lx", containerPtr->wrapper);
+ sprintf(buffer, "0x%" TCL_Z_MODIFIER "x", (size_t) containerPtr->wrapper);
Tcl_DStringAppendElement(&dString, buffer);
} else {
Tcl_DStringAppendElement(&dString, "XXX");
@@ -967,7 +969,7 @@ EmbedWindowDeleted(
* deleted. */
{
Container *containerPtr, *prevPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1026,7 +1028,7 @@ TkUnixContainerId(
TkWindow *winPtr) /* Tk's structure for an embedded window. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (containerPtr = tsdPtr->firstContainerPtr;
@@ -1179,6 +1181,7 @@ TkpCreateBusy(
{
Window root, parent, *dummy;
unsigned int count;
+ (void)busy;
if (winPtr->flags & TK_REPARENTED) {
/*
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index e424bb7..5c0f311 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -4,7 +4,7 @@
* This file implements an event source for X displays for the UNIX
* version of Tk.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -12,11 +12,10 @@
#include "tkUnixInt.h"
#include <signal.h>
-#ifdef HAVE_XKBKEYCODETOKEYSYM
-# include <X11/XKBlib.h>
-#else
-# define XkbOpenDisplay(D,V,E,M,m,R) (((void)D),((void)V),((void)E),((void)M),((void)m),((void)R),(NULL))
-#endif
+#undef register /* Keyword "register" is used in XKBlib.h, so don't try tricky things here */
+#define XkbOpenDisplay XkbOpenDisplay_ /* Move out of the way, conflicting definitions */
+#include <X11/XKBlib.h>
+#undef XkbOpenDisplay
/*
* The following static indicates whether this module has been initialized in
@@ -92,10 +91,11 @@ TkCreateXEventSource(void)
static void
DisplayExitHandler(
- ClientData clientData) /* Not used. */
+ ClientData dummy) /* Not used. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ (void)dummy;
Tcl_DeleteEventSource(DisplaySetupProc, DisplayCheckProc, NULL);
tsdPtr->initialized = 0;
@@ -129,9 +129,8 @@ TkpOpenDisplay(
int major = 1;
int minor = 0;
int reason = 0;
- unsigned int use_xkb = 0;
/* Disabled, until we have a better test. See [Bug 3613668] */
-#if 0 && defined(XKEYCODETOKEYSYM_IS_DEPRECATED) && defined(TCL_THREADS)
+#if 0
static int xinited = 0;
static Tcl_Mutex xinitMutex = NULL;
@@ -154,31 +153,19 @@ TkpOpenDisplay(
/*
** Bug [3607830]: Before using Xkb, it must be initialized and confirmed
- ** that the serve supports it. The XkbOpenDisplay call
+ ** that the server supports it. The XkbOpenDisplay call
** will perform this check and return NULL if the extension
** is not supported.
- **
- ** Work around un-const-ified Xkb headers using (char *) cast.
*/
- display = XkbOpenDisplay((char *)displayNameStr, &event, &error, &major,
+ display = XkbOpenDisplay(displayNameStr, &event, &error, &major,
&minor, &reason);
if (display == NULL) {
- /*fprintf(stderr,"event=%d error=%d major=%d minor=%d reason=%d\nDisabling xkb\n",
- event, error, major, minor, reason);*/
- display = XOpenDisplay(displayNameStr);
- } else {
- use_xkb = TK_DISPLAY_USE_XKB;
- /*fprintf(stderr, "Using xkb %d.%d\n", major, minor);*/
- }
-
- if (display == NULL) {
return NULL;
}
- dispPtr = ckalloc(sizeof(TkDisplay));
+ dispPtr = (TkDisplay *)ckalloc(sizeof(TkDisplay));
memset(dispPtr, 0, sizeof(TkDisplay));
dispPtr->display = display;
- dispPtr->flags |= use_xkb;
#ifdef TK_USE_INPUT_METHODS
OpenIM(dispPtr);
XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
@@ -311,11 +298,12 @@ TkClipCleanup(
static void
DisplaySetupProc(
- ClientData clientData, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags)
{
TkDisplay *dispPtr;
static Tcl_Time blockTime = { 0, 0 };
+ (void)dummy;
if (!(flags & TCL_WINDOW_EVENTS)) {
return;
@@ -443,10 +431,11 @@ TransferXEventsToTcl(
static void
DisplayCheckProc(
- ClientData clientData, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags)
{
TkDisplay *dispPtr;
+ (void)dummy;
if (!(flags & TCL_WINDOW_EVENTS)) {
return;
@@ -481,9 +470,10 @@ DisplayFileProc(
ClientData clientData, /* The display pointer. */
int flags) /* Should be TCL_READABLE. */
{
- TkDisplay *dispPtr = (TkDisplay *) clientData;
+ TkDisplay *dispPtr = (TkDisplay *)clientData;
Display *display = dispPtr->display;
int numFound;
+ (void)flags;
XFlush(display);
numFound = XEventsQueued(display, QueuedAfterReading);
@@ -694,6 +684,8 @@ InstantiateIMCallback(
XPointer call_data)
{
TkDisplay *dispPtr;
+ (void)display;
+ (void)call_data;
dispPtr = (TkDisplay *) client_data;
OpenIM(dispPtr);
@@ -708,6 +700,8 @@ DestroyIMCallback(
XPointer call_data)
{
TkDisplay *dispPtr;
+ (void)im;
+ (void)call_data;
dispPtr = (TkDisplay *) client_data;
dispPtr->inputMethod = NULL;
diff --git a/unix/tkUnixFocus.c b/unix/tkUnixFocus.c
index 0767618..7ab6e3e 100644
--- a/unix/tkUnixFocus.c
+++ b/unix/tkUnixFocus.c
@@ -4,7 +4,7 @@
* This file contains platform specific functions that manage focus for
* Tk.
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
+ * Copyright © 1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 665b260..8987749 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -4,7 +4,7 @@
* Contains the Unix implementation of the platform-independent font
* package interface.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -238,6 +238,7 @@ static unsigned RankAttributes(FontAttributes *wantPtr,
static void ReleaseFont(UnixFont *fontPtr);
static void ReleaseSubFont(Display *display, SubFont *subFontPtr);
static int SeenName(const char *name, Tcl_DString *dsPtr);
+#if TCL_MAJOR_VERSION < 9
static int Ucs2beToUtfProc(void *clientData, const char*src,
int srcLen, int flags, Tcl_EncodingState*statePtr,
char *dst, int dstLen, int *srcReadPtr,
@@ -246,6 +247,7 @@ static int UtfToUcs2beProc(void *clientData, const char*src,
int srcLen, int flags, Tcl_EncodingState*statePtr,
char *dst, int dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr);
+#endif
/*
*-------------------------------------------------------------------------
@@ -312,7 +314,9 @@ TkpFontPkgInit(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
SubFont dummy;
int i;
+#if TCL_MAJOR_VERSION < 9
Tcl_Encoding ucs2;
+#endif
if (tsdPtr->controlFamily.encoding == NULL) {
@@ -333,6 +337,7 @@ TkpFontPkgInit(
* if it doesn't exist yet. It is used in iso10646 fonts.
*/
+#if TCL_MAJOR_VERSION < 9
ucs2 = Tcl_GetEncoding(NULL, "ucs-2be");
if (ucs2 == NULL) {
Tcl_EncodingType ucs2type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2};
@@ -340,6 +345,7 @@ TkpFontPkgInit(
} else {
Tcl_FreeEncoding(ucs2);
}
+#endif
Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL);
}
}
@@ -390,7 +396,7 @@ ControlUtfProc(
const char *srcStart, *srcEnd;
char *dstStart, *dstEnd;
int ch, result;
- static const char hexChars[] = "0123456789abcdef";
+ static const char hexChars[] = "0123456789ABCDEF";
static const char mapChars[] = {
0, 0, 0, 0, 0, 0, 0,
'a', 'b', 't', 'n', 'v', 'f', 'r'
@@ -429,10 +435,10 @@ ControlUtfProc(
} else {
/* TODO we can do better here */
dst[1] = 'u';
- dst[2] = 'f';
- dst[3] = 'f';
- dst[4] = 'f';
- dst[5] = 'd';
+ dst[2] = 'F';
+ dst[3] = 'F';
+ dst[4] = 'F';
+ dst[5] = 'D';
dst += 6;
}
}
@@ -458,6 +464,7 @@ ControlUtfProc(
*-------------------------------------------------------------------------
*/
+#if TCL_MAJOR_VERSION < 9
static int
Ucs2beToUtfProc(
TCL_UNUSED(void *), /* Not used. */
@@ -554,6 +561,14 @@ Ucs2beToUtfProc(
*-------------------------------------------------------------------------
*/
+#if defined(USE_TCL_STUBS)
+/* Since the UCS-2BE encoding is only used when Tk 8.7 is dynamically loaded in Tcl 8.6,
+ * make sure that Tcl_UtfCharComplete is ALWAYS the pre-TIP #575 version,
+ * even though Tk 8.7 is being compiled with -DTCL_NO_DEPRECATED! */
+# undef Tcl_UtfCharComplete
+# define Tcl_UtfCharComplete ((int (*)(const char *, int))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[326]))
+#endif
+
static int
UtfToUcs2beProc(
TCL_UNUSED(void *), /* TableEncodingData that specifies
@@ -627,6 +642,7 @@ UtfToUcs2beProc(
*dstCharsPtr = numChars;
return result;
}
+#endif
/*
*---------------------------------------------------------------------------
@@ -2109,10 +2125,10 @@ FindSubFontForChar(
nameList = ListFonts(fontPtr->display, "*", &numNames);
for (i = 0; i < numNames; i++) {
- fallback = strchr(nameList[i] + 1, '-') + 1;
- strchr(fallback, '-')[0] = '\0';
- if (SeenName(fallback, &ds) == 0) {
- subFontPtr = CanUseFallback(fontPtr, fallback, ch,
+ char *fallbck = strchr(nameList[i] + 1, '-') + 1;
+ strchr(fallbck, '-')[0] = '\0';
+ if (SeenName(fallbck, &ds) == 0) {
+ subFontPtr = CanUseFallback(fontPtr, fallbck, ch,
fixSubFontPtrPtr);
if (subFontPtr != NULL) {
XFreeFontNames(nameList);
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c
index b0aa2fa..1c716f4 100644
--- a/unix/tkUnixInit.c
+++ b/unix/tkUnixInit.c
@@ -3,7 +3,7 @@
*
* This file contains Unix-specific interpreter initialization functions.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,7 +14,7 @@
#ifdef HAVE_COREFOUNDATION
static int GetLibraryPath(Tcl_Interp *interp);
#else
-#define GetLibraryPath(dummy) (void)0
+#define GetLibraryPath(dummy) (void)dummy
#endif /* HAVE_COREFOUNDATION */
/*
@@ -41,6 +41,8 @@ TkpInit(
{
TkCreateXEventSource();
GetLibraryPath(interp);
+ Tktray_Init(interp);
+ (void)SysNotify_Init (interp);
return TCL_OK;
}
@@ -132,11 +134,11 @@ TkpDisplayWarning(
*----------------------------------------------------------------------
*/
+#ifdef TK_FRAMEWORK
static int
GetLibraryPath(
Tcl_Interp *interp)
{
-#ifdef TK_FRAMEWORK
int foundInFramework = TCL_ERROR;
char tkLibPath[PATH_MAX + 1];
@@ -147,10 +149,15 @@ GetLibraryPath(
Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
}
return foundInFramework;
+}
#else
+static int
+GetLibraryPath(
+ TCL_UNUSED(Tcl_Interp *))
+{
return TCL_ERROR;
-#endif
}
+#endif
#endif /* HAVE_COREFOUNDATION */
/*
diff --git a/unix/tkUnixInt.h b/unix/tkUnixInt.h
index 805f314..8736fad 100644
--- a/unix/tkUnixInt.h
+++ b/unix/tkUnixInt.h
@@ -24,7 +24,11 @@
#include "tkIntPlatDecls.h"
+MODULE_SCOPE int Tktray_Init (Tcl_Interp* interp);
+MODULE_SCOPE int SysNotify_Init (Tcl_Interp* interp);
+
#endif /* _TKUNIXINT */
+
/*
* Local Variables:
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index d55fde0..fe0a9a9 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -4,7 +4,7 @@
* This file contains routines for dealing with international keyboard
* input.
*
- * Copyright (c) 1997 by Sun Microsystems, Inc.
+ * Copyright © 1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -12,28 +12,10 @@
#include "tkInt.h"
-#ifdef __GNUC__
-/*
- * We know that XKeycodeToKeysym is deprecated, nothing we can do about it.
- */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
-/*
-** Bug [3607830]: Before using Xkb, it must be initialized. TkpOpenDisplay
-** does this and sets the USE_XKB flag if xkb is supported.
-** (should this be function ptr?)
-*/
-
-#ifdef HAVE_XKBKEYCODETOKEYSYM
-# include <X11/XKBlib.h>
-#else
-# define XkbKeycodeToKeysym(D,K,G,L) XKeycodeToKeysym(D,K,L)
-#endif
-#define TkKeycodeToKeysym(D,K,G,L) \
- ((D)->flags & TK_DISPLAY_USE_XKB) ? \
- XkbKeycodeToKeysym((D)->display,K,G,L) : \
- XKeycodeToKeysym((D)->display,K,L)
+#undef register /* Keyword "register" is used in XKBlib.h, so don't try tricky things here */
+#define XkbOpenDisplay XkbOpenDisplay_ /* Move out of the way, conflicting definitions */
+#include <X11/XKBlib.h>
+#undef XkbOpenDisplay
/*
* Prototypes for local functions defined in this file:
@@ -118,7 +100,7 @@ TkpGetString(
XEvent *eventPtr, /* X keyboard event. */
Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */
{
- int len;
+ TkSizeT len;
Tcl_DString buf;
TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr;
@@ -129,7 +111,7 @@ TkpGetString(
if (kePtr->charValuePtr != NULL) {
Tcl_DStringSetLength(dsPtr, kePtr->charValueLen);
memcpy(Tcl_DStringValue(dsPtr), kePtr->charValuePtr,
- (unsigned) kePtr->charValueLen+1);
+ kePtr->charValueLen+1);
return Tcl_DStringValue(dsPtr);
}
@@ -235,15 +217,15 @@ TkpGetString(
*/
done:
- kePtr->charValuePtr = ckalloc(len + 1);
+ kePtr->charValuePtr = (char *)ckalloc(len + 1);
kePtr->charValueLen = len;
- memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), (unsigned) len + 1);
+ memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), len + 1);
return Tcl_DStringValue(dsPtr);
}
/*
* When mapping from a keysym to a keycode, need information about the
- * modifier state to be used so that when they call TkKeycodeToKeysym taking
+ * modifier state to be used so that when they call XbkKeycodeToKeysym taking
* into account the xkey.state, they will get back the original keysym.
*/
@@ -313,10 +295,6 @@ TkpSetKeycodeAndState(
*----------------------------------------------------------------------
*/
-#ifdef __GNUC__
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
KeySym
TkpGetKeySym(
TkDisplay *dispPtr, /* Display in which to map keycode. */
@@ -381,8 +359,7 @@ TkpGetKeySym(
&& (eventPtr->xkey.state & LockMask))) {
index += 1;
}
-
- sym = TkKeycodeToKeysym(dispPtr, eventPtr->xkey.keycode, 0,
+ sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, 0,
index);
/*
@@ -401,7 +378,7 @@ TkpGetKeySym(
|| ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
|| ((sym >= XK_Oslash) && (sym <= XK_Thorn)))) {
index &= ~1;
- sym = TkKeycodeToKeysym(dispPtr, eventPtr->xkey.keycode,
+ sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
0, index);
}
}
@@ -412,7 +389,7 @@ TkpGetKeySym(
*/
if ((index & 1) && (sym == NoSymbol)) {
- sym = TkKeycodeToKeysym(dispPtr, eventPtr->xkey.keycode,
+ sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
0, index & ~1);
}
return sym;
@@ -462,7 +439,7 @@ TkpInitKeymapInfo(
if (*codePtr == 0) {
continue;
}
- keysym = TkKeycodeToKeysym(dispPtr, *codePtr, 0, 0);
+ keysym = XkbKeycodeToKeysym(dispPtr->display, *codePtr, 0, 0);
if (keysym == XK_Shift_Lock) {
dispPtr->lockUsage = LU_SHIFT;
break;
@@ -488,7 +465,7 @@ TkpInitKeymapInfo(
if (*codePtr == 0) {
continue;
}
- keysym = TkKeycodeToKeysym(dispPtr, *codePtr, 0, 0);
+ keysym = XkbKeycodeToKeysym(dispPtr->display, *codePtr, 0, 0);
if (keysym == XK_Mode_switch) {
dispPtr->modeModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
@@ -510,7 +487,7 @@ TkpInitKeymapInfo(
}
dispPtr->numModKeyCodes = 0;
arraySize = KEYCODE_ARRAY_SIZE;
- dispPtr->modKeyCodes = ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode));
+ dispPtr->modKeyCodes = (KeyCode *)ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode));
for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) {
if (*codePtr == 0) {
continue;
@@ -537,7 +514,7 @@ TkpInitKeymapInfo(
*/
arraySize *= 2;
- newCodes = ckalloc(arraySize * sizeof(KeyCode));
+ newCodes = (KeyCode *)ckalloc(arraySize * sizeof(KeyCode));
memcpy(newCodes, dispPtr->modKeyCodes,
dispPtr->numModKeyCodes * sizeof(KeyCode));
ckfree(dispPtr->modKeyCodes);
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 4ef5af2..08df309 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -3,13 +3,12 @@
*
* This module implements the UNIX platform-specific features of menus.
*
- * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
+ * Copyright © 1996-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkUnixInt.h"
#include "tkMenu.h"
@@ -443,7 +442,7 @@ DrawMenuEntryBackground(
|| (menuPtr->postedCascade != mePtr))) {
relief = TK_RELIEF_FLAT;
} else {
- relief = TK_RELIEF_RAISED;
+ Tk_GetReliefFromObj(NULL, menuPtr->activeReliefPtr, &relief);
}
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
@@ -632,7 +631,6 @@ DrawMenuSeparator(
{
XPoint points[2];
Tk_3DBorder border;
-
if (menuPtr->menuType == MENUBAR) {
return;
}
@@ -862,7 +860,7 @@ DrawMenuUnderline(
const char *label, *start, *end;
label = Tcl_GetString(mePtr->labelPtr);
- start = TkUtfAtIndex(label, mePtr->underline);
+ start = Tcl_UtfAtIndex(label, mePtr->underline);
end = start + TkUtfToUniChar(start, &ch);
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
@@ -938,7 +936,7 @@ TkpPostTearoffMenu(
int vRootX, vRootY, vRootWidth, vRootHeight;
int result;
- if (index >= menuPtr->numEntries) {
+ if (index >= (int)menuPtr->numEntries) {
index = menuPtr->numEntries - 1;
}
if (index >= 0) {
@@ -1128,7 +1126,7 @@ TkpComputeMenubarGeometry(
menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
Tk_GetFontMetrics(menuFont, &menuMetrics);
- for (i = 0; i < menuPtr->numEntries; i++) {
+ for (i = 0; i < (int)menuPtr->numEntries; i++) {
mePtr = menuPtr->entries[i];
mePtr->entryFlags &= ~ENTRY_LAST_COLUMN;
if (mePtr->fontPtr != NULL) {
@@ -1205,7 +1203,7 @@ TkpComputeMenubarGeometry(
maxWidth = x + menuPtr->entries[lastEntry]->width + borderWidth;
}
x = borderWidth;
- for (j = lastRowBreak; j < menuPtr->numEntries; j++) {
+ for (j = lastRowBreak; j < (int)menuPtr->numEntries; j++) {
if (j == helpMenuIndex) {
continue;
}
@@ -1370,16 +1368,16 @@ SetHelpMenu(
cascadeEntryPtr != NULL;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
if ((cascadeEntryPtr->menuPtr->menuType == MENUBAR)
- && (cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin != NULL)
- && (menuPtr->masterMenuPtr->tkwin != NULL)) {
- TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr;
+ && (cascadeEntryPtr->menuPtr->mainMenuPtr->tkwin != NULL)
+ && (menuPtr->mainMenuPtr->tkwin != NULL)) {
+ TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->mainMenuPtr;
char *helpMenuName = (char *)ckalloc(strlen(Tk_PathName(
- masterMenuPtr->tkwin)) + strlen(".help") + 1);
+ mainMenuPtr->tkwin)) + strlen(".help") + 1);
- strcpy(helpMenuName, Tk_PathName(masterMenuPtr->tkwin));
+ strcpy(helpMenuName, Tk_PathName(mainMenuPtr->tkwin));
strcat(helpMenuName, ".help");
if (strcmp(helpMenuName,
- Tk_PathName(menuPtr->masterMenuPtr->tkwin)) == 0) {
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin)) == 0) {
cascadeEntryPtr->entryFlags |= ENTRY_HELP_MENU;
} else {
cascadeEntryPtr->entryFlags &= ~ENTRY_HELP_MENU;
@@ -1707,7 +1705,7 @@ TkpComputeStandardMenuGeometry(
Tk_GetFontMetrics(menuFont, &menuMetrics);
accelSpace = Tk_TextWidth(menuFont, "M", 1);
- for (i = 0; i < menuPtr->numEntries; i++) {
+ for (i = 0; i < (int)menuPtr->numEntries; i++) {
mePtr = menuPtr->entries[i];
if (mePtr->fontPtr == NULL) {
tkfont = menuFont;
@@ -1802,7 +1800,7 @@ TkpComputeStandardMenuGeometry(
if (accelWidth != 0) {
labelWidth += accelSpace;
}
- for (j = lastColumnBreak; j < menuPtr->numEntries; j++) {
+ for (j = lastColumnBreak; j < (int)menuPtr->numEntries; j++) {
menuPtr->entries[j]->indicatorSpace = indicatorSpace;
menuPtr->entries[j]->labelWidth = labelWidth;
menuPtr->entries[j]->width = indicatorSpace + labelWidth
@@ -1849,7 +1847,7 @@ TkpComputeStandardMenuGeometry(
void
TkpMenuNotifyToplevelCreate(
- TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */
+ TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */
TCL_UNUSED(const char *)) /* The name of the menu to reconfigure. */
{
/*
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index b212aea..5bb82f1 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -4,7 +4,7 @@
* This file implements the Unix specific portion of the menubutton
* widget.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -319,6 +319,7 @@ void
TkpDestroyMenuButton(
TkMenuButton *mbPtr)
{
+ (void)mbPtr;
}
/*
diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h
index 44926a4..092b543 100644
--- a/unix/tkUnixPort.h
+++ b/unix/tkUnixPort.h
@@ -26,11 +26,7 @@
#include <math.h>
#include <string.h>
#include <limits.h>
-#ifdef NO_STDLIB_H
-# include "../compat/stdlib.h"
-#else
-# include <stdlib.h>
-#endif
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/file.h>
#ifdef HAVE_SYS_SELECT_H
@@ -40,24 +36,14 @@
#ifndef _TCL
# include <tcl.h>
#endif
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
+#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
-# else
-# include <time.h>
-# endif
#endif
-#if HAVE_INTTYPES_H
+#include <time.h>
+#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
-#ifndef NO_UNISTD_H
-# include <unistd.h>
-#else
-# include "../compat/unistd.h"
-#endif
+#include <unistd.h>
#if defined(__GNUC__) && !defined(__cplusplus)
# pragma GCC diagnostic ignored "-Wc++-compat"
#endif
@@ -114,32 +100,19 @@
# define NBBY 8
#endif
-#ifdef __CYGWIN__
-# include "tkIntXlibDecls.h"
-# define UINT unsigned int
-# define HWND void *
-# define HDC void *
-# define HINSTANCE void *
-# define COLORREF void *
-# define HMENU void *
-# define TkWinDCState void
-# define HPALETTE void *
-# define WNDPROC void *
-# define WPARAM void *
-# define LPARAM void *
-# define LRESULT void *
-
-#else /* !__CYGWIN__ */
- /*
- * The TkPutImage macro strips off the color table information, which isn't
- * needed for X.
- */
-
-# define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \
- XPutImage(display, pixels, gc, image, srcx, srcy, destx, \
- desty, width, height);
-
-#endif /* !__CYGWIN__ */
+#include "tkIntXlibDecls.h"
+#define UINT unsigned int
+#define HWND void *
+#define HDC void *
+#define HINSTANCE void *
+#define COLORREF void *
+#define HMENU void *
+#define TkWinDCState void
+#define HPALETTE void *
+#define WNDPROC void *
+#define WPARAM void *
+#define LPARAM void *
+#define LRESULT void *
/*
* Supply macros for seek offsets, if they're not already provided by
@@ -191,7 +164,7 @@
#ifndef __CYGWIN__
#define TkpPrintWindowId(buf,w) \
- sprintf((buf), "0x%08lx", (unsigned long) (w))
+ sprintf((buf), "0x%lx", (unsigned long) (w))
#endif
/*
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index 226445c..3f463f6 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -3,7 +3,7 @@
*
* Alternate implementation of tkUnixFont.c using Xft.
*
- * Copyright (c) 2002-2003 Keith Packard
+ * Copyright © 2002-2003 Keith Packard
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -55,11 +55,25 @@ typedef struct {
static Tcl_ThreadDataKey dataKey;
/*
- * Package initialization:
- * Nothing to do here except register the fact that we're using Xft in
- * the TIP 59 configuration database.
+ *-------------------------------------------------------------------------
+ *
+ * TkpFontPkgInit --
+ *
+ * This procedure is called when an application is created. It
+ * initializes all the structures that are used by the
+ * platform-dependant code on a per application basis.
+ * Note that this is called before TkpInit() !
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
*/
+
static int utf8ToUcs4(const char *source, FcChar32 *c, int numBytes)
{
if (numBytes >= 6) {
@@ -72,12 +86,7 @@ void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- static const Tcl_Config cfg[] = {
- { "fontsystem", "xft" },
- { 0,0 }
- };
-
- Tcl_RegisterConfig(mainPtr->interp, "tk", cfg, "utf-8");
+ (void)mainPtr;
}
static XftFont *
@@ -198,7 +207,7 @@ GetTkFontAttributes(
slant = XFT_SLANT_ROMAN;
}
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("family %s size %d weight %d slant %d\n",
family, (int)size, weight, slant);
#endif /* DEBUG_FONTSEL */
@@ -443,7 +452,7 @@ TkpGetNativeFont(
{
UnixFtFont *fontPtr;
FcPattern *pattern;
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("TkpGetNativeFont %s\n", name);
#endif /* DEBUG_FONTSEL */
@@ -481,7 +490,7 @@ TkpGetFontFromAttributes(
int weight, slant;
UnixFtFont *fontPtr;
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("TkpGetFontFromAttributes %s-%d %d %d\n", faPtr->family,
faPtr->size, faPtr->weight, faPtr->slant);
#endif /* DEBUG_FONTSEL */
@@ -661,9 +670,9 @@ TkpGetSubFonts(
void
TkpGetFontAttrsForChar(
- TCL_UNUSED(Tk_Window), /* Window on the font's display */
+ TCL_UNUSED(Tk_Window), /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
- int c, /* Character of interest */
+ int c, /* Character of interest */
TkFontAttributes *faPtr) /* Output: Font attributes */
{
UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
@@ -708,7 +717,7 @@ Tk_MeasureChars(
int clen, curX, newX, curByte, newByte, sawNonSpace;
int termByte = 0, termX = 0, errorFlag = 0;
Tk_ErrorHandler handler;
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
char string[256];
int len = 0;
#endif /* DEBUG_FONTSEL */
@@ -745,7 +754,7 @@ Tk_MeasureChars(
sawNonSpace = 1;
}
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
string[len++] = (char) c;
#endif /* DEBUG_FONTSEL */
ftFont = GetFont(fontPtr, c, 0.0);
@@ -785,7 +794,7 @@ Tk_MeasureChars(
curByte = newByte;
}
Tk_DeleteErrorHandler(handler);
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
string[len] = '\0';
printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte);
#endif /* DEBUG_FONTSEL */
@@ -925,7 +934,7 @@ Tk_DrawChars(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (fontPtr->ftDraw == 0) {
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
@@ -1060,7 +1069,7 @@ TkDrawAngledChars(
int originX, originY;
if (fontPtr->ftDraw == 0) {
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
@@ -1169,7 +1178,7 @@ TkDrawAngledChars(
double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
if (fontPtr->ftDraw == 0) {
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
@@ -1380,12 +1389,12 @@ TkpDrawAngledCharsInContext(
void
TkUnixSetXftClipRegion(
- TkRegion clipRegion) /* The clipping region to install. */
+ Region clipRegion) /* The clipping region to install. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- tsdPtr->clipRegion = (Region) clipRegion;
+ tsdPtr->clipRegion = clipRegion;
}
/*
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index a603432..feab521 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -3,8 +3,8 @@
*
* This file implements the X specific portion of the scrollbar widget.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 by Scriptics Corporation.
+ * Copyright © 1996 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c
index 69843db..5a1896f 100644
--- a/unix/tkUnixScrlbr.c
+++ b/unix/tkUnixScrlbr.c
@@ -4,7 +4,7 @@
* This file implements the Unix specific portion of the scrollbar
* widget.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 527bc4c..92c30c9 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -3,7 +3,7 @@
*
* This file contains X specific routines for manipulating selections.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 03d124f..de9eadf 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -4,9 +4,9 @@
* This file provides functions that implement the "send" command,
* allowing commands to be passed from interpreter to interpreter.
*
- * Copyright (c) 1989-1994 The Regents of the University of California.
- * Copyright (c) 1994-1996 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1989-1994 The Regents of the University of California.
+ * Copyright © 1994-1996 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -2049,7 +2049,7 @@ TkpTestsendCmd(
Tcl_DStringFree(&tmp);
}
} else if (index == TESTSEND_SERIAL) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(localData.sendSerial+1));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(localData.sendSerial+1));
}
return TCL_OK;
}
diff --git a/unix/tkUnixSysNotify.c b/unix/tkUnixSysNotify.c
new file mode 100755
index 0000000..1572027
--- /dev/null
+++ b/unix/tkUnixSysNotify.c
@@ -0,0 +1,221 @@
+/*
+ * tkUnixSysNotify.c --
+ *
+ * tkUnixSysNotify.c implements a "sysnotify" Tcl command which
+ * permits one to post system notifications based on the libnotify API.
+ *
+ * Copyright © 2020 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 2020 Christian Werner for runtime linking
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkInt.h"
+#include "tkUnixInt.h"
+
+/*
+ * Runtime linking of libnotify.
+ */
+
+typedef int (*fn_ln_init)(const char *);
+typedef void (*fn_ln_uninit)(void);
+typedef void * (*fn_ln_notification_new)(const char *, const char *,
+ const char *, void *);
+typedef int (*fn_ln_notification_show)(void *, int *);
+
+static struct {
+ int nopen;
+ Tcl_LoadHandle lib;
+ fn_ln_init init;
+ fn_ln_uninit uninit;
+ fn_ln_notification_new notification_new;
+ fn_ln_notification_show notification_show;
+} ln_fns = {
+ 0, NULL, NULL, NULL, NULL, NULL
+};
+
+#define notify_init ln_fns.init
+#define notify_uninit ln_fns.uninit
+#define notify_notification_new ln_fns.notification_new
+#define notify_notification_show ln_fns.notification_show
+
+TCL_DECLARE_MUTEX(ln_mutex);
+
+/*
+ * Forward declarations for procedures defined in this file.
+ */
+
+static void SysNotifyDeleteCmd(void *);
+static int SysNotifyCmd(void *, Tcl_Interp *, int, Tcl_Obj * const*);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SysNotifyDeleteCmd --
+ *
+ * Delete notification and clean up.
+ *
+ * Results:
+ * Window destroyed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+SysNotifyDeleteCmd (
+ TCL_UNUSED(void *))
+{
+ Tcl_MutexLock(&ln_mutex);
+ if (--ln_fns.nopen == 0) {
+ if (notify_uninit) {
+ notify_uninit();
+ }
+ if (ln_fns.lib != NULL) {
+ Tcl_FSUnloadFile(NULL, ln_fns.lib);
+ }
+ memset(&ln_fns, 0, sizeof(ln_fns));
+ }
+ Tcl_MutexUnlock(&ln_mutex);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SysNotifyCreateCmd --
+ *
+ * Create tray command and (unreal) window.
+ *
+ * Results:
+ * Icon tray and hidden window created.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+SysNotifyCmd(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const *objv)
+{
+ const char *title;
+ const char *message;
+ const char *icon;
+ void *notif;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "title message");
+ return TCL_ERROR;
+ }
+
+ /*
+ * Pass strings to notification, and use a sane platform-specific
+ * icon in the alert.
+ */
+
+ title = Tcl_GetString(objv[1]);
+ message = Tcl_GetString(objv[2]);
+ icon = "dialog-information";
+
+ /*
+ * Call to notify_init should go here to prevent test suite failure.
+ */
+
+ if (notify_init && notify_notification_new && notify_notification_show) {
+ Tcl_Encoding enc;
+ Tcl_DString dst, dsm;
+
+ enc = Tcl_GetEncoding(NULL, "utf-8");
+ Tcl_ExternalToUtfDString(enc, title, -1, &dst);
+ Tcl_ExternalToUtfDString(enc, message, -1, &dsm);
+ notify_init("Wish");
+ notif = notify_notification_new(title, message, icon, NULL);
+ notify_notification_show(notif, NULL);
+ Tcl_DStringFree(&dsm);
+ Tcl_DStringFree(&dst);
+ Tcl_FreeEncoding(enc);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SysNotify_Init --
+ *
+ * Initialize the command.
+ *
+ * Results:
+ * Command initialized.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+SysNotify_Init(
+ Tcl_Interp *interp)
+{
+ Tcl_MutexLock(&ln_mutex);
+ if (ln_fns.nopen == 0) {
+ int i = 0;
+ Tcl_Obj *nameobj;
+ static const char *lnlibs[] = {
+ "libnotify.so.4",
+ "libnotify.so.3",
+ "libnotify.so.2",
+ "libnotify.so.1",
+ "libnotify.so",
+ NULL
+ };
+
+ while (lnlibs[i] != NULL) {
+ Tcl_ResetResult(interp);
+ nameobj = Tcl_NewStringObj(lnlibs[i], -1);
+ Tcl_IncrRefCount(nameobj);
+ if (Tcl_LoadFile(interp, nameobj, NULL, 0, NULL, &ln_fns.lib)
+ == TCL_OK) {
+ Tcl_DecrRefCount(nameobj);
+ break;
+ }
+ Tcl_DecrRefCount(nameobj);
+ ++i;
+ }
+ if (ln_fns.lib != NULL) {
+#define LN_SYM(name) \
+ ln_fns.name = (fn_ln_ ## name) \
+ Tcl_FindSymbol(NULL, ln_fns.lib, "notify_" #name)
+ LN_SYM(init);
+ LN_SYM(uninit);
+ LN_SYM(notification_new);
+ LN_SYM(notification_show);
+#undef LN_SYM
+ }
+ }
+ ln_fns.nopen++;
+ Tcl_MutexUnlock(&ln_mutex);
+
+ Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", SysNotifyCmd,
+ interp, SysNotifyDeleteCmd);
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * coding: utf-8
+ * End:
+ */
+
diff --git a/unix/tkUnixSysTray.c b/unix/tkUnixSysTray.c
new file mode 100644
index 0000000..03414e7
--- /dev/null
+++ b/unix/tkUnixSysTray.c
@@ -0,0 +1,1724 @@
+/*
+ * tkUnixSysTray.c --
+ *
+ * tkUnixSysTray.c implements a "systray" Tcl command which permits to
+ * change the system tray/taskbar icon of a Tk toplevel window and
+ * to post system notifications.
+ *
+ * Copyright © 2005 Anton Kovalenko.
+ * Copyright © 2020 Kevin Walzer/WordTech Communications LLC.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkInt.h"
+#include "tkUnixInt.h"
+
+/*
+ * Based extensively on the tktray extension package. Here we are removing
+ * non-essential parts of tktray.
+ */
+
+#include <time.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <X11/X.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+/* XEmbed definitions
+ * See http://www.freedesktop.org/wiki/Standards_2fxembed_2dspec
+ * */
+#define XEMBED_MAPPED (1<<0)
+/* System tray opcodes
+ * See http://www.freedesktop.org/wiki/Standards_2fsystemtray_2dspec
+ * */
+#define SYSTEM_TRAY_REQUEST_DOCK 0
+#define SYSTEM_TRAY_BEGIN_MESSAGE 1
+#define SYSTEM_TRAY_CANCEL_MESSAGE 2
+
+/* Flags of widget configuration options */
+#define ICON_CONF_IMAGE (1<<0) /* Image changed */
+#define ICON_CONF_REDISPLAY (1<<1) /* Redisplay required */
+#define ICON_CONF_XEMBED (1<<2) /* Remapping or unmapping required */
+#define ICON_CONF_CLASS (1<<3) /* TODO WM_CLASS update required */
+#define ICON_CONF_FIRST_TIME (1<<4) /* For IconConfigureMethod invoked by the constructor */
+
+/* Widget states */
+#define ICON_FLAG_REDRAW_PENDING (1<<0)
+#define ICON_FLAG_ARGB32 (1<<1)
+#define ICON_FLAG_DIRTY_EDGES (1<<2)
+
+#define TKU_NO_BAD_WINDOW_BEGIN(display) \
+ { Tk_ErrorHandler error__handler = \
+ Tk_CreateErrorHandler(display, BadWindow, -1, -1, NULL, NULL);
+#define TKU_NO_BAD_WINDOW_END Tk_DeleteErrorHandler(error__handler); }
+
+/*Declaration for utility functions.*/
+static void TKU_WmWithdraw(Tk_Window winPtr, Tcl_Interp* interp);
+static Tk_Window TKU_GetWrapper(Tk_Window winPtr);
+void TKU_AddInput(Display* dpy, Window win, long add_to_mask);
+static Tk_Window TKU_Wrapper(Tk_Window w, Tcl_Interp* interp);
+static Window TKU_XID(Tk_Window w);
+
+/* Customized window withdraw */
+static void
+TKU_WmWithdraw(
+ Tk_Window winPtr,
+ TCL_UNUSED(Tcl_Interp *))
+{
+ TkpWmSetState((TkWindow*)winPtr, WithdrawnState);
+}
+
+/* The wrapper should exist */
+static Tk_Window
+TKU_GetWrapper(
+ Tk_Window winPtr)
+{
+ return (Tk_Window)
+ TkpGetWrapperWindow((TkWindow*)winPtr);
+}
+
+/* Subscribe for extra X11 events (needed for MANAGER selection) */
+void
+TKU_AddInput(
+ Display* dpy,
+ Window win,
+ long add_to_mask)
+{
+ XWindowAttributes xswa;
+ TKU_NO_BAD_WINDOW_BEGIN(dpy)
+ XGetWindowAttributes(dpy,win,&xswa);
+ XSelectInput(dpy,win,xswa.your_event_mask|add_to_mask);
+ TKU_NO_BAD_WINDOW_END
+}
+
+/* Get Tk Window wrapper (make it exist if ny) */
+static Tk_Window
+TKU_Wrapper(
+ Tk_Window w,
+ Tcl_Interp* interp)
+{
+ Tk_Window wrapper = TKU_GetWrapper(w);
+ if (!wrapper) {
+ Tk_MakeWindowExist(w);
+ TKU_WmWithdraw(w, interp);
+ Tk_MapWindow(w);
+ wrapper = (Tk_Window) TKU_GetWrapper(w);
+ }
+ return wrapper;
+}
+
+/* Return X window id for Tk window (make it exist if ny) */
+static Window
+TKU_XID(
+ Tk_Window w)
+{
+ Window xid = Tk_WindowId(w);
+ if (xid == None) {
+ Tk_MakeWindowExist(w);
+ xid = Tk_WindowId(w);
+ }
+ return xid;
+}
+
+/* Data structure representing dock widget */
+typedef struct {
+ /* standard for widget */
+ Tk_Window tkwin, drawingWin;
+ Window wrapper;
+ Window myManager;
+ Window trayManager;
+
+ Tk_OptionTable options;
+ Tcl_Interp *interp;
+ Tcl_Command widgetCmd;
+
+ Tk_Image image; /* image to be drawn */
+
+ /* Only one of imageVisualInstance and photo is needed for argb32
+ * operations. Unless imageString changes, imageVisualInstance is
+ * always valid for the same drawingWin instance, but photo is
+ * invalidated by any "whole image" type change. */
+
+ Tk_Image imageVisualInstance; /* image instance for use with argb32 */
+ Tk_PhotoHandle photo; /* !null if it's really a photo */
+
+ /* Offscreen pixmap is created for a given imageWidth,
+ * imageHeight, drawingWin, and invalidated (and freed) on image
+ * resize or drawingWin destruction.
+
+ * Contents of this pixmap is synced on demand; when image changes
+ * but is not resized, pixmap is marked as out-of-sync. Next time
+ * when redisplay is needed, pixmap is updated before drawing
+ * operation.
+ */
+
+ Pixmap offscreenPixmap;
+ /* There is no need to recreate GC ever; it remains valid once
+ * created */
+
+ GC offscreenGC;
+
+ /* XImage for drawing ARGB32 photo on offscreenPixmap. Should be
+ * freed and nullified each time when a pixmap is freed. Needed
+ * (and created) when redrawing an image being a photo on ARGB32
+ * offscreen pixmap. */
+ XImage *offscreenImage; /* for photo (argb32) drawing code */
+
+ Visual *bestVisual; /* Visual, when it's specified by tray
+ * manager AND is guessed to be
+ * ARGB32 */
+ Colormap bestColormap; /* Colormap for bestVisual */
+
+ Atom aMANAGER;
+ Atom a_NET_SYSTEM_TRAY_Sn;
+ Atom a_XEMBED_INFO;
+ Atom a_NET_SYSTEM_TRAY_MESSAGE_DATA;
+ Atom a_NET_SYSTEM_TRAY_OPCODE;
+ Atom a_NET_SYSTEM_TRAY_ORIENTATION;
+ Atom a_NET_SYSTEM_TRAY_VISUAL;
+
+ int flags; /* ICON_FLAG_ - see defines above */
+ int msgid; /* Last balloon message ID */
+ int useShapeExt;
+
+ int x,y,width,height;
+ int imageWidth, imageHeight;
+ int requestedWidth, requestedHeight;
+ int visible; /* whether XEMBED_MAPPED should be set */
+ int docked; /* whether an icon should be docked */
+ char *imageString, /* option: -image as string */
+ *classString; /* option: -class as string */
+} DockIcon;
+
+/*
+ * Forward declarations for procedures defined in this file.
+ */
+
+static int TrayIconCreateCmd(ClientData cd, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+static int TrayIconObjectCmd(ClientData cd, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+static int TrayIconConfigureMethod(DockIcon *icon, Tcl_Interp* interp,
+ int objc, Tcl_Obj *const objv[],
+ int addflags);
+static int PostBalloon(DockIcon* icon, const char * utf8msg,
+ long timeout);
+static void CancelBalloon(DockIcon* icon, int msgid);
+static int QueryTrayOrientation(DockIcon* icon);
+
+static void TrayIconDeleteProc(ClientData cd );
+static Atom DockSelectionAtomFor(Tk_Window tkwin);
+static void DockToManager(DockIcon *icon);
+static void CreateTrayIconWindow(DockIcon *icon);
+
+static void TrayIconRequestSize(DockIcon* icon, int w, int h);
+static void TrayIconForceImageChange(DockIcon* icon);
+static void TrayIconUpdate(DockIcon* icon, int mask);
+
+static void EventuallyRedrawIcon(DockIcon* icon);
+static void DisplayIcon(ClientData cd);
+
+static void RetargetEvent(DockIcon *icon, XEvent *ev);
+
+static void TrayIconEvent(ClientData cd, XEvent* ev);
+static void UserIconEvent(ClientData cd, XEvent* ev);
+static void TrayIconWrapperEvent(ClientData cd, XEvent* ev);
+static int IconGenericHandler(ClientData cd, XEvent *ev);
+
+int Tktray_Init (Tcl_Interp* interp );
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TrayIconObjectCmd --
+ *
+ * Manage attributes of tray icon.
+ *
+ * Results:
+ * Various values of the tray icon are set and retrieved.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TrayIconObjectCmd(
+ ClientData cd,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ DockIcon *icon = (DockIcon*)cd;
+ int bbox[4] = {0,0,0,0};
+ Tcl_Obj * bboxObj;
+ int wcmd;
+ int i;
+ XWindowAttributes xwa;
+ Window bogus;
+ int msgid;
+
+ enum {XWC_CONFIGURE = 0, XWC_CGET, XWC_BALLOON, XWC_CANCEL,
+ XWC_BBOX, XWC_DOCKED, XWC_ORIENTATION};
+ const char *st_wcmd[] = {"configure", "cget", "balloon", "cancel",
+ "bbox", "docked", "orientation", NULL};
+
+ long timeout = 0;
+ Tcl_Obj* optionValue;
+
+ if (objc<2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(interp, objv[1], st_wcmd,
+ "subcommand", TCL_EXACT, &wcmd) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ switch (wcmd) {
+ case XWC_CONFIGURE:
+ return TrayIconConfigureMethod(icon,interp,objc-2,objv+2,0);
+
+ case XWC_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp,2,objv,"option");
+ return TCL_ERROR;
+ }
+ optionValue = Tk_GetOptionValue(interp,(char*)icon,
+ icon->options,objv[2],icon->tkwin);
+ if (optionValue) {
+ Tcl_SetObjResult(interp,optionValue);
+ return TCL_OK;
+ } else {
+ return TCL_ERROR;
+ }
+
+ case XWC_BALLOON:
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "message ?timeout?");
+ return TCL_ERROR;
+ }
+ if (objc == 4) {
+ if (Tcl_GetLongFromObj(interp,objv[3],&timeout) != TCL_OK)
+ return TCL_ERROR;
+ }
+ msgid = PostBalloon(icon,Tcl_GetString(objv[2]), timeout);
+ Tcl_SetObjResult(interp,Tcl_NewIntObj(msgid));
+ return TCL_OK;
+
+ case XWC_CANCEL:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "messageId");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIntFromObj(interp,objv[2],&msgid) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (msgid)
+ CancelBalloon(icon,msgid);
+ return TCL_OK;
+
+ case XWC_BBOX:
+ if (icon->drawingWin) {
+ XGetWindowAttributes(Tk_Display(icon->drawingWin),
+ TKU_XID(icon->drawingWin), &xwa);
+
+ XTranslateCoordinates(Tk_Display(icon->drawingWin),
+ TKU_XID(icon->drawingWin), xwa.root, 0,0,
+ &icon->x, &icon->y, &bogus);
+ bbox[0] = icon->x;
+ bbox[1] = icon->y;
+ bbox[2] = bbox[0] + icon->width - 1;
+ bbox[3] = bbox[1] + icon->height - 1;
+ }
+ bboxObj = Tcl_NewObj();
+ for (i = 0; i < 4; ++i) {
+ Tcl_ListObjAppendElement(interp, bboxObj, Tcl_NewIntObj(bbox[i]));
+ }
+ Tcl_SetObjResult(interp, bboxObj);
+ return TCL_OK;
+
+ case XWC_DOCKED:
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(icon->myManager != None));
+ return TCL_OK;
+
+ case XWC_ORIENTATION:
+ if (icon->myManager == None || icon->wrapper == None) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1));
+ } else {
+ switch(QueryTrayOrientation(icon)) {
+ case 0:
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("horizontal", -1));
+ break;
+ case 1:
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("vertical", -1));
+ break;
+ default:
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown", -1));
+ break;
+ }
+ }
+ return TCL_OK;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * QueryTrayOrientation --
+ *
+ * Obtain the orientation of the tray icon.
+ *
+ * Results:
+ * Orientation is returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+QueryTrayOrientation(
+ DockIcon* icon)
+{
+ Atom retType = None;
+ int retFormat = 32;
+ unsigned long retNitems, retBytesAfter;
+ unsigned char *retProp = NULL;
+ int result = -1;
+
+ if (icon->wrapper != None && icon->myManager != None) {
+ XGetWindowProperty(Tk_Display(icon->tkwin),
+ icon->myManager,
+ icon->a_NET_SYSTEM_TRAY_ORIENTATION,
+ /* offset */ 0,
+ /* length */ 1,
+ /* delete */ False,
+ /* type */ XA_CARDINAL,
+ &retType, &retFormat, &retNitems,
+ &retBytesAfter, &retProp);
+ if (retType == XA_CARDINAL && retFormat == 32 && retNitems == 1) {
+ result = (int) *(long*)retProp;
+ }
+ if (retProp) {
+ XFree(retProp);
+ }
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DockSelectionAtomFor --
+ *
+ * Obtain the dock selection atom.
+ *
+ * Results:
+ * Selection returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Atom
+DockSelectionAtomFor(
+ Tk_Window tkwin)
+{
+ char buf[256];
+ /* no snprintf in C89 */
+ sprintf(buf,"_NET_SYSTEM_TRAY_S%d",Tk_ScreenNumber(tkwin));
+ return Tk_InternAtom(tkwin,buf);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XembedSetState --
+ *
+ * Set the xembed state.
+ *
+ * Results:
+ * Updates the xembed state.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+XembedSetState(
+ DockIcon *icon,
+ long xembedState)
+{
+ long info[] = { 0, 0 };
+ info[1] = xembedState;
+ if (icon->drawingWin) {
+ XChangeProperty(Tk_Display(icon->drawingWin),
+ icon->wrapper,
+ icon->a_XEMBED_INFO,
+ icon->a_XEMBED_INFO, 32,
+ PropModeReplace, (unsigned char*)info, 2);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XembedRequestDock --
+ *
+ * Obtain the docking window.
+ *
+ * Results:
+ * The dock window is requested.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+XembedRequestDock(
+ DockIcon *icon)
+{
+ Tk_Window tkwin = icon->drawingWin;
+ XEvent ev;
+ Display *dpy = Tk_Display(tkwin);
+
+ memset(&ev, 0, sizeof(ev));
+ ev.xclient.type = ClientMessage;
+ ev.xclient.window = icon->myManager;
+ ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_OPCODE;
+ ev.xclient.format = 32;
+ ev.xclient.data.l[0] = 0;
+ ev.xclient.data.l[1] = SYSTEM_TRAY_REQUEST_DOCK;
+ ev.xclient.data.l[2] = icon->wrapper;
+ ev.xclient.data.l[3] = 0;
+ ev.xclient.data.l[4] = 0;
+ XSendEvent(dpy, icon->myManager, True, StructureNotifyMask|SubstructureNotifyMask, &ev);
+ }
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CheckArgbVisual --
+ *
+ * Find out if a visual is recommended and if it looks like argb32.
+ *
+ * Results:
+ * Render the visual as needed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CheckArgbVisual(
+ DockIcon *icon)
+{
+ /* Find out if a visual is recommended and if it looks like argb32.
+ * For such visuals we should:
+ * Recreate a window if it's created but the depth is wrong;
+ * Don't use ParentRelative but blank background.
+ * For photo images, draw into a window by XPutImage.
+ */
+ Atom retType = None;
+ int retFormat = 32;
+ unsigned long retNitems, retBytesAfter;
+ unsigned char *retProp = NULL;
+ Visual *match = NULL;
+ int depth = 0;
+ Colormap cmap = None;
+
+ TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin))
+ XGetWindowProperty(Tk_Display(icon->tkwin),
+ icon->trayManager,
+ icon->a_NET_SYSTEM_TRAY_VISUAL,
+ /* offset */ 0,
+ /* length */ 1,
+ /* delete */ False,
+ /* type */ XA_VISUALID,
+ &retType, &retFormat, &retNitems,
+ &retBytesAfter, &retProp);
+ TKU_NO_BAD_WINDOW_END
+ if (retType == XA_VISUALID &&
+ retNitems == 1 &&
+ retFormat == 32) {
+ char numeric[256];
+ sprintf(numeric,"%ld",*(long*)retProp);
+ XFree(retProp);
+ match = Tk_GetVisual(icon->interp, icon->tkwin,
+ numeric, &depth, &cmap);
+ }
+ if (match&& depth == 32 &&
+ match->red_mask == 0xFF0000UL &&
+ match->green_mask == 0x00FF00UL &&
+ match->blue_mask == 0x0000FFUL) {
+ icon->bestVisual = match;
+ icon->bestColormap = cmap;
+ } else {
+ icon->bestVisual = NULL;
+ icon->bestColormap = None;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CreateTrayIconWindow --
+ *
+ * Create and configure the window for the icon tray.
+ *
+ * Results:
+ * The window is created and displayed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CreateTrayIconWindow(
+ DockIcon *icon)
+{
+ Tcl_SavedResult oldResult;
+ Tk_Window tkwin;
+ Tk_Window wrapper;
+ XSetWindowAttributes attr;
+
+ Tcl_SaveResult(icon->interp, &oldResult);
+ /* Use the same name (tail) as the widget name, to enable
+ * name-based icon management for supporting trays, as promised by
+ * the docs.
+ */
+ tkwin = icon->drawingWin = Tk_CreateWindow(icon->interp, icon->tkwin,
+ Tk_Name(icon->tkwin), "");
+ if (tkwin) {
+ Tk_SetClass(icon->drawingWin,icon->classString);
+ Tk_CreateEventHandler(icon->drawingWin,ExposureMask|StructureNotifyMask|
+ ButtonPressMask|ButtonReleaseMask|
+ EnterWindowMask|LeaveWindowMask|PointerMotionMask,
+ TrayIconEvent,(ClientData)icon);
+ if(icon->bestVisual) {
+ Tk_SetWindowVisual(icon->drawingWin,icon->bestVisual,
+ 32,icon->bestColormap);
+ icon->flags |= ICON_FLAG_ARGB32;
+ Tk_SetWindowBackground(tkwin, 0);
+ } else {
+ Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative);
+ icon->flags &= ~ICON_FLAG_ARGB32;
+ }
+ Tk_MakeWindowExist(tkwin);
+ TKU_WmWithdraw(tkwin,icon->interp);
+ wrapper = TKU_Wrapper(tkwin,icon->interp);
+
+ attr.override_redirect = True;
+ Tk_ChangeWindowAttributes(wrapper,CWOverrideRedirect,&attr);
+ Tk_CreateEventHandler(wrapper,StructureNotifyMask,TrayIconWrapperEvent,(ClientData)icon);
+ if (!icon->bestVisual) {
+ Tk_SetWindowBackgroundPixmap(wrapper, ParentRelative);
+ } else {
+ Tk_SetWindowBackground(tkwin, 0);
+ }
+ icon->wrapper = TKU_XID(wrapper);
+ TrayIconForceImageChange(icon);
+ } else {
+ Tcl_BackgroundError(icon->interp);
+ }
+ Tcl_RestoreResult(icon->interp, &oldResult);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DockToManager --
+ *
+ * Helper function to manage icon in display.
+ *
+ * Results:
+ * Icon is created and displayed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+DockToManager(
+ DockIcon *icon)
+{
+ icon->myManager = icon->trayManager;
+ Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconCreate"), NULL);
+ XembedSetState(icon, icon->visible ? XEMBED_MAPPED : 0);
+ XembedRequestDock(icon);
+}
+
+static const
+Tk_OptionSpec IconOptionSpec[] = {
+ {TK_OPTION_STRING,"-image","image","Image",
+ (char *) NULL, -1, offsetof(DockIcon, imageString),
+ TK_OPTION_NULL_OK, NULL,
+ ICON_CONF_IMAGE | ICON_CONF_REDISPLAY},
+ {TK_OPTION_STRING,"-class","class","Class",
+ "TrayIcon", -1, offsetof(DockIcon, classString),
+ 0, NULL, ICON_CONF_CLASS},
+ {TK_OPTION_BOOLEAN,"-docked","docked","Docked",
+ "1", -1, offsetof(DockIcon, docked), 0, NULL,
+ ICON_CONF_XEMBED | ICON_CONF_REDISPLAY},
+ {TK_OPTION_BOOLEAN,"-shape","shape","Shape",
+ "0", -1, offsetof(DockIcon, useShapeExt), 0, NULL,
+ ICON_CONF_IMAGE | ICON_CONF_REDISPLAY},
+ {TK_OPTION_BOOLEAN,"-visible","visible","Visible",
+ "1", -1, offsetof(DockIcon, visible), 0, NULL,
+ ICON_CONF_XEMBED | ICON_CONF_REDISPLAY},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TrayIconRequestSize --
+ *
+ * Set icon size.
+ *
+ * Results:
+ * Icon size is obtained/set.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TrayIconRequestSize(
+ DockIcon* icon,
+ int w,
+ int h)
+{
+ if (icon->drawingWin) {
+ if (icon->requestedWidth != w ||
+ icon->requestedHeight != h) {
+ Tk_SetMinimumRequestSize(icon->drawingWin,w,h);
+ Tk_GeometryRequest(icon->drawingWin,w,h);
+ Tk_SetGrid(icon->drawingWin,1,1,w,h);
+ icon->requestedWidth = w;
+ icon->requestedHeight = h;
+ }
+ } else {
+ /* Sign that no size is requested yet */
+ icon->requestedWidth = 0;
+ icon->requestedHeight = 0;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TrayIconImageChanged --
+ *
+ * Fires when icon state changes.
+ *
+ * Results:
+ * Icon changes are rendered.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TrayIconImageChanged(
+ ClientData cd,
+ int x,
+ int y,
+ int w,
+ int h,
+ int imgw,
+ int imgh)
+{
+ DockIcon *icon = (DockIcon*) cd;
+ if (imgw != icon->imageWidth || imgh != icon->imageHeight) {
+ if (icon->offscreenImage) {
+ XDestroyImage(icon->offscreenImage);
+ icon->offscreenImage = NULL;
+ }
+ if (icon->offscreenPixmap) {
+ /* its size is bad */
+ Tk_FreePixmap(Tk_Display(icon->tkwin), icon->offscreenPixmap);
+ icon->offscreenPixmap = None;
+ }
+ /* if some image dimension decreases,
+ * empty areas around the image should be cleared */
+ if (imgw < icon->imageWidth || imgh < icon->imageHeight) {
+ icon->flags |= ICON_FLAG_DIRTY_EDGES;
+ }
+ }
+ icon->imageWidth = imgw;
+ icon->imageHeight = imgh;
+ if (imgw == w && imgh == h && x == 0 && y == 0) {
+ icon->photo = NULL; /* invalidate */
+ }
+ TrayIconRequestSize(icon,imgw,imgh);
+ EventuallyRedrawIcon(icon);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * IgnoreImageChange --
+ *
+ * Currently no-op.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+IgnoreImageChange(
+ TCL_UNUSED(void *),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
+{
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ForceImageChange --
+ *
+ * Push icon changes through.
+ *
+ * Results:
+ * Icon image is updated.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TrayIconForceImageChange(
+ DockIcon* icon)
+{
+ if (icon->image) {
+ int w,h;
+ Tk_SizeOfImage(icon->image,&w,&h);
+ TrayIconImageChanged((ClientData)icon,0,0,w,h,w,h);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EventuallyRedrawIcon --
+ *
+ * Update image icon.
+ *
+ * Results:
+ * Icon image is updated.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+EventuallyRedrawIcon(
+ DockIcon* icon)
+{
+ if (icon->drawingWin && icon->myManager) { /* don't redraw invisible icon */
+ if (!(icon->flags & ICON_FLAG_REDRAW_PENDING)) { /* don't schedule multiple redraw ops */
+ icon->flags |= ICON_FLAG_REDRAW_PENDING;
+ Tcl_DoWhenIdle(DisplayIcon,(ClientData)icon);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DisplayIcon --
+ *
+ * Main function for displaying icon.
+ *
+ * Results:
+ * Icon image is displayed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+DisplayIcon(
+ ClientData cd)
+{
+ DockIcon *icon = (DockIcon*)cd;
+ int w = icon->imageWidth, h = icon->imageHeight;
+ int imgx, imgy, outx, outy, outw, outh;
+ imgx = (icon->width >= w) ? 0 : -(icon->width - w)/2;
+ imgy = (icon->height >= h) ? 0 : -(icon->height - h)/2;
+ outx = (icon->width >= w) ? (icon->width - w)/2 : 0;
+ outy = (icon->height >= h) ? (icon->height - h)/2 : 0;
+ outw = (icon->width >= w) ? w : icon->width;
+ outh = (icon->height >= h) ? h : icon->height;
+
+ icon->flags &= (~ICON_FLAG_REDRAW_PENDING);
+
+ if (icon->drawingWin && icon->docked) {
+ if (icon->flags & ICON_FLAG_ARGB32) {
+ /* ARGB32 redraw: never use a ParentRelative method, and
+ no need to clear window except FIXME when its size changed.
+ Draw on the offscreen pixmap instead, then copy to the window.
+ */
+ if (icon->offscreenPixmap == None) {
+ icon->offscreenPixmap = Tk_GetPixmap(Tk_Display(icon->drawingWin),
+ Tk_WindowId(icon->drawingWin), w, h, 32);
+ }
+ if (!icon->photo) {
+ icon->photo = Tk_FindPhoto(icon->interp, icon->imageString);
+ }
+ if (!icon->photo && !icon->imageVisualInstance) {
+ Tcl_SavedResult saved;
+ Tcl_SaveResult(icon->interp,&saved);
+ icon->imageVisualInstance = Tk_GetImage(icon->interp,icon->drawingWin,
+ icon->imageString, IgnoreImageChange,(ClientData)NULL);
+ Tcl_RestoreResult(icon->interp,&saved);
+ }
+ if (icon->photo && !icon->offscreenImage) {
+ icon->offscreenImage = XGetImage(Tk_Display(icon->drawingWin),
+ icon->offscreenPixmap, 0, 0, w, h, AllPlanes, ZPixmap);
+ }
+ if (icon->offscreenGC == None) {
+ XGCValues gcv;
+ gcv.function = GXcopy;
+ gcv.plane_mask = AllPlanes;
+ gcv.foreground = 0;
+ gcv.background = 0;
+ icon->offscreenGC = Tk_GetGC(icon->drawingWin,
+ GCFunction|GCPlaneMask|GCForeground|GCBackground, &gcv);
+ }
+ if (icon->flags & ICON_FLAG_DIRTY_EDGES) {
+ XClearWindow(Tk_Display(icon->drawingWin), TKU_XID(icon->drawingWin));
+ icon->flags &= ~ICON_FLAG_DIRTY_EDGES;
+ }
+ if (icon->photo) {
+ Tk_PhotoImageBlock pib;
+ int cx,cy;
+ XImage *xim = icon->offscreenImage;
+ /* redraw photo using raw data */
+ Tk_PhotoGetImage(icon->photo,&pib);
+ for (cy = 0; cy < h; ++cy) {
+ for (cx = 0; cx < w; ++cx) {
+ XPutPixel(xim,cx,cy,
+ (*(pib.pixelPtr +
+ pib.pixelSize*cx +
+ pib.pitch*cy +
+ pib.offset[0])<<16) |
+ (*(pib.pixelPtr +
+ pib.pixelSize*cx +
+ pib.pitch*cy +
+ pib.offset[1])<<8) |
+ (*(pib.pixelPtr +
+ pib.pixelSize*cx +
+ pib.pitch*cy +
+ pib.offset[2])) |
+ (pib.offset[3] ?
+ (*(pib.pixelPtr +
+ pib.pixelSize*cx +
+ pib.pitch*cy +
+ pib.offset[3])<<24) : 0));
+ }
+ }
+ XPutImage(Tk_Display(icon->drawingWin),
+ icon->offscreenPixmap,
+ icon->offscreenGC,
+ icon->offscreenImage,
+ 0,0,0,0,w,h);
+ } else {
+ XFillRectangle(Tk_Display(icon->drawingWin),
+ icon->offscreenPixmap,
+ icon->offscreenGC,
+ 0,0,w,h);
+ if (icon->imageVisualInstance) {
+ Tk_RedrawImage(icon->imageVisualInstance,
+ 0,0,w,h,
+ icon->offscreenPixmap,
+ 0,0);
+ }
+ }
+ XCopyArea(Tk_Display(icon->drawingWin),
+ icon->offscreenPixmap,
+ TKU_XID(icon->drawingWin),
+ icon->offscreenGC,
+ imgx,imgy,outw,outh,outx,outy);
+ } else {
+ /* Non-argb redraw: clear window and draw an image over it.
+ For photos it gives a correct alpha blending with a parent
+ window background, even if it's a fancy pixmap (proved to
+ work with lxpanel fancy backgrounds).
+ */
+ XClearWindow(Tk_Display(icon->drawingWin),
+ TKU_XID(icon->drawingWin));
+ if (icon->image && icon->visible) {
+ Tk_RedrawImage(icon->image,imgx,imgy,outw,outh,
+ TKU_XID(icon->drawingWin), outx, outy);
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RetargetEvent --
+ *
+ * Redirect X events to widgets.
+ *
+ * Results:
+ * Icon image is displayed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RetargetEvent(
+ DockIcon *icon,
+ XEvent *ev)
+{
+ int send = 0;
+ Window* saveWin1 = NULL, *saveWin2 = NULL;
+ if (!icon->visible)
+ return;
+ switch (ev->type) {
+ case MotionNotify:
+ send = 1;
+ saveWin1 = &ev->xmotion.subwindow;
+ saveWin2 = &ev->xmotion.window;
+ break;
+ case LeaveNotify:
+ case EnterNotify:
+ send = 1;
+ saveWin1 = &ev->xcrossing.subwindow;
+ saveWin2 = &ev->xcrossing.window;
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ send = 1;
+ saveWin1 = &ev->xbutton.subwindow;
+ saveWin2 = &ev->xbutton.window;
+ break;
+ case MappingNotify:
+ send = 1;
+ saveWin1 = &ev->xmapping.window;
+ }
+ if (saveWin1) {
+ Tk_MakeWindowExist(icon->tkwin);
+ *saveWin1 = Tk_WindowId(icon->tkwin);
+ if (saveWin2) *saveWin2 = *saveWin1;
+ }
+ if (send) {
+ ev->xany.send_event = 0x147321ac;
+ Tk_HandleEvent(ev);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TrayIconWrapperEvent --
+ *
+ * Ensure automapping in root window is done in withdrawn state.
+ *
+ * Results:
+ * Icon image is displayed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TrayIconWrapperEvent(
+ ClientData cd,
+ XEvent* ev)
+{
+ /* Some embedders, like Docker, add icon windows to save set
+ * (XAddToSaveSet), so when they crash the icon is reparented to root.
+ * We have to make sure that automatic mapping in root is done in
+ * withdrawn state (no way to prevent it entirely)
+ */
+ DockIcon *icon = (DockIcon*)cd;
+ XWindowAttributes attr;
+ if (icon->drawingWin) {
+ switch(ev->type) {
+ case ReparentNotify:
+ /* With virtual roots and screen roots etc, the only way
+ to check for reparent-to-root is to ask for this root
+ first */
+ XGetWindowAttributes(ev->xreparent.display,
+ ev->xreparent.window, &attr);
+ if (attr.root == ev->xreparent.parent) {
+ /* upon reparent to root, */
+ if (icon->drawingWin) {
+ /* we were sent away to root */
+ TKU_WmWithdraw(icon->drawingWin,icon->interp);
+ if (icon->myManager)
+ Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconDestroy"), NULL);
+ icon->myManager = None;
+ }
+ } /* Reparenting into some other embedder is theoretically possible,
+ * and everything would just work in this case.
+ */
+ break;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TrayIconEvent --
+ *
+ * Handle X events.
+ *
+ * Results:
+ * Events are handled and processed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TrayIconEvent(
+ ClientData cd,
+ XEvent* ev)
+{
+ DockIcon *icon = (DockIcon*)cd;
+
+ switch (ev->type) {
+ case Expose:
+ if (!ev->xexpose.count)
+ EventuallyRedrawIcon(icon);
+ break;
+
+ case DestroyNotify:
+ /* If anonymous window is destroyed first, then either
+ * something went wrong with a tray (if -visible) or we just
+ * reconfigured to invisibility: nothing to be done in both
+ * cases.
+ * If unreal window is destroyed first, freeing the data structures
+ * is the only thing to do.
+ */
+ if (icon->myManager) {
+ Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconDestroy"), NULL);
+ }
+ Tcl_CancelIdleCall(DisplayIcon,(ClientData)icon);
+ icon->flags &= ~ICON_FLAG_REDRAW_PENDING;
+ icon->drawingWin = NULL;
+ icon->requestedWidth = 0; /* trigger re-request on recreation */
+ icon->requestedHeight = 0;
+ icon->wrapper = None;
+ icon->myManager = None;
+ break;
+
+ case ConfigureNotify:
+ Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconConfigure"), NULL);
+ if (icon->width != ev->xconfigure.width ||
+ icon->height != ev->xconfigure.height) {
+ icon->width = ev->xconfigure.width;
+ icon->height = ev->xconfigure.height;
+ icon->flags |= ICON_FLAG_DIRTY_EDGES;
+ EventuallyRedrawIcon(icon);
+ }
+ RetargetEvent(icon,ev);
+ break;
+
+ case MotionNotify: /* fall through */
+ case ButtonPress: /* fall through */
+ case ButtonRelease: /* fall through */
+ case EnterNotify: /* fall through */
+ case LeaveNotify:
+ RetargetEvent(icon,ev);
+ break;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UserIconEvent --
+ *
+ * Handle user events.
+ *
+ * Results:
+ * Events are handled and processed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+UserIconEvent(
+ ClientData cd,
+ XEvent* ev)
+{
+ DockIcon *icon = (DockIcon*)cd;
+
+ switch (ev->type) {
+
+ case DestroyNotify:
+ Tk_DeleteGenericHandler(IconGenericHandler, (ClientData)icon);
+ if(icon->drawingWin) {
+ icon->visible = 0;
+ Tcl_CancelIdleCall(DisplayIcon,(ClientData)icon);
+ icon->flags &= ~ICON_FLAG_REDRAW_PENDING;
+ Tk_DestroyWindow(icon->drawingWin);
+ }
+ if(icon->imageVisualInstance) {
+ Tk_FreeImage(icon->imageVisualInstance);
+ icon->image = NULL;
+ }
+ if(icon->offscreenImage) {
+ XDestroyImage(icon->offscreenImage);
+ icon->offscreenImage = NULL;
+ }
+ if(icon->offscreenGC) {
+ Tk_FreeGC(Tk_Display(icon->tkwin),icon->offscreenGC);
+ icon->offscreenGC = NULL;
+ }
+ if(icon->offscreenPixmap) {
+ Tk_FreePixmap(Tk_Display(icon->tkwin),icon->offscreenPixmap);
+ }
+ if(icon->image) {
+ Tk_FreeImage(icon->image);
+ icon->image = NULL;
+ }
+ if(icon->widgetCmd)
+ Tcl_DeleteCommandFromToken(icon->interp,icon->widgetCmd);
+ Tk_FreeConfigOptions((char*)icon, icon->options, icon->tkwin);
+ break;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * PostBalloon --
+ *
+ * Display tooltip/balloon window over tray icon.
+ *
+ * Results:
+ * Window is displayed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+PostBalloon(
+ DockIcon *icon,
+ const char *utf8msg,
+ long timeout)
+{
+ Tk_Window tkwin = icon -> tkwin;
+ Display* dpy = Tk_Display(tkwin);
+ int length = strlen(utf8msg);
+ XEvent ev;
+
+ if (!(icon->drawingWin) || (icon->myManager == None))
+ return 0;
+
+ /* overflow protection */
+ if (icon->msgid < 0)
+ icon->msgid = 0;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.xclient.type = ClientMessage;
+ ev.xclient.window = icon->wrapper;
+ ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_OPCODE;
+ ev.xclient.format = 32;
+ ev.xclient.data.l[0] = CurrentTime;
+ ev.xclient.data.l[1] = SYSTEM_TRAY_BEGIN_MESSAGE;
+ ev.xclient.data.l[2] = timeout;
+ ev.xclient.data.l[3] = length;
+ ev.xclient.data.l[4] = ++icon->msgid;
+ TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin))
+ XSendEvent(dpy, icon->myManager , True, StructureNotifyMask|SubstructureNotifyMask, &ev);
+ XSync(dpy, False);
+
+ /* Sending message elements */
+ while (length>0) {
+ ev.type = ClientMessage;
+ ev.xclient.window = icon->wrapper;
+ ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_MESSAGE_DATA;
+ ev.xclient.format = 8;
+ memset(ev.xclient.data.b,0,20);
+ strncpy(ev.xclient.data.b,utf8msg,length<20?length:20);
+ XSendEvent(dpy, icon->myManager, True, StructureNotifyMask|SubstructureNotifyMask, &ev);
+ XSync(dpy,False);
+ utf8msg += 20;
+ length -= 20;
+ }
+ TKU_NO_BAD_WINDOW_END;
+ return icon->msgid;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CancelBalloon --
+ *
+ * Remove balloon from display over tray icon.
+ *
+ * Results:
+ * Window is destroyed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CancelBalloon(
+ DockIcon *icon,
+ int msgid)
+{
+ Tk_Window tkwin = icon -> tkwin;
+ Display* dpy = Tk_Display(tkwin);
+ XEvent ev;
+
+ if (!(icon->drawingWin) || (icon->myManager == None))
+ return;
+ /* overflow protection */
+ if (icon->msgid < 0)
+ icon->msgid = 0;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.type = ClientMessage;
+ ev.xclient.window = icon->wrapper;
+ ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_OPCODE;
+ ev.xclient.format = 32;
+ ev.xclient.data.l[0] = CurrentTime;
+ ev.xclient.data.l[1] = SYSTEM_TRAY_CANCEL_MESSAGE;
+ ev.xclient.data.l[2] =msgid;
+ TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin))
+ XSendEvent(dpy, icon->myManager , True,
+ StructureNotifyMask|SubstructureNotifyMask, &ev);
+ TKU_NO_BAD_WINDOW_END
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * IconGenericHandler --
+ *
+ * Process non-tk events.
+ *
+ * Results:
+ * Events are processed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+IconGenericHandler(
+ ClientData cd,
+ XEvent *ev)
+{
+ DockIcon *icon = (DockIcon*)cd;
+
+ if ((ev->type == ClientMessage) &&
+ (ev->xclient.message_type == icon->aMANAGER) &&
+ ((Atom)ev->xclient.data.l[1] == icon->a_NET_SYSTEM_TRAY_Sn)) {
+ icon->trayManager = (Window)ev->xclient.data.l[2];
+ XSelectInput(ev->xclient.display,icon->trayManager,StructureNotifyMask);
+ if (icon->myManager == None)
+ TrayIconUpdate(icon, ICON_CONF_XEMBED);
+ return 1;
+ }
+ if (ev->type == DestroyNotify) {
+ if (ev->xdestroywindow.window == icon->trayManager) {
+ icon->trayManager = None;
+ }
+ if (ev->xdestroywindow.window == icon->myManager) {
+ icon->myManager = None;
+ icon->wrapper = None;
+ if (icon->drawingWin) {
+ Tk_DestroyWindow(icon->drawingWin);
+ icon->drawingWin = NULL;
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TrayIconUpdate --
+ *
+ * Get in touch with new options that are certainly valid.
+ *
+ * Results:
+ * Options updated.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TrayIconUpdate(
+ DockIcon *icon,
+ int mask)
+{
+ /* why should someone need this option?
+ * anyway, let's handle it if we provide it.
+ */
+ if (mask & ICON_CONF_CLASS) {
+ if (icon->drawingWin)
+ Tk_SetClass(icon->drawingWin,Tk_GetUid(icon->classString));
+ }
+ /*
+ * First, ensure right icon visibility.
+ * If should be visible and not yet managed,
+ * we have to get the tray or wait for it.
+ * If should be invisible and managed,
+ * real-window is simply destroyed.
+ * If should be invisible and not managed,
+ * generic handler should be abandoned.
+ */
+ if (mask & ICON_CONF_XEMBED) {
+ if (icon->myManager == None &&
+ icon->trayManager != None &&
+ icon->docked) {
+ CheckArgbVisual(icon);
+ if (icon->drawingWin &&
+ ((icon->bestVisual && !(icon->flags & ICON_FLAG_ARGB32)) ||
+ (!icon->bestVisual && (icon->flags & ICON_FLAG_ARGB32)))) {
+ icon->myManager = None;
+ icon->wrapper = None;
+ icon->requestedWidth = icon->requestedHeight = 0;
+ Tk_DestroyWindow(icon->drawingWin);
+ icon->drawingWin = NULL;
+ }
+ if (!icon->drawingWin) {
+ CreateTrayIconWindow(icon);
+ }
+ if (icon->drawingWin) {
+ DockToManager(icon);
+ }
+ }
+ if (icon->myManager != None &&
+ icon->drawingWin != NULL &&
+ !icon->docked) {
+ Tk_DestroyWindow(icon->drawingWin);
+ icon->drawingWin = NULL;
+ icon->myManager = None;
+ icon->wrapper = None;
+ }
+ if (icon->drawingWin) {
+ XembedSetState(icon, icon->visible ? XEMBED_MAPPED : 0);
+ }
+ }
+ if (mask & ICON_CONF_IMAGE) {
+ TrayIconForceImageChange(icon);
+ }
+ if (mask & ICON_CONF_REDISPLAY) {
+ EventuallyRedrawIcon(icon);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TrayIconConfigureMethod --
+ *
+ * Returns TCL_ERROR if some option is invalid,
+ * or else retrieve resource references and free old resources.
+ *
+ * Results:
+ * Widget configured.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TrayIconConfigureMethod(
+ DockIcon *icon,
+ Tcl_Interp* interp,
+ int objc,
+ Tcl_Obj *const objv[],
+ int addflags)
+{
+ Tk_SavedOptions saved;
+ Tk_Image newImage = NULL;
+ int mask = 0;
+
+ if (objc <= 1 && !(addflags & ICON_CONF_FIRST_TIME)) {
+ Tcl_Obj* info = Tk_GetOptionInfo(interp, (char*)icon, icon->options,
+ objc? objv[0] : NULL, icon->tkwin);
+ if (info) {
+ Tcl_SetObjResult(interp,info);
+ return TCL_OK;
+ } else {
+ return TCL_ERROR; /* msg by Tk_GetOptionInfo */
+ }
+ }
+
+ if (Tk_SetOptions(interp,(char*)icon,icon->options,objc,objv,
+ icon->tkwin,&saved,&mask) != TCL_OK) {
+ return TCL_ERROR; /* msg by Tk_SetOptions */
+ }
+ mask |= addflags;
+ /* now check option validity */
+ if (mask & ICON_CONF_IMAGE) {
+ if (icon->imageString) {
+ newImage = Tk_GetImage(interp, icon->tkwin, icon->imageString,
+ TrayIconImageChanged, (ClientData)icon);
+ if (!newImage) {
+ Tk_RestoreSavedOptions(&saved);
+ return TCL_ERROR; /* msg by Tk_GetImage */
+ }
+ }
+ if (icon->image) {
+ Tk_FreeImage(icon->image);
+ icon->image = NULL;
+ }
+ if (icon->imageVisualInstance) {
+ Tk_FreeImage(icon->imageVisualInstance);
+ icon->imageVisualInstance = NULL;
+ }
+ icon->image = newImage; /* may be null, as intended */
+ icon->photo = NULL; /* invalidate photo reference */
+ }
+ Tk_FreeSavedOptions(&saved);
+ /* Now as we are reconfigured... */
+ TrayIconUpdate(icon,mask);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TrayIconDeleteProc --
+ *
+ * Delete tray window and clean up.
+ *
+ * Results:
+ * Window destroyed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TrayIconDeleteProc(
+ ClientData cd )
+{
+ DockIcon *icon = (DockIcon *)cd;
+ Tk_DestroyWindow(icon->tkwin);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TrayIconCreateCmd --
+ *
+ * Create tray command and (unreal) window.
+ *
+ * Results:
+ * Icon tray and hidden window created.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TrayIconCreateCmd(
+ ClientData cd,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ Tk_Window mainWindow = (Tk_Window)cd;
+ DockIcon *icon;
+
+ icon = (DockIcon*)attemptckalloc(sizeof(DockIcon));
+ if (!icon) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("running out of memory", -1));
+ goto handleErrors;
+ }
+ memset(icon,0,sizeof(*icon));
+
+ if (objc < 2||(objc%2)) {
+ Tcl_WrongNumArgs(interp, 1, objv, "pathName ?option value ...?");
+ goto handleErrors;
+ }
+
+ /* It's not a toplevel window by now. It really doesn't matter,
+ * because it's not really shown.
+ */
+ icon->tkwin = Tk_CreateWindowFromPath(interp, mainWindow,
+ Tcl_GetString(objv[1]),"");
+ if (icon->tkwin == NULL) {
+ goto handleErrors;
+ }
+
+ /* Subscribe to StructureNotify */
+ TKU_AddInput(Tk_Display(icon->tkwin),
+ RootWindowOfScreen(Tk_Screen(icon->tkwin)),StructureNotifyMask);
+ TKU_AddInput(Tk_Display(icon->tkwin),
+ RootWindow(Tk_Display(icon->tkwin),0),StructureNotifyMask);
+ /* Spec says "screen 0" not "default", but... */
+ TKU_AddInput(Tk_Display(icon->tkwin),
+ DefaultRootWindow(Tk_Display(icon->tkwin)),StructureNotifyMask);
+
+ /* Early tracking of DestroyNotify is essential */
+ Tk_CreateEventHandler(icon->tkwin,StructureNotifyMask,
+ UserIconEvent,(ClientData)icon);
+
+ /* Now try setting options */
+ icon->options = Tk_CreateOptionTable(interp,IconOptionSpec);
+ /* Class name is used for retrieving defaults, so... */
+ Tk_SetClass(icon->tkwin, Tk_GetUid("TrayIcon"));
+ if (Tk_InitOptions(interp,(char*)icon,icon->options,icon->tkwin) != TCL_OK) {
+ goto handleErrors;
+ }
+
+ icon->a_NET_SYSTEM_TRAY_Sn = DockSelectionAtomFor(icon->tkwin);
+ icon->a_NET_SYSTEM_TRAY_OPCODE = Tk_InternAtom(icon->tkwin,"_NET_SYSTEM_TRAY_OPCODE");
+ icon->a_NET_SYSTEM_TRAY_MESSAGE_DATA = Tk_InternAtom(icon->tkwin,"_NET_SYSTEM_TRAY_MESSAGE_DATA");
+ icon->a_NET_SYSTEM_TRAY_ORIENTATION = Tk_InternAtom(icon->tkwin,"_NET_SYSTEM_TRAY_ORIENTATION");
+ icon->a_NET_SYSTEM_TRAY_VISUAL = Tk_InternAtom(icon->tkwin,"_NET_SYSTEM_TRAY_VISUAL");
+ icon->a_XEMBED_INFO = Tk_InternAtom(icon->tkwin,"_XEMBED_INFO");
+ icon->aMANAGER = Tk_InternAtom(icon->tkwin,"MANAGER");
+
+ icon->interp = interp;
+
+ icon->trayManager = XGetSelectionOwner(Tk_Display(icon->tkwin), icon->a_NET_SYSTEM_TRAY_Sn);
+ if (icon->trayManager) {
+ XSelectInput(Tk_Display(icon->tkwin),icon->trayManager, StructureNotifyMask);
+ }
+
+ Tk_CreateGenericHandler(IconGenericHandler, (ClientData)icon);
+
+ if (objc>3) {
+ if (TrayIconConfigureMethod(icon, interp, objc-2, objv+2,
+ ICON_CONF_XEMBED|ICON_CONF_IMAGE|ICON_CONF_FIRST_TIME) != TCL_OK) {
+ goto handleErrors;
+ }
+ }
+
+ icon->widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[1]),
+ TrayIconObjectCmd, (ClientData)icon, TrayIconDeleteProc);
+
+ /* Sometimes a command just can't be created... */
+ if (!icon->widgetCmd) {
+ goto handleErrors;
+ }
+
+ Tcl_SetObjResult(interp,objv[1]);
+ return TCL_OK;
+
+handleErrors:
+ /* Rolling back */
+ if (icon) {
+ if (icon->options) {
+ Tk_DeleteOptionTable(icon->options);
+ icon->options = NULL;
+ }
+ if (icon->tkwin) {
+ /* Resources will be freed by DestroyNotify handler */
+ Tk_DestroyWindow(icon->tkwin);
+ }
+ ckfree((char*)icon);
+ }
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tktray_Init --
+ *
+ * Initialize the command.
+ *
+ * Results:
+ * Command initialized.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tktray_Init(
+ Tcl_Interp *interp)
+{
+ Tcl_CreateObjCommand(interp, "::tk::systray::_systray",
+ TrayIconCreateCmd, Tk_MainWindow(interp), NULL);
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 83b36e3..7ef3667 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -6,8 +6,8 @@
* the "wm" command and passes geometry information to the window
* manager.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -36,7 +36,7 @@ typedef struct ProtocolHandler {
} ProtocolHandler;
#define HANDLER_SIZE(cmdLength) \
- ((unsigned)((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength))
+ (offsetof(ProtocolHandler, command) + 1 + cmdLength)
/*
* Data for [wm attributes] command:
@@ -312,12 +312,12 @@ static void MenubarReqProc(ClientData clientData,
static const Tk_GeomMgr wmMgrType = {
"wm", /* name */
TopLevelReqProc, /* requestProc */
- NULL, /* lostSlaveProc */
+ NULL, /* lostContentProc */
};
static const Tk_GeomMgr menubarMgrType = {
"menubar", /* name */
MenubarReqProc, /* requestProc */
- NULL, /* lostSlaveProc */
+ NULL, /* lostContentProc */
};
/*
@@ -1032,7 +1032,7 @@ Tk_WmObjCmd(
WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM,
WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER,
WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT, WMOPT_WITHDRAW };
- int index, length;
+ int index;
const char *argv1;
TkWindow *winPtr;
Tk_Window targetWin;
@@ -1044,9 +1044,9 @@ Tk_WmObjCmd(
return TCL_ERROR;
}
- argv1 = Tcl_GetStringFromObj(objv[1], &length);
- if ((argv1[0] == 't') && (strncmp(argv1, "tracing", (size_t) length) == 0)
- && (length >= 3)) {
+ argv1 = Tcl_GetString(objv[1]);
+ if ((argv1[0] == 't') && (strncmp(argv1, "tracing", objv[1]->length) == 0)
+ && (objv[1]->length >= 3)) {
int wmTracing;
if ((objc != 2) && (objc != 3)) {
@@ -1054,8 +1054,8 @@ Tk_WmObjCmd(
return TCL_ERROR;
}
if (objc == 2) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- dispPtr->flags & TK_DISPLAY_WM_TRACING));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
+ (dispPtr->flags & TK_DISPLAY_WM_TRACING) != 0));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing) != TCL_OK) {
@@ -1199,10 +1199,10 @@ WmAspectCmd(
if (wmPtr->sizeHintsFlags & PAspect) {
Tcl_Obj *results[4];
- results[0] = Tcl_NewIntObj(wmPtr->minAspect.x);
- results[1] = Tcl_NewIntObj(wmPtr->minAspect.y);
- results[2] = Tcl_NewIntObj(wmPtr->maxAspect.x);
- results[3] = Tcl_NewIntObj(wmPtr->maxAspect.y);
+ results[0] = Tcl_NewWideIntObj(wmPtr->minAspect.x);
+ results[1] = Tcl_NewWideIntObj(wmPtr->minAspect.y);
+ results[2] = Tcl_NewWideIntObj(wmPtr->maxAspect.x);
+ results[3] = Tcl_NewWideIntObj(wmPtr->maxAspect.y);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
@@ -1344,11 +1344,11 @@ WmGetAttribute(
case WMATT_ALPHA:
return Tcl_NewDoubleObj(wmPtr->attributes.alpha);
case WMATT_TOPMOST:
- return Tcl_NewBooleanObj(wmPtr->attributes.topmost);
+ return Tcl_NewWideIntObj(wmPtr->attributes.topmost != 0);
case WMATT_ZOOMED:
- return Tcl_NewBooleanObj(wmPtr->attributes.zoomed);
+ return Tcl_NewWideIntObj(wmPtr->attributes.zoomed != 0);
case WMATT_FULLSCREEN:
- return Tcl_NewBooleanObj(wmPtr->attributes.fullscreen);
+ return Tcl_NewWideIntObj(wmPtr->attributes.fullscreen != 0);
case WMATT_TYPE:
return GetNetWmType(winPtr);
case _WMATT_LAST_ATTRIBUTE:
@@ -1398,7 +1398,7 @@ WmAttributesCmd(
Tcl_ListObjAppendElement(interp, result,
Tcl_NewStringObj(WmAttributeNames[attribute], -1));
Tcl_ListObjAppendElement(interp, result,
- WmGetAttribute(winPtr, attribute));
+ WmGetAttribute(winPtr, (WmAttribute)attribute));
}
Tcl_SetObjResult(interp, result);
return TCL_OK;
@@ -1407,7 +1407,7 @@ WmAttributesCmd(
sizeof(char *), "attribute", 0, &attribute) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, WmGetAttribute(winPtr, attribute));
+ Tcl_SetObjResult(interp, WmGetAttribute(winPtr, (WmAttribute)attribute));
return TCL_OK;
} else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */
int i;
@@ -1417,7 +1417,7 @@ WmAttributesCmd(
sizeof(char *), "attribute", 0, &attribute) != TCL_OK) {
return TCL_ERROR;
}
- if (WmSetAttribute(winPtr,interp,attribute,objv[i+1]) != TCL_OK) {
+ if (WmSetAttribute(winPtr,interp,(WmAttribute)attribute,objv[i+1]) != TCL_OK) {
return TCL_ERROR;
}
}
@@ -1455,7 +1455,6 @@ WmClientCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -1468,7 +1467,7 @@ WmClientCmd(
}
return TCL_OK;
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ argv3 = Tcl_GetString(objv[3]);
if (argv3[0] == 0) {
if (wmPtr->clientMachine != NULL) {
ckfree(wmPtr->clientMachine);
@@ -1484,7 +1483,7 @@ WmClientCmd(
if (wmPtr->clientMachine != NULL) {
ckfree(wmPtr->clientMachine);
}
- wmPtr->clientMachine = (char *)ckalloc(length + 1);
+ wmPtr->clientMachine = (char *)ckalloc(objv[3]->length + 1);
strcpy(wmPtr->clientMachine, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
@@ -1981,10 +1980,10 @@ WmGridCmd(
if (wmPtr->sizeHintsFlags & PBaseSize) {
Tcl_Obj *results[4];
- results[0] = Tcl_NewIntObj(wmPtr->reqGridWidth);
- results[1] = Tcl_NewIntObj(wmPtr->reqGridHeight);
- results[2] = Tcl_NewIntObj(wmPtr->widthInc);
- results[3] = Tcl_NewIntObj(wmPtr->heightInc);
+ results[0] = Tcl_NewWideIntObj(wmPtr->reqGridWidth);
+ results[1] = Tcl_NewWideIntObj(wmPtr->reqGridHeight);
+ results[2] = Tcl_NewWideIntObj(wmPtr->widthInc);
+ results[3] = Tcl_NewWideIntObj(wmPtr->heightInc);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
@@ -2072,7 +2071,6 @@ WmGroupCmd(
Tk_Window tkwin2;
WmInfo *wmPtr2;
const char *argv3;
- int length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
@@ -2084,7 +2082,7 @@ WmGroupCmd(
}
return TCL_OK;
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ argv3 = Tcl_GetString(objv[3]);
if (*argv3 == '\0') {
wmPtr->hints.flags &= ~WindowGroupHint;
if (wmPtr->leaderName != NULL) {
@@ -2112,7 +2110,7 @@ WmGroupCmd(
}
wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr);
wmPtr->hints.flags |= WindowGroupHint;
- wmPtr->leaderName = (char *)ckalloc(length + 1);
+ wmPtr->leaderName = (char *)ckalloc(objv[3]->length + 1);
strcpy(wmPtr->leaderName, argv3);
}
UpdateHints(winPtr);
@@ -2227,14 +2225,14 @@ WmIconifyCmd(
}
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an icon for %s",
+ "can't iconify \"%s\": it is an icon for \"%s\"",
winPtr->pathName, Tk_PathName(wmPtr->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an embedded window",
+ "can't iconify \"%s\": it is an embedded window",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL);
return TCL_ERROR;
@@ -2334,7 +2332,6 @@ WmIconnameCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
@@ -2349,8 +2346,8 @@ WmIconnameCmd(
if (wmPtr->iconName != NULL) {
ckfree(wmPtr->iconName);
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->iconName = ckalloc(length + 1);
+ argv3 = Tcl_GetString(objv[3]);
+ wmPtr->iconName = (char *)ckalloc(objv[3]->length + 1);
strcpy(wmPtr->iconName, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
UpdateTitle(winPtr);
@@ -2545,8 +2542,8 @@ WmIconpositionCmd(
if (wmPtr->hints.flags & IconPositionHint) {
Tcl_Obj *results[2];
- results[0] = Tcl_NewIntObj(wmPtr->hints.icon_x);
- results[1] = Tcl_NewIntObj(wmPtr->hints.icon_y);
+ results[0] = Tcl_NewWideIntObj(wmPtr->hints.icon_x);
+ results[1] = Tcl_NewWideIntObj(wmPtr->hints.icon_y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
}
return TCL_OK;
@@ -2602,7 +2599,7 @@ WmIconwindowCmd(
}
if (objc == 3) {
if (wmPtr->icon != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(wmPtr->icon));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(wmPtr->icon));
}
return TCL_OK;
}
@@ -2784,8 +2781,8 @@ WmMaxsizeCmd(
Tcl_Obj *results[2];
GetMaxSize(wmPtr, &width, &height);
- results[0] = Tcl_NewIntObj(width);
- results[1] = Tcl_NewIntObj(height);
+ results[0] = Tcl_NewWideIntObj(width);
+ results[1] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
@@ -2842,8 +2839,8 @@ WmMinsizeCmd(
if (objc == 3) {
Tcl_Obj *results[2];
- results[0] = Tcl_NewIntObj(wmPtr->minWidth);
- results[1] = Tcl_NewIntObj(wmPtr->minHeight);
+ results[0] = Tcl_NewWideIntObj(wmPtr->minWidth);
+ results[1] = Tcl_NewWideIntObj(wmPtr->minHeight);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
@@ -2892,7 +2889,7 @@ WmOverrideredirectCmd(
}
curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect;
if (objc == 3) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(curValue));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(curValue != 0));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) {
@@ -3012,7 +3009,7 @@ WmProtocolCmd(
ProtocolHandler *protPtr, *prevPtr;
Atom protocol;
const char *cmd;
- int cmdLength;
+ TkSizeT cmdLength;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?");
@@ -3128,8 +3125,8 @@ WmResizableCmd(
if (objc == 3) {
Tcl_Obj *results[2];
- results[0] = Tcl_NewBooleanObj(!(wmPtr->flags&WM_WIDTH_NOT_RESIZABLE));
- results[1] = Tcl_NewBooleanObj(!(wmPtr->flags&WM_HEIGHT_NOT_RESIZABLE));
+ results[0] = Tcl_NewWideIntObj(!(wmPtr->flags&WM_WIDTH_NOT_RESIZABLE));
+ results[1] = Tcl_NewWideIntObj(!(wmPtr->flags&WM_HEIGHT_NOT_RESIZABLE));
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
@@ -3338,7 +3335,7 @@ WmStackorderCmd(
} else { /* OPT_ISBELOW */
result = index1 < index2;
}
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result));
return TCL_OK;
}
return TCL_OK;
@@ -3477,7 +3474,6 @@ WmTitleCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?");
@@ -3493,8 +3489,8 @@ WmTitleCmd(
if (wmPtr->title != NULL) {
ckfree(wmPtr->title);
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->title = (char *)ckalloc(length + 1);
+ argv3 = Tcl_GetString(objv[3]);
+ wmPtr->title = (char *)ckalloc(objv[3]->length + 1);
strcpy(wmPtr->title, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -3534,12 +3530,12 @@ WmTransientCmd(
WmInfo *wmPtr2;
if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?master?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?window?");
return TCL_ERROR;
}
if (objc == 3) {
if (containerPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) containerPtr));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) containerPtr));
}
return TCL_OK;
}
@@ -3593,7 +3589,7 @@ WmTransientCmd(
if (wmPtr2->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't make \"%s\" a master: it is an icon for %s",
+ "can't make \"%s\" a container: it is an icon for %s",
Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
return TCL_ERROR;
@@ -3603,7 +3599,7 @@ WmTransientCmd(
w = (TkWindow *)w->wmInfoPtr->containerPtr) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "setting \"%s\" as master creates a transient/master cycle",
+ "can't set \"%s\" as container: would cause management loop",
Tk_PathName(containerPtr)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
return TCL_ERROR;
@@ -5465,7 +5461,7 @@ SetNetWmType(
for (n = 0; n < objc; ++n) {
Tcl_DString ds, dsName;
- int len;
+ TkSizeT len;
char *name = Tcl_GetStringFromObj(objv[n], &len);
Tcl_UtfToUpper(name);
@@ -6466,7 +6462,7 @@ TkWmStackorderToplevel(
windows = NULL;
} else {
for (i = 0; i < numChildren; i++) {
- hPtr = Tcl_FindHashEntry(&table, (char *)children[i]);
+ hPtr = Tcl_FindHashEntry(&table, children[i]);
if (hPtr != NULL) {
childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr);
*window_ptr++ = childWinPtr;
diff --git a/unix/tkUnixXId.c b/unix/tkUnixXId.c
index ec2451c..5788881 100644
--- a/unix/tkUnixXId.c
+++ b/unix/tkUnixXId.c
@@ -1,8 +1,8 @@
/*
* tkUnixXId.c --
*
- * Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1993 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,39 +14,6 @@
/*
*----------------------------------------------------------------------
*
- * Tk_FreeXId --
- *
- * This function is called to indicate that an X resource identifier is
- * now free.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The identifier is added to the stack of free identifiers for its
- * display, so that it can be re-used.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_FreeXId(
- Display *display, /* Display for which xid was allocated. */
- XID xid) /* Identifier that is no longer in use. */
-{
- /*
- * This does nothing, because the XC-MISC extension takes care of
- * freeing XIDs for us. It has been a standard X11 extension for
- * about 15 years as of 2008. Keith Packard and another X.org
- * developer suggested that we remove the previous code that used:
- * #define XLIB_ILLEGAL_ACCESS.
- */
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
* Tk_GetPixmap --
*
* Same as the XCreatePixmap function except that it manages resource
diff --git a/win/Makefile.in b/win/Makefile.in
index a60961e..c95c5a4 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -71,11 +71,8 @@ MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3
# Directory in which to install manual entries for the built-in Tk commands:
MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann
-# Libraries built with optimization switches have this additional extension
-TK_DBGX = @TK_DBGX@
-
# Directory in which to install the pkgIndex.tcl file for loadable Tk
-PKG_INSTALL_DIR = $(LIB_INSTALL_DIR)/tk$(VERSION)$(TK_DBGX)
+PKG_INSTALL_DIR = $(LIB_INSTALL_DIR)/tk$(VERSION)
# Package index file for loadable Tk
PKG_INDEX = $(PKG_INSTALL_DIR)/pkgIndex.tcl
@@ -129,14 +126,21 @@ TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)')
DLLSUFFIX = @DLLSUFFIX@
LIBSUFFIX = @LIBSUFFIX@
EXESUFFIX = @EXESUFFIX@
+TCLVER = @TCL_MAJOR_VERSION@@TCL_MINOR_VERSION@
VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@
DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@
+TK_ZIP_FILE = @TK_ZIP_FILE@
+TK_VFS_PATH = libtk.vfs/tk_library
+TK_VFS_ROOT = libtk.vfs
+
TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
TK_LIB_FILE = @TK_LIB_FILE@
TK_DLL_FILE = @TK_DLL_FILE@
+TK_DLL_FILE_TCL8 = @TK_DLL_FILE_TCL8@
+TK_DLL_FILE_TCL9 = @TK_DLL_FILE_TCL9@
TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX}
-TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}.a
+TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}${LIBSUFFIX}
SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE)
STATIC_LIBRARIES = $(TK_LIB_FILE)
@@ -198,14 +202,13 @@ MKDIR = mkdir -p
SHELL = @SHELL@
RM = rm -f
COPY = cp
-
-BUILD_TCLSH = @BUILD_TCLSH@
+LN = ln
# Tk does not used deprecated Tcl constructs so it should
# compile fine with -DTCL_NO_DEPRECATED. To remove its own
# set of deprecated code uncomment the second line.
-NO_DEPRECATED_FLAGS =
-#NO_DEPRECATED_FLAGS = -DTK_NO_DEPRECATED
+NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED
+#NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED
# TCL_EXE is the name of a tclsh executable that is available *BEFORE*
# running make for the first time. Certain build targets (make genstubs)
@@ -213,6 +216,46 @@ NO_DEPRECATED_FLAGS =
# required just to do a normal build although it can be required to run
# make dist.
TCL_EXE = @TCLSH_PROG@
+WINE = @WINE@
+
+###
+# Tip 430 - ZipFS Modifications
+###
+
+TK_ZIP_FILE = @TK_ZIP_FILE@
+TK_VFS_PATH = libtk.vfs/tk_library
+TK_VFS_ROOT = libtk.vfs
+
+HOST_CC = @CC_FOR_BUILD@
+HOST_EXEEXT = @EXEEXT_FOR_BUILD@
+HOST_OBJEXT = @OBJEXT_FOR_BUILD@
+ZIPFS_BUILD = @ZIPFS_BUILD@
+NATIVE_ZIP = @ZIP_PROG@
+ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@
+ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@
+SHARED_BUILD = @SHARED_BUILD@
+INSTALL_MSGS = @INSTALL_MSGS@
+INSTALL_LIBRARIES = @INSTALL_LIBRARIES@
+
+# Minizip
+MINIZIP_OBJS = \
+ adler32.$(HOST_OBJEXT) \
+ compress.$(HOST_OBJEXT) \
+ crc32.$(HOST_OBJEXT) \
+ deflate.$(HOST_OBJEXT) \
+ infback.$(HOST_OBJEXT) \
+ inffast.$(HOST_OBJEXT) \
+ inflate.$(HOST_OBJEXT) \
+ inftrees.$(HOST_OBJEXT) \
+ ioapi.$(HOST_OBJEXT) \
+ iowin32.$(HOST_OBJEXT) \
+ trees.$(HOST_OBJEXT) \
+ uncompr.$(HOST_OBJEXT) \
+ zip.$(HOST_OBJEXT) \
+ zutil.$(HOST_OBJEXT) \
+ minizip.$(HOST_OBJEXT)
+
+ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@
CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \
@@ -264,6 +307,8 @@ TK_OBJS = \
tkWinDraw.$(OBJEXT) \
tkWinEmbed.$(OBJEXT) \
tkWinFont.$(OBJEXT) \
+ tkWinGDI.$(OBJEXT) \
+ tkWinIco.$(OBJEXT) \
tkWinImage.$(OBJEXT) \
tkWinInit.$(OBJEXT) \
tkWinKey.$(OBJEXT) \
@@ -274,6 +319,7 @@ TK_OBJS = \
tkWinScrlbr.$(OBJEXT) \
tkWinSend.$(OBJEXT) \
tkWinSendCom.$(OBJEXT) \
+ tkWinSysTray.$(OBJEXT) \
tkWinWindow.$(OBJEXT) \
tkWinWm.$(OBJEXT) \
tkWinX.$(OBJEXT) \
@@ -314,9 +360,11 @@ TK_OBJS = \
tkGrid.$(OBJEXT) \
tkImage.$(OBJEXT) \
tkImgBmap.$(OBJEXT) \
+ tkImgListFormat.$(OBJEXT) \
tkImgGIF.$(OBJEXT) \
tkImgPNG.$(OBJEXT) \
tkImgPPM.$(OBJEXT) \
+ tkImgSVGnano.$(OBJEXT) \
tkImgPhoto.$(OBJEXT) \
tkImgPhInstance.$(OBJEXT) \
tkImgUtil.$(OBJEXT) \
@@ -333,6 +381,7 @@ TK_OBJS = \
tkOldConfig.$(OBJEXT) \
tkOption.$(OBJEXT) \
tkPack.$(OBJEXT) \
+ tkPkgConfig.$(OBJEXT) \
tkPlace.$(OBJEXT) \
tkPointer.$(OBJEXT) \
tkRectOval.$(OBJEXT) \
@@ -436,23 +485,23 @@ $(MAN2TCL): $(TCL_SRC_DIR)/tools/man2tcl.c
test: test-classic test-ttk
test-classic: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32)
- $(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" \
- $(TESTFLAGS) | ./$(CAT32)
+ $(SHELL_ENV) $(WINE) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" \
+ $(TESTFLAGS) | $(WINE) ./$(CAT32)
test-ttk: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32)
- $(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/ttk/all.tcl" \
- $(TESTFLAGS) | ./$(CAT32)
+ $(SHELL_ENV) $(WINE) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/ttk/all.tcl" \
+ $(TESTFLAGS) | $(WINE) ./$(CAT32)
runtest: binaries $(TKTEST) $(TEST_DLL_FILE)
- $(SHELL_ENV) ./$(TKTEST) $(TESTFLAGS) $(SCRIPT)
+ $(SHELL_ENV) $(WINE) ./$(TKTEST) $(TESTFLAGS) $(SCRIPT)
# This target can be used to run wish from the build directory
# via `make shell` or `make shell SCRIPT=foo.tcl`
shell: binaries
- $(SHELL_ENV) ./$(WISH) $(SCRIPT)
+ $(SHELL_ENV) $(WINE) ./$(WISH) $(SCRIPT)
demo: $(WISH)
- $(SHELL_ENV) ./$(WISH) $(ROOT_DIR)/library/demos/widget
+ $(SHELL_ENV) $(WINE) ./$(WISH) $(ROOT_DIR)/library/demos/widget
# This target can be used to run wish inside either gdb or insight
gdb: binaries
@@ -484,13 +533,22 @@ install-binaries: binaries
@echo "Creating package index $(PKG_INDEX)";
@$(RM) $(PKG_INDEX);
@(\
- echo "if {![package vsatisfies [package provide Tcl] 8.6.0]} return";\
+ echo "if {![package vsatisfies [package provide Tcl] 8.6-]} return";\
echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\
echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\
- echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]]]";\
+ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\
+ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtcl9tk$(VERSION).dll]]]";\
+ echo " } else {";\
+ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]]]";\
+ echo " }";\
echo "} else {";\
- echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE)]]]";\
+ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\
+ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE_TCL9)]]]";\
+ echo " } else {";\
+ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE_TCL8)]]]";\
+ echo " }";\
echo "}";\
+ echo "package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list package require -exact tk $(VERSION)$(PATCH_LEVEL)]";\
) > $(PKG_INDEX);
@for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \
do \
@@ -608,11 +666,16 @@ install-private-headers: libraries
$(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \
done;
-$(WISH): $(WISH_OBJS) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES)
+$(WISH): $(WISH_OBJS) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES) ${TK_ZIP_FILE}
$(CC) $(CFLAGS) $(WISH_OBJS) $(TK_LIB_FILE) \
$(TK_STUB_LIB_FILE) $(TCL_LIB_FILE) $(LIBS) \
wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW)
@VC_MANIFEST_EMBED_EXE@
+ @if test "${ZIPFS_BUILD}" = "2" ; then \
+ cat ${TK_ZIP_FILE} >> ${WISH}; \
+ ${NATIVE_ZIP} -A ${WISH} \
+ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \
+ fi
tktest: $(TKTEST)
@@ -634,6 +697,30 @@ cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c
$(CAT32): cat32.${OBJEXT}
$(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE)
+tkzipfile: ${TK_ZIP_FILE}
+
+${TK_ZIP_FILE}: ${ZIP_INSTALL_OBJS}
+ @$(RMDIR) ${TK_VFS_ROOT}
+ @mkdir -p ${TK_VFS_PATH}
+ @echo "creating ${TK_VFS_PATH} (prepare compression)"
+ @( \
+ $(COPY) -a $(TOP_DIR)/library/* ${TK_VFS_PATH}; \
+ )
+ @$(RMDIR) $(TK_VFS_PATH)/demos
+ -@if test "${ZIPFS_BUILD}" = "2" ; then \
+ cp ${TCL_BIN_DIR}/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE} || cp ${TCL_BIN_DIR}/../bin/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE}; \
+ (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \
+ (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \
+ cd ${TK_VFS_ROOT} && $$zip -J ../${TK_ZIP_FILE}) \
+ fi
+ (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \
+ (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \
+ cd ${TK_VFS_ROOT} && \
+ $$zip ${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} >/dev/null && \
+ echo "${TK_ZIP_FILE} successful created with $$zip" && \
+ cd ..)
+
+
# The following targets are configured by autoconf to generate either
# a shared library or static library
@@ -642,10 +729,15 @@ ${TK_STUB_LIB_FILE}: ${STUB_OBJS}
@MAKE_STUB_LIB@ ${STUB_OBJS}
@POST_MAKE_LIB@
-${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES)
+${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES) ${TK_ZIP_FILE}
@$(RM) ${TK_DLL_FILE}
@MAKE_DLL@ ${TK_OBJS} $(TK_RES) $(SHLIB_LD_LIBS)
@VC_MANIFEST_EMBED_DLL@
+ @if test "${ZIPFS_BUILD}" = "1" ; then \
+ cat ${TK_ZIP_FILE} >> ${TK_DLL_FILE}; \
+ ${NATIVE_ZIP} -A ${TK_DLL_FILE} \
+ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \
+ fi
${TK_LIB_FILE}: ${TK_OBJS}
@$(RM) ${TK_LIB_FILE}
@@ -687,6 +779,12 @@ tkUnixMenubu.$(OBJEXT): ${UNIX_DIR}/tkUnixMenubu.c
tkUnixScale.$(OBJEXT): ${UNIX_DIR}/tkUnixScale.c
$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME)
+tkPkgConfig.$(OBJEXT): $(GENERIC_DIR)/tkPkgConfig.c
+ $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk \
+ -DCFG_RUNTIME_DLLFILE="\"$(TK_DLL_FILE)\"" \
+ @DEPARG@ $(CC_OBJNAME)
+
+
# Extra dependency info
tkConsole.$(OBJEXT): configure Makefile
tkMain.$(OBJEXT): configure Makefile
@@ -741,7 +839,7 @@ genstubs:
"$(GENERIC_DIR_NATIVE)" \
"$(GENERIC_DIR_NATIVE)/tk.decls" \
"$(GENERIC_DIR_NATIVE)/tkInt.decls"
- $(TCL_EXE) "$(TTK_DIR)/ttkGenStubs.tcl" \
+ $(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \
"$(TTK_DIR)" \
"$(TTK_DIR)/ttk.decls"
diff --git a/win/README b/win/README
index 950854e..e371a2c 100644
--- a/win/README
+++ b/win/README
@@ -1,4 +1,4 @@
-Tk 8.6 for Windows
+Tk 8.7 for Windows
Originally by Scott Stanton while at Sun Microsystems Labs
diff --git a/win/configure b/win/configure
index 52c0a7d..1b38323 100755
--- a/win/configure
+++ b/win/configure
@@ -1,81 +1,479 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for tk 8.6.
+# Generated by GNU Autoconf 2.71 for tk 8.7.
+#
+#
+# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
+# Inc.
+#
#
-# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+as_nop=:
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
emulate sh
NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else $as_nop
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
fi
-DUALCASE=1; export DUALCASE # for MKS sh
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
+as_nl='
+'
+export as_nl
+IFS=" "" $as_nl"
+
PS1='$ '
PS2='> '
PS4='+ '
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
+
+# The user is always right.
+if ${PATH_SEPARATOR+false} :; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ test -r "$as_dir$0" && as_myself=$as_dir$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="as_nop=:
+if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else \$as_nop
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" )
+then :
+
+else \$as_nop
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+blah=\$(echo \$(echo blah))
+test x\"\$blah\" = xblah || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null
+then :
+ as_have_required=yes
+else $as_nop
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null
+then :
+
+else $as_nop
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null
+then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
done
+IFS=$as_save_IFS
+if $as_found
+then :
+
+else $as_nop
+ if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi
+fi
+
+
+ if test "x$CONFIG_SHELL" != x
+then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno
+then :
+ printf "%s\n" "$0: This script requires a shell more modern than all"
+ printf "%s\n" "$0: the shells that I found on your system."
+ if test ${ZSH_VERSION+y} ; then
+ printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+# as_fn_nop
+# ---------
+# Do nothing but, unlike ":", preserve the value of $?.
+as_fn_nop ()
+{
+ return $?
+}
+as_nop=as_fn_nop
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else $as_nop
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else $as_nop
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+# as_fn_nop
+# ---------
+# Do nothing but, unlike ":", preserve the value of $?.
+as_fn_nop ()
+{
+ return $?
+}
+as_nop=as_fn_nop
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ printf "%s\n" "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
-# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
-
-# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -83,146 +481,102 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
+ s/-\n.*//
' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
+ chmod +x "$as_me.lineno" ||
+ { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n. New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
+
rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-as_executable_p="test -f"
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -231,90 +585,245 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-exec 6>&1
-
#
# Initializations.
#
ac_default_prefix=/usr/local
+ac_clean_files=
ac_config_libobj_dir=.
+LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
# Identity of this package.
PACKAGE_NAME='tk'
PACKAGE_TARNAME='tk'
-PACKAGE_VERSION='8.6'
-PACKAGE_STRING='tk 8.6'
+PACKAGE_VERSION='8.7'
+PACKAGE_STRING='tk 8.7'
PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
ac_unique_file="../generic/tk.h"
# Factoring default headers for most tests.
ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
+#include <stddef.h>
+#ifdef HAVE_STDIO_H
+# include <stdio.h>
#endif
-#if STDC_HEADERS
+#ifdef HAVE_STDLIB_H
# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
+#ifdef HAVE_STRING_H
# include <string.h>
#endif
-#if HAVE_STRINGS_H
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
#endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR ac_ct_AR RANLIB ac_ct_RANLIB RC ac_ct_RC SET_MAKE TCL_THREADS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_DEFS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING CFLAGS_NOLTO MAN2TCLFLAGS CFLAGS_DEFAULT LDFLAGS_DEFAULT VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE BUILD_TCLSH TCLSH_PROG TK_WIN_VERSION MACHINE TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_DBGX TK_LIB_FILE TK_DLL_FILE TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_BUILD_STUB_LIB_SPEC TK_SRC_DIR TK_BIN_DIR TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_DBGX CFG_TK_SHARED_LIB_SUFFIX CFG_TK_UNSHARED_LIB_SUFFIX CFG_TK_EXPORT_FILE_SUFFIX EXTRA_CFLAGS DEPARG CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW TK_RES STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX TK_SHARED_BUILD LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB MAKE_STUB_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TK_LIB_FLAG TK_LIB_SPEC TK_BUILD_LIB_SPEC TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_BUILD_STUB_LIB_PATH TK_CC_SEARCH_FLAGS TK_LD_SEARCH_FLAGS RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES RES LIBOBJS LTLIBOBJS'
+ac_header_c_list=
+ac_subst_vars='LTLIBOBJS
+LIBOBJS
+RES
+RC_DEFINES
+RC_DEFINE
+RC_INCLUDE
+RC_TYPE
+RC_OUT
+TK_LD_SEARCH_FLAGS
+TK_CC_SEARCH_FLAGS
+TK_BUILD_STUB_LIB_PATH
+TK_STUB_LIB_PATH
+TK_STUB_LIB_SPEC
+TK_BUILD_LIB_SPEC
+TK_LIB_SPEC
+TK_LIB_FLAG
+MAKE_EXE
+MAKE_DLL
+POST_MAKE_LIB
+MAKE_STUB_LIB
+MAKE_LIB
+LIBRARIES
+EXESUFFIX
+LIBSUFFIX
+LIBPREFIX
+DLLSUFFIX
+LIBS_GUI
+TK_SHARED_BUILD
+SHLIB_SUFFIX
+SHLIB_CFLAGS
+SHLIB_LD_LIBS
+SHLIB_LD
+STLIB_LD
+TK_RES
+LDFLAGS_WINDOW
+LDFLAGS_CONSOLE
+LDFLAGS_OPTIMIZE
+LDFLAGS_DEBUG
+CC_EXENAME
+CC_OBJNAME
+DEPARG
+EXTRA_CFLAGS
+CFG_TK_EXPORT_FILE_SUFFIX
+CFG_TK_UNSHARED_LIB_SUFFIX
+CFG_TK_SHARED_LIB_SUFFIX
+TCL_PATCH_LEVEL
+TCL_MINOR_VERSION
+TCL_MAJOR_VERSION
+TK_BIN_DIR
+TK_SRC_DIR
+TK_BUILD_STUB_LIB_SPEC
+TK_STUB_LIB_FLAG
+TK_STUB_LIB_FILE
+TK_DLL_FILE_TCL9
+TK_DLL_FILE_TCL8
+TK_DLL_FILE
+TK_LIB_FILE
+TK_PATCH_LEVEL
+TK_MINOR_VERSION
+TK_MAJOR_VERSION
+TK_VERSION
+MACHINE
+TK_WIN_VERSION
+INSTALL_MSGS
+INSTALL_LIBRARIES
+TK_ZIP_FILE
+ZIPFS_BUILD
+ZIP_INSTALL_OBJS
+ZIP_PROG_VFSSEARCH
+ZIP_PROG_OPTIONS
+ZIP_PROG
+EXEEXT_FOR_BUILD
+CC_FOR_BUILD
+TCLSH_PROG
+BUILD_TCLSH
+VC_MANIFEST_EMBED_EXE
+VC_MANIFEST_EMBED_DLL
+EGREP
+GREP
+CPP
+LDFLAGS_DEFAULT
+CFLAGS_DEFAULT
+MAN2TCLFLAGS
+CFLAGS_NOLTO
+CFLAGS_WARNING
+CFLAGS_OPTIMIZE
+CFLAGS_DEBUG
+DL_LIBS
+WINE
+CYGPATH
+TCL_DEFS
+TCL_STUB_LIB_SPEC
+TCL_STUB_LIB_FLAG
+TCL_STUB_LIB_FILE
+TCL_LIB_SPEC
+TCL_LIB_FLAG
+TCL_LIB_FILE
+TCL_SRC_DIR
+TCL_BIN_DIR
+TCL_VERSION
+SHARED_BUILD
+SET_MAKE
+RC
+RANLIB
+AR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+runstatedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL
+OBJEXT_FOR_BUILD'
ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_shared
+with_tcl
+enable_64bit
+enable_symbols
+enable_embedded_manifest
+enable_zipfs
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
@@ -337,34 +846,48 @@ x_libraries=NONE
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
ac_prev=
+ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
+ eval $ac_prev=\$ac_option
ac_prev=
continue
fi
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
@@ -386,33 +909,59 @@ do
--config-cache | -C)
cache_file=config.cache ;;
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ -datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
-disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: \`$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
-enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: \`$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
+ eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -439,6 +988,12 @@ do
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
@@ -463,13 +1018,16 @@ do
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
-localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
+ | --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -534,10 +1092,29 @@ do
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -584,26 +1161,36 @@ do
ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: \`$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
esac
- eval "with_$ac_package='$ac_optarg'" ;;
+ eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: \`$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
@@ -623,27 +1210,26 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -651,31 +1237,36 @@ done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "missing argument to $ac_option"
fi
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
-done
+fi
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir runstatedir
do
- eval ac_val=$`echo $ac_var`
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
@@ -689,8 +1280,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -702,74 +1291,72 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
+ if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
-fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
- { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
#
# Report the --help message.
@@ -778,7 +1365,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tk 8.6 to adapt to many kinds of systems.
+\`configure' configures tk 8.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -792,20 +1379,17 @@ Configuration:
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
+ -q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
-_ACEOF
-
- cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
+ [$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
+ [PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
@@ -815,18 +1399,26 @@ for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/tk]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
@@ -835,155 +1427,315 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tk 8.6:";;
+ short | recursive ) echo "Configuration of tk 8.7:";;
esac
cat <<\_ACEOF
Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-threads build with threads (default: on)
--enable-shared build and link with shared libraries (default: on)
--enable-64bit enable 64bit support (where applicable)
- --enable-wince enable Win/CE support (where applicable)
--enable-symbols build with debugging symbols (default: off)
--enable-embedded-manifest
embed manifest if possible (default: yes)
+ --enable-zipfs build with Zipfs support (default: on)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-tcl directory containing tcl configuration
(tclConfig.sh)
- --with-celib=DIR use Windows/CE support library from DIR
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
+Report bugs to the package provider.
_ACEOF
+ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
ac_builddir=.
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for configure.gnu first; this name is used for a wrapper for
+ # Metaconfig's "Configure" on case-insensitive file systems.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
+ printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
-test -n "$ac_init_help" && exit 0
+test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tk configure 8.6
-generated by GNU Autoconf 2.59
+tk configure 8.7
+generated by GNU Autoconf 2.71
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 2021 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
- exit 0
+ exit
fi
-exec 5>config.log
-cat >&5 <<_ACEOF
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest.beam
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext
+then :
+ ac_retval=0
+else $as_nop
+ printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ eval "$3=yes"
+else $as_nop
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main (void)
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main (void)
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+
+else $as_nop
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }
+then :
+ ac_retval=0
+else $as_nop
+ printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+ac_configure_args_raw=
+for ac_arg
+do
+ case $ac_arg in
+ *\'*)
+ ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append ac_configure_args_raw " '$ac_arg'"
+done
+
+case $ac_configure_args_raw in
+ *$as_nl*)
+ ac_safe_unquote= ;;
+ *)
+ ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab.
+ ac_unsafe_a="$ac_unsafe_z#~"
+ ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g"
+ ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;;
+esac
+
+cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tk $as_me 8.6, which was
-generated by GNU Autoconf 2.59. Invocation command line was
+It was created by tk $as_me 8.7, which was
+generated by GNU Autoconf 2.71. Invocation command line was
- $ $0 $@
+ $ $0$ac_configure_args_raw
_ACEOF
+exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
@@ -1002,7 +1754,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
@@ -1013,9 +1765,14 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ printf "%s\n" "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
} >&5
@@ -1037,7 +1794,6 @@ _ACEOF
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
-ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
@@ -1048,13 +1804,13 @@ do
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*)
+ ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
@@ -1070,217 +1826,558 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
+ as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
+ # Sanitize IFS.
+ IFS=" "" $as_nl"
# Save into config.log some information that might help in debugging.
{
echo
- cat <<\_ASBOX
-## ---------------- ##
+ printf "%s\n" "## ---------------- ##
## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
(set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
*)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-}
+ esac |
+ sort
+)
echo
- cat <<\_ASBOX
-## ----------------- ##
+ printf "%s\n" "## ----------------- ##
## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
+ printf "%s\n" "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
+ printf "%s\n" "## ----------- ##
## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
echo
- sed "/^$/d" confdefs.h | sort
+ cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
+ printf "%s\n" "$as_me: caught signal $ac_signal"
+ printf "%s\n" "$as_me: exit $exit_status"
} >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
- ' 0
+' 0
for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
+rm -f -r conftest* confdefs.h
-# Predefined preprocessor variables.
+printf "%s\n" "/* confdefs.h */" > confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
+# Predefined preprocessor variables.
+printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
+printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h
+printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
+printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h
+printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
+printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h
# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
+# Prefer an explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ ac_site_files="$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
+else
+ ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
+
+for ac_site_file in $ac_site_files
+do
+ case $ac_site_file in #(
+ */*) :
+ ;; #(
+ *) :
+ ac_site_file=./$ac_site_file ;;
+esac
+ if test -f "$ac_site_file" && test -r "$ac_site_file"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
+ . "$ac_site_file" \
+ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
fi
done
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+printf "%s\n" "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
esac
fi
else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+printf "%s\n" "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
+# Test code for whether the C compiler supports C89 (global declarations)
+ac_c_conftest_c89_globals='
+/* Does the compiler advertise C89 conformance?
+ Do not test the value of __STDC__, because some compilers set it to 0
+ while being otherwise adequately conformant. */
+#if !defined __STDC__
+# error "Compiler does not advertise C89 conformance"
+#endif
+
+#include <stddef.h>
+#include <stdarg.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */
+struct buf { int x; };
+struct buf * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not \xHH hex character constants.
+ These do not provoke an error unfortunately, instead are silently treated
+ as an "x". The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously \x00 != x always comes out true, for an
+ array size at least. It is necessary to write \x00 == 0 to get something
+ that is true only with -std. */
+int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) '\''x'\''
+int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),
+ int, int);'
+
+# Test code for whether the C compiler supports C89 (body of main).
+ac_c_conftest_c89_main='
+ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);
+'
+
+# Test code for whether the C compiler supports C99 (global declarations)
+ac_c_conftest_c99_globals='
+// Does the compiler advertise C99 conformance?
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
+# error "Compiler does not advertise C99 conformance"
+#endif
+
+#include <stdbool.h>
+extern int puts (const char *);
+extern int printf (const char *, ...);
+extern int dprintf (int, const char *, ...);
+extern void *malloc (size_t);
+
+// Check varargs macros. These examples are taken from C99 6.10.3.5.
+// dprintf is used instead of fprintf to avoid needing to declare
+// FILE and stderr.
+#define debug(...) dprintf (2, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+ int x = 1234;
+ int y = 5678;
+ debug ("Flag");
+ debug ("X = %d\n", x);
+ showlist (The first, second, and third items.);
+ report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+ #error "your preprocessor is broken"
+#endif
+#if BIG_OK
+#else
+ #error "your preprocessor is broken"
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+ int datasize;
+ double data[];
+};
+
+struct named_init {
+ int number;
+ const wchar_t *name;
+ double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+ // See if C++-style comments work.
+ // Iterate through items via the restricted pointer.
+ // Also check for declarations in for loops.
+ for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i)
+ continue;
+ return 0;
+}
+
+// Check varargs and va_copy.
+static bool
+test_varargs (const char *format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ va_list args_copy;
+ va_copy (args_copy, args);
+
+ const char *str = "";
+ int number = 0;
+ float fnumber = 0;
+
+ while (*format)
+ {
+ switch (*format++)
+ {
+ case '\''s'\'': // string
+ str = va_arg (args_copy, const char *);
+ break;
+ case '\''d'\'': // int
+ number = va_arg (args_copy, int);
+ break;
+ case '\''f'\'': // float
+ fnumber = va_arg (args_copy, double);
+ break;
+ default:
+ break;
+ }
+ }
+ va_end (args_copy);
+ va_end (args);
+
+ return *str && number && fnumber;
+}
+'
+
+# Test code for whether the C compiler supports C99 (body of main).
+ac_c_conftest_c99_main='
+ // Check bool.
+ _Bool success = false;
+ success |= (argc != 0);
+
+ // Check restrict.
+ if (test_restrict ("String literal") == 0)
+ success = true;
+ char *restrict newvar = "Another string";
+
+ // Check varargs.
+ success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234);
+ test_varargs_macros ();
+
+ // Check flexible array members.
+ struct incomplete_array *ia =
+ malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+ ia->datasize = 10;
+ for (int i = 0; i < ia->datasize; ++i)
+ ia->data[i] = i * 1.234;
+
+ // Check named initializers.
+ struct named_init ni = {
+ .number = 34,
+ .name = L"Test wide string",
+ .average = 543.34343,
+ };
+
+ ni.number = 58;
+
+ int dynamic_array[ni.number];
+ dynamic_array[0] = argv[0][0];
+ dynamic_array[ni.number - 1] = 543;
+
+ // work around unused variable warnings
+ ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
+ || dynamic_array[ni.number - 1] != 543);
+'
+
+# Test code for whether the C compiler supports C11 (global declarations)
+ac_c_conftest_c11_globals='
+// Does the compiler advertise C11 conformance?
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
+# error "Compiler does not advertise C11 conformance"
+#endif
+
+// Check _Alignas.
+char _Alignas (double) aligned_as_double;
+char _Alignas (0) no_special_alignment;
+extern char aligned_as_int;
+char _Alignas (0) _Alignas (int) aligned_as_int;
+
+// Check _Alignof.
+enum
+{
+ int_alignment = _Alignof (int),
+ int_array_alignment = _Alignof (int[100]),
+ char_alignment = _Alignof (char)
+};
+_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
+
+// Check _Noreturn.
+int _Noreturn does_not_return (void) { for (;;) continue; }
+
+// Check _Static_assert.
+struct test_static_assert
+{
+ int x;
+ _Static_assert (sizeof (int) <= sizeof (long int),
+ "_Static_assert does not work in struct");
+ long int y;
+};
+
+// Check UTF-8 literals.
+#define u8 syntax error!
+char const utf8_literal[] = u8"happens to be ASCII" "another string";
+
+// Check duplicate typedefs.
+typedef long *long_ptr;
+typedef long int *long_ptr;
+typedef long_ptr long_ptr;
+
+// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
+struct anonymous
+{
+ union {
+ struct { int i; int j; };
+ struct { int k; long int l; } w;
+ };
+ int m;
+} v1;
+'
+
+# Test code for whether the C compiler supports C11 (body of main).
+ac_c_conftest_c11_main='
+ _Static_assert ((offsetof (struct anonymous, i)
+ == offsetof (struct anonymous, w.k)),
+ "Anonymous union alignment botch");
+ v1.i = 2;
+ v1.w.k = 5;
+ ok |= v1.i != 5;
+'
+
+# Test code for whether the C compiler supports C11 (complete).
+ac_c_conftest_c11_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+${ac_c_conftest_c11_globals}
+
+int
+main (int argc, char **argv)
+{
+ int ok = 0;
+ ${ac_c_conftest_c89_main}
+ ${ac_c_conftest_c99_main}
+ ${ac_c_conftest_c11_main}
+ return ok;
+}
+"
+
+# Test code for whether the C compiler supports C99 (complete).
+ac_c_conftest_c99_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+
+int
+main (int argc, char **argv)
+{
+ int ok = 0;
+ ${ac_c_conftest_c89_main}
+ ${ac_c_conftest_c99_main}
+ return ok;
+}
+"
+
+# Test code for whether the C compiler supports C89 (complete).
+ac_c_conftest_c89_program="${ac_c_conftest_c89_globals}
+
+int
+main (int argc, char **argv)
+{
+ int ok = 0;
+ ${ac_c_conftest_c89_main}
+ return ok;
+}
+"
+
+as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H"
+as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H"
+as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H"
+as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H"
+as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H"
+as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H"
+as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H"
+as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H"
+as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file'
+ and start over" "$LINENO" 5
fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -1292,40 +2389,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The following define is needed when building with Cygwin since newer
# versions of autoconf incorrectly set SHELL to /bin/bash instead of
# /bin/sh. The bash shell seems to suffer from some strange failures.
SHELL=/bin/sh
-TK_VERSION=8.6
+TK_VERSION=8.7
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=6
-TK_PATCH_LEVEL=".11"
+TK_MINOR_VERSION=7
+TK_PATCH_LEVEL="a6"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------
@@ -1351,6 +2423,15 @@ if test "${CFLAGS+set}" != "set" ; then
CFLAGS=""
fi
+
+
+
+
+
+
+
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -1359,11 +2440,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
@@ -1371,37 +2453,44 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
@@ -1409,41 +2498,57 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
@@ -1451,79 +2556,44 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
+ fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
@@ -1532,19 +2602,24 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
@@ -1555,32 +2630,34 @@ if test $ac_prog_rejected = yes; then
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
@@ -1588,41 +2665,48 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
@@ -1630,71 +2714,191 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
test -n "$ac_ct_CC" && break
done
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args.
+set dummy ${ac_tool_prefix}clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}clang"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "clang", so it can be a program name with args.
+set dummy clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="clang"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
fi
fi
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
+printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion -version; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -1702,112 +2906,111 @@ main ()
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+printf %s "checking whether the C compiler works... " >&6; }
+ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
+ if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
break;;
* )
break;;
esac
done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+test "$ac_cv_exeext" = no && ac_cv_exeext=
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
+else $as_nop
+ ac_file=''
fi
+if test -z "$ac_file"
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+printf %s "checking for C compiler default output file name... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+printf "%s\n" "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+printf %s "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+then :
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -1815,42 +3018,95 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
break;;
* ) break;;
esac
done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+else $as_nop
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
+rm -f conftest conftest$ac_cv_exeext
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+printf "%s\n" "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main (void)
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+printf %s "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+printf "%s\n" "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+printf %s "checking for suffix of object files... " >&6; }
+if test ${ac_cv_objext+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -1858,49 +3114,52 @@ main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
-else
- echo "$as_me: failed program was:" >&5
+else $as_nop
+ printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
fi
-
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+printf "%s\n" "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5
+printf %s "checking whether the compiler supports GNU C... " >&6; }
+if test ${ac_cv_c_compiler_gnu+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
#ifndef __GNUC__
choke me
@@ -1910,99 +3169,95 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
+else $as_nop
+ ac_compiler_gnu=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; }
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+y}
+ac_save_CFLAGS=$CFLAGS
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+printf %s "checking whether $CC accepts -g... " >&6; }
+if test ${ac_cv_prog_cc_g+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+else $as_nop
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-ac_cv_prog_cc_g=no
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+
+else $as_nop
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_g=yes
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
-if test "$ac_test_CFLAGS" = set; then
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+printf "%s\n" "$ac_cv_prog_cc_g" >&6; }
+if test $ac_test_CFLAGS; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
@@ -2017,264 +3272,146 @@ else
CFLAGS=
fi
fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
+ac_prog_cc_stdc=no
+if test x$ac_prog_cc_stdc = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5
+printf %s "checking for $CC option to enable C11 features... " >&6; }
+if test ${ac_cv_prog_cc_c11+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_cv_prog_cc_c11=no
ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
+$ac_c_conftest_c11_program
_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -std=gnu11
do
CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+ if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_c11=$ac_arg
fi
-rm -f conftest.err conftest.$ac_objext
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+ test "x$ac_cv_prog_cc_c11" != "xno" && break
done
-rm -f conftest.$ac_ext conftest.$ac_objext
+rm -f conftest.$ac_ext
CC=$ac_save_CC
-
fi
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if test "x$ac_cv_prog_cc_c11" = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else $as_nop
+ if test "x$ac_cv_prog_cc_c11" = x
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5
+printf "%s\n" "$ac_cv_prog_cc_c11" >&6; }
+ CC="$CC $ac_cv_prog_cc_c11"
+fi
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11
+ ac_prog_cc_stdc=c11
+fi
+fi
+if test x$ac_prog_cc_stdc = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5
+printf %s "checking for $CC option to enable C99 features... " >&6; }
+if test ${ac_cv_prog_cc_c99+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
+$ac_c_conftest_c99_program
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99=
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_c99=$ac_arg
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+ test "x$ac_cv_prog_cc_c99" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+fi
+
+if test "x$ac_cv_prog_cc_c99" = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else $as_nop
+ if test "x$ac_cv_prog_cc_c99" = x
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
+printf "%s\n" "$ac_cv_prog_cc_c99" >&6; }
+ CC="$CC $ac_cv_prog_cc_c99"
+fi
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
+ ac_prog_cc_stdc=c99
+fi
+fi
+if test x$ac_prog_cc_stdc = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5
+printf %s "checking for $CC option to enable C89 features... " >&6; }
+if test ${ac_cv_prog_cc_c89+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
+$ac_c_conftest_c89_program
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_c89=$ac_arg
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+if test "x$ac_cv_prog_cc_c89" = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else $as_nop
+ if test "x$ac_cv_prog_cc_c89" = x
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+printf "%s\n" "$ac_cv_prog_cc_c89" >&6; }
+ CC="$CC $ac_cv_prog_cc_c89"
+fi
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
+ ac_prog_cc_stdc=c89
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2282,61 +3419,34 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking for inline" >&5
-echo $ECHO_N "checking for inline... $ECHO_C" >&6
-if test "${ac_cv_c_inline+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+printf %s "checking for inline... " >&6; }
+if test ${ac_cv_c_inline+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef __cplusplus
typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
+static $ac_kw foo_t static_foo (void) {return 0; }
+$ac_kw foo_t foo (void) {return 0; }
#endif
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_inline=$ac_kw; break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_c_inline=$ac_kw
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
done
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6
-
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+printf "%s\n" "$ac_cv_c_inline" >&6; }
case $ac_cv_c_inline in
inline | yes) ;;
@@ -2353,432 +3463,45 @@ _ACEOF
;;
esac
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
+ac_header= ac_cache=
+for ac_item in $ac_header_c_list
do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ if test $ac_cache; then
+ ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
+ if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
+ printf "%s\n" "#define $ac_item 1" >> confdefs.h
+ fi
+ ac_header= ac_cache=
+ elif test $ac_header; then
+ ac_cache=$ac_item
else
- ac_cpp_err=
+ ac_header=$ac_item
fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-int
-main ()
-{
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_stdc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
+if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
+then :
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
fi
-
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_AR+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_AR+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
@@ -2786,37 +3509,44 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+printf "%s\n" "$AR" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_AR+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$ac_ct_AR"; then
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
else
@@ -2824,28 +3554,43 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
- echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+printf "%s\n" "$ac_ct_AR" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- AR=$ac_ct_AR
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
else
AR="$ac_cv_prog_AR"
fi
@@ -2853,11 +3598,12 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_RANLIB+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
@@ -2865,37 +3611,44 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+printf "%s\n" "$RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_RANLIB+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$ac_ct_RANLIB"; then
ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
else
@@ -2903,28 +3656,43 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+printf "%s\n" "$ac_ct_RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- RANLIB=$ac_ct_RANLIB
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
else
RANLIB="$ac_cv_prog_RANLIB"
fi
@@ -2932,11 +3700,12 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
set dummy ${ac_tool_prefix}windres; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_RC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$RC"; then
ac_cv_prog_RC="$RC" # Let the user override the test.
else
@@ -2944,37 +3713,44 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_RC="${ac_tool_prefix}windres"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
RC=$ac_cv_prog_RC
if test -n "$RC"; then
- echo "$as_me:$LINENO: result: $RC" >&5
-echo "${ECHO_T}$RC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RC" >&5
+printf "%s\n" "$RC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_RC"; then
ac_ct_RC=$RC
# Extract the first word of "windres", so it can be a program name with args.
set dummy windres; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_RC+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$ac_ct_RC"; then
ac_cv_prog_ac_ct_RC="$ac_ct_RC" # Let the user override the test.
else
@@ -2982,28 +3758,43 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RC="windres"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
fi
fi
ac_ct_RC=$ac_cv_prog_ac_ct_RC
if test -n "$ac_ct_RC"; then
- echo "$as_me:$LINENO: result: $ac_ct_RC" >&5
-echo "${ECHO_T}$ac_ct_RC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5
+printf "%s\n" "$ac_ct_RC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- RC=$ac_ct_RC
+ if test "x$ac_ct_RC" = x; then
+ RC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RC=$ac_ct_RC
+ fi
else
RC="$ac_cv_prog_RC"
fi
@@ -3013,13 +3804,14 @@ fi
# Checks to see if the make program sets the $MAKE variable.
#--------------------------------------------------------------------
-echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
-ac_make=`echo "" | sed 'y,:./+-,___p_,'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval test \${ac_cv_prog_make_${ac_make}_set+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
cat >conftest.make <<\_ACEOF
SHELL = /bin/sh
all:
@@ -3035,12 +3827,12 @@ esac
rm -f conftest.make
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
SET_MAKE=
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
@@ -3053,73 +3845,36 @@ fi
#--------------------------------------------------------------------
-# Check whether --enable-threads or --disable-threads was given.
-#--------------------------------------------------------------------
-
-
- echo "$as_me:$LINENO: checking for building with threads" >&5
-echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
- # Check whether --enable-threads or --disable-threads was given.
-if test "${enable_threads+set}" = set; then
- enableval="$enable_threads"
- tcl_ok=$enableval
-else
- tcl_ok=yes
-fi;
-
- if test "$tcl_ok" = "yes"; then
- echo "$as_me:$LINENO: result: yes (default)" >&5
-echo "${ECHO_T}yes (default)" >&6
- TCL_THREADS=1
- cat >>confdefs.h <<\_ACEOF
-#define TCL_THREADS 1
-_ACEOF
-
- # USE_THREAD_ALLOC tells us to try the special thread-based
- # allocator that significantly reduces lock contention
- cat >>confdefs.h <<\_ACEOF
-#define USE_THREAD_ALLOC 1
-_ACEOF
-
- else
- TCL_THREADS=0
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
- fi
-
-
-
-#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtk as a shared library instead of a static library.
#--------------------------------------------------------------------
- echo "$as_me:$LINENO: checking how to build libraries" >&5
-echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6
- # Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- tcl_ok=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
+printf %s "checking how to build libraries... " >&6; }
+ # Check whether --enable-shared was given.
+if test ${enable_shared+y}
+then :
+ enableval=$enable_shared; tcl_ok=$enableval
+else $as_nop
tcl_ok=yes
-fi;
+fi
+
if test "$tcl_ok" = "yes" ; then
- echo "$as_me:$LINENO: result: shared" >&5
-echo "${ECHO_T}shared" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: shared" >&5
+printf "%s\n" "shared" >&6; }
SHARED_BUILD=1
else
- echo "$as_me:$LINENO: result: static" >&5
-echo "${ECHO_T}static" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: static" >&5
+printf "%s\n" "static" >&6; }
SHARED_BUILD=0
-cat >>confdefs.h <<\_ACEOF
-#define STATIC_BUILD 1
-_ACEOF
+printf "%s\n" "#define STATIC_BUILD 1" >>confdefs.h
fi
+
#--------------------------------------------------------------------
# Locate and source the tclConfig.sh file.
#--------------------------------------------------------------------
@@ -3135,16 +3890,18 @@ _ACEOF
# we reset no_tcl in case something fails here
no_tcl=true
-# Check whether --with-tcl or --without-tcl was given.
-if test "${with_tcl+set}" = set; then
- withval="$with_tcl"
- with_tclconfig="${withval}"
-fi;
- echo "$as_me:$LINENO: checking for Tcl configuration" >&5
-echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6
- if test "${ac_cv_c_tclconfig+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+# Check whether --with-tcl was given.
+if test ${with_tcl+y}
+then :
+ withval=$with_tcl; with_tclconfig="${withval}"
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5
+printf %s "checking for Tcl configuration... " >&6; }
+ if test ${ac_cv_c_tclconfig+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
# First check to see if --with-tcl was specified.
@@ -3152,17 +3909,15 @@ else
case "${with_tclconfig}" in
*/tclConfig.sh )
if test -f "${with_tclconfig}"; then
- { echo "$as_me:$LINENO: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5
-echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5
+printf "%s\n" "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;}
with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
fi ;;
esac
if test -f "${with_tclconfig}/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
else
- { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5
-echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5
fi
fi
@@ -3226,28 +3981,26 @@ fi
if test x"${ac_cv_c_tclconfig}" = x ; then
TCL_BIN_DIR="# no Tcl configs found"
- { { echo "$as_me:$LINENO: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&5
-echo "$as_me: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" "$LINENO" 5
else
no_tcl=
TCL_BIN_DIR="${ac_cv_c_tclconfig}"
- echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
-echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
+printf "%s\n" "found ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
fi
fi
- echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
-echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
+printf %s "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... " >&6; }
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
- echo "$as_me:$LINENO: result: loading" >&5
-echo "${ECHO_T}loading" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: loading" >&5
+printf "%s\n" "loading" >&6; }
. "${TCL_BIN_DIR}/tclConfig.sh"
else
- echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
-echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
+printf "%s\n" "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
fi
#
@@ -3265,14 +4018,6 @@ echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
fi
- #
- # eval is required to do the TCL_DBGX substitution
- #
-
- eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
- eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
- eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
@@ -3292,23 +4037,17 @@ echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
+if test "${TCL_MAJOR_VERSION}" -lt 9 ; then
if test "${TCL_MAJOR_VERSION}" != "${TK_MAJOR_VERSION}"; then
- { { echo "$as_me:$LINENO: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&5
-echo "$as_me: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test "${TCL_MINOR_VERSION}" -lt "${TK_MINOR_VERSION}"; then
- { { echo "$as_me:$LINENO: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&5
-echo "$as_me: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
+Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+.
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better." "$LINENO" 5
+fi
+if test "${TCL_MINOR_VERSION}" -lt 6; then
+ as_fn_error $? "${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
+Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+.
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better." "$LINENO" 5
+fi
fi
#--------------------------------------------------------------------
@@ -3321,60 +4060,33 @@ fi
# Step 0: Enable 64 bit support?
- echo "$as_me:$LINENO: checking if 64bit support is requested" >&5
-echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6
- # Check whether --enable-64bit or --disable-64bit was given.
-if test "${enable_64bit+set}" = set; then
- enableval="$enable_64bit"
- do64bit=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5
+printf %s "checking if 64bit support is requested... " >&6; }
+ # Check whether --enable-64bit was given.
+if test ${enable_64bit+y}
+then :
+ enableval=$enable_64bit; do64bit=$enableval
+else $as_nop
do64bit=no
-fi;
- echo "$as_me:$LINENO: result: $do64bit" >&5
-echo "${ECHO_T}$do64bit" >&6
-
- # Cross-compiling options for Windows/CE builds
-
- echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5
-echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6
- # Check whether --enable-wince or --disable-wince was given.
-if test "${enable_wince+set}" = set; then
- enableval="$enable_wince"
- doWince=$enableval
-else
- doWince=no
-fi;
- echo "$as_me:$LINENO: result: $doWince" >&5
-echo "${ECHO_T}$doWince" >&6
-
- echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5
-echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6
-
-# Check whether --with-celib or --without-celib was given.
-if test "${with_celib+set}" = set; then
- withval="$with_celib"
- CELIB_DIR=$withval
-else
- CELIB_DIR=NO_CELIB
-fi;
- echo "$as_me:$LINENO: result: $CELIB_DIR" >&5
-echo "${ECHO_T}$CELIB_DIR" >&6
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5
+printf "%s\n" "$do64bit" >&6; }
# Set some defaults (may get changed below)
EXTRA_CFLAGS=""
-cat >>confdefs.h <<\_ACEOF
-#define MODULE_SCOPE extern
-_ACEOF
+printf "%s\n" "#define MODULE_SCOPE extern" >>confdefs.h
# Extract the first word of "cygpath", so it can be a program name with args.
set dummy cygpath; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CYGPATH+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CYGPATH+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
if test -n "$CYGPATH"; then
ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test.
else
@@ -3382,29 +4094,77 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CYGPATH="cygpath -m"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo"
fi
fi
CYGPATH=$ac_cv_prog_CYGPATH
if test -n "$CYGPATH"; then
- echo "$as_me:$LINENO: result: $CYGPATH" >&5
-echo "${ECHO_T}$CYGPATH" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5
+printf "%s\n" "$CYGPATH" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+ # Extract the first word of "wine", so it can be a program name with args.
+set dummy wine; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_WINE+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test -n "$WINE"; then
+ ac_cv_prog_WINE="$WINE" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_WINE="wine"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+WINE=$ac_cv_prog_WINE
+if test -n "$WINE"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $WINE" >&5
+printf "%s\n" "$WINE" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+
SHLIB_SUFFIX=".dll"
# MACHINE is IX86 for LINK, but this is used by the manifest,
@@ -3413,16 +4173,13 @@ fi
if test "$GCC" = "yes"; then
- echo "$as_me:$LINENO: checking for cross-compile version of gcc" >&5
-echo $ECHO_N "checking for cross-compile version of gcc... $ECHO_C" >&6
-if test "${ac_cv_cross+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cross-compile version of gcc" >&5
+printf %s "checking for cross-compile version of gcc... " >&6; }
+if test ${ac_cv_cross+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef _WIN32
@@ -3430,47 +4187,24 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_cross=no
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_cross=yes
+else $as_nop
+ ac_cv_cross=yes
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_cross" >&5
-echo "${ECHO_T}$ac_cv_cross" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cross" >&5
+printf "%s\n" "$ac_cv_cross" >&6; }
if test "$ac_cv_cross" = "yes"; then
case "$do64bit" in
@@ -3505,20 +4239,20 @@ echo "${ECHO_T}$ac_cv_cross" >&6
echo "101 \"name\"" >> $conftest
echo "END" >> $conftest
- echo "$as_me:$LINENO: checking for Windows native path bug in windres" >&5
-echo $ECHO_N "checking for Windows native path bug in windres... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Windows native path bug in windres" >&5
+printf %s "checking for Windows native path bug in windres... " >&6; }
cyg_conftest=`$CYGPATH $conftest`
if { ac_try='$RC -o conftest.res.o $cyg_conftest'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } ; then
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; } ; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
else
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
CYGPATH=echo
fi
conftest=
@@ -3536,16 +4270,13 @@ echo "${ECHO_T}yes" >&6
if test "${GCC}" = "yes" ; then
extra_cflags="-pipe"
extra_ldflags="-pipe -static-libgcc"
- echo "$as_me:$LINENO: checking for mingw32 version of gcc" >&5
-echo $ECHO_N "checking for mingw32 version of gcc... $ECHO_C" >&6
-if test "${ac_cv_win32+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mingw32 version of gcc" >&5
+printf %s "checking for mingw32 version of gcc... " >&6; }
+if test ${ac_cv_win32+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef _WIN32
@@ -3553,188 +4284,191 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_win32=no
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_win32=yes
+else $as_nop
+ ac_cv_win32=yes
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_win32" >&5
-echo "${ECHO_T}$ac_cv_win32" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_win32" >&5
+printf "%s\n" "$ac_cv_win32" >&6; }
if test "$ac_cv_win32" != "yes"; then
- { { echo "$as_me:$LINENO: error: ${CC} cannot produce win32 executables." >&5
-echo "$as_me: error: ${CC} cannot produce win32 executables." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${CC} cannot produce win32 executables." "$LINENO" 5
fi
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain"
- echo "$as_me:$LINENO: checking for working -municode linker flag" >&5
-echo $ECHO_N "checking for working -municode linker flag... $ECHO_C" >&6
-if test "${ac_cv_municode+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -municode linker flag" >&5
+printf %s "checking for working -municode linker flag... " >&6; }
+if test ${ac_cv_municode+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }
+then :
+ ac_retval=0
+else $as_nop
+ printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <windows.h>
int APIENTRY wWinMain(HINSTANCE a, HINSTANCE b, LPWSTR c, int d) {return 0;}
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_municode=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_municode=no
+else $as_nop
+ ac_cv_municode=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_municode" >&5
-echo "${ECHO_T}$ac_cv_municode" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_municode" >&5
+printf "%s\n" "$ac_cv_municode" >&6; }
CFLAGS=$hold_cflags
if test "$ac_cv_municode" = "yes" ; then
extra_ldflags="$extra_ldflags -municode"
else
extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS"
fi
- echo "$as_me:$LINENO: checking for working -fno-lto" >&5
-echo $ECHO_N "checking for working -fno-lto... $ECHO_C" >&6
-if test "${ac_cv_nolto+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -fno-lto" >&5
+printf %s "checking for working -fno-lto... " >&6; }
+if test ${ac_cv_nolto+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_nolto=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_nolto=no
+else $as_nop
+ ac_cv_nolto=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_nolto" >&5
-echo "${ECHO_T}$ac_cv_nolto" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_nolto" >&5
+printf "%s\n" "$ac_cv_nolto" >&6; }
CFLAGS=$hold_cflags
if test "$ac_cv_nolto" = "yes" ; then
CFLAGS_NOLTO="-fno-lto"
else
CFLAGS_NOLTO=""
fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -finput-charset" >&5
+printf %s "checking if the compiler understands -finput-charset... " >&6; }
+if test ${tcl_cv_cc_input_charset+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ tcl_cv_cc_input_charset=yes
+else $as_nop
+ tcl_cv_cc_input_charset=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ CFLAGS=$hold_cflags
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_input_charset" >&5
+printf "%s\n" "$tcl_cv_cc_input_charset" >&6; }
+ if test $tcl_cv_cc_input_charset = yes; then
+ extra_cflags="$extra_cflags -finput-charset=UTF-8"
+ fi
fi
- echo "$as_me:$LINENO: checking compiler flags" >&5
-echo $ECHO_N "checking compiler flags... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking compiler flags" >&5
+printf %s "checking compiler flags... " >&6; }
if test "${GCC}" = "yes" ; then
SHLIB_LD=""
SHLIB_LD_LIBS='${LIBS}'
LIBS="-lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32"
# mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't
- LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32"
+ LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32 -lwinspool"
STLIB_LD='${AR} cr'
RC_OUT=-o
RC_TYPE=
@@ -3749,29 +4483,26 @@ echo $ECHO_N "checking compiler flags... $ECHO_C" >&6
if test "${SHARED_BUILD}" = "0" ; then
# static
- echo "$as_me:$LINENO: result: using static flags" >&5
-echo "${ECHO_T}using static flags" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5
+printf "%s\n" "using static flags" >&6; }
runtime=
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
- echo "$as_me:$LINENO: result: using shared flags" >&5
-echo "${ECHO_T}using shared flags" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5
+printf "%s\n" "using shared flags" >&6; }
# ad-hoc check to see if CC supports -shared.
if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then
- { { echo "$as_me:$LINENO: error: ${CC} does not support the -shared option.
- You will need to upgrade to a newer version of the toolchain." >&5
-echo "$as_me: error: ${CC} does not support the -shared option.
- You will need to upgrade to a newer version of the toolchain." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${CC} does not support the -shared option.
+ You will need to upgrade to a newer version of the toolchain." "$LINENO" 5
fi
runtime=
# Add SHLIB_LD_LIBS to the Make rule, not here.
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
LIBRARIES="\${SHARED_LIBRARIES}"
fi
# Link with gcc since ld does not link to default libs like
@@ -3782,16 +4513,16 @@ echo "$as_me: error: ${CC} does not support the -shared option.
-Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\$@)"
# DLLSUFFIX is separate because it is the building block for
# users of tclConfig.sh that may build shared or static.
- DLLSUFFIX="\${DBGX}.dll"
- LIBSUFFIX="\${DBGX}.a"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".a"
+ LIBFLAGSUFFIX=""
SHLIB_SUFFIX=.dll
EXTRA_CFLAGS="${extra_cflags}"
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
@@ -3800,7 +4531,7 @@ echo "$as_me: error: ${CC} does not support the -shared option.
CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format"
;;
*)
- CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement"
+ CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers"
;;
esac
@@ -3828,20 +4559,16 @@ echo "$as_me: error: ${CC} does not support the -shared option.
case "$do64bit" in
amd64|x64|yes)
MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
- echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
-echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5
+printf "%s\n" " Using 64-bit $MACHINE mode" >&6; }
;;
ia64)
MACHINE="IA64"
- echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
-echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5
+printf "%s\n" " Using 64-bit $MACHINE mode" >&6; }
;;
*)
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef _WIN64
@@ -3849,68 +4576,45 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_win_64bit=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_win_64bit=no
+else $as_nop
+ tcl_win_64bit=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
if test "$tcl_win_64bit" = "yes" ; then
- do64bit=amd64
- MACHINE="AMD64"
- echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
-echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
+ do64bit=amd64
+ MACHINE="AMD64"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5
+printf "%s\n" " Using 64-bit $MACHINE mode" >&6; }
fi
;;
esac
else
if test "${SHARED_BUILD}" = "0" ; then
# static
- echo "$as_me:$LINENO: result: using static flags" >&5
-echo "${ECHO_T}using static flags" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5
+printf "%s\n" "using static flags" >&6; }
runtime=-MT
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
- echo "$as_me:$LINENO: result: using shared flags" >&5
-echo "${ECHO_T}using shared flags" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5
+printf "%s\n" "using shared flags" >&6; }
runtime=-MD
# Add SHLIB_LD_LIBS to the Make rule, not here.
LIBRARIES="\${SHARED_LIBRARIES}"
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
case "x`echo \${VisualStudioVersion}`" in
x1[4-9]*)
lflags="${lflags} -nodefaultlib:libucrt.lib"
@@ -3922,9 +4626,9 @@ echo "${ECHO_T}using shared flags" >&6
MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\$@"
# DLLSUFFIX is separate because it is the building block for
# users of tclConfig.sh that may build shared or static.
- DLLSUFFIX="\${DBGX}.dll"
- LIBSUFFIX="\${DBGX}.lib"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".lib"
+ LIBFLAGSUFFIX=""
if test "$do64bit" != "no" ; then
case "$do64bit" in
@@ -3935,8 +4639,8 @@ echo "${ECHO_T}using shared flags" >&6
MACHINE="IA64"
;;
esac
- echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
-echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5
+printf "%s\n" " Using 64-bit $MACHINE mode" >&6; }
fi
LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib userenv.lib ws2_32.lib"
@@ -3970,111 +4674,7 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
LINKBIN="link"
fi
- if test "$doWince" != "no" ; then
- # Set defaults for common evc4/PPC2003 setup
- # Currently Tcl requires 300+, possibly 420+ for sockets
- CEVERSION=420; # could be 211 300 301 400 420 ...
- TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
- ARCH=ARM; # could be ARM MIPS X86EM ...
- PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
- if test "$doWince" != "yes"; then
- # If !yes then the user specified something
- # Reset ARCH to allow user to skip specifying it
- ARCH=
- eval `echo $doWince | awk -F "," '{ \
- if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \
- if ($1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
- if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \
- if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \
- if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \
- }'`
- if test "x${ARCH}" = "x" ; then
- ARCH=$TARGETCPU;
- fi
- fi
- OSVERSION=WCE$CEVERSION;
- if test "x${WCEROOT}" = "x" ; then
- WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
- if test ! -d "${WCEROOT}" ; then
- WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
- fi
- fi
- if test "x${SDKROOT}" = "x" ; then
- SDKROOT="C:/Program Files/Windows CE Tools"
- if test ! -d "${SDKROOT}" ; then
- SDKROOT="C:/Windows CE Tools"
- fi
- fi
- # The space-based-path will work for the Makefile, but will
- # not work if AC_TRY_COMPILE is called.
- WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
- SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
- CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
- if test ! -d "${CELIB_DIR}/inc"; then
- { { echo "$as_me:$LINENO: error: Invalid celib directory \"${CELIB_DIR}\"" >&5
-echo "$as_me: error: Invalid celib directory \"${CELIB_DIR}\"" >&2;}
- { (exit 1); exit 1; }; }
- fi
- if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\
- -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
- { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5
-echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;}
- { (exit 1); exit 1; }; }
- else
- CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
- if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
- CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
- fi
- CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
- fi
- fi
-
- if test "$doWince" != "no" ; then
- CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
- if test "${TARGETCPU}" = "X86"; then
- CC="${CEBINROOT}/cl.exe"
- else
- CC="${CEBINROOT}/cl${ARCH}.exe"
- fi
- CC="\"${CC}\" -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
- RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
- arch=`echo ${ARCH} | awk '{print tolower($0)}'`
- defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS"
- for i in $defs ; do
- cat >>confdefs.h <<_ACEOF
-#define $i 1
-_ACEOF
-
- done
-# if test "${ARCH}" = "X86EM"; then
-# AC_DEFINE_UNQUOTED(_WIN32_WCE_EMULATION)
-# fi
- cat >>confdefs.h <<_ACEOF
-#define _WIN32_WCE $CEVERSION
-_ACEOF
-
- cat >>confdefs.h <<_ACEOF
-#define UNDER_CE $CEVERSION
-_ACEOF
-
- CFLAGS_DEBUG="-nologo -Zi -Od"
- CFLAGS_OPTIMIZE="-nologo -O2"
- lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
- lflags="-nodefaultlib -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
- LINKBIN="\"${CEBINROOT}/link.exe\""
-
- if test "${CEVERSION}" -lt 400 ; then
- LIBS="coredll.lib corelibc.lib winsock.lib"
- else
- LIBS="coredll.lib corelibc.lib ws2.lib"
- fi
- # celib currently stuck at wce300 status
- #LIBS="$LIBS \${CELIB_DIR}/wince-${ARCH}-pocket-${OSVERSION}-release/celib.lib"
- LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\""
- LIBS_GUI="commctrl.lib commdlg.lib"
- else
- LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib"
- fi
+ LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib winspool.lib"
SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
SHLIB_LD_LIBS='${LIBS}'
@@ -4105,7 +4705,7 @@ _ACEOF
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
- if test "$doWince" != "no" -a "${TARGETCPU}" != "X86"; then
+ if test "${TARGETCPU}" != "X86"; then
LDFLAGS_CONSOLE="-link ${lflags}"
LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
else
@@ -4115,26 +4715,65 @@ _ACEOF
fi
if test "$do64bit" != "no" ; then
- cat >>confdefs.h <<\_ACEOF
-#define TCL_CFG_DO64BIT 1
-_ACEOF
+ printf "%s\n" "#define TCL_CFG_DO64BIT 1" >>confdefs.h
fi
if test "${GCC}" = "yes" ; then
- echo "$as_me:$LINENO: checking for SEH support in compiler" >&5
-echo $ECHO_N "checking for SEH support in compiler... $ECHO_C" >&6
-if test "${tcl_cv_seh+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$cross_compiling" = yes; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5
+printf %s "checking for SEH support in compiler... " >&6; }
+if test ${tcl_cv_seh+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test "$cross_compiling" = yes
+then :
tcl_cv_seh=no
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+else $as_nop
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that
+# executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+then :
+ ac_retval=0
+else $as_nop
+ printf "%s\n" "$as_me: program exited with status $ac_status" >&5
+ printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define WIN32_LEAN_AND_MEAN
@@ -4153,37 +4792,23 @@ cat >>conftest.$ac_ext <<_ACEOF
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"
+then :
tcl_cv_seh=yes
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-tcl_cv_seh=no
+else $as_nop
+ tcl_cv_seh=no
fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
+
fi
-echo "$as_me:$LINENO: result: $tcl_cv_seh" >&5
-echo "${ECHO_T}$tcl_cv_seh" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_seh" >&5
+printf "%s\n" "$tcl_cv_seh" >&6; }
if test "$tcl_cv_seh" = "no" ; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NO_SEH 1
-_ACEOF
+printf "%s\n" "#define HAVE_NO_SEH 1" >>confdefs.h
fi
@@ -4193,16 +4818,13 @@ _ACEOF
# with Cygwin's version as of 2002-04-10, define it to be int,
# sufficient for getting the current code to work.
#
- echo "$as_me:$LINENO: checking for EXCEPTION_DISPOSITION support in include files" >&5
-echo $ECHO_N "checking for EXCEPTION_DISPOSITION support in include files... $ECHO_C" >&6
-if test "${tcl_cv_eh_disposition+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EXCEPTION_DISPOSITION support in include files" >&5
+printf %s "checking for EXCEPTION_DISPOSITION support in include files... " >&6; }
+if test ${tcl_cv_eh_disposition+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
# define WIN32_LEAN_AND_MEAN
@@ -4210,7 +4832,7 @@ cat >>conftest.$ac_ext <<_ACEOF
# undef WIN32_LEAN_AND_MEAN
int
-main ()
+main (void)
{
EXCEPTION_DISPOSITION x;
@@ -4219,45 +4841,20 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_eh_disposition=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_eh_disposition=no
+else $as_nop
+ tcl_cv_eh_disposition=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_eh_disposition" >&5
-echo "${ECHO_T}$tcl_cv_eh_disposition" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_eh_disposition" >&5
+printf "%s\n" "$tcl_cv_eh_disposition" >&6; }
if test "$tcl_cv_eh_disposition" = "no" ; then
-cat >>confdefs.h <<\_ACEOF
-#define EXCEPTION_DISPOSITION int
-_ACEOF
+printf "%s\n" "#define EXCEPTION_DISPOSITION int" >>confdefs.h
fi
@@ -4265,16 +4862,13 @@ _ACEOF
# even if VOID has already been #defined. The win32api
# used by mingw and cygwin is known to do this.
- echo "$as_me:$LINENO: checking for winnt.h that ignores VOID define" >&5
-echo $ECHO_N "checking for winnt.h that ignores VOID define... $ECHO_C" >&6
-if test "${tcl_cv_winnt_ignore_void+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for winnt.h that ignores VOID define" >&5
+printf %s "checking for winnt.h that ignores VOID define... " >&6; }
+if test ${tcl_cv_winnt_ignore_void+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define VOID void
@@ -4283,7 +4877,7 @@ cat >>conftest.$ac_ext <<_ACEOF
#undef WIN32_LEAN_AND_MEAN
int
-main ()
+main (void)
{
CHAR c;
@@ -4294,66 +4888,47 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_winnt_ignore_void=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_winnt_ignore_void=no
+else $as_nop
+ tcl_cv_winnt_ignore_void=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_winnt_ignore_void" >&5
-echo "${ECHO_T}$tcl_cv_winnt_ignore_void" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5
+printf "%s\n" "$tcl_cv_winnt_ignore_void" >&6; }
if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_WINNT_IGNORE_VOID 1
-_ACEOF
+printf "%s\n" "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h
fi
+ ac_fn_c_check_header_compile "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdbool_h" = xyes
+then :
+
+printf "%s\n" "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+fi
+
+
# See if the compiler supports casting to a union type.
# This is used to stop gcc from printing a compiler
# warning when initializing a union member.
- echo "$as_me:$LINENO: checking for cast to union support" >&5
-echo $ECHO_N "checking for cast to union support... $ECHO_C" >&6
-if test "${tcl_cv_cast_to_union+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5
+printf %s "checking for cast to union support... " >&6; }
+if test ${tcl_cv_cast_to_union+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
union foo { int i; double d; };
@@ -4363,45 +4938,20 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_cast_to_union=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cast_to_union=no
+else $as_nop
+ tcl_cv_cast_to_union=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cast_to_union" >&5
-echo "${ECHO_T}$tcl_cv_cast_to_union" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5
+printf "%s\n" "$tcl_cv_cast_to_union" >&6; }
if test "$tcl_cv_cast_to_union" = "yes"; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CAST_TO_UNION 1
-_ACEOF
+printf "%s\n" "#define HAVE_CAST_TO_UNION 1" >>confdefs.h
fi
fi
@@ -4414,561 +4964,183 @@ _ACEOF
-#--------------------------------------------------------------------
-# man2tcl needs this so that it can use errno.h
-#--------------------------------------------------------------------
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
+ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "
+#include <stdint.h>
+"
+if test "x$ac_cv_type_intptr_t" = xyes
+then :
+printf "%s\n" "#define HAVE_INTPTR_T 1" >>confdefs.h
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "
+#include <stdint.h>
-fi
-
-done
+"
+if test "x$ac_cv_type_uintptr_t" = xyes
+then :
+printf "%s\n" "#define HAVE_UINTPTR_T 1" >>confdefs.h
-if test "${ac_cv_header_errno_h+set}" = set; then
- echo "$as_me:$LINENO: checking for errno.h" >&5
-echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
-if test "${ac_cv_header_errno_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
-echo "${ECHO_T}$ac_cv_header_errno_h" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking errno.h usability" >&5
-echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <errno.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-# Is the header present?
-echo "$as_me:$LINENO: checking errno.h presence" >&5
-echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <errno.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+#--------------------------------------------------------------------
+# man2tcl needs this so that it can use errno.h
+#--------------------------------------------------------------------
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: errno.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: errno.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: errno.h: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------- ##
-## Report this to the tk lists. ##
-## ----------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for errno.h" >&5
-echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
-if test "${ac_cv_header_errno_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_header_errno_h=$ac_header_preproc
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
-echo "${ECHO_T}$ac_cv_header_errno_h" >&6
+ac_fn_c_check_header_compile "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default"
+if test "x$ac_cv_header_errno_h" = xyes
+then :
-fi
-if test $ac_cv_header_errno_h = yes; then
- :
-else
+else $as_nop
MAN2TCLFLAGS="-DNO_ERRNO_H"
fi
-
#-------------------------------------------
# Check for _strtoi64
#-------------------------------------------
-echo "$as_me:$LINENO: checking availability of _strtoi64" >&5
-echo $ECHO_N "checking availability of _strtoi64... $ECHO_C" >&6
-if test "${tcl_cv_strtoi64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking availability of _strtoi64" >&5
+printf %s "checking availability of _strtoi64... " >&6; }
+if test ${tcl_cv_strtoi64+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
int
-main ()
+main (void)
{
_strtoi64(0,0,0)
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_strtoi64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_strtoi64=no
+else $as_nop
+ tcl_cv_strtoi64=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $tcl_cv_strtoi64" >&5
-echo "${ECHO_T}$tcl_cv_strtoi64" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtoi64" >&5
+printf "%s\n" "$tcl_cv_strtoi64" >&6; }
if test $tcl_cv_strtoi64 = no; then
-cat >>confdefs.h <<\_ACEOF
-#define NO_STRTOI64 1
-_ACEOF
+printf "%s\n" "#define NO_STRTOI64 1" >>confdefs.h
fi
-echo "$as_me:$LINENO: checking for intptr_t" >&5
-echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6
-if test "${ac_cv_type_intptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((intptr_t *) 0)
- return 0;
-if (sizeof (intptr_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_intptr_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_intptr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
-echo "${ECHO_T}$ac_cv_type_intptr_t" >&6
-if test $ac_cv_type_intptr_t = yes; then
+ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
+if test "x$ac_cv_type_intptr_t" = xyes
+then :
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_INTPTR_T 1
-_ACEOF
+printf "%s\n" "#define HAVE_INTPTR_T 1" >>confdefs.h
-else
+else $as_nop
- echo "$as_me:$LINENO: checking for pointer-size signed integer type" >&5
-echo $ECHO_N "checking for pointer-size signed integer type... $ECHO_C" >&6
-if test "${tcl_cv_intptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pointer-size signed integer type" >&5
+printf %s "checking for pointer-size signed integer type... " >&6; }
+if test ${tcl_cv_intptr_t+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
for tcl_cv_intptr_t in "int" "long" "__int64" none; do
if test "$tcl_cv_intptr_t" != none; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_ok=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_ok=no
+else $as_nop
+ tcl_ok=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test "$tcl_ok" = yes && break; fi
done
fi
-echo "$as_me:$LINENO: result: $tcl_cv_intptr_t" >&5
-echo "${ECHO_T}$tcl_cv_intptr_t" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_intptr_t" >&5
+printf "%s\n" "$tcl_cv_intptr_t" >&6; }
if test "$tcl_cv_intptr_t" != none; then
-cat >>confdefs.h <<_ACEOF
-#define intptr_t $tcl_cv_intptr_t
-_ACEOF
+printf "%s\n" "#define intptr_t $tcl_cv_intptr_t" >>confdefs.h
fi
fi
-echo "$as_me:$LINENO: checking for uintptr_t" >&5
-echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
-if test "${ac_cv_type_uintptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((uintptr_t *) 0)
- return 0;
-if (sizeof (uintptr_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_uintptr_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_uintptr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
-echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
-if test $ac_cv_type_uintptr_t = yes; then
+ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
+if test "x$ac_cv_type_uintptr_t" = xyes
+then :
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_UINTPTR_T 1
-_ACEOF
+printf "%s\n" "#define HAVE_UINTPTR_T 1" >>confdefs.h
-else
+else $as_nop
- echo "$as_me:$LINENO: checking for pointer-size unsigned integer type" >&5
-echo $ECHO_N "checking for pointer-size unsigned integer type... $ECHO_C" >&6
-if test "${tcl_cv_uintptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pointer-size unsigned integer type" >&5
+printf %s "checking for pointer-size unsigned integer type... " >&6; }
+if test ${tcl_cv_uintptr_t+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned __int64" \
none; do
if test "$tcl_cv_uintptr_t" != none; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_ok=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_ok=no
+else $as_nop
+ tcl_ok=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test "$tcl_ok" = yes && break; fi
done
fi
-echo "$as_me:$LINENO: result: $tcl_cv_uintptr_t" >&5
-echo "${ECHO_T}$tcl_cv_uintptr_t" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_uintptr_t" >&5
+printf "%s\n" "$tcl_cv_uintptr_t" >&6; }
if test "$tcl_cv_uintptr_t" != none; then
-cat >>confdefs.h <<_ACEOF
-#define uintptr_t $tcl_cv_uintptr_t
-_ACEOF
+printf "%s\n" "#define uintptr_t $tcl_cv_uintptr_t" >>confdefs.h
fi
@@ -4979,123 +5151,27 @@ fi
# Windows XP theme engine header for Ttk
#--------------------------------------------------------------------
-echo "$as_me:$LINENO: checking for uxtheme.h" >&5
-echo $ECHO_N "checking for uxtheme.h... $ECHO_C" >&6
-if test "${ac_cv_header_uxtheme_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <windows.h>
+ac_fn_c_check_header_compile "$LINENO" "uxtheme.h" "ac_cv_header_uxtheme_h" "#include <windows.h>
+"
+if test "x$ac_cv_header_uxtheme_h" = xyes
+then :
+ printf "%s\n" "#define HAVE_UXTHEME_H 1" >>confdefs.h
-#include <uxtheme.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_uxtheme_h=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_uxtheme_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_uxtheme_h" >&5
-echo "${ECHO_T}$ac_cv_header_uxtheme_h" >&6
-if test $ac_cv_header_uxtheme_h = yes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_UXTHEME_H 1
-_ACEOF
-
-else
- { echo "$as_me:$LINENO: xpnative theme will be unavailable" >&5
-echo "$as_me: xpnative theme will be unavailable" >&6;}
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: xpnative theme will be unavailable" >&5
+printf "%s\n" "$as_me: xpnative theme will be unavailable" >&6;}
fi
-
-echo "$as_me:$LINENO: checking for vssym32.h" >&5
-echo $ECHO_N "checking for vssym32.h... $ECHO_C" >&6
-if test "${ac_cv_header_vssym32_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <windows.h>
+ac_fn_c_check_header_compile "$LINENO" "vssym32.h" "ac_cv_header_vssym32_h" "#include <windows.h>
#include <uxtheme.h>
-
-#include <vssym32.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_vssym32_h=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_vssym32_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_vssym32_h" >&5
-echo "${ECHO_T}$ac_cv_header_vssym32_h" >&6
-if test $ac_cv_header_vssym32_h = yes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_VSSYM32_H 1
-_ACEOF
+"
+if test "x$ac_cv_header_vssym32_h" = xyes
+then :
+ printf "%s\n" "#define HAVE_VSSYM32_H 1" >>confdefs.h
fi
-
#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols
# option. This macro depends on C flags, and should be called
@@ -5103,39 +5179,34 @@ fi
#--------------------------------------------------------------------
- echo "$as_me:$LINENO: checking for build with symbols" >&5
-echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6
- # Check whether --enable-symbols or --disable-symbols was given.
-if test "${enable_symbols+set}" = set; then
- enableval="$enable_symbols"
- tcl_ok=$enableval
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5
+printf %s "checking for build with symbols... " >&6; }
+ # Check whether --enable-symbols was given.
+if test ${enable_symbols+y}
+then :
+ enableval=$enable_symbols; tcl_ok=$enableval
+else $as_nop
tcl_ok=no
-fi;
+fi
+
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
-cat >>confdefs.h <<\_ACEOF
-#define NDEBUG 1
-_ACEOF
+printf "%s\n" "#define NDEBUG 1" >>confdefs.h
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
- cat >>confdefs.h <<\_ACEOF
-#define TCL_CFG_OPTIMIZED 1
-_ACEOF
+ printf "%s\n" "#define TCL_CFG_OPTIMIZED 1" >>confdefs.h
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
- echo "$as_me:$LINENO: result: yes (standard debugging)" >&5
-echo "${ECHO_T}yes (standard debugging)" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5
+printf "%s\n" "yes (standard debugging)" >&6; }
fi
fi
@@ -5143,52 +5214,320 @@ echo "${ECHO_T}yes (standard debugging)" >&6
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
-cat >>confdefs.h <<\_ACEOF
-#define TCL_MEM_DEBUG 1
-_ACEOF
+printf "%s\n" "#define TCL_MEM_DEBUG 1" >>confdefs.h
fi
if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
-cat >>confdefs.h <<\_ACEOF
-#define TCL_COMPILE_DEBUG 1
-_ACEOF
+printf "%s\n" "#define TCL_COMPILE_DEBUG 1" >>confdefs.h
-cat >>confdefs.h <<\_ACEOF
-#define TCL_COMPILE_STATS 1
-_ACEOF
+printf "%s\n" "#define TCL_COMPILE_STATS 1" >>confdefs.h
fi
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
if test "$tcl_ok" = "all"; then
- echo "$as_me:$LINENO: result: enabled symbols mem compile debugging" >&5
-echo "${ECHO_T}enabled symbols mem compile debugging" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem compile debugging" >&5
+printf "%s\n" "enabled symbols mem compile debugging" >&6; }
else
- echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5
-echo "${ECHO_T}enabled $tcl_ok debugging" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5
+printf "%s\n" "enabled $tcl_ok debugging" >&6; }
fi
fi
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Embed the manifest if we can determine how
#--------------------------------------------------------------------
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+printf %s "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test ${ac_cv_prog_CPP+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ # Double quotes because $CC needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+
+else $as_nop
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+ # Broken: success on invalid input.
+continue
+else $as_nop
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok
+then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+printf "%s\n" "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+
+else $as_nop
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+ # Broken: success on invalid input.
+continue
+else $as_nop
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok
+then :
+
+else $as_nop
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+printf %s "checking for grep that handles long lines and -e... " >&6; }
+if test ${ac_cv_path_GREP+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_prog in grep ggrep
+ do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ printf %s 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ printf "%s\n" 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
- echo "$as_me:$LINENO: checking whether to embed manifest" >&5
-echo $ECHO_N "checking whether to embed manifest... $ECHO_C" >&6
- # Check whether --enable-embedded-manifest or --disable-embedded-manifest was given.
-if test "${enable_embedded_manifest+set}" = set; then
- enableval="$enable_embedded_manifest"
- embed_ok=$enableval
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+printf "%s\n" "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+printf %s "checking for egrep... " >&6; }
+if test ${ac_cv_path_EGREP+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_prog in egrep
+ do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ printf %s 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ printf "%s\n" 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+printf "%s\n" "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to embed manifest" >&5
+printf %s "checking whether to embed manifest... " >&6; }
+ # Check whether --enable-embedded-manifest was given.
+if test ${enable_embedded_manifest+y}
+then :
+ enableval=$enable_embedded_manifest; embed_ok=$enableval
+else $as_nop
embed_ok=yes
-fi;
+fi
+
VC_MANIFEST_EMBED_DLL=
VC_MANIFEST_EMBED_EXE=
@@ -5196,11 +5535,7 @@ fi;
if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \
-a "$GCC" != "yes" ; then
# Add the magic to embed the manifest into the dll/exe
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if defined(_MSC_VER) && _MSC_VER >= 1400
@@ -5209,7 +5544,8 @@ print("manifest needed")
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "manifest needed" >/dev/null 2>&1; then
+ $EGREP "manifest needed" >/dev/null 2>&1
+then :
# Could do a CHECK_PROG for mt, but should always be with MSVC8+
# Could add 'if test -f' check, but manifest should be created
@@ -5225,30 +5561,31 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
fi
fi
-rm -f conftest*
+rm -rf conftest*
fi
- echo "$as_me:$LINENO: result: $result" >&5
-echo "${ECHO_T}$result" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $result" >&5
+printf "%s\n" "$result" >&6; }
- echo "$as_me:$LINENO: checking for tclsh in Tcl build directory" >&5
-echo $ECHO_N "checking for tclsh in Tcl build directory... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5
+printf %s "checking for tclsh in Tcl build directory... " >&6; }
BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}\${EXESUFFIX}
- echo "$as_me:$LINENO: result: $BUILD_TCLSH" >&5
-echo "${ECHO_T}$BUILD_TCLSH" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5
+printf "%s\n" "$BUILD_TCLSH" >&6; }
- echo "$as_me:$LINENO: checking for tclsh" >&5
-echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5
+printf %s "checking for tclsh... " >&6; }
- if test "${ac_cv_path_tclsh+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ if test ${ac_cv_path_tclsh+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
@@ -5268,17 +5605,186 @@ fi
if test -f "$ac_cv_path_tclsh" ; then
TCLSH_PROG="$ac_cv_path_tclsh"
- echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
-echo "${ECHO_T}$TCLSH_PROG" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5
+printf "%s\n" "$TCLSH_PROG" >&6; }
else
# It is not an error if an installed version of Tcl can't be located.
TCLSH_PROG=""
- echo "$as_me:$LINENO: result: No tclsh found on PATH" >&5
-echo "${ECHO_T}No tclsh found on PATH" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5
+printf "%s\n" "No tclsh found on PATH" >&6; }
+ fi
+
+
+
+#--------------------------------------------------------------------
+# Zipfs support - Tip 430
+#--------------------------------------------------------------------
+# Check whether --enable-zipfs was given.
+if test ${enable_zipfs+y}
+then :
+ enableval=$enable_zipfs; tcl_ok=$enableval
+else $as_nop
+ tcl_ok=yes
+fi
+
+if test "$tcl_ok" = "yes" ; then
+ #
+ # Find a native compiler
+ #
+ # Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5
+printf %s "checking for gcc... " >&6; }
+ if test ${ac_cv_path_cc+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+
+fi
+
+ fi
+fi
+
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+ OBJEXT_FOR_BUILD='$(OBJEXT)'
+else
+ OBJEXT_FOR_BUILD='.no'
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5
+printf %s "checking for build system executable suffix... " >&6; }
+if test ${bfd_cv_build_exeext+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5
+printf "%s\n" "$bfd_cv_build_exeext" >&6; }
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+fi
+
+ #
+ # Find a native zip implementation
+ #
+
+ ZIP_PROG=""
+ ZIP_PROG_OPTIONS=""
+ ZIP_PROG_VFSSEARCH=""
+ ZIP_INSTALL_OBJS=""
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zip" >&5
+printf %s "checking for zip... " >&6; }
+ if test ${ac_cv_path_zip+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
+ done
+
+fi
+
+ if test -f "$ac_cv_path_zip" ; then
+ ZIP_PROG="$ac_cv_path_zip"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5
+printf "%s\n" "$ZIP_PROG" >&6; }
+ ZIP_PROG_OPTIONS="-rq"
+ ZIP_PROG_VFSSEARCH="*"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5
+printf "%s\n" "Found INFO Zip in environment" >&6; }
+ # Use standard arguments for zip
+ else
+ # It is not an error if an installed version of Zip can't be located.
+ # We can use the locally distributed minizip instead
+ ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
+ ZIP_PROG_OPTIONS="-o -r"
+ ZIP_PROG_VFSSEARCH="*"
+ ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5
+printf "%s\n" "No zip found on PATH building minizip" >&6; }
fi
+
+
+ ZIPFS_BUILD=1
+ TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip
+else
+ ZIPFS_BUILD=0
+ TCL_ZIP_FILE=
+fi
+# Do checking message here to not mess up interleaved configure output
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5
+printf %s "checking for building with zipfs... " >&6; }
+if test "${ZIPFS_BUILD}" = 1; then
+ if test "${SHARED_BUILD}" = 0; then
+ ZIPFS_BUILD=2;
+
+printf "%s\n" "#define ZIPFS_BUILD 2" >>confdefs.h
+
+ INSTALL_LIBRARIES=install-libraries-zipfs-static
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+ else
+
+printf "%s\n" "#define ZIPFS_BUILD 1" >>confdefs.h
+\
+ INSTALL_LIBRARIES=install-libraries-zipfs-shared
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+ fi
+else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+INSTALL_LIBRARIES=install-libraries
+INSTALL_MSGS=install-msgs
+fi
+
+
+
+
+
+
#------------------------------------------------------------------------
# tkConfig.sh refers to this by a different name
#------------------------------------------------------------------------
@@ -5295,18 +5801,33 @@ TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\""
+eval "TK_DLL_FILE_TCL8=tk$VER${DLLSUFFIX}"
+eval "TK_DLL_FILE_TCL9=tcl9tk$VER${DLLSUFFIX}"
+if test ${TCL_MAJOR_VERSION} = 8 ; then
eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}"
if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}"
else
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a"
fi
+else
+eval "TK_DLL_FILE=tcl9tk$VER${DLLSUFFIX}"
+if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
+ eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${LIBSUFFIX}"
+else
+ eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${DLLSUFFIX}.a"
+fi
+fi
eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}"
# FIXME: All of this var junk needs to be done in tcl.m4 !!!!
# I left out the other vars that also need to get defined here.
# we also need to double check about spaces in path names
-eval "TK_LIB_FLAG=\"-ltk${VER}${LIBFLAGSUFFIX}\""
+TK_LIB_FLAG="-l"
+if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ TK_LIB_FLAG="${TK_LIB_FLAG}tcl9"
+fi
+eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}${VER}${LIBFLAGSUFFIX}\""
TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}"
@@ -5332,18 +5853,10 @@ CFG_TK_EXPORT_FILE_SUFFIX=${TK_EXPORT_FILE_SUFFIX}
#--------------------------------------------------------------------
if test ${SHARED_BUILD} = 0 -o "$TCL_NEEDS_EXP_FILE" = 0; then
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD ${RC_DEFINE} DEBUG"
- else
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
- fi
+ RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
TK_RES=""
else
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} DEBUG"
- else
- RC_DEFINES=""
- fi
+ RC_DEFINES=""
TK_RES='tk.$(RES)'
fi
@@ -5441,7 +5954,8 @@ TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.`
- ac_config_files="$ac_config_files Makefile tkConfig.sh wish.exe.manifest"
+ac_config_files="$ac_config_files Makefile tkConfig.sh wish.exe.manifest"
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -5460,39 +5974,70 @@ _ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
+# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
+ ;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-} |
+ esac |
+ sort
+) |
sed '
+ /^ac_cv_env_/b end
t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/
t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+printf "%s\n" "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
- echo "not updating unwritable cache $cache_file"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
@@ -5501,63 +6046,55 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
#
# If the first sed substitution is executed (which looks for macros that
-# take arguments), then we branch to the quote section. Otherwise,
+# take arguments), then branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
-cat >confdef2opt.sed <<\_ACEOF
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
t quote
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
t quote
-d
-: quote
-s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
-s,\[,\\&,g
-s,\],\\&,g
-s,\$,$$,g
-p
-_ACEOF
-# We use echo to avoid assuming a particular line-breaking character.
-# The extra dot is to prevent the shell from consuming trailing
-# line-breaks from the sub-command output. A line-break within
-# single-quotes doesn't work because, if this script is created in a
-# platform that uses two characters for line-breaks (e.g., DOS), tr
-# would break.
-ac_LF_and_DOT=`echo; echo .`
-DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
-rm -f confdef2opt.sed
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
@@ -5565,12 +6102,14 @@ LTLIBOBJS=$ac_ltlibobjs
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
@@ -5580,81 +6119,236 @@ cat >$CONFIG_STATUS <<_ACEOF
debug=false
ac_cs_recheck=false
ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+as_nop=:
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
emulate sh
NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else $as_nop
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
fi
-DUALCASE=1; export DUALCASE # for MKS sh
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
+as_nl='
+'
+export as_nl
+IFS=" "" $as_nl"
+
PS1='$ '
PS2='> '
PS4='+ '
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
+
+# The user is always right.
+if ${PATH_SEPARATOR+false} :; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ test -r "$as_dir$0" && as_myself=$as_dir$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
-done
+ printf "%s\n" "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else $as_nop
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else $as_nop
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
-# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
-# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -5662,148 +6356,121 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n. New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-as_executable_p="test -f"
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -5812,31 +6479,20 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by tk $as_me 8.6, which was
-generated by GNU Autoconf 2.59. Invocation command line was
+# values after options handling.
+ac_log="
+This file was extended by tk $as_me 8.7, which was
+generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -5844,124 +6500,118 @@ generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
_ACEOF
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
-cat >>$CONFIG_STATUS <<\_ACEOF
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
-Usage: $0 [OPTIONS] [FILE]...
+Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
Configuration files:
$config_files
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
+Report bugs to the package provider."
-cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
+ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"`
+ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"`
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-tk config.status 8.6
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+tk config.status 8.7
+configured by $0, generated by GNU Autoconf 2.71,
+ with options \\"\$ac_cs_config\\"
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 2021 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+test -n "\$AWK" || AWK=awk
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
ac_shift=:
;;
- -*)
+ *)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ printf "%s\n" "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ printf "%s\n" "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ case $ac_optarg in
+ *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ printf "%s\n" "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
- *) ac_config_targets="$ac_config_targets $1" ;;
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
esac
shift
@@ -5975,454 +6625,463 @@ if $ac_cs_silent; then
fi
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
fi
_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ printf "%s\n" "$ac_log"
+} >&5
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-
-
-cat >>$CONFIG_STATUS <<\_ACEOF
+# Handling of arguments.
for ac_config_target in $ac_config_targets
do
- case "$ac_config_target" in
- # Handling of arguments.
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "tkConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tkConfig.sh" ;;
- "wish.exe.manifest" ) CONFIG_FILES="$CONFIG_FILES wish.exe.manifest" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
+ case $ac_config_target in
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "tkConfig.sh") CONFIG_FILES="$CONFIG_FILES tkConfig.sh" ;;
+ "wish.exe.manifest") CONFIG_FILES="$CONFIG_FILES wish.exe.manifest" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
+
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files
fi
# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
+# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
}
-
# Create a (secure) tmp directory for tmp files.
{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
} ||
{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
}
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
-#
-# CONFIG_FILES section.
-#
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@AR@,$AR,;t t
-s,@ac_ct_AR@,$ac_ct_AR,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@RC@,$RC,;t t
-s,@ac_ct_RC@,$ac_ct_RC,;t t
-s,@SET_MAKE@,$SET_MAKE,;t t
-s,@TCL_THREADS@,$TCL_THREADS,;t t
-s,@TCL_VERSION@,$TCL_VERSION,;t t
-s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t
-s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t
-s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t
-s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t
-s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t
-s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t
-s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t
-s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t
-s,@TCL_DEFS@,$TCL_DEFS,;t t
-s,@CYGPATH@,$CYGPATH,;t t
-s,@CELIB_DIR@,$CELIB_DIR,;t t
-s,@DL_LIBS@,$DL_LIBS,;t t
-s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t
-s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t
-s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t
-s,@CFLAGS_NOLTO@,$CFLAGS_NOLTO,;t t
-s,@MAN2TCLFLAGS@,$MAN2TCLFLAGS,;t t
-s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t
-s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t
-s,@VC_MANIFEST_EMBED_DLL@,$VC_MANIFEST_EMBED_DLL,;t t
-s,@VC_MANIFEST_EMBED_EXE@,$VC_MANIFEST_EMBED_EXE,;t t
-s,@BUILD_TCLSH@,$BUILD_TCLSH,;t t
-s,@TCLSH_PROG@,$TCLSH_PROG,;t t
-s,@TK_WIN_VERSION@,$TK_WIN_VERSION,;t t
-s,@MACHINE@,$MACHINE,;t t
-s,@TK_VERSION@,$TK_VERSION,;t t
-s,@TK_MAJOR_VERSION@,$TK_MAJOR_VERSION,;t t
-s,@TK_MINOR_VERSION@,$TK_MINOR_VERSION,;t t
-s,@TK_PATCH_LEVEL@,$TK_PATCH_LEVEL,;t t
-s,@TK_DBGX@,$TK_DBGX,;t t
-s,@TK_LIB_FILE@,$TK_LIB_FILE,;t t
-s,@TK_DLL_FILE@,$TK_DLL_FILE,;t t
-s,@TK_STUB_LIB_FILE@,$TK_STUB_LIB_FILE,;t t
-s,@TK_STUB_LIB_FLAG@,$TK_STUB_LIB_FLAG,;t t
-s,@TK_BUILD_STUB_LIB_SPEC@,$TK_BUILD_STUB_LIB_SPEC,;t t
-s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t
-s,@TK_BIN_DIR@,$TK_BIN_DIR,;t t
-s,@TCL_MAJOR_VERSION@,$TCL_MAJOR_VERSION,;t t
-s,@TCL_MINOR_VERSION@,$TCL_MINOR_VERSION,;t t
-s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t
-s,@TCL_DBGX@,$TCL_DBGX,;t t
-s,@CFG_TK_SHARED_LIB_SUFFIX@,$CFG_TK_SHARED_LIB_SUFFIX,;t t
-s,@CFG_TK_UNSHARED_LIB_SUFFIX@,$CFG_TK_UNSHARED_LIB_SUFFIX,;t t
-s,@CFG_TK_EXPORT_FILE_SUFFIX@,$CFG_TK_EXPORT_FILE_SUFFIX,;t t
-s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t
-s,@DEPARG@,$DEPARG,;t t
-s,@CC_OBJNAME@,$CC_OBJNAME,;t t
-s,@CC_EXENAME@,$CC_EXENAME,;t t
-s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t
-s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t
-s,@LDFLAGS_CONSOLE@,$LDFLAGS_CONSOLE,;t t
-s,@LDFLAGS_WINDOW@,$LDFLAGS_WINDOW,;t t
-s,@TK_RES@,$TK_RES,;t t
-s,@STLIB_LD@,$STLIB_LD,;t t
-s,@SHLIB_LD@,$SHLIB_LD,;t t
-s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t
-s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t
-s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t
-s,@TK_SHARED_BUILD@,$TK_SHARED_BUILD,;t t
-s,@LIBS_GUI@,$LIBS_GUI,;t t
-s,@DLLSUFFIX@,$DLLSUFFIX,;t t
-s,@LIBPREFIX@,$LIBPREFIX,;t t
-s,@LIBSUFFIX@,$LIBSUFFIX,;t t
-s,@EXESUFFIX@,$EXESUFFIX,;t t
-s,@LIBRARIES@,$LIBRARIES,;t t
-s,@MAKE_LIB@,$MAKE_LIB,;t t
-s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t
-s,@POST_MAKE_LIB@,$POST_MAKE_LIB,;t t
-s,@MAKE_DLL@,$MAKE_DLL,;t t
-s,@MAKE_EXE@,$MAKE_EXE,;t t
-s,@TK_LIB_FLAG@,$TK_LIB_FLAG,;t t
-s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;t t
-s,@TK_BUILD_LIB_SPEC@,$TK_BUILD_LIB_SPEC,;t t
-s,@TK_STUB_LIB_SPEC@,$TK_STUB_LIB_SPEC,;t t
-s,@TK_STUB_LIB_PATH@,$TK_STUB_LIB_PATH,;t t
-s,@TK_BUILD_STUB_LIB_PATH@,$TK_BUILD_STUB_LIB_PATH,;t t
-s,@TK_CC_SEARCH_FLAGS@,$TK_CC_SEARCH_FLAGS,;t t
-s,@TK_LD_SEARCH_FLAGS@,$TK_LD_SEARCH_FLAGS,;t t
-s,@RC_OUT@,$RC_OUT,;t t
-s,@RC_TYPE@,$RC_TYPE,;t t
-s,@RC_INCLUDE@,$RC_INCLUDE,;t t
-s,@RC_DEFINE@,$RC_DEFINE,;t t
-s,@RC_DEFINES@,$RC_DEFINES,;t t
-s,@RES@,$RES,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-_ACEOF
+eval set X " :F $CONFIG_FILES "
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+printf "%s\n" "$as_me: creating $ac_file" >&6;}
fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`printf "%s\n" "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
esac
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+ ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+_ACEOF
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-{ (exit 0); exit 0; }
+ esac
+
+done # for ac_tag
+
+
+as_fn_exit 0
_ACEOF
-chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
@@ -6442,7 +7101,12 @@ if test "$no_create" != yes; then
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
diff --git a/win/configure.in b/win/configure.ac
index 038dc26..0c5fe71 100644
--- a/win/configure.in
+++ b/win/configure.ac
@@ -3,19 +3,19 @@
# generate the file "configure", which is run during Tk installation
# to configure the system for the local environment.
-AC_INIT([tk],[8.6])
+AC_INIT([tk],[8.7])
AC_CONFIG_SRCDIR([../generic/tk.h])
-AC_PREREQ([2.59])
+AC_PREREQ([2.69])
# The following define is needed when building with Cygwin since newer
# versions of autoconf incorrectly set SHELL to /bin/bash instead of
# /bin/sh. The bash shell seems to suffer from some strange failures.
SHELL=/bin/sh
-TK_VERSION=8.6
+TK_VERSION=8.7
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=6
-TK_PATCH_LEVEL=".11"
+TK_MINOR_VERSION=7
+TK_PATCH_LEVEL="a6"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------
@@ -43,7 +43,7 @@ fi
AC_PROG_CC
AC_C_INLINE
-AC_HEADER_STDC
+AC_CHECK_INCLUDES_DEFAULT
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib)
@@ -63,12 +63,6 @@ AC_OBJEXT
AC_EXEEXT
#--------------------------------------------------------------------
-# Check whether --enable-threads or --disable-threads was given.
-#--------------------------------------------------------------------
-
-SC_ENABLE_THREADS
-
-#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtk as a shared library instead of a static library.
#--------------------------------------------------------------------
@@ -82,15 +76,17 @@ SC_ENABLE_SHARED
SC_PATH_TCLCONFIG($TK_PATCH_LEVEL)
SC_LOAD_TCLCONFIG
+if test "${TCL_MAJOR_VERSION}" -lt 9 ; then
if test "${TCL_MAJOR_VERSION}" != "${TK_MAJOR_VERSION}"; then
AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}.])
+Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+.
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better.])
fi
-if test "${TCL_MINOR_VERSION}" -lt "${TK_MINOR_VERSION}"; then
+if test "${TCL_MINOR_VERSION}" -lt 6; then
AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}.])
+Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+.
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better.])
+fi
fi
#--------------------------------------------------------------------
@@ -101,6 +97,10 @@ fi
SC_CONFIG_CFLAGS
+AC_CHECK_TYPES([intptr_t, uintptr_t],,,[[
+#include <stdint.h>
+]])
+
#--------------------------------------------------------------------
# man2tcl needs this so that it can use errno.h
#--------------------------------------------------------------------
@@ -113,9 +113,7 @@ AC_SUBST(MAN2TCLFLAGS)
#-------------------------------------------
AC_CACHE_CHECK([availability of _strtoi64], tcl_cv_strtoi64, [
- AC_TRY_LINK([#include <stdlib.h>],
- [_strtoi64(0,0,0)],
- tcl_cv_strtoi64=yes, tcl_cv_strtoi64=no)])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], [[_strtoi64(0,0,0)]])],[tcl_cv_strtoi64=yes],[tcl_cv_strtoi64=no])])
if test $tcl_cv_strtoi64 = no; then
AC_DEFINE(NO_STRTOI64, 1, [Is _strtoi64 function available?])
fi
@@ -171,8 +169,6 @@ AC_CHECK_HEADER([vssym32.h], [AC_DEFINE(HAVE_VSSYM32_H)], [],
SC_ENABLE_SYMBOLS
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Embed the manifest if we can determine how
#--------------------------------------------------------------------
@@ -182,6 +178,52 @@ SC_EMBED_MANIFEST(wish.exe.manifest)
SC_BUILD_TCLSH
SC_PROG_TCLSH
+#--------------------------------------------------------------------
+# Zipfs support - Tip 430
+#--------------------------------------------------------------------
+AC_ARG_ENABLE(zipfs,
+ AS_HELP_STRING([--enable-zipfs],
+ [build with Zipfs support (default: on)]),
+ [tcl_ok=$enableval], [tcl_ok=yes])
+if test "$tcl_ok" = "yes" ; then
+ #
+ # Find a native compiler
+ #
+ AX_CC_FOR_BUILD
+ #
+ # Find a native zip implementation
+ #
+ SC_ZIPFS_SUPPORT
+ ZIPFS_BUILD=1
+ TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip
+else
+ ZIPFS_BUILD=0
+ TCL_ZIP_FILE=
+fi
+# Do checking message here to not mess up interleaved configure output
+AC_MSG_CHECKING([for building with zipfs])
+if test "${ZIPFS_BUILD}" = 1; then
+ if test "${SHARED_BUILD}" = 0; then
+ ZIPFS_BUILD=2;
+ AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?])
+ INSTALL_LIBRARIES=install-libraries-zipfs-static
+ AC_MSG_RESULT([yes])
+ else
+ AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\
+ INSTALL_LIBRARIES=install-libraries-zipfs-shared
+ AC_MSG_RESULT([yes])
+ fi
+else
+AC_MSG_RESULT([no])
+INSTALL_LIBRARIES=install-libraries
+INSTALL_MSGS=install-msgs
+fi
+AC_SUBST(ZIPFS_BUILD)
+AC_SUBST(TK_ZIP_FILE)
+AC_SUBST(INSTALL_LIBRARIES)
+AC_SUBST(INSTALL_MSGS)
+
+
#------------------------------------------------------------------------
# tkConfig.sh refers to this by a different name
#------------------------------------------------------------------------
@@ -198,18 +240,33 @@ TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\""
+eval "TK_DLL_FILE_TCL8=tk$VER${DLLSUFFIX}"
+eval "TK_DLL_FILE_TCL9=tcl9tk$VER${DLLSUFFIX}"
+if test ${TCL_MAJOR_VERSION} = 8 ; then
eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}"
if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}"
else
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a"
fi
+else
+eval "TK_DLL_FILE=tcl9tk$VER${DLLSUFFIX}"
+if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
+ eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${LIBSUFFIX}"
+else
+ eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${DLLSUFFIX}.a"
+fi
+fi
eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}"
# FIXME: All of this var junk needs to be done in tcl.m4 !!!!
# I left out the other vars that also need to get defined here.
# we also need to double check about spaces in path names
-eval "TK_LIB_FLAG=\"-ltk${VER}${LIBFLAGSUFFIX}\""
+TK_LIB_FLAG="-l"
+if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ TK_LIB_FLAG="${TK_LIB_FLAG}tcl9"
+fi
+eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}${VER}${LIBFLAGSUFFIX}\""
TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}"
@@ -235,18 +292,10 @@ CFG_TK_EXPORT_FILE_SUFFIX=${TK_EXPORT_FILE_SUFFIX}
#--------------------------------------------------------------------
if test ${SHARED_BUILD} = 0 -o "$TCL_NEEDS_EXP_FILE" = 0; then
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD ${RC_DEFINE} DEBUG"
- else
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
- fi
+ RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
TK_RES=""
else
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} DEBUG"
- else
- RC_DEFINES=""
- fi
+ RC_DEFINES=""
TK_RES='tk.$(RES)'
fi
@@ -267,9 +316,10 @@ AC_SUBST(TK_VERSION)
AC_SUBST(TK_MAJOR_VERSION)
AC_SUBST(TK_MINOR_VERSION)
AC_SUBST(TK_PATCH_LEVEL)
-AC_SUBST(TK_DBGX)
AC_SUBST(TK_LIB_FILE)
AC_SUBST(TK_DLL_FILE)
+AC_SUBST(TK_DLL_FILE_TCL8)
+AC_SUBST(TK_DLL_FILE_TCL9)
AC_SUBST(TK_STUB_LIB_FILE)
AC_SUBST(TK_STUB_LIB_FLAG)
AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
@@ -283,7 +333,6 @@ AC_SUBST(TCL_PATCH_LEVEL)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_BIN_DIR)
-AC_SUBST(TCL_DBGX)
AC_SUBST(CFG_TK_SHARED_LIB_SUFFIX)
AC_SUBST(CFG_TK_UNSHARED_LIB_SUFFIX)
AC_SUBST(CFG_TK_EXPORT_FILE_SUFFIX)
@@ -344,7 +393,8 @@ AC_SUBST(RC_DEFINE)
AC_SUBST(RC_DEFINES)
AC_SUBST(RES)
-AC_OUTPUT(Makefile tkConfig.sh wish.exe.manifest)
+AC_CONFIG_FILES([Makefile tkConfig.sh wish.exe.manifest])
+AC_OUTPUT
dnl Local Variables:
dnl mode: autoconf
diff --git a/win/makefile.vc b/win/makefile.vc
index ee14935..68daeee 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -20,6 +20,9 @@
# For MACRODEF, see TIP 477 (https://core.tcl-lang.org/tips/doc/trunk/tip/477.md)
# or examine Sections 6-8 in rules.vc. This makefile has the following
# values for the OPTS macro in addition to the ones described there.
+# noembed = Embeds Tcl scripts into the wish executable. Currently only
+# applicable for static builds. Non-static builds currently
+# never embed.
# noxp = If you do not have the uxtheme.h header then you
# cannot include support for XP themeing.
# square = Include the demo square widget.
@@ -90,6 +93,12 @@ USE_WIDECHAR_API = 0
# the build configuration, macros, output directories etc.
!include "rules-ext.vc"
+!if ($(TCL_MAJOR_VERSION) > 8) || ($(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) > 6)
+USING_PRE87_TCL = 0
+!else
+USING_PRE87_TCL = 1
+!endif
+
# TCLINSTALL is set to 1 by rules.vc to indicate we are building against
# an installed Tcl and 0 if building against Tcl source. Tk needs the latter.
!if $(TCLINSTALL)
@@ -102,6 +111,7 @@ USE_WIDECHAR_API = 0
!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
HAVE_UXTHEME_H = 1
TTK_SQUARE_WIDGET = 0
+TK_EMBED_SCRIPTS = $(STATIC_BUILD)
!else
!if [nmakehlp -f $(OPTS) "noxp"]
!message *** Exclude support for XP theme
@@ -115,6 +125,24 @@ TTK_SQUARE_WIDGET = 1
!else
TTK_SQUARE_WIDGET = 0
!endif
+!if [nmakehlp -f $(OPTS) "noembed"]
+!message *** Option noembed specified. Tk script library will not be appended to the binary.
+TK_EMBED_SCRIPTS = 0
+!else
+!message *** Tk script library will be appended to the binary.
+TK_EMBED_SCRIPTS = $(STATIC_BUILD)
+!endif
+!endif
+
+!if $(USING_PRE87_TCL)
+TK_EMBED_SCRIPTS = 0
+!endif
+
+TK_NO_DEPRECATED = 0
+!if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"]
+!if [nmakehlp -f $(CHECKS) "nodep"]
+TK_NO_DEPRECATED = 1
+!endif
!endif
WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe"
@@ -124,7 +152,7 @@ CAT32 = "$(OUT_DIR)\cat32.exe"
WISHOBJS = \
$(TMP_DIR)\winMain.obj \
-!if $(TCL_USE_STATIC_PACKAGES)
+!if $(STATIC_BUILD) && !$(STATIC_BUILD)
$(TCLDDELIB) \
$(TCLREGLIB) \
!endif
@@ -160,6 +188,8 @@ TKOBJS = \
$(TMP_DIR)\tkWinDraw.obj \
$(TMP_DIR)\tkWinEmbed.obj \
$(TMP_DIR)\tkWinFont.obj \
+ $(TMP_DIR)\tkWinGDI.obj \
+ $(TMP_DIR)\tkWinIco.obj \
$(TMP_DIR)\tkWinImage.obj \
$(TMP_DIR)\tkWinInit.obj \
$(TMP_DIR)\tkWinKey.obj \
@@ -170,6 +200,7 @@ TKOBJS = \
$(TMP_DIR)\tkWinScrlbr.obj \
$(TMP_DIR)\tkWinSend.obj \
$(TMP_DIR)\tkWinSendCom.obj \
+ $(TMP_DIR)\tkWinSysTray.obj \
$(TMP_DIR)\tkWinWindow.obj \
$(TMP_DIR)\tkWinWm.obj \
$(TMP_DIR)\tkWinX.obj \
@@ -210,9 +241,11 @@ TKOBJS = \
$(TMP_DIR)\tkGrid.obj \
$(TMP_DIR)\tkImage.obj \
$(TMP_DIR)\tkImgBmap.obj \
+ $(TMP_DIR)\tkImgListFormat.obj \
$(TMP_DIR)\tkImgGIF.obj \
$(TMP_DIR)\tkImgPNG.obj \
$(TMP_DIR)\tkImgPPM.obj \
+ $(TMP_DIR)\tkImgSVGnano.obj \
$(TMP_DIR)\tkImgPhoto.obj \
$(TMP_DIR)\tkImgPhInstance.obj \
$(TMP_DIR)\tkImgUtil.obj \
@@ -229,6 +262,7 @@ TKOBJS = \
$(TMP_DIR)\tkOldConfig.obj \
$(TMP_DIR)\tkOption.obj \
$(TMP_DIR)\tkPack.obj \
+ $(TMP_DIR)\tkPkgConfig.obj \
$(TMP_DIR)\tkPlace.obj \
$(TMP_DIR)\tkPointer.obj \
$(TMP_DIR)\tkRectOval.obj \
@@ -300,12 +334,18 @@ XLIBDIR = $(ROOT)\xlib
TTKDIR = $(ROOT)\generic\ttk
BITMAPDIR = $(ROOT)\bitmaps
+# Directories where to build TIP430 ZIP files
+# One for Tk - always built, contains Tk scripts
+# One for Wish - for static builds, contains Tcl+Tk scripts
+LIBTKVFS = $(OUT_DIR)\libtk.vfs
+WISHSCRIPTZIP = $(OUT_DIR)\wish.zip
+
# Additional include and C macro definitions for the implicit rules
# defined in rules.vc
PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)"
-CONFIG_DEFS =/DSTDC_HEADERS=1 /DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \
- /DHAVE_STDLIB_H=1 /DHAVE_STRING_H=1 /DHAVE_MEMORY_H=1 \
+CONFIG_DEFS =/DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \
+ /DHAVE_STRING_H=1 /DHAVE_MEMORY_H=1 \
/DHAVE_STRINGS_H=1 \
!if $(HAVE_UXTHEME_H)
/DHAVE_UXTHEME_H=1 \
@@ -313,12 +353,14 @@ CONFIG_DEFS =/DSTDC_HEADERS=1 /DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \
!if $(TTK_SQUARE_WIDGET)
/DTTK_SQUARE_WIDGET=1 \
!endif
+!if $(TK_NO_DEPRECATED)
+ /DTK_NO_DEPRECATED=1
+!endif
PRJ_DEFINES = /DBUILD_ttk $(CONFIG_DEFS) /Dinline=__inline /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
# Additional Link libraries needed beyond those in rules.vc
-PRJ_LIBS = netapi32.lib gdi32.lib user32.lib userenv.lib
-
+PRJ_LIBS = netapi32.lib gdi32.lib user32.lib userenv.lib winspool.lib
#---------------------------------------------------------------------
# TkTest flags
@@ -333,9 +375,29 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
#---------------------------------------------------------------------
release: setup $(TKSTUBLIB) $(WISH)
+!if !$(USING_PRE87_TCL)
+release: libtkzip embed
+!endif
all: release $(CAT32)
core: setup $(TKSTUBLIB) $(TKLIB)
cwish: $(WISHC)
+libtkzip: setup $(TKSCRIPTZIP)
+!if $(TK_EMBED_SCRIPTS)
+!if $(STATIC_BUILD)
+embed: setup $(WISH) $(WISHSCRIPTZIP)
+ @copy /y /b "$(WISH)"+"$(WISHSCRIPTZIP)" "$(WISH)"
+!else
+# Note this is currently dead code as TK_EMBED_SCRIPTS is always 0
+# for non-static builds as the C code does not currently setup up
+# a VFS for a non-static wish.
+embed: setup $(TKLIB) $(TKSCRIPTZIP)
+ @copy /y /b "$(TKLIB)"+"$(TKSCRIPTZIP)" "$(TKLIB)"
+!endif
+!else
+# ! TK_EMBED_SCRIPTS - still need to build the zip even if not embedded
+embed: $(TKSCRIPTZIP)
+!endif
+
install: install-binaries install-libraries install-docs
!if $(SYMBOLS)
install: install-pdbs
@@ -452,6 +514,30 @@ $(TKTEST): $(TKTESTOBJS) $(TKSTUBLIB) $(TKIMPLIB)
$(GUIEXECMD) -stack:2300000 $**
$(_VC_MANIFEST_EMBED_EXE)
+TKSCRIPTZIPTOP = tk_library
+#TKSCRIPTZIPTOP = "tk$(DOTVERSION)"
+$(TKSCRIPTZIP): .PHONY
+ @echo Building Tk library zip file
+ @if not exist "$(LIBTKVFS)" $(MKDIR) "$(LIBTKVFS)"
+ @if exist "$(LIBTKVFS)\$(TKSCRIPTZIPTOP)" $(RMDIR) "$(LIBTKVFS)\$(TKSCRIPTZIPTOP)"
+ @$(CPYDIR) $(LIBDIR) "$(LIBTKVFS)\$(TKSCRIPTZIPTOP)"
+ @cd "$(OUT_DIR)" && $(TCLSH) <<
+file delete -force {$@}
+zipfs mkzip {$@} {$(LIBTKVFS)} {$(LIBTKVFS)}
+<<
+
+!if $(STATIC_BUILD)
+$(WISHSCRIPTZIP): $(TKSCRIPTZIP)
+ @echo Building Wish Tcl+Tk library zip file
+ @if exist "$(LIBTKVFS)\tcl_library" $(RMDIR) "$(LIBTKVFS)\tcl_library"
+ @cd "$(OUT_DIR)" && $(TCLSH) <<
+file delete -force {$@}
+zipfs mount mnt "$(TCLSCRIPTZIP:\=/)"
+file copy [file join [zipfs root] mnt tcl_library] "$(LIBTKVFS:\=/)"
+zipfs mkzip {$@} {$(LIBTKVFS)} {$(LIBTKVFS)}
+<<
+!endif
+
$(CAT32): $(_TCLDIR)\win\cat.c
$(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE /DUNICODE /D_UNICODE -Fo$(TMP_DIR)\ $?
@@ -530,9 +616,10 @@ install-pdbs:
# Special case object file targets
#---------------------------------------------------------------------
+# Note: Static builds now always mandate statically linking Tcl registry etc.
$(TMP_DIR)\testMain.obj: $(WIN_DIR)\winMain.c
$(cc32) $(appcflags_nostubs) /DTK_TEST /DUNICODE /D_UNICODE \
- /DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
+ /DTCL_USE_STATIC_PACKAGES=$(STATIC_BUILD) \
-Fo$@ $?
$(TMP_DIR)\tkTest.obj: $(GENERICDIR)\tkTest.c
@@ -547,14 +634,20 @@ $(TMP_DIR)\tkWinTest.obj: $(WIN_DIR)\tkWinTest.c
$(TMP_DIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c
$(cc32) $(appcflags_nostubs) -Fo$@ $?
+# Note: Static builds now always mandate statically linking Tcl registry etc.
$(TMP_DIR)\winMain.obj: $(WIN_DIR)\winMain.c
$(cc32) $(appcflags_nostubs) /DUNICODE /D_UNICODE \
- /DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
+ /DTCL_USE_STATIC_PACKAGES=$(STATIC_BUILD) \
-Fo$@ $?
$(TMP_DIR)\tkMain2.obj: $(GENERICDIR)\tkMain.c
$(cc32) $(pkgcflags) /DUNICODE /D_UNICODE -Fo$@ $?
+$(TMP_DIR)\tkPkgConfig.obj: $(GENERICDIR)\tkPkgConfig.c
+ $(cc32) $(pkgcflags) \
+ -DCFG_RUNTIME_DLLFILE="\"$(TKLIBNAME)\"" \
+ -Fo$@ $?
+
# The following objects are part of the stub library and should not
# be built as DLL objects but none of the symbols should be exported
# and no reference made to a C runtime.
@@ -652,13 +745,22 @@ install-binaries:
!if !$(STATIC_BUILD)
@echo creating package index
@type << > $(OUT_DIR)\pkgIndex.tcl
-if {![package vsatisfies [package provide Tcl] 8.6.0]} return
+if {![package vsatisfies [package provide Tcl] 8.6-]} return
if {($$::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)]
|| ([info exists ::argv] && ("-display" in $$::argv)))} {
- package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin libtk$(DOTVERSION).dll]]
+ if {[package vsatisfies [package provide Tcl] 9.0]} {
+ package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin libtcl9tk$(DOTVERSION).dll]]]
+ } else {
+ package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin libtk$(DOTVERSION).dll]]]
+ }
} else {
- package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin $(TKLIBNAME)]]
+ if {[package vsatisfies [package provide Tcl] 9.0]} {
+ package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin $(TKLIBNAME9)]]]
+ } else {
+ package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin $(TKLIBNAME8)]]]
+ }
}
+package ifneeded Tk $(TK_PATCH_LEVEL) [list package require -exact tk $(TK_PATCH_LEVEL)]
<<
@$(CPY) $(OUT_DIR)\pkgIndex.tcl "$(SCRIPT_INSTALL_DIR)\"
!endif
@@ -672,6 +774,10 @@ install-libraries:
@$(CPY) "$(GENERICDIR)\tkPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tkIntXlibDecls.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(XLIBDIR)\X11\*.h" "$(INCLUDE_INSTALL_DIR)\X11\"
+!if !$(USING_PRE87_TCL)
+ @$(CPY) "$(TKSCRIPTZIP)" "$(LIB_INSTALL_DIR)"
+!endif
+!if !$(TK_EMBED_SCRIPTS)
@echo installing script library
@$(CPY) "$(LIBDIR)\*" "$(SCRIPT_INSTALL_DIR)\"
@echo installing theme library
@@ -680,6 +786,7 @@ install-libraries:
@$(CPY) "$(LIBDIR)\images\*" "$(SCRIPT_INSTALL_DIR)\images\"
@echo installing language files
@$(CPY) "$(LIBDIR)\msgs\*" "$(SCRIPT_INSTALL_DIR)\msgs\"
+!endif
@echo installing demos
@$(CPY) "$(DEMODIR)\*" "$(DEMO_INSTALL_DIR)\"
@$(CPY) "$(DEMODIR)\images\*" "$(DEMO_INSTALL_DIR)\images\"
@@ -707,3 +814,8 @@ tidy:
@echo Removing $(TKSTUBLIB) ...
@if exist $(TKSTUBLIB) del $(TKSTUBLIB)
+.PHONY:
+
+# Local Variables:
+# mode: makefile
+# End:
diff --git a/win/mkd.bat b/win/mkd.bat
deleted file mode 100644
index 1bd5ccb..0000000
--- a/win/mkd.bat
+++ /dev/null
@@ -1,12 +0,0 @@
-@echo off
-
-if exist %1\nul goto end
-
-md %1
-if errorlevel 1 goto end
-
-echo Created directory %1
-
-:end
-
-
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 2dc33cc..a7b7a07 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -4,8 +4,8 @@
*
* This is used to fix limitations within nmake and the environment.
*
- * Copyright (c) 2002 by David Gravereaux.
- * Copyright (c) 2006 by Pat Thoyts
+ * Copyright (c) 2002 David Gravereaux.
+ * Copyright (c) 2006 Pat Thoyts
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/win/rc/tk.rc b/win/rc/tk.rc
index 6a74be3..57f75dc 100644
--- a/win/rc/tk.rc
+++ b/win/rc/tk.rc
@@ -8,19 +8,13 @@
//
// build-up the name suffix that defines the type of build this is.
//
-#if TCL_THREADS
-#define SUFFIX_THREADS "t"
-#else
-#define SUFFIX_THREADS ""
-#endif
-
#if DEBUG && !UNCHECKED
#define SUFFIX_DEBUG "g"
#else
#define SUFFIX_DEBUG ""
#endif
-#define SUFFIX SUFFIX_THREADS SUFFIX_DEBUG
+#define SUFFIX SUFFIX_DEBUG
VS_VERSION_INFO VERSIONINFO
@@ -44,7 +38,7 @@ BEGIN
VALUE "OriginalFilename", "tk" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".dll\0"
VALUE "CompanyName", "ActiveState Corporation\0"
VALUE "FileVersion", TK_PATCH_LEVEL
- VALUE "LegalCopyright", "Copyright \251 2001 by ActiveState Corporation, et al\0"
+ VALUE "LegalCopyright", "Copyright \251 2001 ActiveState Corporation, et al\0"
VALUE "ProductName", "Tk " TK_VERSION " for Windows\0"
VALUE "ProductVersion", TK_PATCH_LEVEL
END
diff --git a/win/rc/wish.rc b/win/rc/wish.rc
index 53e02fa..0f9391c 100644
--- a/win/rc/wish.rc
+++ b/win/rc/wish.rc
@@ -8,12 +8,6 @@
//
// build-up the name suffix that defines the type of build this is.
//
-#if TCL_THREADS
-#define SUFFIX_THREADS "t"
-#else
-#define SUFFIX_THREADS ""
-#endif
-
#if STATIC_BUILD
#define SUFFIX_STATIC "s"
#else
@@ -26,7 +20,7 @@
#define SUFFIX_DEBUG ""
#endif
-#define SUFFIX SUFFIX_THREADS SUFFIX_STATIC SUFFIX_DEBUG
+#define SUFFIX SUFFIX_STATIC SUFFIX_DEBUG
VS_VERSION_INFO VERSIONINFO
@@ -50,7 +44,7 @@ BEGIN
VALUE "OriginalFilename", "wish" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".exe\0"
VALUE "CompanyName", "ActiveState Corporation\0"
VALUE "FileVersion", TK_PATCH_LEVEL
- VALUE "LegalCopyright", "Copyright \251 2000 by ActiveState Corporation, et al\0"
+ VALUE "LegalCopyright", "Copyright \251 2000 ActiveState Corporation, et al\0"
VALUE "ProductName", "Tk " TK_VERSION " for Windows\0"
VALUE "ProductVersion", TK_PATCH_LEVEL
END
diff --git a/win/rmd.bat b/win/rmd.bat
deleted file mode 100644
index 820b76f..0000000
--- a/win/rmd.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-if not exist %1\nul goto end
-
-echo Removing directory %1
-
-if "%OS%" == "Windows_NT" goto winnt
-
-deltree /y %1
-if errorlevel 1 goto end
-goto success
-
-:winnt
-rmdir /s /q %1
-if errorlevel 1 goto end
-
-:success
-echo Deleted directory %1
-
-:end
diff --git a/win/tcl.m4 b/win/tcl.m4
index 79cb87b..ee2256d 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -30,7 +30,7 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
AC_ARG_WITH(tcl,
AS_HELP_STRING([--with-tcl],
[directory containing tcl configuration (tclConfig.sh)]),
- with_tclconfig="${withval}")
+ [with_tclconfig="${withval}"])
AC_MSG_CHECKING([for Tcl configuration])
AC_CACHE_VAL(ac_cv_c_tclconfig,[
@@ -148,7 +148,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
AC_ARG_WITH(tk,
AS_HELP_STRING([--with-tk],
[directory containing tk configuration (tkConfig.sh)]),
- with_tkconfig="${withval}")
+ [with_tkconfig="${withval}"])
AC_MSG_CHECKING([for Tk configuration])
AC_CACHE_VAL(ac_cv_c_tkconfig,[
@@ -279,14 +279,6 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
fi
- #
- # eval is required to do the TCL_DBGX substitution
- #
-
- eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
- eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
- eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
@@ -372,42 +364,7 @@ AC_DEFUN([SC_ENABLE_SHARED], [
SHARED_BUILD=0
AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
fi
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_THREADS --
-#
-# Specify if thread support should be enabled
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-threads=yes|no
-#
-# Defines the following vars:
-# TCL_THREADS
-#------------------------------------------------------------------------
-
-AC_DEFUN([SC_ENABLE_THREADS], [
- AC_MSG_CHECKING(for building with threads)
- AC_ARG_ENABLE(threads, [ --enable-threads build with threads (default: on)],
- [tcl_ok=$enableval], [tcl_ok=yes])
-
- if test "$tcl_ok" = "yes"; then
- AC_MSG_RESULT([yes (default)])
- TCL_THREADS=1
- AC_DEFINE(TCL_THREADS)
- # USE_THREAD_ALLOC tells us to try the special thread-based
- # allocator that significantly reduces lock contention
- AC_DEFINE(USE_THREAD_ALLOC)
- else
- TCL_THREADS=0
- AC_MSG_RESULT(no)
- fi
- AC_SUBST(TCL_THREADS)
+ AC_SUBST(SHARED_BUILD)
])
#------------------------------------------------------------------------
@@ -434,7 +391,6 @@ AC_DEFUN([SC_ENABLE_THREADS], [
# Sets to $(CFLAGS_OPTIMIZE) if false
# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
# Sets to $(LDFLAGS_OPTIMIZE) if false
-# DBGX Debug library extension
#
#------------------------------------------------------------------------
@@ -445,7 +401,6 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
AC_DEFINE(NDEBUG, 1, [Is no debugging enabled?])
AC_MSG_RESULT([no])
@@ -453,7 +408,6 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
AC_MSG_RESULT([yes (standard debugging)])
fi
@@ -537,22 +491,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no])
AC_MSG_RESULT($do64bit)
- # Cross-compiling options for Windows/CE builds
-
- AC_MSG_CHECKING([if Windows/CE build is requested])
- AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no])
- AC_MSG_RESULT($doWince)
-
- AC_MSG_CHECKING([for Windows/CE celib directory])
- AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR],
- CELIB_DIR=$withval, CELIB_DIR=NO_CELIB)
- AC_MSG_RESULT([$CELIB_DIR])
-
# Set some defaults (may get changed below)
EXTRA_CFLAGS=""
AC_DEFINE(MODULE_SCOPE, [extern], [No need to mark inidividual symbols as hidden])
AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
+ AC_CHECK_PROG(WINE, wine, wine,)
SHLIB_SUFFIX=".dll"
@@ -671,6 +615,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
else
CFLAGS_NOLTO=""
fi
+ AC_CACHE_CHECK([if the compiler understands -finput-charset],
+ tcl_cv_cc_input_charset, [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_input_charset=yes],[tcl_cv_cc_input_charset=no])
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_input_charset = yes; then
+ extra_cflags="$extra_cflags -finput-charset=UTF-8"
+ fi
fi
AC_MSG_CHECKING([compiler flags])
@@ -679,7 +631,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_LD_LIBS='${LIBS}'
LIBS="-lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32"
# mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't
- LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32"
+ LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32 -lwinspool"
STLIB_LD='${AR} cr'
RC_OUT=-o
RC_TYPE=
@@ -697,7 +649,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_MSG_RESULT([using static flags])
runtime=
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
AC_MSG_RESULT([using shared flags])
@@ -711,7 +663,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
runtime=
# Add SHLIB_LD_LIBS to the Make rule, not here.
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
LIBRARIES="\${SHARED_LIBRARIES}"
fi
# Link with gcc since ld does not link to default libs like
@@ -722,16 +674,16 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
-Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\[$]@)"
# DLLSUFFIX is separate because it is the building block for
# users of tclConfig.sh that may build shared or static.
- DLLSUFFIX="\${DBGX}.dll"
- LIBSUFFIX="\${DBGX}.a"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".a"
+ LIBFLAGSUFFIX=""
SHLIB_SUFFIX=.dll
EXTRA_CFLAGS="${extra_cflags}"
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
@@ -740,7 +692,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format"
;;
*)
- CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement"
+ CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers"
;;
esac
@@ -784,9 +736,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
[tcl_win_64bit=no]
)
if test "$tcl_win_64bit" = "yes" ; then
- do64bit=amd64
- MACHINE="AMD64"
- AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
+ do64bit=amd64
+ MACHINE="AMD64"
+ AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
fi
;;
esac
@@ -796,14 +748,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_MSG_RESULT([using static flags])
runtime=-MT
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
AC_MSG_RESULT([using shared flags])
runtime=-MD
# Add SHLIB_LD_LIBS to the Make rule, not here.
LIBRARIES="\${SHARED_LIBRARIES}"
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
case "x`echo \${VisualStudioVersion}`" in
x1[[4-9]]*)
lflags="${lflags} -nodefaultlib:libucrt.lib"
@@ -815,9 +767,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\[$]@"
# DLLSUFFIX is separate because it is the building block for
# users of tclConfig.sh that may build shared or static.
- DLLSUFFIX="\${DBGX}.dll"
- LIBSUFFIX="\${DBGX}.lib"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".lib"
+ LIBFLAGSUFFIX=""
if test "$do64bit" != "no" ; then
case "$do64bit" in
@@ -862,98 +814,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LINKBIN="link"
fi
- if test "$doWince" != "no" ; then
- # Set defaults for common evc4/PPC2003 setup
- # Currently Tcl requires 300+, possibly 420+ for sockets
- CEVERSION=420; # could be 211 300 301 400 420 ...
- TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
- ARCH=ARM; # could be ARM MIPS X86EM ...
- PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
- if test "$doWince" != "yes"; then
- # If !yes then the user specified something
- # Reset ARCH to allow user to skip specifying it
- ARCH=
- eval `echo $doWince | awk -F "," '{ \
- if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
- if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
- if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
- if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
- if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
- }'`
- if test "x${ARCH}" = "x" ; then
- ARCH=$TARGETCPU;
- fi
- fi
- OSVERSION=WCE$CEVERSION;
- if test "x${WCEROOT}" = "x" ; then
- WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
- if test ! -d "${WCEROOT}" ; then
- WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
- fi
- fi
- if test "x${SDKROOT}" = "x" ; then
- SDKROOT="C:/Program Files/Windows CE Tools"
- if test ! -d "${SDKROOT}" ; then
- SDKROOT="C:/Windows CE Tools"
- fi
- fi
- # The space-based-path will work for the Makefile, but will
- # not work if AC_TRY_COMPILE is called.
- WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
- SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
- CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
- if test ! -d "${CELIB_DIR}/inc"; then
- AC_MSG_ERROR([Invalid celib directory "${CELIB_DIR}"])
- fi
- if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\
- -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
- AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
- else
- CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
- if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
- CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
- fi
- CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
- fi
- fi
-
- if test "$doWince" != "no" ; then
- CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
- if test "${TARGETCPU}" = "X86"; then
- CC="${CEBINROOT}/cl.exe"
- else
- CC="${CEBINROOT}/cl${ARCH}.exe"
- fi
- CC="\"${CC}\" -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
- RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
- arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
- defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS"
- for i in $defs ; do
- AC_DEFINE_UNQUOTED($i)
- done
-# if test "${ARCH}" = "X86EM"; then
-# AC_DEFINE_UNQUOTED(_WIN32_WCE_EMULATION)
-# fi
- AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION)
- AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION)
- CFLAGS_DEBUG="-nologo -Zi -Od"
- CFLAGS_OPTIMIZE="-nologo -O2"
- lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
- lflags="-nodefaultlib -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
- LINKBIN="\"${CEBINROOT}/link.exe\""
- AC_SUBST(CELIB_DIR)
- if test "${CEVERSION}" -lt 400 ; then
- LIBS="coredll.lib corelibc.lib winsock.lib"
- else
- LIBS="coredll.lib corelibc.lib ws2.lib"
- fi
- # celib currently stuck at wce300 status
- #LIBS="$LIBS \${CELIB_DIR}/wince-${ARCH}-pocket-${OSVERSION}-release/celib.lib"
- LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\""
- LIBS_GUI="commctrl.lib commdlg.lib"
- else
- LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib"
- fi
+ LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib winspool.lib"
SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
SHLIB_LD_LIBS='${LIBS}'
@@ -984,7 +845,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
- if test "$doWince" != "no" -a "${TARGETCPU}" != "X86"; then
+ if test "${TARGETCPU}" != "X86"; then
LDFLAGS_CONSOLE="-link ${lflags}"
LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
else
@@ -1072,6 +933,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
[Defined when cygwin/mingw ignores VOID define in winnt.h])
fi
+ AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],)
+
# See if the compiler supports casting to a union type.
# This is used to stop gcc from printing a compiler
# warning when initializing a union member.
@@ -1117,13 +980,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
#------------------------------------------------------------------------
AC_DEFUN([SC_WITH_TCL], [
- if test -d ../../tcl8.6$1/win; then
- TCL_BIN_DEFAULT=../../tcl8.6$1/win
+ if test -d ../../tcl8.7$1/win; then
+ TCL_BIN_DEFAULT=../../tcl8.7$1/win
else
- TCL_BIN_DEFAULT=../../tcl8.6/win
+ TCL_BIN_DEFAULT=../../tcl8.7/win
fi
- AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.6 binaries from DIR],
+ AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.7 binaries from DIR],
TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`)
if test ! -d $TCL_BIN_DIR; then
AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist)
@@ -1232,8 +1095,7 @@ AC_DEFUN([SC_TCL_CFG_ENCODING], [
if test x"${with_tcencoding}" != x ; then
AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}")
else
- # Default encoding on windows is not "iso8859-1"
- AC_DEFINE(TCL_CFGVAL_ENCODING,"cp1252")
+ AC_DEFINE(TCL_CFGVAL_ENCODING,"utf-8")
fi
])
@@ -1288,3 +1150,126 @@ print("manifest needed")
AC_SUBST(VC_MANIFEST_EMBED_DLL)
AC_SUBST(VC_MANIFEST_EMBED_EXE)
])
+
+#------------------------------------------------------------------------
+# SC_CC_FOR_BUILD
+# For cross compiles, locate a C compiler that can generate native binaries.
+#
+# Arguments:
+# none
+#
+# Results:
+# Substitutes the following vars:
+# CC_FOR_BUILD
+# EXEEXT_FOR_BUILD
+#------------------------------------------------------------------------
+
+dnl Get a default for CC_FOR_BUILD to put into Makefile.
+AC_DEFUN([AX_CC_FOR_BUILD],
+[# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ AC_MSG_CHECKING([for gcc])
+ AC_CACHE_VAL(ac_cv_path_cc, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+ fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+ OBJEXT_FOR_BUILD='$(OBJEXT)'
+else
+ OBJEXT_FOR_BUILD='.no'
+ AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
+ [rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+fi
+AC_SUBST(EXEEXT_FOR_BUILD)])dnl
+AC_SUBST(OBJEXT_FOR_BUILD)])dnl
+
+
+
+#------------------------------------------------------------------------
+# SC_ZIPFS_SUPPORT
+# Locate a zip encoder installed on the system path, or none.
+#
+# Arguments:
+# none
+#
+# Results:
+# Substitutes the following vars:
+# ZIP_PROG
+# ZIP_PROG_OPTIONS
+# ZIP_PROG_VFSSEARCH
+# ZIP_INSTALL_OBJS
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_ZIPFS_SUPPORT], [
+ ZIP_PROG=""
+ ZIP_PROG_OPTIONS=""
+ ZIP_PROG_VFSSEARCH=""
+ ZIP_INSTALL_OBJS=""
+
+ AC_MSG_CHECKING([for zip])
+ AC_CACHE_VAL(ac_cv_path_zip, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+ if test -f "$ac_cv_path_zip" ; then
+ ZIP_PROG="$ac_cv_path_zip"
+ AC_MSG_RESULT([$ZIP_PROG])
+ ZIP_PROG_OPTIONS="-rq"
+ ZIP_PROG_VFSSEARCH="*"
+ AC_MSG_RESULT([Found INFO Zip in environment])
+ # Use standard arguments for zip
+ else
+ # It is not an error if an installed version of Zip can't be located.
+ # We can use the locally distributed minizip instead
+ ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
+ ZIP_PROG_OPTIONS="-o -r"
+ ZIP_PROG_VFSSEARCH="*"
+ ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
+ AC_MSG_RESULT([No zip found on PATH building minizip])
+ fi
+ AC_SUBST(ZIP_PROG)
+ AC_SUBST(ZIP_PROG_OPTIONS)
+ AC_SUBST(ZIP_PROG_VFSSEARCH)
+ AC_SUBST(ZIP_INSTALL_OBJS)
+])
diff --git a/win/tkConfig.sh.in b/win/tkConfig.sh.in
index c511312..d93e649 100644
--- a/win/tkConfig.sh.in
+++ b/win/tkConfig.sh.in
@@ -25,8 +25,9 @@ TK_DEFS='@DEFS@'
# Flag, 1: we built a shared lib, 0 we didn't
TK_SHARED_BUILD=@TK_SHARED_BUILD@
-# This indicates if Tk was build with debugging symbols
-TK_DBGX=@TK_DBGX@
+# TK_DBGX used to be used to distinguish debug vs. non-debug builds.
+# This was a righteous pain so the core doesn't do that any more.
+TK_DBGX=
# The name of the Tk library (may be either a .a file or a shared library):
TK_LIB_FILE='@TK_LIB_FILE@'
diff --git a/win/tkWin.h b/win/tkWin.h
index 4d278d7..188c825 100644
--- a/win/tkWin.h
+++ b/win/tkWin.h
@@ -4,7 +4,7 @@
* Declarations of public types and interfaces that are only
* available under Windows.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright (c) 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -18,14 +18,18 @@
* the SystemParametersInfo API doesn't like to receive structures that
* are larger than it expects which affects the font assignments.
*
- * WINVER = 0x0500 means Windows 2000 and above
+ * WINVER = 0x0600 means Windows Vista and above. Even though we still
+ * support Windows XP, but the Vista-specifics are tested at runtime.
*/
#ifndef WINVER
-#define WINVER 0x0500
+# define WINVER 0x0601
#endif
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
+# define _WIN32_WINNT 0x0601
+#endif
+#ifndef _WIN32_IE
+# define _WIN32_IE 0x0800
#endif
#ifndef _TK
diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c
index 8cfddee..a761ee1 100644
--- a/win/tkWin32Dll.c
+++ b/win/tkWin32Dll.c
@@ -3,7 +3,7 @@
*
* This file contains a stub dll entry point.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -104,6 +104,7 @@ DllMain(
#ifdef HAVE_NO_SEH
TCLEXCEPTION_REGISTRATION registration;
#endif
+ (void)reserved;
/*
* If we are attaching to the DLL from a new process, tell Tk about the
diff --git a/win/tkWin3d.c b/win/tkWin3d.c
index 9f7ca22..2c2181b 100644
--- a/win/tkWin3d.c
+++ b/win/tkWin3d.c
@@ -4,7 +4,7 @@
* This file contains the platform specific routines for drawing 3D
* borders in the Windows 95 style.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -43,7 +43,7 @@ typedef struct {
TkBorder *
TkpGetBorder(void)
{
- WinBorder *borderPtr = ckalloc(sizeof(WinBorder));
+ WinBorder *borderPtr = (WinBorder *)ckalloc(sizeof(WinBorder));
borderPtr->light2ColorPtr = NULL;
borderPtr->dark2ColorPtr = NULL;
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index 4e965c2..68aef38 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -4,7 +4,7 @@
* This file implements the Windows specific portion of the button
* widgets.
*
- * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
+ * Copyright © 1996-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -208,9 +208,10 @@ TkpButtonSetDefaults(void)
TkButton *
TkpCreateButton(
- TCL_UNUSED(Tk_Window))
+ Tk_Window tkwin)
{
WinButton *butPtr;
+ (void)tkwin;
butPtr = (WinButton *)ckalloc(sizeof(WinButton));
butPtr->hwnd = NULL;
@@ -1302,7 +1303,7 @@ ButtonProc(
}
/* FALLTHRU */
default:
- if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ if (TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
return result;
}
}
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index bcea1c1..61c6b36 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -3,8 +3,8 @@
*
* This file contains functions for managing the clipboard.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 by Scriptics Corporation.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -332,21 +332,21 @@ TkWinClipboardRender(
}
*buffer = '\0';
- Tcl_DStringInit(&ds);
- Tcl_UtfToWCharDString(rawText, -1, &ds);
- ckfree(rawText);
- handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
- Tcl_DStringLength(&ds) + 2);
- if (!handle) {
+ Tcl_DStringInit(&ds);
+ Tcl_UtfToWCharDString(rawText, -1, &ds);
+ ckfree(rawText);
+ handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
+ (unsigned) Tcl_DStringLength(&ds) + 2);
+ if (!handle) {
+ Tcl_DStringFree(&ds);
+ return;
+ }
+ buffer = (char *)GlobalLock(handle);
+ memcpy(buffer, Tcl_DStringValue(&ds),
+ (unsigned) Tcl_DStringLength(&ds) + 2);
+ GlobalUnlock(handle);
Tcl_DStringFree(&ds);
- return;
- }
- buffer = (char *)GlobalLock(handle);
- memcpy(buffer, Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds) + 2);
- GlobalUnlock(handle);
- Tcl_DStringFree(&ds);
- SetClipboardData(CF_UNICODETEXT, handle);
+ SetClipboardData(CF_UNICODETEXT, handle);
}
/*
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index fa3f233..d4a0d59 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.c
@@ -3,8 +3,8 @@
*
* Functions to map color names to system color values.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
- * Copyright (c) 1994 Software Research Associates, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
+ * Copyright © 1994 Software Research Associates, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -58,6 +58,7 @@ static const SystemColorEntry sysColors[] = {
{"InfoText", COLOR_INFOTEXT},
{"Menu", COLOR_MENU},
{"MenuText", COLOR_MENUTEXT},
+ {"PlaceHolderText", COLOR_GRAYTEXT},
{"Scrollbar", COLOR_SCROLLBAR},
{"Window", COLOR_WINDOW},
{"WindowFrame", COLOR_WINDOWFRAME},
@@ -173,7 +174,7 @@ TkpGetColor(
&& FindSystemColor(name+6, &color, &index))
|| TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), name,
&color)) {
- winColPtr = ckalloc(sizeof(WinColor));
+ winColPtr = (WinColor *)ckalloc(sizeof(WinColor));
winColPtr->info.color = color;
winColPtr->index = index;
@@ -211,7 +212,7 @@ TkpGetColorByValue(
XColor *colorPtr) /* Red, green, and blue fields indicate
* desired color. */
{
- WinColor *tkColPtr = ckalloc(sizeof(WinColor));
+ WinColor *tkColPtr = (WinColor *)ckalloc(sizeof(WinColor));
tkColPtr->info.color.red = colorPtr->red;
tkColPtr->info.color.green = colorPtr->green;
@@ -274,7 +275,7 @@ int
TkWinIndexOfColor(
XColor *colorPtr)
{
- register WinColor *winColPtr = (WinColor *) colorPtr;
+ WinColor *winColPtr = (WinColor *) colorPtr;
if (winColPtr->info.magic == COLOR_MAGIC) {
return winColPtr->index;
}
@@ -307,6 +308,7 @@ XAllocColor(
TkWinColormap *cmap = (TkWinColormap *) colormap;
PALETTEENTRY entry, closeEntry;
HDC dc = GetDC(NULL);
+ (void)display;
entry.peRed = (color->red) >> 8;
entry.peGreen = (color->green) >> 8;
@@ -316,7 +318,7 @@ XAllocColor(
if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) {
unsigned long sizePalette = GetDeviceCaps(dc, SIZEPALETTE);
UINT newPixel, closePixel;
- int new;
+ int isNew;
size_t refCount;
Tcl_HashEntry *entryPtr;
UINT index;
@@ -358,13 +360,13 @@ XAllocColor(
color->pixel = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue);
entryPtr = Tcl_CreateHashEntry(&cmap->refCounts,
- INT2PTR(color->pixel), &new);
- if (new) {
+ INT2PTR(color->pixel), &isNew);
+ if (isNew) {
refCount = 1;
} else {
refCount = (size_t)Tcl_GetHashValue(entryPtr) + 1;
}
- Tcl_SetHashValue(entryPtr, (void *)refCount);
+ Tcl_SetHashValue(entryPtr, INT2PTR(refCount));
} else {
/*
* Determine what color will actually be used on non-colormap systems.
@@ -414,6 +416,8 @@ XFreeColors(
PALETTEENTRY entry, *entries;
Tcl_HashEntry *entryPtr;
HDC dc = GetDC(NULL);
+ (void)display;
+ (void)planes;
/*
* We don't have to do anything for non-palette devices.
@@ -436,7 +440,7 @@ XFreeColors(
GetPaletteEntries(cmap->palette, index, 1, &entry);
if (cref == RGB(entry.peRed, entry.peGreen, entry.peBlue)) {
count = cmap->size - index;
- entries = ckalloc(sizeof(PALETTEENTRY) * count);
+ entries = (PALETTEENTRY *)ckalloc(sizeof(PALETTEENTRY) * count);
GetPaletteEntries(cmap->palette, index+1, count, entries);
SetPaletteEntries(cmap->palette, index, count, entries);
ckfree(entries);
@@ -446,7 +450,7 @@ XFreeColors(
}
Tcl_DeleteHashEntry(entryPtr);
} else {
- Tcl_SetHashValue(entryPtr, (size_t)refCount);
+ Tcl_SetHashValue(entryPtr, INT2PTR(refCount));
}
}
}
@@ -482,9 +486,13 @@ XCreateColormap(
PALETTEENTRY *entryPtr;
TkWinColormap *cmap;
Tcl_HashEntry *hashPtr;
- int new;
+ int isNew;
UINT i;
HPALETTE sysPal;
+ (void)display;
+ (void)w;
+ (void)visual;
+ (void)alloc;
/*
* Allocate a starting palette with all of the reserved colors.
@@ -496,7 +504,7 @@ XCreateColormap(
logPalettePtr->palNumEntries = GetPaletteEntries(sysPal, 0, 256,
logPalettePtr->palPalEntry);
- cmap = ckalloc(sizeof(TkWinColormap));
+ cmap = (TkWinColormap *)ckalloc(sizeof(TkWinColormap));
cmap->size = logPalettePtr->palNumEntries;
cmap->stale = 0;
cmap->palette = CreatePalette(logPalettePtr);
@@ -509,7 +517,7 @@ XCreateColormap(
for (i = 0; i < logPalettePtr->palNumEntries; i++) {
entryPtr = logPalettePtr->palPalEntry + i;
hashPtr = Tcl_CreateHashEntry(&cmap->refCounts, INT2PTR(PALETTERGB(
- entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &new);
+ entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &isNew);
Tcl_SetHashValue(hashPtr, INT2PTR(1));
}
@@ -539,6 +547,7 @@ XFreeColormap(
Colormap colormap)
{
TkWinColormap *cmap = (TkWinColormap *) colormap;
+ (void)display;
if (!DeleteObject(cmap->palette)) {
Tcl_Panic("Unable to free colormap, palette is still selected");
diff --git a/win/tkWinConfig.c b/win/tkWinConfig.c
index aeb9405..1c93e12 100644
--- a/win/tkWinConfig.c
+++ b/win/tkWinConfig.c
@@ -4,7 +4,7 @@
* This module implements the Windows system defaults for the
* configuration package.
*
- * Copyright (c) 1997 by Sun Microsystems, Inc.
+ * Copyright © 1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index 8c9399a..4e9a546 100644
--- a/win/tkWinCursor.c
+++ b/win/tkWinCursor.c
@@ -3,7 +3,7 @@
*
* This file contains Win32 specific cursor related routines.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -100,6 +100,7 @@ TkGetCursorByName(
TkWinCursor *cursorPtr;
int argc;
const char **argv = NULL;
+ (void)tkwin;
/*
* All cursor names are valid lists of one element (for
@@ -113,7 +114,7 @@ TkGetCursorByName(
goto badCursorSpec;
}
- cursorPtr = ckalloc(sizeof(TkWinCursor));
+ cursorPtr = (TkWinCursor *)ckalloc(sizeof(TkWinCursor));
cursorPtr->info.cursor = (Tk_Cursor) cursorPtr;
cursorPtr->winCursor = NULL;
cursorPtr->system = 0;
@@ -201,6 +202,16 @@ TkCreateCursorFromData(
XColor fgColor, /* Foreground color for cursor. */
XColor bgColor) /* Background color for cursor. */
{
+ (void)tkwin;
+ (void)source;
+ (void)mask;
+ (void)width;
+ (void)height;
+ (void)xHot;
+ (void)yHot;
+ (void)fgColor;
+ (void)bgColor;
+
return NULL;
}
@@ -225,6 +236,8 @@ void
TkpFreeCursor(
TkCursor *cursorPtr)
{
+ (void)cursorPtr;
+
/* TkWinCursor *winCursorPtr = (TkWinCursor *) cursorPtr; */
}
diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h
index 852de02..0a747d9 100644
--- a/win/tkWinDefault.h
+++ b/win/tkWinDefault.h
@@ -68,7 +68,7 @@
#define DEF_BUTTON_HIGHLIGHT HIGHLIGHT
#define DEF_LABEL_HIGHLIGHT_WIDTH "0"
#define DEF_BUTTON_HIGHLIGHT_WIDTH "1"
-#define DEF_BUTTON_IMAGE ((char *) NULL)
+#define DEF_BUTTON_IMAGE NULL
#define DEF_BUTTON_INDICATOR "1"
#define DEF_BUTTON_JUSTIFY "center"
#define DEF_BUTTON_OFF_VALUE "0"
@@ -84,14 +84,13 @@
#define DEF_BUTTON_REPEAT_INTERVAL "0"
#define DEF_BUTTON_SELECT_COLOR INDICATOR
#define DEF_BUTTON_SELECT_MONO BLACK
-#define DEF_BUTTON_SELECT_IMAGE ((char *) NULL)
+#define DEF_BUTTON_SELECT_IMAGE NULL
#define DEF_BUTTON_STATE "normal"
#define DEF_LABEL_TAKE_FOCUS "0"
-#define DEF_BUTTON_TAKE_FOCUS ((char *) NULL)
+#define DEF_BUTTON_TAKE_FOCUS NULL
#define DEF_BUTTON_TEXT ""
#define DEF_BUTTON_TEXT_VARIABLE ""
#define DEF_BUTTON_TRISTATE_VALUE ""
-#define DEF_BUTTON_UNDERLINE "-1"
#define DEF_BUTTON_VALUE ""
#define DEF_BUTTON_WIDTH "0"
#define DEF_BUTTON_WRAP_LENGTH "0"
@@ -126,7 +125,7 @@
#define DEF_CANVAS_SELECT_BD_MONO "0"
#define DEF_CANVAS_SELECT_FG_COLOR SELECT_FG
#define DEF_CANVAS_SELECT_FG_MONO WHITE
-#define DEF_CANVAS_TAKE_FOCUS ((char *) NULL)
+#define DEF_CANVAS_TAKE_FOCUS NULL
#define DEF_CANVAS_WIDTH "10c"
#define DEF_CANVAS_X_SCROLL_CMD ""
#define DEF_CANVAS_X_SCROLL_INCREMENT "0"
@@ -157,6 +156,8 @@
#define DEF_ENTRY_INSERT_ON_TIME "600"
#define DEF_ENTRY_INSERT_WIDTH "2"
#define DEF_ENTRY_JUSTIFY "left"
+#define DEF_ENTRY_PLACEHOLDER ""
+#define DEF_ENTRY_PLACEHOLDERFG "SystemPlaceHolderText"
#define DEF_ENTRY_READONLY_BG_COLOR "SystemButtonFace"
#define DEF_ENTRY_READONLY_BG_MONO WHITE
#define DEF_ENTRY_RELIEF "sunken"
@@ -167,9 +168,9 @@
#define DEF_ENTRY_SELECT_BD_MONO "0"
#define DEF_ENTRY_SELECT_FG_COLOR SELECT_FG
#define DEF_ENTRY_SELECT_FG_MONO WHITE
-#define DEF_ENTRY_SHOW ((char *) NULL)
+#define DEF_ENTRY_SHOW NULL
#define DEF_ENTRY_STATE "normal"
-#define DEF_ENTRY_TAKE_FOCUS ((char *) NULL)
+#define DEF_ENTRY_TAKE_FOCUS NULL
#define DEF_ENTRY_TEXT_VARIABLE ""
#define DEF_ENTRY_WIDTH "20"
@@ -178,7 +179,9 @@
*/
#define DEF_FRAME_BG_COLOR NORMAL_BG
+#define DEF_FRAME_BG_IMAGE NULL
#define DEF_FRAME_BG_MONO WHITE
+#define DEF_FRAME_BG_TILE "0"
#define DEF_FRAME_BORDER_WIDTH "0"
#define DEF_FRAME_CLASS "Frame"
#define DEF_FRAME_COLORMAP ""
@@ -236,37 +239,36 @@
#define DEF_LISTBOX_SELECT_MODE "browse"
#define DEF_LISTBOX_SET_GRID "0"
#define DEF_LISTBOX_STATE "normal"
-#define DEF_LISTBOX_TAKE_FOCUS ((char *) NULL)
+#define DEF_LISTBOX_TAKE_FOCUS NULL
#define DEF_LISTBOX_WIDTH "20"
/*
* Defaults for individual entries of menus:
*/
-#define DEF_MENU_ENTRY_ACTIVE_BG ((char *) NULL)
-#define DEF_MENU_ENTRY_ACTIVE_FG ((char *) NULL)
-#define DEF_MENU_ENTRY_ACCELERATOR ((char *) NULL)
-#define DEF_MENU_ENTRY_BG ((char *) NULL)
+#define DEF_MENU_ENTRY_ACTIVE_BG NULL
+#define DEF_MENU_ENTRY_ACTIVE_FG NULL
+#define DEF_MENU_ENTRY_ACCELERATOR NULL
+#define DEF_MENU_ENTRY_BG NULL
#define DEF_MENU_ENTRY_BITMAP NULL
#define DEF_MENU_ENTRY_COLUMN_BREAK "0"
-#define DEF_MENU_ENTRY_COMMAND ((char *) NULL)
+#define DEF_MENU_ENTRY_COMMAND NULL
#define DEF_MENU_ENTRY_COMPOUND "none"
-#define DEF_MENU_ENTRY_FG ((char *) NULL)
-#define DEF_MENU_ENTRY_FONT ((char *) NULL)
+#define DEF_MENU_ENTRY_FG NULL
+#define DEF_MENU_ENTRY_FONT NULL
#define DEF_MENU_ENTRY_HIDE_MARGIN "0"
-#define DEF_MENU_ENTRY_IMAGE ((char *) NULL)
+#define DEF_MENU_ENTRY_IMAGE NULL
#define DEF_MENU_ENTRY_INDICATOR "1"
-#define DEF_MENU_ENTRY_LABEL ((char *) NULL)
-#define DEF_MENU_ENTRY_MENU ((char *) NULL)
+#define DEF_MENU_ENTRY_LABEL NULL
+#define DEF_MENU_ENTRY_MENU NULL
#define DEF_MENU_ENTRY_OFF_VALUE "0"
#define DEF_MENU_ENTRY_ON_VALUE "1"
-#define DEF_MENU_ENTRY_SELECT_IMAGE ((char *) NULL)
+#define DEF_MENU_ENTRY_SELECT_IMAGE NULL
#define DEF_MENU_ENTRY_STATE "normal"
-#define DEF_MENU_ENTRY_VALUE ((char *) NULL)
-#define DEF_MENU_ENTRY_CHECK_VARIABLE ((char *) NULL)
+#define DEF_MENU_ENTRY_VALUE NULL
+#define DEF_MENU_ENTRY_CHECK_VARIABLE NULL
#define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
-#define DEF_MENU_ENTRY_SELECT ((char *) NULL)
-#define DEF_MENU_ENTRY_UNDERLINE "-1"
+#define DEF_MENU_ENTRY_SELECT NULL
/*
* Defaults for menus overall:
@@ -277,6 +279,7 @@
#define DEF_MENU_ACTIVE_BORDER_WIDTH "0"
#define DEF_MENU_ACTIVE_FG_COLOR SELECT_FG
#define DEF_MENU_ACTIVE_FG_MONO WHITE
+#define DEF_MENU_ACTIVE_RELIEF "flat"
#define DEF_MENU_BG_COLOR MENU_BG
#define DEF_MENU_BG_MONO WHITE
#define DEF_MENU_BORDER_WIDTH "0"
@@ -290,8 +293,8 @@
#define DEF_MENU_SELECT_COLOR MENU_FG
#define DEF_MENU_SELECT_MONO BLACK
#define DEF_MENU_TAKE_FOCUS "0"
-#define DEF_MENU_TEAROFF "1"
-#define DEF_MENU_TEAROFF_CMD ((char *) NULL)
+#define DEF_MENU_TEAROFF "0"
+#define DEF_MENU_TEAROFF_CMD NULL
#define DEF_MENU_TITLE ""
#define DEF_MENU_TYPE "normal"
@@ -319,7 +322,7 @@
#define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
#define DEF_MENUBUTTON_HIGHLIGHT HIGHLIGHT
#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
-#define DEF_MENUBUTTON_IMAGE ((char *) NULL)
+#define DEF_MENUBUTTON_IMAGE NULL
#define DEF_MENUBUTTON_INDICATOR "0"
#define DEF_MENUBUTTON_JUSTIFY "center"
#define DEF_MENUBUTTON_MENU ""
@@ -330,7 +333,6 @@
#define DEF_MENUBUTTON_TAKE_FOCUS "0"
#define DEF_MENUBUTTON_TEXT ""
#define DEF_MENUBUTTON_TEXT_VARIABLE ""
-#define DEF_MENUBUTTON_UNDERLINE "-1"
#define DEF_MENUBUTTON_WIDTH "0"
#define DEF_MENUBUTTON_WRAP_LENGTH "0"
@@ -429,7 +431,7 @@
#define DEF_SCALE_SLIDER_LENGTH "30"
#define DEF_SCALE_SLIDER_RELIEF "raised"
#define DEF_SCALE_STATE "normal"
-#define DEF_SCALE_TAKE_FOCUS ((char *) NULL)
+#define DEF_SCALE_TAKE_FOCUS NULL
#define DEF_SCALE_TICK_INTERVAL "0"
#define DEF_SCALE_TO "100"
#define DEF_SCALE_VARIABLE ""
@@ -456,7 +458,7 @@
#define DEF_SCROLLBAR_RELIEF "sunken"
#define DEF_SCROLLBAR_REPEAT_DELAY "300"
#define DEF_SCROLLBAR_REPEAT_INTERVAL "100"
-#define DEF_SCROLLBAR_TAKE_FOCUS ((char *) NULL)
+#define DEF_SCROLLBAR_TAKE_FOCUS NULL
#define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
#define DEF_SCROLLBAR_TROUGH_MONO WHITE
#define DEF_SCROLLBAR_WIDTH "10"
@@ -504,7 +506,7 @@
#define DEF_TEXT_STATE "normal"
#define DEF_TEXT_TABS ""
#define DEF_TEXT_TABSTYLE "tabular"
-#define DEF_TEXT_TAKE_FOCUS ((char *) NULL)
+#define DEF_TEXT_TAKE_FOCUS NULL
#define DEF_TEXT_UNDO "0"
#define DEF_TEXT_WIDTH "80"
#define DEF_TEXT_WRAP "char"
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 176ba88..07997e2 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -3,7 +3,7 @@
*
* Contains the Windows implementation of the common dialog boxes.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -590,63 +590,7 @@ static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam,
static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam);
static void SetTkDialog(ClientData clientData);
static const char *ConvertExternalFilename(LPCWSTR, Tcl_DString *);
-static void LoadShellProcs(void);
-
-/* Definitions of dynamically loaded Win32 calls */
-typedef HRESULT (STDAPICALLTYPE SHCreateItemFromParsingNameProc)(
- PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv);
-struct ShellProcPointers {
- SHCreateItemFromParsingNameProc *SHCreateItemFromParsingName;
-} ShellProcs;
-
-
-/*
- *-------------------------------------------------------------------------
- *
- * LoadShellProcs --
- *
- * Some shell functions are not available on older versions of
- * Windows. This function dynamically loads them and stores pointers
- * to them in ShellProcs. Any function that is not available has
- * the corresponding pointer set to NULL.
- *
- * Note this call never fails. Unavailability of a function is not
- * a reason for failure. Caller should check whether a particular
- * function pointer is NULL or not. Once loaded a function stays
- * forever loaded.
- *
- * XXX - we load the function pointers into global memory. This implies
- * there is a potential (however small) for race conditions between
- * threads. However, Tk is in any case meant to be loaded in exactly
- * one thread so this should not be an issue and saves us from
- * unnecessary bookkeeping.
- *
- * Return value:
- * None.
- *
- * Side effects:
- * ShellProcs is populated.
- *-------------------------------------------------------------------------
- */
-static void LoadShellProcs(void)
-{
- static HMODULE shell32_handle = NULL;
-
- if (shell32_handle != NULL) {
- return; /* We have already been through here. */
- }
-
- shell32_handle = GetModuleHandleW(L"shell32.dll");
- if (shell32_handle == NULL) { /* Should never happen but check anyways. */
- return;
- }
-
- ShellProcs.SHCreateItemFromParsingName = (SHCreateItemFromParsingNameProc*)
- (void *)GetProcAddress(shell32_handle, "SHCreateItemFromParsingName");
-}
-
-
/*
*-------------------------------------------------------------------------
*
@@ -1071,7 +1015,7 @@ ParseOFNOptions(
};
static const struct Options dirOptions[] = {
{"-initialdir", FILE_INITDIR},
- {"-mustexist", FILE_MUSTEXIST},
+ {"-mustexist", FILE_MUSTEXIST},
{"-parent", FILE_PARENT},
{"-title", FILE_TITLE},
{NULL, FILE_DEFAULT/*ignored*/ }
@@ -1211,30 +1155,26 @@ static int VistaFileDialogsAvailable(void)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->newFileDialogsState == FDLG_STATE_INIT) {
- tsdPtr->newFileDialogsState = FDLG_STATE_USE_OLD;
- LoadShellProcs();
- if (ShellProcs.SHCreateItemFromParsingName != NULL) {
- hr = CoInitialize(0);
- /* XXX - need we schedule CoUninitialize at thread shutdown ? */
-
- /* Ensure all COM interfaces we use are available */
- if (SUCCEEDED(hr)) {
- hr = CoCreateInstance(&ClsidFileOpenDialog, NULL,
- CLSCTX_INPROC_SERVER, &IIDIFileOpenDialog, (void **) &fdlgPtr);
- if (SUCCEEDED(hr)) {
- fdlgPtr->lpVtbl->Release(fdlgPtr);
- hr = CoCreateInstance(&ClsidFileSaveDialog, NULL,
- CLSCTX_INPROC_SERVER, &IIDIFileSaveDialog,
- (void **) &fdlgPtr);
- if (SUCCEEDED(hr)) {
- fdlgPtr->lpVtbl->Release(fdlgPtr);
-
- /* Looks like we have all we need */
- tsdPtr->newFileDialogsState = FDLG_STATE_USE_NEW;
- }
- }
- }
- }
+ tsdPtr->newFileDialogsState = FDLG_STATE_USE_OLD;
+ hr = CoInitialize(0);
+ /* XXX - need we schedule CoUninitialize at thread shutdown ? */
+
+ /* Ensure all COM interfaces we use are available */
+ if (SUCCEEDED(hr)) {
+ hr = CoCreateInstance(&ClsidFileOpenDialog, NULL,
+ CLSCTX_INPROC_SERVER, &IIDIFileOpenDialog, (void **) &fdlgPtr);
+ if (SUCCEEDED(hr)) {
+ fdlgPtr->lpVtbl->Release(fdlgPtr);
+ hr = CoCreateInstance(&ClsidFileSaveDialog, NULL,
+ CLSCTX_INPROC_SERVER, &IIDIFileSaveDialog, (void **) &fdlgPtr);
+ if (SUCCEEDED(hr)) {
+ fdlgPtr->lpVtbl->Release(fdlgPtr);
+
+ /* Looks like we have all we need */
+ tsdPtr->newFileDialogsState = FDLG_STATE_USE_NEW;
+ }
+ }
+ }
}
return (tsdPtr->newFileDialogsState == FDLG_STATE_USE_NEW);
@@ -1413,7 +1353,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
Tcl_IncrRefCount(normPath);
nativePath = (LPCWSTR)Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/
if (nativePath) {
- hr = ShellProcs.SHCreateItemFromParsingName(
+ hr = SHCreateItemFromParsingName(
nativePath, NULL,
&IIDIShellItem, (void **) &dirIf);
if (SUCCEEDED(hr)) {
@@ -1658,8 +1598,8 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
Tcl_DStringValue(&optsPtr->utfDirString), &cwd) == NULL)) {
Tcl_ResetResult(interp);
} else {
- Tcl_DStringInit(&dirString);
- Tcl_UtfToWCharDString(Tcl_DStringValue(&cwd),
+ Tcl_DStringInit(&dirString);
+ Tcl_UtfToWCharDString(Tcl_DStringValue(&cwd),
Tcl_DStringLength(&cwd), &dirString);
}
Tcl_DStringFree(&cwd);
@@ -2116,7 +2056,7 @@ MakeFilter(
*p = '\0';
} else {
- int len;
+ TkSizeT len;
if (valuePtr == NULL) {
len = 0;
@@ -2228,9 +2168,9 @@ static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr)
DWORD dw;
for (dw = 0; dw < count; ++dw) {
if (dlgFilterPtr[dw].pszName != NULL)
- ckfree(dlgFilterPtr[dw].pszName);
+ ckfree((char *)dlgFilterPtr[dw].pszName);
if (dlgFilterPtr[dw].pszSpec != NULL)
- ckfree(dlgFilterPtr[dw].pszSpec);
+ ckfree((char *)dlgFilterPtr[dw].pszSpec);
}
ckfree(dlgFilterPtr);
}
@@ -2305,8 +2245,8 @@ static int MakeFilterVista(
initialIndex = i+1; /* Windows filter indices are 1-based */
/* First stash away the text description of the pattern */
- Tcl_DStringInit(&ds);
- Tcl_UtfToWCharDString(filterPtr->name, -1, &ds);
+ Tcl_DStringInit(&ds);
+ Tcl_UtfToWCharDString(filterPtr->name, -1, &ds);
nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */
nbytes += sizeof(WCHAR); /* Terminating \0 */
dlgFilterPtr[i].pszName = (LPCWSTR)ckalloc(nbytes);
@@ -2334,8 +2274,8 @@ static int MakeFilterVista(
}
/* Again we need a Unicode form of the string */
- Tcl_DStringInit(&ds);
- Tcl_UtfToWCharDString(Tcl_DStringValue(&patterns), -1, &ds);
+ Tcl_DStringInit(&ds);
+ Tcl_UtfToWCharDString(Tcl_DStringValue(&patterns), -1, &ds);
nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */
nbytes += sizeof(WCHAR); /* Terminating \0 */
dlgFilterPtr[i].pszSpec = (LPCWSTR)ckalloc(nbytes);
@@ -2474,12 +2414,12 @@ Tk_ChooseDirectoryObjCmd(
Tcl_DStringInit(&tempString);
Tcl_UtfToWCharDString(Tcl_DStringValue(&ofnOpts.utfDirString), -1,
&tempString);
- uniStr = (WCHAR *) Tcl_DStringValue(&tempString);
+ uniStr = (WCHAR *) Tcl_DStringValue(&tempString);
- /* Convert possible relative path to full path to keep dialog happy. */
+ /* Convert possible relative path to full path to keep dialog happy. */
- GetFullPathNameW(uniStr, MAX_PATH, saveDir, NULL);
- wcsncpy(cdCBData.initDir, saveDir, MAX_PATH);
+ GetFullPathNameW(uniStr, MAX_PATH, saveDir, NULL);
+ wcsncpy(cdCBData.initDir, saveDir, MAX_PATH);
}
/* XXX - rest of this (original) code has no error checks at all. */
@@ -3086,7 +3026,7 @@ GetFontObj(
Tcl_NewStringObj(Tcl_DStringValue(&ds), -1));
Tcl_DStringFree(&ds);
pt = -MulDiv(plf->lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY));
- Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewIntObj(pt));
+ Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewWideIntObj(pt));
if (plf->lfWeight >= 700) {
Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj("bold", -1));
}
@@ -3187,13 +3127,13 @@ HookProc(
if (IsWindow(hwndCtrl)) {
EnableWindow(hwndCtrl, FALSE);
}
- TkSendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
return 1; /* we handled the message */
}
if (WM_DESTROY == msg) {
phd->hwnd = NULL;
- TkSendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
return 0;
}
@@ -3211,7 +3151,7 @@ HookProc(
ApplyLogfont(phd->interp, phd->cmdObj, hdc, &lf);
}
if (phd && phd->parent) {
- TkSendVirtualEvent(phd->parent, "TkFontchooserFontChanged", NULL);
+ Tk_SendVirtualEvent(phd->parent, "TkFontchooserFontChanged", NULL);
}
return 1;
}
@@ -3265,7 +3205,7 @@ FontchooserCget(
}
break;
case FontchooserVisible:
- resObj = Tcl_NewBooleanObj(hdPtr->hwnd && IsWindow(hdPtr->hwnd));
+ resObj = Tcl_NewWideIntObj((hdPtr->hwnd != NULL) && IsWindow(hdPtr->hwnd));
break;
default:
resObj = Tcl_NewStringObj("", 0);
@@ -3525,7 +3465,7 @@ FontchooserShowCmd(
ApplyLogfont(hdPtr->interp, hdPtr->cmdObj, hdc, &lf);
}
if (hdPtr->parent) {
- TkSendVirtualEvent(hdPtr->parent, "TkFontchooserFontChanged", NULL);
+ Tk_SendVirtualEvent(hdPtr->parent, "TkFontchooserFontChanged", NULL);
}
}
Tcl_SetServiceMode(oldMode);
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 4ed8ab2..531f06b 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -4,8 +4,8 @@
* This file contains the Xlib emulation functions pertaining to actually
* drawing objects on a window.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
- * Copyright (c) 1994 Software Research Associates, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
+ * Copyright © 1994 Software Research Associates, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -244,7 +244,7 @@ ConvertPoints(
if (tsdPtr->winPoints != NULL) {
ckfree(tsdPtr->winPoints);
}
- tsdPtr->winPoints = ckalloc(sizeof(POINT) * npoints);
+ tsdPtr->winPoints = (POINT *)ckalloc(sizeof(POINT) * npoints);
if (tsdPtr->winPoints == NULL) {
tsdPtr->nWinPoints = -1;
return NULL;
@@ -412,7 +412,7 @@ XCopyPlane(
*/
fgBrush = CreateSolidBrush(gc->foreground);
- oldBrush = SelectObject(destDC, fgBrush);
+ oldBrush = (HBRUSH)SelectObject(destDC, fgBrush);
SetBkColor(destDC, RGB(255,255,255));
SetTextColor(destDC, RGB(0,0,0));
BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, srcDC,
@@ -450,7 +450,7 @@ XCopyPlane(
BitBlt(memDC, 0, 0, (int) width, (int) height, maskDC,
dest_x - gc->clip_x_origin, dest_y - gc->clip_y_origin,
SRCAND);
- oldBrush = SelectObject(destDC, fgBrush);
+ oldBrush = (HBRUSH)SelectObject(destDC, fgBrush);
BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, memDC,
0, 0, MASKPAT);
@@ -553,10 +553,10 @@ TkPutImage(
usePalette = (image->bits_per_pixel < 16);
if (usePalette) {
- infoPtr = ckalloc(sizeof(BITMAPINFOHEADER)
+ infoPtr = (BITMAPINFO *)ckalloc(sizeof(BITMAPINFOHEADER)
+ sizeof(RGBQUAD)*ncolors);
} else {
- infoPtr = ckalloc(sizeof(BITMAPINFOHEADER));
+ infoPtr = (BITMAPINFO *)ckalloc(sizeof(BITMAPINFOHEADER));
}
infoPtr->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@@ -586,9 +586,11 @@ TkPutImage(
ckfree(infoPtr);
}
if (!bitmap) {
- Tcl_Panic("Fail to allocate bitmap");
+ DeleteDC(dcMem);
+ TkWinReleaseDrawableDC(d, dc, &state);
+ return BadValue;
}
- bitmap = SelectObject(dcMem, bitmap);
+ bitmap = (HBITMAP)SelectObject(dcMem, bitmap);
BitBlt(dc, dest_x, dest_y, (int) width, (int) height, dcMem, src_x, src_y,
SRCCOPY);
DeleteObject(SelectObject(dcMem, bitmap));
@@ -597,6 +599,7 @@ TkPutImage(
return Success;
}
+#undef XPutImage
int
XPutImage(
Display *display,
@@ -668,7 +671,7 @@ XFillRectangles(
stipple = CreatePatternBrush(twdPtr->bitmap.handle);
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
- oldBrush = SelectObject(dc, stipple);
+ oldBrush = (HBRUSH)SelectObject(dc, stipple);
dcMem = CreateCompatibleDC(dc);
/*
@@ -680,7 +683,7 @@ XFillRectangles(
while (nrectangles-- > 0) {
bitmap = CreateCompatibleBitmap(dc, rectangles[0].width,
rectangles[0].height);
- oldBitmap = SelectObject(dcMem, bitmap);
+ oldBitmap = (HBITMAP)SelectObject(dcMem, bitmap);
rect.left = 0;
rect.top = 0;
rect.right = rectangles[0].width;
@@ -715,8 +718,8 @@ XFillRectangles(
}
} else {
HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
- HPEN oldPen = SelectObject(dc, newPen);
- oldBrush = SelectObject(dc, brush);
+ HPEN oldPen = (HPEN)SelectObject(dc, newPen);
+ oldBrush = (HBRUSH)SelectObject(dc, brush);
while (nrectangles-- > 0) {
Rectangle(dc, rectangles[0].x, rectangles[0].y,
@@ -845,7 +848,7 @@ RenderObject(
*/
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
- oldBrush = SelectObject(dc, CreatePatternBrush(twdPtr->bitmap.handle));
+ oldBrush = (HBRUSH)SelectObject(dc, CreatePatternBrush(twdPtr->bitmap.handle));
/*
* Create temporary drawing surface containing a copy of the
@@ -853,9 +856,9 @@ RenderObject(
*/
dcMem = CreateCompatibleDC(dc);
- oldBitmap = SelectObject(dcMem, CreateCompatibleBitmap(dc, width,
+ oldBitmap = (HBITMAP)SelectObject(dcMem, CreateCompatibleBitmap(dc, width,
height));
- oldPen = SelectObject(dcMem, pen);
+ oldPen = (HPEN)SelectObject(dcMem, pen);
BitBlt(dcMem, 0, 0, width, height, dc, rect.left, rect.top, SRCCOPY);
/*
@@ -875,7 +878,7 @@ RenderObject(
SetPolyFillMode(dcMem, (gc->fill_rule == EvenOddRule) ? ALTERNATE
: WINDING);
- oldMemBrush = SelectObject(dcMem, CreateSolidBrush(gc->foreground));
+ oldMemBrush = (HBRUSH)SelectObject(dcMem, CreateSolidBrush(gc->foreground));
MakeAndStrokePath(dcMem, winPoints, npoints, func);
BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0, COPYFG);
@@ -898,8 +901,8 @@ RenderObject(
DeleteObject(SelectObject(dcMem, oldBitmap));
DeleteDC(dcMem);
} else {
- oldPen = SelectObject(dc, pen);
- oldBrush = SelectObject(dc, CreateSolidBrush(gc->foreground));
+ oldPen = (HPEN)SelectObject(dc, pen);
+ oldBrush = (HBRUSH)SelectObject(dc, CreateSolidBrush(gc->foreground));
SetROP2(dc, tkpWinRopModes[gc->function]);
SetPolyFillMode(dc, (gc->fill_rule == EvenOddRule) ? ALTERNATE
@@ -983,6 +986,7 @@ XFillPolygon(
HPEN pen;
TkWinDCState state;
HDC dc;
+ (void)shape;
if (d == None) {
return BadDrawable;
@@ -990,7 +994,7 @@ XFillPolygon(
dc = TkWinGetDrawableDC(display, d, &state);
- pen = GetStockObject(NULL_PEN);
+ pen = (HPEN)GetStockObject(NULL_PEN);
RenderObject(dc, gc, points, npoints, mode, pen, Polygon);
TkWinReleaseDrawableDC(d, dc, &state);
@@ -1034,8 +1038,8 @@ XDrawRectangle(
pen = SetUpGraphicsPort(gc);
SetBkMode(dc, TRANSPARENT);
- oldPen = SelectObject(dc, pen);
- oldBrush = SelectObject(dc, GetStockObject(NULL_BRUSH));
+ oldPen = (HPEN)SelectObject(dc, pen);
+ oldBrush = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH));
SetROP2(dc, tkpWinRopModes[gc->function]);
Rectangle(dc, x, y, (int) x+width+1, (int) y+height+1);
@@ -1260,7 +1264,7 @@ DrawOrFillArc(
*/
pen = SetUpGraphicsPort(gc);
- oldPen = SelectObject(dc, pen);
+ oldPen = (HPEN)SelectObject(dc, pen);
if (!fill) {
/*
* Note that this call will leave a gap of one pixel at the end of the
@@ -1273,7 +1277,7 @@ DrawOrFillArc(
xend, yend);
} else {
brush = CreateSolidBrush(gc->foreground);
- oldBrush = SelectObject(dc, brush);
+ oldBrush = (HBRUSH)SelectObject(dc, brush);
if (gc->arc_mode == ArcChord) {
Chord(dc, x, y, (int) (x+width+1), (int) (y+height+1),
xstart, ystart, xend, yend);
@@ -1399,10 +1403,11 @@ TkScrollWindow(
int x, int y, int width, int height,
/* Position rectangle to be scrolled. */
int dx, int dy, /* Distance rectangle should be moved. */
- TkRegion damageRgn) /* Region to accumulate damage in. */
+ Region damageRgn) /* Region to accumulate damage in. */
{
HWND hwnd = TkWinGetHWND(Tk_WindowId(tkwin));
RECT scrollRect;
+ (void)gc;
scrollRect.left = x;
scrollRect.top = y;
@@ -1479,13 +1484,15 @@ TkpDrawHighlightBorder(
int highlightWidth,
Drawable drawable)
{
+ (void)bgGC;
+
TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
/*
*----------------------------------------------------------------------
*
- * TkpDrawFrame --
+ * TkpDrawFrameEx --
*
* This function draws the rectangular frame area.
*
@@ -1499,14 +1506,15 @@ TkpDrawHighlightBorder(
*/
void
-TkpDrawFrame(
+TkpDrawFrameEx(
Tk_Window tkwin,
+ Drawable drawable,
Tk_3DBorder border,
int highlightWidth,
int borderWidth,
int relief)
{
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, highlightWidth,
+ Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth,
highlightWidth, Tk_Width(tkwin) - 2 * highlightWidth,
Tk_Height(tkwin) - 2 * highlightWidth, borderWidth, relief);
}
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index 36c6047..126b6d1 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -6,7 +6,7 @@
* one application can use as its main window an internal window from
* another application).
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -69,7 +69,7 @@ void
TkWinCleanupContainerList(void)
{
Container *nextPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (; tsdPtr->firstContainerPtr != NULL;
@@ -96,14 +96,18 @@ TkWinCleanupContainerList(void)
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
TkpTestembedCmd(
- ClientData clientData,
+ ClientData dummy,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
+ (void)dummy;
+ (void)interp;
+ (void)objc;
+ (void)objv;
+
return TCL_OK;
}
@@ -173,7 +177,7 @@ void Tk_MapEmbeddedWindow(
TkpWmSetState(winPtr, state);
TkWmMapWindow(winPtr);
}
- Tcl_Release((ClientData)winPtr);
+ Tcl_Release(winPtr);
}
/*
@@ -331,8 +335,8 @@ TkpUseWindow(
* window.
*/
- Tcl_Preserve((ClientData) winPtr);
- Tcl_DoWhenIdle((Tcl_IdleProc*) Tk_MapEmbeddedWindow, (ClientData) winPtr);
+ Tcl_Preserve(winPtr);
+ Tcl_DoWhenIdle((Tcl_IdleProc*) Tk_MapEmbeddedWindow, winPtr);
return TCL_OK;
}
@@ -371,7 +375,7 @@ TkpMakeContainer(
*/
Tk_MakeWindowExist(tkwin);
- containerPtr = ckalloc(sizeof(Container));
+ containerPtr = (Container *)ckalloc(sizeof(Container));
containerPtr->parentPtr = winPtr;
containerPtr->parentHWnd = Tk_GetHWND(Tk_WindowId(tkwin));
containerPtr->embeddedHWnd = NULL;
@@ -392,7 +396,7 @@ TkpMakeContainer(
*/
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- ContainerEventProc, (ClientData) containerPtr);
+ ContainerEventProc, containerPtr);
}
/*
@@ -1050,6 +1054,8 @@ TkpRedirectKeyEvent(
XEvent *eventPtr) /* X event to redirect (should be KeyPress or
* KeyRelease). */
{
+ (void)winPtr;
+ (void)eventPtr;
/* not implemented */
}
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 5eed32c..78a192e 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -4,9 +4,9 @@
* Contains the Windows implementation of the platform-independent font
* package interface.
*
- * Copyright (c) 1994 Software Research Associates, Inc.
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1994 Software Research Associates, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -2547,22 +2547,6 @@ FamilyExists(
int result;
Tcl_DString faceString;
- /*
- * Just immediately rule out the following fonts, because they look so
- * ugly on windows. The caller's fallback mechanism will cause the
- * corresponding appropriate TrueType fonts to be selected.
- */
-
- if (strcasecmp(faceName, "Courier") == 0) {
- return 0;
- }
- if (strcasecmp(faceName, "Times") == 0) {
- return 0;
- }
- if (strcasecmp(faceName, "Helvetica") == 0) {
- return 0;
- }
-
Tcl_DStringInit(&faceString);
Tcl_UtfToWCharDString(faceName, -1, &faceString);
diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c
new file mode 100644
index 0000000..7c6705a
--- /dev/null
+++ b/win/tkWinGDI.c
@@ -0,0 +1,3893 @@
+/*
+ * tkWinGDI.c --
+ *
+ * This module implements access to the Win32 GDI API.
+ *
+ * Copyright © 1991-2018 Microsoft Corp.
+ * Copyright © 2009, Michael I. Schwartz.
+ * Copyright © 1998-2019 Harald Oehlmann, Elmicron GmbH
+ * Copyright © 2021 Kevin Walzer/WordTech Communications LLC.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+
+#include <windows.h>
+#include <stdlib.h>
+#include <math.h>
+#include <wtypes.h>
+#include <winspool.h>
+#include <commdlg.h>
+#include <wingdi.h>
+
+#include <tcl.h>
+
+#include "tkWinInt.h"
+
+/*
+ * Create a standard "DrawFunc" to make this more workable....
+ */
+#ifdef _MSC_VER
+typedef BOOL (WINAPI *DrawFunc) (
+ HDC, int, int, int, int, int, int, int, int); /* Arc, Chord, Pie. */
+#else
+typedef BOOL WINAPI (*DrawFunc) (
+ HDC, int, int, int, int, int, int, int, int); /* Arc, Chord, Pie. */
+#endif
+
+/* Real functions. */
+static int GdiArc(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiBitmap(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiCharWidths(ClientData clientData,
+ Tcl_Interp *interp, int argc, const char **argv);
+static int GdiImage(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiPhoto(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiLine(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiOval(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiPolygon(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiRectangle(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiText(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiMap(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+static int GdiCopyBits(ClientData clientData, Tcl_Interp *interp,
+ int argc, const char **argv);
+
+/* Local copies of similar routines elsewhere in Tcl/Tk. */
+static int GdiGetColor(const char *name, COLORREF *color);
+
+/*
+ * Helper functions.
+ */
+static int GdiMakeLogFont(Tcl_Interp *interp, const char *str,
+ LOGFONTW *lf, HDC hDC);
+static int GdiMakePen(Tcl_Interp *interp, int width,
+ int dashstyle, const char *dashstyledata,
+ int capstyle, int joinstyle,
+ int stipplestyle, const char *stippledata,
+ unsigned long color, HDC hDC, HGDIOBJ *oldPen);
+static int GdiFreePen(Tcl_Interp *interp, HDC hDC, HGDIOBJ oldPen);
+static int GdiMakeBrush(Tcl_Interp *interp, unsigned int style,
+ unsigned long color, long hatch, LOGBRUSH *lb,
+ HDC hDC, HGDIOBJ *oldBrush);
+static int GdiFreeBrush(Tcl_Interp *interp, HDC hDC,
+ HGDIOBJ oldBcrush);
+static int GdiGetHdcInfo(HDC hdc,
+ LPPOINT worigin, LPSIZE wextent,
+ LPPOINT vorigin, LPSIZE vextent);
+
+/* Helper functions for printing the window client area. */
+enum PrintType { PTWindow = 0, PTClient = 1, PTScreen = 2 };
+
+static HANDLE CopyToDIB(HWND wnd, enum PrintType type);
+static HBITMAP CopyScreenToBitmap(LPRECT lpRect);
+static HANDLE BitmapToDIB(HBITMAP hb, HPALETTE hp);
+static HANDLE CopyScreenToDIB(LPRECT lpRect);
+static int DIBNumColors(LPBITMAPINFOHEADER lpDIB);
+static int PalEntriesOnDevice(HDC hDC);
+static HPALETTE GetSystemPalette(void);
+static void GetDisplaySize(LONG *width, LONG *height);
+static int GdiWordToWeight(const char *str);
+static int GdiParseFontWords(Tcl_Interp *interp, LOGFONTW *lf,
+ const char *str[], int numargs);
+static int PrintSelectPrinter(ClientData clientData,
+ Tcl_Interp *interp, int argc,
+ Tcl_Obj *const objv[]);
+static int PrintOpenPrinter(ClientData clientData,
+ Tcl_Interp *interp, int argc,
+ Tcl_Obj *const objv[]);
+static int PrintClosePrinter(ClientData clientData,
+ Tcl_Interp *interp, int argc,
+ Tcl_Obj *const objv[]);
+static int PrintOpenDoc(ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj *const objv[]);
+static int PrintCloseDoc(ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj *const objv[]);
+static int PrintOpenPage(ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj *const objv[]);
+static int PrintClosePage(ClientData clientData,
+ Tcl_Interp *interp, int argc,
+ Tcl_Obj *const objv[]);
+
+/*
+ * Global state.
+ */
+
+static PRINTDLGW pd;
+static DOCINFOW di;
+static WCHAR *localPrinterName = NULL;
+static int copies, paper_width, paper_height, dpi_x, dpi_y;
+static LPDEVNAMES devnames;
+static HDC printDC;
+
+/*
+ * To make the "subcommands" follow a standard convention, add them to this
+ * array. The first element is the subcommand name, and the second a standard
+ * Tcl command handler.
+ */
+
+static const struct gdi_command {
+ const char *command_string;
+ Tcl_CmdProc *command;
+} gdi_commands[] = {
+ { "arc", GdiArc },
+ { "bitmap", GdiBitmap },
+ { "characters", GdiCharWidths },
+ { "image", GdiImage },
+ { "line", GdiLine },
+ { "map", GdiMap },
+ { "oval", GdiOval },
+ { "photo", GdiPhoto },
+ { "polygon", GdiPolygon },
+ { "rectangle", GdiRectangle },
+ { "text", GdiText },
+ { "copybits", GdiCopyBits },
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiArc --
+ *
+ * Map canvas arcs to GDI context.
+ *
+ * Results:
+ * Renders arcs.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiArc(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi arc hdc x1 y1 x2 y2 "
+ "-extent angle -start angle -style arcstyle "
+ "-fill color -outline color "
+ "-width dimension -dash dashrule "
+ "-outlinestipple ignored -stipple ignored\n" ;
+ int x1, y1, x2, y2;
+ int xr0, yr0, xr1, yr1;
+ HDC hDC;
+ double extent = 0.0, start = 0.0;
+ DrawFunc drawfunc;
+ int width = 0;
+ HPEN hPen;
+ COLORREF linecolor = 0, fillcolor = BS_NULL;
+ int dolinecolor = 0, dofillcolor = 0;
+ HBRUSH hBrush;
+ LOGBRUSH lbrush;
+ HGDIOBJ oldobj;
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ drawfunc = Pie;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ x1 = atoi(argv[2]);
+ y1 = atoi(argv[3]);
+ x2 = atoi(argv[4]);
+ y2 = atoi(argv[5]);
+
+ argc -= 6;
+ argv += 6;
+ while (argc >= 2) {
+ if (strcmp(argv[0], "-extent") == 0) {
+ extent = atof(argv[1]);
+ } else if (strcmp(argv[0], "-start") == 0) {
+ start = atof(argv[1]);
+ } else if (strcmp(argv[0], "-style") == 0) {
+ if (strcmp(argv[1], "pieslice") == 0) {
+ drawfunc = Pie;
+ } else if (strcmp(argv[1], "arc") == 0) {
+ drawfunc = Arc;
+ } else if (strcmp(argv[1], "chord") == 0) {
+ drawfunc = Chord;
+ }
+ } else if (strcmp(argv[0], "-fill") == 0) {
+ /* Handle all args, even if we don't use them yet. */
+ if (GdiGetColor(argv[1], &fillcolor)) {
+ dofillcolor = 1;
+ }
+ } else if (strcmp(argv[0], "-outline") == 0) {
+ if (GdiGetColor(argv[1], &linecolor)) {
+ dolinecolor = 1;
+ }
+ } else if (strcmp(argv[0], "-outlinestipple") == 0) {
+ /* ignored */
+ } else if (strcmp(argv[0], "-stipple") == 0) {
+ /* ignored */
+ } else if (strcmp(argv[0], "-width") == 0) {
+ width = atoi(argv[1]);
+ } else if (strcmp(argv[0], "-dash") == 0) {
+ if (argv[1]) {
+ dodash = 1;
+ dashdata = argv[1];
+ }
+ } else {
+ /* Don't know that option! */
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+ argc -= 2;
+ argv += 2;
+ }
+ xr0 = xr1 = (x1 + x2) / 2;
+ yr0 = yr1 = (y1 + y2) / 2;
+
+ /*
+ * The angle used by the arc must be "warped" by the eccentricity of the
+ * ellipse. Thanks to Nigel Dodd <nigel.dodd@avellino.com> for bringing a
+ * nice example.
+ */
+
+ xr0 += (int)(100.0 * (x2 - x1) * cos((start * 2.0 * 3.14159265) / 360.0));
+ yr0 -= (int)(100.0 * (y2 - y1) * sin((start * 2.0 * 3.14159265) / 360.0));
+ xr1 += (int)(100.0 * (x2 - x1) * cos(((start+extent) * 2.0 * 3.14159265) / 360.0));
+ yr1 -= (int)(100.0 * (y2 - y1) * sin(((start+extent) * 2.0 * 3.14159265) / 360.0));
+
+ /*
+ * Under Win95, SetArcDirection isn't implemented--so we have to assume
+ * that arcs are drawn counterclockwise (e.g., positive extent) So if it's
+ * negative, switch the coordinates!
+ */
+
+ if (extent < 0) {
+ int xr2 = xr0;
+ int yr2 = yr0;
+
+ xr0 = xr1;
+ xr1 = xr2;
+ yr0 = yr1;
+ yr1 = yr2;
+ }
+
+ if (dofillcolor) {
+ GdiMakeBrush(interp, 0, fillcolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush);
+ } else {
+ oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH));
+ }
+
+ if (width || dolinecolor) {
+ GdiMakePen(interp, width, dodash, dashdata,
+ 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+
+ (*drawfunc)(hDC, x1, y1, x2, y2, xr0, yr0, xr1, yr1);
+
+ if (width || dolinecolor) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (dofillcolor) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ } else {
+ SelectObject(hDC, oldobj);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiBitmap --
+ *
+ * Unimplemented for now. Should use the same techniques as
+ * CanvasPsBitmap (tkCanvPs.c).
+ *
+ * Results:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiBitmap(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(const char **))
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi bitmap hdc x y "
+ "-anchor [center|n|e|s|w] -background color "
+ "-bitmap bitmap -foreground color\n"
+ "Not implemented yet. Sorry!";
+
+ /*
+ * Skip this for now. Should be based on common code with the copybits
+ * command.
+ */
+
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiImage --
+ *
+ * Unimplemented for now. Unimplemented for now. Should switch on image
+ * type and call either GdiPhoto or GdiBitmap. This code is similar to
+ * that in tkWinImage.c.
+ *
+ * Results:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiImage(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(const char **))
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi image hdc x y -anchor [center|n|e|s|w] -image name\n"
+ "Not implemented yet. Sorry!";
+
+ /* Skip this for now..... */
+ /* Should be based on common code with the copybits command. */
+
+ Tcl_AppendResult(interp, usage_message, NULL);
+ /* Normally, usage results in TCL_ERROR--but wait til' it's implemented. */
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiPhoto --
+ *
+ * Contributed by Lukas Rosenthaler <lukas.rosenthaler@balcab.ch>
+ *
+ * Note: The canvas doesn't directly support photos (only as images), so
+ * this is the first ::tk::print::_gdi command without an equivalent
+ * canvas command. This code may be modified to support photo images on
+ * the canvas.
+ *
+ * Results:
+ * Renders a photo.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiPhoto(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi photo hdc [-destination x y [w [h]]] -photo name\n";
+ HDC dst;
+ int dst_x = 0, dst_y = 0, dst_w = 0, dst_h = 0;
+ int nx, ny, sll;
+ const char *photoname = 0; /* For some reason Tk_FindPhoto takes a char *. */
+ Tk_PhotoHandle photo_handle;
+ Tk_PhotoImageBlock img_block;
+ BITMAPINFO bitmapinfo; /* Since we don't need the bmiColors table,
+ * there is no need for dynamic allocation. */
+ int oldmode; /* For saving the old stretch mode. */
+ POINT pt; /* For saving the brush org. */
+ char *pbuf = NULL;
+ int i, j, k;
+ int retval = TCL_OK;
+
+ /*
+ * Parse the arguments.
+ */
+
+ /* HDC is required. */
+ if (argc < 2) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ dst = printDC;
+
+ /*
+ * Next, check to see if 'dst' can support BitBlt.
+ * If not, raise an error.
+ */
+
+ if ((GetDeviceCaps(dst, RASTERCAPS) & RC_STRETCHDIB) == 0) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "::tk::print::_gdi photo not supported on device context (0x%s)",
+ argv[1]));
+ return TCL_ERROR;
+ }
+
+ /* Parse the command line arguments. */
+ for (j = 2; j < argc; j++) {
+ if (strcmp(argv[j], "-destination") == 0) {
+ double x, y, w, h;
+ int count = 0;
+ char dummy;
+
+ if (j < argc) {
+ count = sscanf(argv[++j], "%lf%lf%lf%lf%c",
+ &x, &y, &w, &h, &dummy);
+ }
+
+ if (count < 2 || count > 4) {
+ /* Destination must provide at least 2 arguments. */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "-destination requires a list of 2 to 4 numbers\n%s",
+ usage_message));
+ return TCL_ERROR;
+ }
+
+ dst_x = (int) x;
+ dst_y = (int) y;
+ if (count == 3) {
+ dst_w = (int) w;
+ dst_h = -1;
+ } else if (count == 4) {
+ dst_w = (int) w;
+ dst_h = (int) h;
+ }
+ } else if (strcmp(argv[j], "-photo") == 0) {
+ photoname = argv[++j];
+ }
+ }
+
+ if (photoname == 0) { /* No photo provided. */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "No photo name provided to ::tk::print::_gdi photo\n%s",
+ usage_message));
+ return TCL_ERROR;
+ }
+
+ photo_handle = Tk_FindPhoto(interp, photoname);
+ if (photo_handle == 0) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "::tk::print::_gdi photo: Photo name %s can't be located\n%s",
+ photoname, usage_message));
+ return TCL_ERROR;
+ }
+ Tk_PhotoGetImage(photo_handle, &img_block);
+
+ nx = img_block.width;
+ ny = img_block.height;
+ sll = ((3*nx + 3) / 4)*4; /* Must be multiple of 4. */
+
+ /*
+ * Buffer is potentially large enough that failure to allocate might be
+ * recoverable.
+ */
+
+ pbuf = (char *) Tcl_AttemptAlloc(sll * ny * sizeof(char));
+ if (pbuf == 0) { /* Memory allocation failure. */
+ Tcl_AppendResult(interp,
+ "::tk::print::_gdi photo failed--out of memory", NULL);
+ return TCL_ERROR;
+ }
+
+ /* After this, all returns must go through retval. */
+
+ /* BITMAP expects BGR; photo provides RGB. */
+ for (k = 0; k < ny; k++) {
+ for (i = 0; i < nx; i++) {
+ pbuf[k*sll + 3*i] = img_block.pixelPtr[
+ k*img_block.pitch + i*img_block.pixelSize + img_block.offset[2]];
+ pbuf[k*sll + 3*i + 1] = img_block.pixelPtr[
+ k*img_block.pitch + i*img_block.pixelSize + img_block.offset[1]];
+ pbuf[k*sll + 3*i + 2] = img_block.pixelPtr[
+ k*img_block.pitch + i*img_block.pixelSize + img_block.offset[0]];
+ }
+ }
+
+ memset(&bitmapinfo, 0L, sizeof(BITMAPINFO));
+
+ bitmapinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bitmapinfo.bmiHeader.biWidth = nx;
+ bitmapinfo.bmiHeader.biHeight = -ny;
+ bitmapinfo.bmiHeader.biPlanes = 1;
+ bitmapinfo.bmiHeader.biBitCount = 24;
+ bitmapinfo.bmiHeader.biCompression = BI_RGB;
+ bitmapinfo.bmiHeader.biSizeImage = 0; /* sll*ny;. */
+ bitmapinfo.bmiHeader.biXPelsPerMeter = 0;
+ bitmapinfo.bmiHeader.biYPelsPerMeter = 0;
+ bitmapinfo.bmiHeader.biClrUsed = 0;
+ bitmapinfo.bmiHeader.biClrImportant = 0;
+
+ oldmode = SetStretchBltMode(dst, HALFTONE);
+ /*
+ * According to the Win32 Programmer's Manual, we have to set the brush
+ * org, now.
+ */
+ SetBrushOrgEx(dst, 0, 0, &pt);
+
+ if (dst_w <= 0) {
+ dst_w = nx;
+ dst_h = ny;
+ } else if (dst_h <= 0) {
+ dst_h = ny*dst_w / nx;
+ }
+
+ if (StretchDIBits(dst, dst_x, dst_y, dst_w, dst_h, 0, 0, nx, ny,
+ pbuf, &bitmapinfo, DIB_RGB_COLORS, SRCCOPY) == (int)GDI_ERROR) {
+ int errcode = GetLastError();
+
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "::tk::print::_gdi photo internal failure: "
+ "StretchDIBits error code %d", errcode));
+ retval = TCL_ERROR;
+ }
+
+ /* Clean up the hDC. */
+ if (oldmode != 0) {
+ SetStretchBltMode(dst, oldmode);
+ SetBrushOrgEx(dst, pt.x, pt.y, &pt);
+ }
+
+ Tcl_Free(pbuf);
+
+ if (retval == TCL_OK) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "%d %d %d %d", dst_x, dst_y, dst_w, dst_h));
+ }
+
+ return retval;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Bezierize --
+ *
+ * Interface to Tk's line smoother, used for lines and pollies.
+ * Provided by Jasper Taylor <jasper.taylor@ed.ac.uk>.
+ *
+ * Results:
+ * Smooths lines.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int Bezierize(
+ POINT* polypoints,
+ int npoly,
+ int nStep,
+ POINT* bpointptr)
+{
+ /* First, translate my points into a list of doubles. */
+ double *inPointList, *outPointList;
+ int n;
+ int nbpoints = 0;
+ POINT* bpoints;
+
+ inPointList = (double *) Tcl_AttemptAlloc(2 * sizeof(double) * npoly);
+ if (inPointList == 0) {
+ /* TODO: unreachable */
+ return nbpoints; /* 0. */
+ }
+
+ for (n=0; n<npoly; n++) {
+ inPointList[2*n] = polypoints[n].x;
+ inPointList[2*n + 1] = polypoints[n].y;
+ }
+
+ nbpoints = 1 + npoly * nStep; /* this is the upper limit. */
+ outPointList = (double *) Tcl_AttemptAlloc(2 * sizeof(double) * nbpoints);
+ if (outPointList == 0) {
+ /* TODO: unreachable */
+ Tcl_Free((void *) inPointList);
+ return 0;
+ }
+
+ nbpoints = TkMakeBezierCurve(NULL, inPointList, npoly, nStep,
+ NULL, outPointList);
+
+ Tcl_Free((void *) inPointList);
+ bpoints = (POINT *) Tcl_AttemptAlloc(sizeof(POINT)*nbpoints);
+ if (bpoints == 0) {
+ /* TODO: unreachable */
+ Tcl_Free((void *) outPointList);
+ return 0;
+ }
+
+ for (n=0; n<nbpoints; n++) {
+ bpoints[n].x = (long) outPointList[2*n];
+ bpoints[n].y = (long) outPointList[2*n + 1];
+ }
+ Tcl_Free((void *) outPointList);
+ *bpointptr = *bpoints;
+ return nbpoints;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiLine --
+ *
+ * Maps lines to GDI context.
+ *
+ * Results:
+ * Renders lines.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiLine(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi line hdc x1 y1 ... xn yn "
+ "-arrow [first|last|both|none] -arrowshape {d1 d2 d3} "
+ "-dash dashlist "
+ "-capstyle [butt|projecting|round] -fill color "
+ "-joinstyle [bevel|miter|round] -smooth [true|false|bezier] "
+ "-splinesteps number -stipple bitmap -width linewid";
+ char *strend;
+ POINT *polypoints;
+ int npoly;
+ int x, y;
+ HDC hDC;
+ HPEN hPen;
+
+ LOGBRUSH lbrush;
+ HBRUSH hBrush;
+
+ int width = 0;
+ COLORREF linecolor = 0;
+ int dolinecolor = 0;
+ int dosmooth = 0;
+ int doarrow = 0; /* 0=none; 1=end; 2=start; 3=both. */
+ int arrowshape[3];
+
+ int nStep = 12;
+
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ arrowshape[0] = 8;
+ arrowshape[1] = 10;
+ arrowshape[2] = 3;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ polypoints = (POINT *) Tcl_AttemptAlloc((argc - 1) * sizeof(POINT));
+ if (polypoints == 0) {
+ Tcl_AppendResult(interp, "Out of memory in GdiLine", NULL);
+ return TCL_ERROR;
+ }
+ polypoints[0].x = atol(argv[2]);
+ polypoints[0].y = atol(argv[3]);
+ polypoints[1].x = atol(argv[4]);
+ polypoints[1].y = atol(argv[5]);
+ argc -= 6;
+ argv += 6;
+ npoly = 2;
+
+ while (argc >= 2) {
+ /* Check for a number. */
+ x = strtoul(argv[0], &strend, 0);
+ if (strend > argv[0]) {
+ /* One number.... */
+ y = strtoul(argv[1], &strend, 0);
+ if (strend > argv[1]) {
+ /* TWO numbers!. */
+ polypoints[npoly].x = x;
+ polypoints[npoly].y = y;
+ npoly++;
+ argc -= 2;
+ argv += 2;
+ } else {
+ /* Only one number... Assume a usage error. */
+ Tcl_Free((void *)polypoints);
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+ } else {
+ if (strcmp(*argv, "-arrow") == 0) {
+ if (strcmp(argv[1], "none") == 0) {
+ doarrow = 0;
+ } else if (strcmp(argv[1], "both") == 0) {
+ doarrow = 3;
+ } else if (strcmp(argv[1], "first") == 0) {
+ doarrow = 2;
+ } else if (strcmp(argv[1], "last") == 0) {
+ doarrow = 1;
+ }
+ argv += 2;
+ argc -= 2;
+ } else if (strcmp(*argv, "-arrowshape") == 0) {
+ /* List of 3 numbers--set arrowshape array. */
+ int a1, a2, a3;
+ char dummy;
+
+ if (sscanf(argv[1], "%d%d%d%c", &a1, &a2, &a3, &dummy) == 3
+ && a1 > 0 && a2 > 0 && a3 > 0) {
+ arrowshape[0] = a1;
+ arrowshape[1] = a2;
+ arrowshape[2] = a3;
+ }
+ /* Else the argument was bad. */
+
+ argv += 2;
+ argc -= 2;
+ } else if (strcmp(*argv, "-capstyle") == 0) {
+ argv += 2;
+ argc -= 2;
+ } else if (strcmp(*argv, "-fill") == 0) {
+ if (GdiGetColor(argv[1], &linecolor)) {
+ dolinecolor = 1;
+ }
+ argv += 2;
+ argc -= 2;
+ } else if (strcmp(*argv, "-joinstyle") == 0) {
+ argv += 2;
+ argc -= 2;
+ } else if (strcmp(*argv, "-smooth") == 0) {
+ /* Argument is true/false or 1/0 or bezier. */
+ if (argv[1]) {
+ switch (argv[1][0]) {
+ case 't': case 'T':
+ case '1':
+ case 'b': case 'B': /* bezier. */
+ dosmooth = 1;
+ break;
+ default:
+ dosmooth = 0;
+ break;
+ }
+ argv += 2;
+ argc -= 2;
+ }
+ } else if (strcmp(*argv, "-splinesteps") == 0) {
+ nStep = atoi(argv[1]);
+ argv += 2;
+ argc -= 2;
+ } else if (strcmp(*argv, "-dash") == 0) {
+ if (argv[1]) {
+ dodash = 1;
+ dashdata = argv[1];
+ }
+ argv += 2;
+ argc -= 2;
+ } else if (strcmp(*argv, "-dashoffset") == 0) {
+ argv += 2;
+ argc -= 2;
+ } else if (strcmp(*argv, "-stipple") == 0) {
+ argv += 2;
+ argc -= 2;
+ } else if (strcmp(*argv, "-width") == 0) {
+ width = atoi(argv[1]);
+ argv += 2;
+ argc -= 2;
+ } else { /* It's an unknown argument!. */
+ argc--;
+ argv++;
+ }
+ /* Check for arguments
+ * Most of the arguments affect the "Pen"
+ */
+ }
+ }
+
+ if (width || dolinecolor || dodash) {
+ GdiMakePen(interp, width, dodash, dashdata,
+ 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+ if (doarrow != 0) {
+ GdiMakeBrush(interp, 0, linecolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush);
+ }
+
+ if (dosmooth) { /* Use PolyBezier. */
+ int nbpoints;
+ POINT *bpoints = 0;
+
+ nbpoints = Bezierize(polypoints,npoly,nStep,bpoints);
+ if (nbpoints > 0) {
+ Polyline(hDC, bpoints, nbpoints);
+ } else {
+ Polyline(hDC, polypoints, npoly); /* Out of memory? Just draw a regular line. */
+ }
+ if (bpoints != 0) {
+ Tcl_Free((void *)bpoints);
+ }
+ } else {
+ Polyline(hDC, polypoints, npoly);
+ }
+
+ if (dodash && doarrow) { /* Don't use dashed or thick pen for the arrows! */
+ GdiFreePen(interp, hDC, hPen);
+ GdiMakePen(interp, width, 0, 0, 0, 0, 0, 0,
+ linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+
+ /* Now the arrowheads, if any. */
+ if (doarrow & 1) {
+ /* Arrowhead at end = polypoints[npoly-1].x, polypoints[npoly-1].y. */
+ POINT ahead[6];
+ double dx, dy, length;
+ double sinTheta, cosTheta;
+ double vertX, vertY, temp;
+ double fracHeight;
+
+ fracHeight = 2.0 / arrowshape[2];
+
+ ahead[0].x = ahead[5].x = polypoints[npoly-1].x;
+ ahead[0].y = ahead[5].y = polypoints[npoly-1].y;
+ dx = ahead[0].x - polypoints[npoly-2].x;
+ dy = ahead[0].y - polypoints[npoly-2].y;
+ if ((length = hypot(dx, dy)) == 0) {
+ sinTheta = cosTheta = 0.0;
+ } else {
+ sinTheta = dy / length;
+ cosTheta = dx / length;
+ }
+ vertX = ahead[0].x - arrowshape[0]*cosTheta;
+ vertY = ahead[0].y - arrowshape[0]*sinTheta;
+ temp = arrowshape[2]*sinTheta;
+ ahead[1].x = (long)(ahead[0].x - arrowshape[1]*cosTheta + temp);
+ ahead[4].x = (long)(ahead[1].x - 2 * temp);
+ temp = arrowshape[2]*cosTheta;
+ ahead[1].y = (long)(ahead[0].y - arrowshape[1]*sinTheta - temp);
+ ahead[4].y = (long)(ahead[1].y + 2 * temp);
+ ahead[2].x = (long)(ahead[1].x*fracHeight + vertX*(1.0-fracHeight));
+ ahead[2].y = (long)(ahead[1].y*fracHeight + vertY*(1.0-fracHeight));
+ ahead[3].x = (long)(ahead[4].x*fracHeight + vertX*(1.0-fracHeight));
+ ahead[3].y = (long)(ahead[4].y*fracHeight + vertY*(1.0-fracHeight));
+
+ Polygon(hDC, ahead, 6);
+ }
+
+ if (doarrow & 2) {
+ /* Arrowhead at end = polypoints[0].x, polypoints[0].y. */
+ POINT ahead[6];
+ double dx, dy, length;
+ double sinTheta, cosTheta;
+ double vertX, vertY, temp;
+ double fracHeight;
+
+ fracHeight = 2.0 / arrowshape[2];
+
+ ahead[0].x = ahead[5].x = polypoints[0].x;
+ ahead[0].y = ahead[5].y = polypoints[0].y;
+ dx = ahead[0].x - polypoints[1].x;
+ dy = ahead[0].y - polypoints[1].y;
+ if ((length = hypot(dx, dy)) == 0) {
+ sinTheta = cosTheta = 0.0;
+ } else {
+ sinTheta = dy / length;
+ cosTheta = dx / length;
+ }
+ vertX = ahead[0].x - arrowshape[0]*cosTheta;
+ vertY = ahead[0].y - arrowshape[0]*sinTheta;
+ temp = arrowshape[2]*sinTheta;
+ ahead[1].x = (long)(ahead[0].x - arrowshape[1]*cosTheta + temp);
+ ahead[4].x = (long)(ahead[1].x - 2 * temp);
+ temp = arrowshape[2]*cosTheta;
+ ahead[1].y = (long)(ahead[0].y - arrowshape[1]*sinTheta - temp);
+ ahead[4].y = (long)(ahead[1].y + 2 * temp);
+ ahead[2].x = (long)(ahead[1].x*fracHeight + vertX*(1.0-fracHeight));
+ ahead[2].y = (long)(ahead[1].y*fracHeight + vertY*(1.0-fracHeight));
+ ahead[3].x = (long)(ahead[4].x*fracHeight + vertX*(1.0-fracHeight));
+ ahead[3].y = (long)(ahead[4].y*fracHeight + vertY*(1.0-fracHeight));
+
+ Polygon(hDC, ahead, 6);
+ }
+
+ if (width || dolinecolor || dodash) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (doarrow) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ }
+
+ Tcl_Free((void *)polypoints);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiOval --
+ *
+ * Maps ovals to GDI context.
+ *
+ * Results:
+ * Renders ovals.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiOval(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi oval hdc x1 y1 x2 y2 -fill color -outline color "
+ "-stipple bitmap -width linewid";
+ int x1, y1, x2, y2;
+ HDC hDC;
+ HPEN hPen;
+ int width = 0;
+ COLORREF linecolor = 0, fillcolor = 0;
+ int dolinecolor = 0, dofillcolor = 0;
+ HBRUSH hBrush;
+ LOGBRUSH lbrush;
+ HGDIOBJ oldobj;
+
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ x1 = atol(argv[2]);
+ y1 = atol(argv[3]);
+ x2 = atol(argv[4]);
+ y2 = atol(argv[5]);
+ if (x1 > x2) {
+ int x3 = x1;
+ x1 = x2;
+ x2 = x3;
+ }
+ if (y1 > y2) {
+ int y3 = y1;
+ y1 = y2;
+ y2 = y3;
+ }
+ argc -= 6;
+ argv += 6;
+
+ while (argc > 0) {
+ /* Now handle any other arguments that occur. */
+ if (strcmp(argv[0], "-fill") == 0) {
+ if (argv[1] && GdiGetColor(argv[1], &fillcolor)) {
+ dofillcolor = 1;
+ }
+ } else if (strcmp(argv[0], "-outline") == 0) {
+ if (argv[1] && GdiGetColor(argv[1], &linecolor)) {
+ dolinecolor = 1;
+ }
+ } else if (strcmp(argv[0], "-stipple") == 0) {
+ /* Not actually implemented */
+ } else if (strcmp(argv[0], "-width") == 0) {
+ if (argv[1]) {
+ width = atoi(argv[1]);
+ }
+ } else if (strcmp(argv[0], "-dash") == 0) {
+ if (argv[1]) {
+ dodash = 1;
+ dashdata = argv[1];
+ }
+ }
+ argv += 2;
+ argc -= 2;
+ }
+
+ if (dofillcolor) {
+ GdiMakeBrush(interp, 0, fillcolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush);
+ } else {
+ oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH));
+ }
+
+ if (width || dolinecolor) {
+ GdiMakePen(interp, width, dodash, dashdata,
+ 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+ /*
+ * Per Win32, Rectangle includes lower and right edges--per Tcl8.3.2 and
+ * earlier documentation, canvas rectangle does not. Thus, add 1 to right
+ * and lower bounds to get appropriate behavior.
+ */
+ Ellipse(hDC, x1, y1, x2+1, y2+1);
+
+ if (width || dolinecolor) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (dofillcolor) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ } else {
+ SelectObject(hDC, oldobj);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiPolygon --
+ *
+ * Maps polygons to GDI context.
+ *
+ * Results:
+ * Renders polygons.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiPolygon(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi polygon hdc x1 y1 ... xn yn "
+ "-fill color -outline color -smooth [true|false|bezier] "
+ "-splinesteps number -stipple bitmap -width linewid";
+
+ char *strend;
+ POINT *polypoints;
+ int npoly;
+ int dosmooth = 0;
+ int nStep = 12;
+ int x, y;
+ HDC hDC;
+ HPEN hPen;
+ int width = 0;
+ COLORREF linecolor = 0, fillcolor = BS_NULL;
+ int dolinecolor = 0, dofillcolor = 0;
+ LOGBRUSH lbrush;
+ HBRUSH hBrush;
+ HGDIOBJ oldobj;
+
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ polypoints = (POINT *) Tcl_AttemptAlloc((argc - 1) * sizeof(POINT));
+ if (polypoints == 0) {
+ /* TODO: unreachable */
+ Tcl_AppendResult(interp, "Out of memory in GdiLine", NULL);
+ return TCL_ERROR;
+ }
+ polypoints[0].x = atol(argv[2]);
+ polypoints[0].y = atol(argv[3]);
+ polypoints[1].x = atol(argv[4]);
+ polypoints[1].y = atol(argv[5]);
+ argc -= 6;
+ argv += 6;
+ npoly = 2;
+
+ while (argc >= 2) {
+ /* Check for a number */
+ x = strtoul(argv[0], &strend, 0);
+ if (strend > argv[0]) {
+ /* One number.... */
+ y = strtoul(argv[1], &strend, 0);
+ if (strend > argv[1]) {
+ /* TWO numbers!. */
+ polypoints[npoly].x = x;
+ polypoints[npoly].y = y;
+ npoly++;
+ argc -= 2;
+ argv += 2;
+ } else {
+ /* Only one number... Assume a usage error. */
+ Tcl_Free((void *) polypoints);
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+ } else {
+ /*
+ * Check for arguments.
+ * Most of the arguments affect the "Pen" and "Brush".
+ */
+ if (strcmp(argv[0], "-fill") == 0) {
+ if (argv[1] && GdiGetColor(argv[1], &fillcolor)) {
+ dofillcolor = 1;
+ }
+ } else if (strcmp(argv[0], "-outline") == 0) {
+ if (GdiGetColor(argv[1], &linecolor)) {
+ dolinecolor = 0;
+ }
+ } else if (strcmp(argv[0], "-smooth") == 0) {
+ if (argv[1]) {
+ switch (argv[1][0]) {
+ case 't': case 'T':
+ case '1':
+ case 'b': case 'B': /* bezier. */
+ dosmooth = 1;
+ break;
+ default:
+ dosmooth = 0;
+ break;
+ }
+ }
+ } else if (strcmp(argv[0], "-splinesteps") == 0) {
+ if (argv[1]) {
+ nStep = atoi(argv[1]);
+ }
+ } else if (strcmp(argv[0], "-stipple") == 0) {
+ /* Not supported */
+ } else if (strcmp(argv[0], "-width") == 0) {
+ if (argv[1]) {
+ width = atoi(argv[1]);
+ }
+ } else if (strcmp(argv[0], "-dash") == 0) {
+ if (argv[1]) {
+ dodash = 1;
+ dashdata = argv[1];
+ }
+ }
+ argc -= 2;
+ argv += 2;
+ }
+ }
+
+ if (dofillcolor) {
+ GdiMakeBrush(interp, 0, fillcolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush);
+ } else {
+ oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH));
+ }
+
+ if (width || dolinecolor) {
+ GdiMakePen(interp, width, dodash, dashdata, 0, 0, 0, 0,
+ linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+
+ if (dosmooth) {
+ int nbpoints;
+ POINT *bpoints = 0;
+ nbpoints = Bezierize(polypoints,npoly,nStep,bpoints);
+ if (nbpoints > 0) {
+ Polygon(hDC, bpoints, nbpoints);
+ } else {
+ Polygon(hDC, polypoints, npoly);
+ }
+ if (bpoints != 0) {
+ Tcl_Free((void *)bpoints);
+ }
+ } else {
+ Polygon(hDC, polypoints, npoly);
+ }
+
+ if (width || dolinecolor) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (dofillcolor) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ } else {
+ SelectObject(hDC, oldobj);
+ }
+
+ Tcl_Free((void *)polypoints);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiRectangle --
+ *
+ * Maps rectangles to GDI context.
+ *
+ * Results:
+ * Renders rectangles.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiRectangle(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi rectangle hdc x1 y1 x2 y2 "
+ "-fill color -outline color "
+ "-stipple bitmap -width linewid";
+
+ int x1, y1, x2, y2;
+ HDC hDC;
+ HPEN hPen;
+ int width = 0;
+ COLORREF linecolor = 0, fillcolor = BS_NULL;
+ int dolinecolor = 0, dofillcolor = 0;
+ LOGBRUSH lbrush;
+ HBRUSH hBrush;
+ HGDIOBJ oldobj;
+
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ x1 = atol(argv[2]);
+ y1 = atol(argv[3]);
+ x2 = atol(argv[4]);
+ y2 = atol(argv[5]);
+ if (x1 > x2) {
+ int x3 = x1;
+ x1 = x2;
+ x2 = x3;
+ }
+ if (y1 > y2) {
+ int y3 = y1;
+ y1 = y2;
+ y2 = y3;
+ }
+ argc -= 6;
+ argv += 6;
+
+ /* Now handle any other arguments that occur. */
+ while (argc > 1) {
+ if (strcmp(argv[0], "-fill") == 0) {
+ if (argv[1] && GdiGetColor(argv[1], &fillcolor)) {
+ dofillcolor = 1;
+ }
+ } else if (strcmp(argv[0], "-outline") == 0) {
+ if (argv[1] && GdiGetColor(argv[1], &linecolor)) {
+ dolinecolor = 1;
+ }
+ } else if (strcmp(argv[0], "-stipple") == 0) {
+ /* Not supported; ignored */
+ } else if (strcmp(argv[0], "-width") == 0) {
+ if (argv[1]) {
+ width = atoi(argv[1]);
+ }
+ } else if (strcmp(argv[0], "-dash") == 0) {
+ if (argv[1]) {
+ dodash = 1;
+ dashdata = argv[1];
+ }
+ }
+
+ argc -= 2;
+ argv += 2;
+ }
+
+ /*
+ * Note: If any fill is specified, the function must create a brush and
+ * put the coordinates in a RECTANGLE structure, and call FillRect.
+ * FillRect requires a BRUSH / color.
+ * If not, the function Rectangle must be called.
+ */
+ if (dofillcolor) {
+ GdiMakeBrush(interp, 0, fillcolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush);
+ } else {
+ oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH));
+ }
+
+ if (width || dolinecolor) {
+ GdiMakePen(interp, width, dodash, dashdata,
+ 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+ /*
+ * Per Win32, Rectangle includes lower and right edges--per Tcl8.3.2 and
+ * earlier documentation, canvas rectangle does not. Thus, add 1 to
+ * right and lower bounds to get appropriate behavior.
+ */
+ Rectangle(hDC, x1, y1, x2+1, y2+1);
+
+ if (width || dolinecolor) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (dofillcolor) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ } else {
+ SelectObject(hDC, oldobj);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiCharWidths --
+ *
+ * Computes /character widths. This is completely inadequate for
+ * typesetting, but should work for simple text manipulation.
+ *
+ * Results:
+ * Returns character width.
+ *
+ *----------------------------------------------------------------------
+ */
+
+
+static int GdiCharWidths(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi characters hdc [-font fontname] [-array ary]";
+ /*
+ * Returns widths of characters from font in an associative array.
+ * Font is currently selected font for HDC if not specified.
+ * Array name is GdiCharWidths if not specified.
+ * Widths should be in the same measures as all other values (1/1000 inch).
+ */
+
+ HDC hDC;
+ LOGFONTW lf;
+ HFONT hfont, oldfont;
+ int made_font = 0;
+ const char *aryvarname = "GdiCharWidths";
+ /* For now, assume 256 characters in the font.... */
+ int widths[256];
+ int retval;
+
+ if (argc < 2) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ argc -= 2;
+ argv += 2;
+
+ while (argc > 0) {
+ if (strcmp(argv[0], "-font") == 0) {
+ argc--;
+ argv++;
+ if (GdiMakeLogFont(interp, argv[0], &lf, hDC)) {
+ if ((hfont = CreateFontIndirectW(&lf)) != NULL) {
+ made_font = 1;
+ oldfont = SelectObject(hDC, hfont);
+ }
+ }
+ /* Else leave the font alone!. */
+ } else if (strcmp(argv[0], "-array") == 0) {
+ argv++;
+ argc--;
+ if (argc > 0) {
+ aryvarname = argv[0];
+ }
+ }
+ argv++;
+ argc--;
+ }
+
+ /* Now, get the widths using the correct function for font type. */
+ if ((retval = GetCharWidth32W(hDC, 0, 255, widths)) == FALSE) {
+ retval = GetCharWidthW(hDC, 0, 255, widths);
+ }
+
+ /*
+ * Retval should be 1 (TRUE) if the function succeeded. If the function
+ * fails, get the "extended" error code and return. Be sure to deallocate
+ * the font if necessary.
+ */
+ if (retval == FALSE) {
+ DWORD val = GetLastError();
+
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "::tk::print::_gdi character failed with code %ld", val));
+ if (made_font) {
+ SelectObject(hDC, oldfont);
+ DeleteObject(hfont);
+ }
+ return TCL_ERROR;
+ }
+
+ {
+ int i;
+ char ind[2];
+ ind[1] = '\0';
+
+ for (i = 0; i < 255; i++) {
+ /* TODO: use a bytearray for the index name so NUL works */
+ ind[0] = i;
+ Tcl_SetVar2Ex(interp, aryvarname, ind, Tcl_NewIntObj(widths[i]),
+ TCL_GLOBAL_ONLY);
+ }
+ }
+ /* Now, remove the font if we created it only for this function. */
+ if (made_font) {
+ SelectObject(hDC, oldfont);
+ DeleteObject(hfont);
+ }
+
+ /* The return value should be the array name(?). */
+ Tcl_AppendResult(interp, (char *)aryvarname, NULL);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiText --
+ *
+ * Maps text to GDI context.
+ *
+ * Results:
+ * Renders text.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int GdiText(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi text hdc x y -anchor [center|n|e|s|w] "
+ "-fill color -font fontname "
+ "-justify [left|right|center] "
+ "-stipple bitmap -text string -width linelen "
+ "-single -backfill";
+
+ HDC hDC;
+ int x, y;
+ const char *string = 0;
+ RECT sizerect;
+ UINT format_flags = DT_EXPANDTABS|DT_NOPREFIX; /* Like the canvas. */
+ Tk_Anchor anchor = 0;
+ LOGFONTW lf;
+ HFONT hfont, oldfont;
+ int made_font = 0;
+ int retval;
+ int dotextcolor = 0;
+ int dobgmode = 0;
+ int bgmode;
+ COLORREF textcolor = 0;
+ int usesingle = 0;
+ WCHAR *wstring;
+ Tcl_DString tds;
+
+ if (argc < 4) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ /* Parse the command. */
+
+ hDC = printDC;
+
+ x = atol(argv[2]);
+ y = atol(argv[3]);
+ argc -= 4;
+ argv += 4;
+
+ sizerect.left = sizerect.right = x;
+ sizerect.top = sizerect.bottom = y;
+
+ while (argc > 0) {
+ if (strcmp(argv[0], "-anchor") == 0) {
+ argc--;
+ argv++;
+ if (argc > 0) {
+ Tk_GetAnchor(interp, argv[0], &anchor);
+ }
+ } else if (strcmp(argv[0], "-justify") == 0) {
+ argc--;
+ argv++;
+ if (argc > 0) {
+ if (strcmp(argv[0], "left") == 0) {
+ format_flags |= DT_LEFT;
+ } else if (strcmp(argv[0], "center") == 0) {
+ format_flags |= DT_CENTER;
+ } else if (strcmp(argv[0], "right") == 0) {
+ format_flags |= DT_RIGHT;
+ }
+ }
+ } else if (strcmp(argv[0], "-text") == 0) {
+ argc--;
+ argv++;
+ if (argc > 0) {
+ string = argv[0];
+ }
+ } else if (strcmp(argv[0], "-font") == 0) {
+ argc--;
+ argv++;
+ if (GdiMakeLogFont(interp, argv[0], &lf, hDC)) {
+ if ((hfont = CreateFontIndirectW(&lf)) != NULL) {
+ made_font = 1;
+ oldfont = SelectObject(hDC, hfont);
+ }
+ }
+ /* Else leave the font alone! */
+ } else if (strcmp(argv[0], "-stipple") == 0) {
+ argc--;
+ argv++;
+ /* Not implemented yet. */
+ } else if (strcmp(argv[0], "-fill") == 0) {
+ argc--;
+ argv++;
+ /* Get text color. */
+ if (GdiGetColor(argv[0], &textcolor)) {
+ dotextcolor = 1;
+ }
+ } else if (strcmp(argv[0], "-width") == 0) {
+ argc--;
+ argv++;
+ if (argc > 0) {
+ sizerect.right += atol(argv[0]);
+ }
+ /* If a width is specified, break at words. */
+ format_flags |= DT_WORDBREAK;
+ } else if (strcmp(argv[0], "-single") == 0) {
+ usesingle = 1;
+ } else if (strcmp(argv[0], "-backfill") == 0) {
+ dobgmode = 1;
+ }
+
+ argc--;
+ argv++;
+ }
+
+ if (string == 0) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ /* Set the format flags for -single: Overrides -width. */
+ if (usesingle == 1) {
+ format_flags |= DT_SINGLELINE;
+ format_flags |= DT_NOCLIP;
+ format_flags &= ~DT_WORDBREAK;
+ }
+
+ Tcl_DStringInit(&tds);
+ /* Just for fun, let's try translating string to Unicode. */
+ wstring = Tcl_UtfToWCharDString(string, -1, &tds);
+ DrawTextW(hDC, wstring, Tcl_DStringLength(&tds)/2, &sizerect,
+ format_flags | DT_CALCRECT);
+
+ /* Adjust the rectangle according to the anchor. */
+ x = y = 0;
+ switch (anchor) {
+ case TK_ANCHOR_N:
+ x = (sizerect.right - sizerect.left) / 2;
+ break;
+ case TK_ANCHOR_S:
+ x = (sizerect.right - sizerect.left) / 2;
+ y = (sizerect.bottom - sizerect.top);
+ break;
+ case TK_ANCHOR_E:
+ x = (sizerect.right - sizerect.left);
+ y = (sizerect.bottom - sizerect.top) / 2;
+ break;
+ case TK_ANCHOR_W:
+ y = (sizerect.bottom - sizerect.top) / 2;
+ break;
+ case TK_ANCHOR_NE:
+ x = (sizerect.right - sizerect.left);
+ break;
+ case TK_ANCHOR_NW:
+ break;
+ case TK_ANCHOR_SE:
+ x = (sizerect.right - sizerect.left);
+ y = (sizerect.bottom - sizerect.top);
+ break;
+ case TK_ANCHOR_SW:
+ y = (sizerect.bottom - sizerect.top);
+ break;
+ case TK_ANCHOR_CENTER:
+ x = (sizerect.right - sizerect.left) / 2;
+ y = (sizerect.bottom - sizerect.top) / 2;
+ break;
+ }
+ sizerect.right -= x;
+ sizerect.left -= x;
+ sizerect.top -= y;
+ sizerect.bottom -= y;
+
+ /* Get the color right. */
+ if (dotextcolor) {
+ textcolor = SetTextColor(hDC, textcolor);
+ }
+
+ if (dobgmode) {
+ bgmode = SetBkMode(hDC, OPAQUE);
+ } else {
+ bgmode = SetBkMode(hDC, TRANSPARENT);
+ }
+
+ /* Print the text. */
+ retval = DrawTextW(hDC, wstring,
+ Tcl_DStringLength(&tds)/2, &sizerect, format_flags);
+ Tcl_DStringFree(&tds);
+
+ /* Get the color set back. */
+ if (dotextcolor) {
+ textcolor = SetTextColor(hDC, textcolor);
+ }
+ SetBkMode(hDC, bgmode);
+ if (made_font) {
+ SelectObject(hDC, oldfont);
+ DeleteObject(hfont);
+ }
+
+ /* In this case, the return value is the height of the text. */
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(retval));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiGetHdcInfo --
+ *
+ * Gets salient characteristics of the CTM.
+ *
+ * Results:
+ * The return value is 0 if any failure occurs--in which case none of the
+ * other values are meaningful. Otherwise the return value is the
+ * current mapping mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiGetHdcInfo(
+ HDC hdc,
+ LPPOINT worigin,
+ LPSIZE wextent,
+ LPPOINT vorigin,
+ LPSIZE vextent)
+{
+ int mapmode;
+ int retval;
+
+ memset(worigin, 0, sizeof(POINT));
+ memset(vorigin, 0, sizeof(POINT));
+ memset(wextent, 0, sizeof(SIZE));
+ memset(vextent, 0, sizeof(SIZE));
+
+ if ((mapmode = GetMapMode(hdc)) == 0) {
+ /* Failed! */
+ retval = 0;
+ } else {
+ retval = mapmode;
+ }
+
+ if (GetWindowExtEx(hdc, wextent) == FALSE) {
+ /* Failed! */
+ retval = 0;
+ }
+ if (GetViewportExtEx(hdc, vextent) == FALSE) {
+ /* Failed! */
+ retval = 0;
+ }
+ if (GetWindowOrgEx(hdc, worigin) == FALSE) {
+ /* Failed! */
+ retval = 0;
+ }
+ if (GetViewportOrgEx(hdc, vorigin) == FALSE) {
+ /* Failed! */
+ retval = 0;
+ }
+
+ return retval;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiNameToMode --
+ *
+ * Converts Windows mapping mode names.
+ *
+ * Results:
+ * Mapping modes are delineated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiNameToMode(
+ const char *name)
+{
+ static const struct gdimodes {
+ int mode;
+ const char *name;
+ } modes[] = {
+ { MM_ANISOTROPIC, "MM_ANISOTROPIC" },
+ { MM_HIENGLISH, "MM_HIENGLISH" },
+ { MM_HIMETRIC, "MM_HIMETRIC" },
+ { MM_ISOTROPIC, "MM_ISOTROPIC" },
+ { MM_LOENGLISH, "MM_LOENGLISH" },
+ { MM_LOMETRIC, "MM_LOMETRIC" },
+ { MM_TEXT, "MM_TEXT" },
+ { MM_TWIPS, "MM_TWIPS" }
+ };
+
+ size_t i;
+ for (i=0; i < sizeof(modes) / sizeof(struct gdimodes); i++) {
+ if (strcmp(modes[i].name, name) == 0) {
+ return modes[i].mode;
+ }
+ }
+ return atoi(name);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiModeToName --
+ *
+ * Converts the mode number to a printable form.
+ *
+ * Results:
+ * Mapping numbers are delineated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static const char *GdiModeToName(
+ int mode)
+{
+ static const struct gdi_modes {
+ int mode;
+ const char *name;
+ } modes[] = {
+ { MM_ANISOTROPIC, "Anisotropic" },
+ { MM_HIENGLISH, "1/1000 inch" },
+ { MM_HIMETRIC, "1/100 mm" },
+ { MM_ISOTROPIC, "Isotropic" },
+ { MM_LOENGLISH, "1/100 inch" },
+ { MM_LOMETRIC, "1/10 mm" },
+ { MM_TEXT, "1 to 1" },
+ { MM_TWIPS, "1/1440 inch" }
+ };
+
+ size_t i;
+ for (i=0; i < sizeof(modes) / sizeof(struct gdi_modes); i++) {
+ if (modes[i].mode == mode) {
+ return modes[i].name;
+ }
+ }
+ return "Unknown";
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiMap --
+ *
+ * Sets mapping mode between logical and physical device space.
+ *
+ * Results:
+ * Bridges map modes.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiMap(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi map hdc "
+ "[-logical x[y]] [-physical x[y]] "
+ "[-offset {x y} ] [-default] [-mode mode]";
+ HDC hdc;
+ int mapmode; /* Mapping mode. */
+ SIZE wextent; /* Device extent. */
+ SIZE vextent; /* Viewport extent. */
+ POINT worigin; /* Device origin. */
+ POINT vorigin; /* Viewport origin. */
+ int argno;
+
+ /* Keep track of what parts of the function need to be executed. */
+ int need_usage = 0;
+ int use_logical = 0;
+ int use_physical = 0;
+ int use_offset = 0;
+ int use_default = 0;
+ int use_mode = 0;
+
+ /* Required parameter: HDC for printer. */
+ if (argc < 2) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ hdc = printDC;
+
+ if ((mapmode = GdiGetHdcInfo(hdc, &worigin, &wextent, &vorigin, &vextent)) == 0) {
+ /* Failed!. */
+ Tcl_AppendResult(interp, "Cannot get current HDC info", NULL);
+ return TCL_ERROR;
+ }
+
+ /* Parse remaining arguments. */
+ for (argno = 2; argno < argc; argno++) {
+ if (strcmp(argv[argno], "-default") == 0) {
+ vextent.cx = vextent.cy = wextent.cx = wextent.cy = 1;
+ vorigin.x = vorigin.y = worigin.x = worigin.y = 0;
+ mapmode = MM_TEXT;
+ use_default = 1;
+ } else if (strcmp(argv[argno], "-mode") == 0) {
+ if (argno + 1 >= argc) {
+ need_usage = 1;
+ } else {
+ mapmode = GdiNameToMode(argv[argno + 1]);
+ use_mode = 1;
+ argno++;
+ }
+ } else if (strcmp(argv[argno], "-offset") == 0) {
+ if (argno + 1 >= argc) {
+ need_usage = 1;
+ } else {
+ /* It would be nice if this parsed units as well.... */
+ if (sscanf(argv[argno + 1], "%ld%ld",
+ &vorigin.x, &vorigin.y) == 2) {
+ use_offset = 1;
+ } else {
+ need_usage = 1;
+ }
+ argno++;
+ }
+ } else if (strcmp(argv[argno], "-logical") == 0) {
+ if (argno + 1 >= argc) {
+ need_usage = 1;
+ } else {
+ int count;
+
+ argno++;
+ /* In "real-life", this should parse units as well.. */
+ if ((count = sscanf(argv[argno], "%ld%ld",
+ &wextent.cx, &wextent.cy)) != 2) {
+ if (count == 1) {
+ mapmode = MM_ISOTROPIC;
+ use_logical = 1;
+ wextent.cy = wextent.cx; /* Make them the same. */
+ } else {
+ need_usage = 1;
+ }
+ } else {
+ mapmode = MM_ANISOTROPIC;
+ use_logical = 2;
+ }
+ }
+ } else if (strcmp(argv[argno], "-physical") == 0) {
+ if (argno + 1 >= argc) {
+ need_usage = 1;
+ } else {
+ int count;
+
+ argno++;
+ /* In "real-life", this should parse units as well.. */
+ if ((count = sscanf(argv[argno], "%ld%ld",
+ &vextent.cx, &vextent.cy)) != 2) {
+ if (count == 1) {
+ mapmode = MM_ISOTROPIC;
+ use_physical = 1;
+ vextent.cy = vextent.cx; /* Make them the same. */
+ } else {
+ need_usage = 1;
+ }
+ } else {
+ mapmode = MM_ANISOTROPIC;
+ use_physical = 2;
+ }
+ }
+ }
+ }
+
+ /* Check for any impossible combinations. */
+ if (use_logical != use_physical) {
+ need_usage = 1;
+ }
+ if (use_default && (use_logical || use_offset || use_mode)) {
+ need_usage = 1;
+ }
+ if (use_mode && use_logical &&
+ (mapmode != MM_ISOTROPIC && mapmode != MM_ANISOTROPIC)) {
+ need_usage = 1;
+ }
+
+ if (need_usage) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ /* Call Windows CTM functions. */
+ if (use_logical || use_default || use_mode) { /* Don't call for offset only. */
+ SetMapMode(hdc, mapmode);
+ }
+
+ if (use_offset || use_default) {
+ POINT oldorg;
+ SetViewportOrgEx(hdc, vorigin.x, vorigin.y, &oldorg);
+ SetWindowOrgEx(hdc, worigin.x, worigin.y, &oldorg);
+ }
+
+ if (use_logical) { /* Same as use_physical. */
+ SIZE oldsiz;
+ SetWindowExtEx(hdc, wextent.cx, wextent.cy, &oldsiz);
+ SetViewportExtEx(hdc, vextent.cx, vextent.cy, &oldsiz);
+ }
+
+ /*
+ * Since we may not have set up every parameter, get them again for the
+ * report.
+ */
+ mapmode = GdiGetHdcInfo(hdc, &worigin, &wextent, &vorigin, &vextent);
+
+ /*
+ * Output current CTM info.
+ * Note: This should really be in terms that can be used in a
+ * ::tk::print::_gdi map command!
+ */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Transform: \"(%ld, %ld) -> (%ld, %ld)\" "
+ "Origin: \"(%ld, %ld)\" "
+ "MappingMode: \"%s\"",
+ vextent.cx, vextent.cy, wextent.cx, wextent.cy,
+ vorigin.x, vorigin.y,
+ GdiModeToName(mapmode)));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiCopyBits --
+ *
+ * Copies window bits from source to destination.
+ *
+ * Results:
+ * Copies window bits.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiCopyBits(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ const char **argv)
+{
+ /* Goal: get the Tk_Window from the top-level
+ * convert it to an HWND
+ * get the HDC
+ * Do a bitblt to the given hdc
+ * Use an optional parameter to point to an arbitrary window instead of
+ * the main
+ * Use optional parameters to map to the width and height required for the
+ * dest.
+ */
+ static const char usage_message[] =
+ "::tk::print::_gdi copybits hdc [-window w|-screen] [-client] "
+ "[-source \"a b c d\"] "
+ "[-destination \"a b c d\"] [-scale number] [-calc]";
+
+ Tk_Window mainWin;
+ Tk_Window workwin;
+ Window wnd;
+ HDC src;
+ HDC dst;
+ HWND hwnd = 0;
+
+ HANDLE hDib; /* Handle for device-independent bitmap. */
+ LPBITMAPINFOHEADER lpDIBHdr;
+ LPSTR lpBits;
+ enum PrintType wintype = PTWindow;
+
+ int hgt, wid;
+ char *strend;
+ long errcode;
+ int k;
+
+ /* Variables to remember what we saw in the arguments. */
+ int do_window = 0;
+ int do_screen = 0;
+ int do_scale = 0;
+ int do_print = 1;
+
+ /* Variables to remember the values in the arguments. */
+ const char *window_spec;
+ double scale = 1.0;
+ int src_x = 0, src_y = 0, src_w = 0, src_h = 0;
+ int dst_x = 0, dst_y = 0, dst_w = 0, dst_h = 0;
+ int is_toplevel = 0;
+
+ /*
+ * The following steps are peculiar to the top level window.
+ * There is likely a clever way to do the mapping of a widget pathname to
+ * the proper window, to support the idea of using a parameter for this
+ * purpose.
+ */
+ if ((workwin = mainWin = Tk_MainWindow(interp)) == 0) {
+ Tcl_AppendResult(interp, "Can't find main Tk window", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Parse the arguments.
+ */
+ /* HDC is required. */
+ if (argc < 2) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ dst = printDC;
+
+ /*
+ * Next, check to see if 'dst' can support BitBlt. If not, raise an
+ * error.
+ */
+ if ((GetDeviceCaps(dst, RASTERCAPS) & RC_BITBLT) == 0) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Can't do bitmap operations on device context\n"));
+ return TCL_ERROR;
+ }
+
+ /* Loop through the remaining arguments. */
+ for (k=2; k<argc; k++) {
+ if (strcmp(argv[k], "-window") == 0) {
+ if (argv[k+1] && argv[k+1][0] == '.') {
+ do_window = 1;
+ workwin = Tk_NameToWindow(interp, window_spec = argv[++k], mainWin);
+ if (workwin == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Can't find window %s in this application",
+ window_spec));
+ return TCL_ERROR;
+ }
+ } else {
+ /* Use strtoul() so octal or hex representations will be
+ * parsed. */
+ hwnd = (HWND) INT2PTR(strtoul(argv[++k], &strend, 0));
+ if (strend == 0 || strend == argv[k]) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Can't understand window id %s", argv[k]));
+ return TCL_ERROR;
+ }
+ }
+ } else if (strcmp(argv[k], "-screen") == 0) {
+ do_screen = 1;
+ wintype = PTScreen;
+ } else if (strcmp(argv[k], "-client") == 0) {
+ wintype = PTClient;
+ } else if (strcmp(argv[k], "-source") == 0) {
+ float a, b, c, d;
+ int count = sscanf(argv[++k], "%f%f%f%f", &a, &b, &c, &d);
+
+ if (count < 2) { /* Can't make heads or tails of it.... */
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+ src_x = (int)a;
+ src_y = (int)b;
+ if (count == 4) {
+ src_w = (int)c;
+ src_h = (int)d;
+ }
+ } else if (strcmp(argv[k], "-destination") == 0) {
+ float a, b, c, d;
+ int count;
+
+ count = sscanf(argv[++k], "%f%f%f%f", &a, &b, &c, &d);
+ if (count < 2) { /* Can't make heads or tails of it.... */
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+ dst_x = (int)a;
+ dst_y = (int)b;
+ if (count == 3) {
+ dst_w = (int)c;
+ dst_h = -1;
+ } else if (count == 4) {
+ dst_w = (int)c;
+ dst_h = (int)d;
+ }
+ } else if (strcmp(argv[k], "-scale") == 0) {
+ if (argv[++k]) {
+ scale = strtod(argv[k], &strend);
+ if (strend == 0 || strend == argv[k]) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Can't understand scale specification %s",
+ argv[k]));
+ return TCL_ERROR;
+ }
+ if (scale <= 0.01 || scale >= 100.0) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Unreasonable scale specification %s", argv[k]));
+ return TCL_ERROR;
+ }
+ do_scale = 1;
+ }
+ } else if (strcmp(argv[k], "-noprint") == 0
+ || strncmp(argv[k], "-calc", 5) == 0) {
+ /* This option suggested by Pascal Bouvier to get sizes without
+ * printing. */
+ do_print = 0;
+ }
+ }
+
+ /*
+ * Check to ensure no incompatible arguments were used.
+ */
+ if (do_window && do_screen) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Get the MS Window we want to copy. Given the HDC, we can get the
+ * "Window".
+ */
+ if (hwnd == 0) {
+ if (Tk_IsTopLevel(workwin)) {
+ is_toplevel = 1;
+ }
+
+ if ((wnd = Tk_WindowId(workwin)) == 0) {
+ Tcl_AppendResult(interp, "Can't get id for Tk window", NULL);
+ return TCL_ERROR;
+ }
+
+ /* Given the "Window" we can get a Microsoft Windows HWND. */
+
+ if ((hwnd = Tk_GetHWND(wnd)) == 0) {
+ Tcl_AppendResult(interp, "Can't get Windows handle for Tk window",
+ NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * If it's a toplevel, give it special treatment: Get the top-level
+ * window instead. If the user only wanted the client, the -client
+ * flag will take care of it. This uses "windows" tricks rather than
+ * Tk since the obvious method of getting the wrapper window didn't
+ * seem to work.
+ */
+ if (is_toplevel) {
+ HWND tmpWnd = hwnd;
+ while ((tmpWnd = GetParent(tmpWnd)) != 0) {
+ hwnd = tmpWnd;
+ }
+ }
+ }
+
+ /* Given the HWND, we can get the window's device context. */
+ if ((src = GetWindowDC(hwnd)) == 0) {
+ Tcl_AppendResult(interp, "Can't get device context for Tk window", NULL);
+ return TCL_ERROR;
+ }
+
+ if (do_screen) {
+ LONG w, h;
+ GetDisplaySize(&w, &h);
+ wid = w;
+ hgt = h;
+ } else if (is_toplevel) {
+ RECT tl;
+ GetWindowRect(hwnd, &tl);
+ wid = tl.right - tl.left;
+ hgt = tl.bottom - tl.top;
+ } else {
+ if ((hgt = Tk_Height(workwin)) <= 0) {
+ Tcl_AppendResult(interp, "Can't get height of Tk window", NULL);
+ ReleaseDC(hwnd,src);
+ return TCL_ERROR;
+ }
+
+ if ((wid = Tk_Width(workwin)) <= 0) {
+ Tcl_AppendResult(interp, "Can't get width of Tk window", NULL);
+ ReleaseDC(hwnd,src);
+ return TCL_ERROR;
+ }
+ }
+
+ /*
+ * Ensure all the widths and heights are set up right
+ * A: No dimensions are negative
+ * B: No dimensions exceed the maximums
+ * C: The dimensions don't lead to a 0 width or height image.
+ */
+ if (src_x < 0) {
+ src_x = 0;
+ }
+ if (src_y < 0) {
+ src_y = 0;
+ }
+ if (dst_x < 0) {
+ dst_x = 0;
+ }
+ if (dst_y < 0) {
+ dst_y = 0;
+ }
+
+ if (src_w > wid || src_w <= 0) {
+ src_w = wid;
+ }
+
+ if (src_h > hgt || src_h <= 0) {
+ src_h = hgt;
+ }
+
+ if (do_scale && dst_w == 0) {
+ /* Calculate destination width and height based on scale. */
+ dst_w = (int)(scale * src_w);
+ dst_h = (int)(scale * src_h);
+ }
+
+ if (dst_h == -1) {
+ dst_h = (int) (((long)src_h * dst_w) / (src_w + 1)) + 1;
+ }
+
+ if (dst_h == 0 || dst_w == 0) {
+ dst_h = src_h;
+ dst_w = src_w;
+ }
+
+ if (do_print) {
+ /*
+ * Based on notes from Heiko Schock and Arndt Roger Schneider, create
+ * this as a DIBitmap, to allow output to a greater range of devices.
+ * This approach will also allow selection of
+ * a) Whole screen
+ * b) Whole window
+ * c) Client window only
+ * for the "grab"
+ */
+ hDib = CopyToDIB(hwnd, wintype);
+
+ /* GdiFlush();. */
+
+ if (!hDib) {
+ Tcl_AppendResult(interp, "Can't create DIB", NULL);
+ ReleaseDC(hwnd,src);
+ return TCL_ERROR;
+ }
+
+ lpDIBHdr = (LPBITMAPINFOHEADER) GlobalLock(hDib);
+ if (!lpDIBHdr) {
+ Tcl_AppendResult(interp, "Can't get DIB header", NULL);
+ ReleaseDC(hwnd,src);
+ return TCL_ERROR;
+ }
+
+ lpBits = (LPSTR) lpDIBHdr + lpDIBHdr->biSize + DIBNumColors(lpDIBHdr) * sizeof(RGBQUAD);
+
+ /* stretch the DIBbitmap directly in the target device. */
+
+ if (StretchDIBits(dst,
+ dst_x, dst_y, dst_w, dst_h,
+ src_x, src_y, src_w, src_h,
+ lpBits, (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS,
+ SRCCOPY) == (int)GDI_ERROR) {
+ errcode = GetLastError();
+ GlobalUnlock(hDib);
+ GlobalFree(hDib);
+ ReleaseDC(hwnd,src);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "StretchDIBits failed with code %ld", errcode));
+ return TCL_ERROR;
+ }
+
+ /* free allocated memory. */
+ GlobalUnlock(hDib);
+ GlobalFree(hDib);
+ }
+
+ ReleaseDC(hwnd,src);
+
+ /*
+ * The return value should relate to the size in the destination space.
+ * At least the height should be returned (for page layout purposes).
+ */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "%d %d %d %d", dst_x, dst_y, dst_w, dst_h));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DIBNumColors --
+ *
+ * Computes the number of colors required for a DIB palette.
+ *
+ * Results:
+ * Returns number of colors.
+
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int DIBNumColors(
+ LPBITMAPINFOHEADER lpDIB)
+{
+ WORD wBitCount; /* DIB bit count. */
+ DWORD dwClrUsed;
+
+ /*
+ * If this is a Windows-style DIB, the number of colors in the color table
+ * can be less than the number of bits per pixel allows for (i.e.
+ * lpbi->biClrUsed can be set to some value). If this is the case, return
+ * the appropriate value..
+ */
+
+ dwClrUsed = lpDIB->biClrUsed;
+ if (dwClrUsed) {
+ return (WORD) dwClrUsed;
+ }
+
+ /*
+ * Calculate the number of colors in the color table based on.
+ * The number of bits per pixel for the DIB.
+ */
+
+ wBitCount = lpDIB->biBitCount;
+
+ /* Return number of colors based on bits per pixel. */
+
+ switch (wBitCount) {
+ case 1:
+ return 2;
+ case 4:
+ return 16;
+ case 8:
+ return 256;
+ default:
+ return 0;
+ }
+}
+
+/*
+ * Helper functions
+ */
+
+/*
+ * ParseFontWords converts various keywords to modifyers of a
+ * font specification.
+ * For all words, later occurrences override earlier occurrences.
+ * Overstrike and underline cannot be "undone" by other words
+ */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiParseFontWords --
+ *
+ * Converts various keywords to modifiers of a font specification. For
+ * all words, later occurrences override earlier occurrences. Overstrike
+ * and underline cannot be "undone" by other words
+ *
+ * Results:
+ * Keywords converted to modifiers.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiParseFontWords(
+ TCL_UNUSED(Tcl_Interp *),
+ LOGFONTW *lf,
+ const char *str[],
+ int numargs)
+{
+ int i;
+ int retval = 0; /* Number of words that could not be parsed. */
+
+ for (i=0; i<numargs; i++) {
+ if (str[i]) {
+ int wt;
+ if ((wt = GdiWordToWeight(str[i])) != -1) {
+ lf->lfWeight = wt;
+ } else if (strcmp(str[i], "roman") == 0) {
+ lf->lfItalic = FALSE;
+ } else if (strcmp(str[i], "italic") == 0) {
+ lf->lfItalic = TRUE;
+ } else if (strcmp(str[i], "underline") == 0) {
+ lf->lfUnderline = TRUE;
+ } else if (strcmp(str[i], "overstrike") == 0) {
+ lf->lfStrikeOut = TRUE;
+ } else {
+ retval++;
+ }
+ }
+ }
+ return retval;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiWordToWeight --
+ *
+ * Converts keywords to font weights.
+ *
+ * Results:
+ * Helps set the proper font for GDI rendering.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiWordToWeight(
+ const char *str)
+{
+ int retval = -1;
+ size_t i;
+ static const struct font_weight {
+ const char *name;
+ int weight;
+ } font_weights[] = {
+ { "thin", FW_THIN },
+ { "extralight", FW_EXTRALIGHT },
+ { "ultralight", FW_EXTRALIGHT },
+ { "light", FW_LIGHT },
+ { "normal", FW_NORMAL },
+ { "regular", FW_NORMAL },
+ { "medium", FW_MEDIUM },
+ { "semibold", FW_SEMIBOLD },
+ { "demibold", FW_SEMIBOLD },
+ { "bold", FW_BOLD },
+ { "extrabold", FW_EXTRABOLD },
+ { "ultrabold", FW_EXTRABOLD },
+ { "heavy", FW_HEAVY },
+ { "black", FW_HEAVY },
+ };
+
+ if (str == 0) {
+ return -1;
+ }
+
+ for (i=0; i<sizeof(font_weights) / sizeof(struct font_weight); i++) {
+ if (strcmp(str, font_weights[i].name) == 0) {
+ retval = font_weights[i].weight;
+ break;
+ }
+ }
+
+ return retval;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MakeLogFont --
+ *
+ * Takes the font description string and converts this into a logical
+ * font spec.
+ *
+ * Results:
+ * Sets font weight.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiMakeLogFont(
+ Tcl_Interp *interp,
+ const char *str,
+ LOGFONTW *lf,
+ HDC hDC)
+{
+ const char **list;
+ int count;
+
+ /* Set up defaults for logical font. */
+ memset(lf, 0, sizeof(*lf));
+ lf->lfWeight = FW_NORMAL;
+ lf->lfCharSet = DEFAULT_CHARSET;
+ lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
+ lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ lf->lfQuality = DEFAULT_QUALITY;
+ lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
+
+ /* The cast to (char *) is silly, based on prototype of Tcl_SplitList. */
+ if (Tcl_SplitList(interp, str, &count, &list) != TCL_OK) {
+ return 0;
+ }
+
+ /* Now we have the font structure broken into name, size, weight. */
+ if (count >= 1) {
+ Tcl_DString ds;
+
+ Tcl_DStringInit(&ds);
+ wcsncpy(lf->lfFaceName, Tcl_UtfToWCharDString(list[0], -1, &ds),
+ LF_FACESIZE-1);
+ Tcl_DStringFree(&ds);
+ lf->lfFaceName[LF_FACESIZE-1] = 0;
+ } else {
+ return 0;
+ }
+
+ if (count >= 2) {
+ int siz;
+ char *strend;
+ siz = strtol(list[1], &strend, 0);
+
+ /*
+ * Assumptions:
+ * 1) Like canvas, if a positive number is specified, it's in points.
+ * 2) Like canvas, if a negative number is specified, it's in pixels.
+ */
+ if (strend > list[1]) { /* If it looks like a number, it is a number.... */
+ if (siz > 0) { /* Size is in points. */
+ SIZE wextent, vextent;
+ POINT worigin, vorigin;
+ double factor;
+
+ switch (GdiGetHdcInfo(hDC, &worigin, &wextent, &vorigin, &vextent)) {
+ case MM_ISOTROPIC:
+ if (vextent.cy < -1 || vextent.cy > 1) {
+ factor = (double)wextent.cy / vextent.cy;
+ if (factor < 0.0) {
+ factor = -factor;
+ }
+ lf->lfHeight = (int)(-siz * GetDeviceCaps(hDC, LOGPIXELSY) * factor / 72.0);
+ } else if (vextent.cx < -1 || vextent.cx > 1) {
+ factor = (double)wextent.cx / vextent.cx;
+ if (factor < 0.0) {
+ factor = -factor;
+ }
+ lf->lfHeight = (int)(-siz * GetDeviceCaps(hDC, LOGPIXELSY) * factor / 72.0);
+ } else {
+ lf->lfHeight = -siz; /* This is bad news.... */
+ }
+ break;
+ case MM_ANISOTROPIC:
+ if (vextent.cy != 0) {
+ factor = (double)wextent.cy / vextent.cy;
+ if (factor < 0.0) {
+ factor = -factor;
+ }
+ lf->lfHeight = (int)(-siz * GetDeviceCaps(hDC, LOGPIXELSY) * factor / 72.0);
+ } else {
+ lf->lfHeight = -siz; /* This is bad news.... */
+ }
+ break;
+ case MM_TEXT:
+ default:
+ /* If mapping mode is MM_TEXT, use the documented
+ * formula. */
+ lf->lfHeight = -MulDiv(siz, GetDeviceCaps(hDC, LOGPIXELSY), 72);
+ break;
+ case MM_HIENGLISH:
+ lf->lfHeight = -MulDiv(siz, 1000, 72);
+ break;
+ case MM_LOENGLISH:
+ lf->lfHeight = -MulDiv(siz, 100, 72);
+ break;
+ case MM_HIMETRIC:
+ lf->lfHeight = -MulDiv(siz, (int)(1000*2.54), 72);
+ break;
+ case MM_LOMETRIC:
+ lf->lfHeight = -MulDiv(siz, (int)(100*2.54), 72);
+ break;
+ case MM_TWIPS:
+ lf->lfHeight = -MulDiv(siz, 1440, 72);
+ break;
+ }
+ } else if (siz == 0) { /* Use default size of 12 points. */
+ lf->lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);
+ } else { /* Use pixel size. */
+ lf->lfHeight = siz; /* Leave this negative. */
+ }
+ } else {
+ GdiParseFontWords(interp, lf, list+1, count-1);
+ }
+ }
+
+ if (count >= 3) {
+ GdiParseFontWords(interp, lf, list+2, count-2);
+ }
+
+ Tcl_Free((char *)list);
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiMakePen --
+ *
+ * Creates a logical pen based on input parameters and selects it into
+ * the hDC.
+ *
+ * Results:
+ * Sets rendering pen.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiMakePen(
+ Tcl_Interp *interp,
+ int width,
+ int dashstyle,
+ const char *dashstyledata,
+ TCL_UNUSED(int), /* Ignored for now. */
+ TCL_UNUSED(int), /* Ignored for now. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(const char *), /* Ignored for now. */
+ unsigned long color,
+ HDC hDC,
+ HGDIOBJ *oldPen)
+{
+ /*
+ * The LOGPEN structure takes the following dash options:
+ * PS_SOLID: a solid pen
+ * PS_DASH: a dashed pen
+ * PS_DOT: a dotted pen
+ * PS_DASHDOT: a pen with a dash followed by a dot
+ * PS_DASHDOTDOT: a pen with a dash followed by 2 dots
+ *
+ * It seems that converting to ExtCreatePen may be more advantageous, as
+ * it matches the Tk canvas pens much better--but not for Win95, which
+ * does not support PS_USERSTYLE. An explicit test (or storage in a static
+ * after first failure) may suffice for working around this. The
+ * ExtCreatePen is not supported at all under Win32.
+ */
+
+ HPEN hPen;
+ LOGBRUSH lBrush;
+ DWORD pStyle = PS_SOLID; /* -dash should override*/
+ DWORD endStyle = PS_ENDCAP_ROUND; /* -capstyle should override. */
+ DWORD joinStyle = PS_JOIN_ROUND; /* -joinstyle should override. */
+ DWORD styleCount = 0;
+ DWORD *styleArray = 0;
+
+ /*
+ * To limit the propagation of allocated memory, the dashes will have a
+ * maximum here. If one wishes to remove the static allocation, please be
+ * sure to update GdiFreePen and ensure that the array is NOT freed if the
+ * LOGPEN option is used.
+ */
+ static DWORD pStyleData[24];
+ if (dashstyle != 0 && dashstyledata != 0) {
+ const char *cp;
+ size_t i;
+ char *dup = (char *) Tcl_Alloc(strlen(dashstyledata) + 1);
+ strcpy(dup, dashstyledata);
+ /* DEBUG. */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "DEBUG: Found a dash spec of |%s|\n",
+ dashstyledata));
+
+ /* Parse the dash spec. */
+ if (isdigit(dashstyledata[0])) {
+ cp = strtok(dup, " \t,;");
+ for (i = 0; cp && i < sizeof(pStyleData) / sizeof(DWORD); i++) {
+ pStyleData[styleCount++] = atoi(cp);
+ cp = strtok(NULL, " \t,;");
+ }
+ } else {
+ for (i=0; dashstyledata[i] != '\0' && i< sizeof(pStyleData) / sizeof(DWORD); i++) {
+ switch (dashstyledata[i]) {
+ case ' ':
+ pStyleData[styleCount++] = 8;
+ break;
+ case ',':
+ pStyleData[styleCount++] = 4;
+ break;
+ case '_':
+ pStyleData[styleCount++] = 6;
+ break;
+ case '-':
+ pStyleData[styleCount++] = 4;
+ break;
+ case '.':
+ pStyleData[styleCount++] = 2;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ if (styleCount > 0) {
+ styleArray = pStyleData;
+ } else {
+ dashstyle = 0;
+ }
+ if (dup) {
+ Tcl_Free(dup);
+ }
+ }
+
+ if (dashstyle != 0) {
+ pStyle = PS_USERSTYLE;
+ }
+
+ /* -stipple could affect this.... */
+ lBrush.lbStyle = BS_SOLID;
+ lBrush.lbColor = color;
+ lBrush.lbHatch = 0;
+
+ /* We only use geometric pens, even for 1-pixel drawing. */
+ hPen = ExtCreatePen(PS_GEOMETRIC|pStyle|endStyle|joinStyle,
+ width, &lBrush, styleCount, styleArray);
+
+ if (hPen == 0) { /* Failed for some reason...Fall back on CreatePenIndirect. */
+ LOGPEN lf;
+ lf.lopnWidth.x = width;
+ lf.lopnWidth.y = 0; /* Unused in LOGPEN. */
+ if (dashstyle == 0) {
+ lf.lopnStyle = PS_SOLID; /* For now...convert 'style' in the future. */
+ } else {
+ lf.lopnStyle = PS_DASH; /* REALLLLY simple for now. */
+ }
+ lf.lopnColor = color; /* Assume we're getting a COLORREF. */
+ /* Now we have a logical pen. Create the "real" pen and put it in the
+ * hDC. */
+ hPen = CreatePenIndirect(&lf);
+ }
+
+ *oldPen = SelectObject(hDC, hPen);
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiFreePen --
+ *
+ * Wraps the protocol to delete a created pen.
+ *
+ * Results:
+ * Deletes pen.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiFreePen(
+ TCL_UNUSED(Tcl_Interp *),
+ HDC hDC,
+ HGDIOBJ oldPen)
+{
+ HGDIOBJ gonePen = SelectObject(hDC, oldPen);
+
+ DeleteObject(gonePen);
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiMakeBrush--
+ *
+ * Creates a logical brush based on input parameters, and selects it into
+ * the hdc.
+ *
+ * Results:
+ * Creates brush.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiMakeBrush(
+ TCL_UNUSED(Tcl_Interp *),
+ TCL_UNUSED(unsigned int),
+ unsigned long color,
+ long hatch,
+ LOGBRUSH *lb,
+ HDC hDC,
+ HGDIOBJ *oldBrush)
+{
+ HBRUSH hBrush;
+ lb->lbStyle = BS_SOLID; /* Support other styles later. */
+ lb->lbColor = color; /* Assume this is a COLORREF. */
+ lb->lbHatch = hatch; /* Ignored for now, given BS_SOLID in the Style. */
+
+ /* Now we have the logical brush. Create the "real" brush and put it in
+ * the hDC. */
+ hBrush = CreateBrushIndirect(lb);
+ *oldBrush = SelectObject(hDC, hBrush);
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiFreeBrush --
+ *
+ * Wraps the protocol to delete a created brush.
+ *
+ * Results:
+ * Deletes brush.
+ *
+ *----------------------------------------------------------------------
+ */
+static int GdiFreeBrush(
+ TCL_UNUSED(Tcl_Interp *),
+ HDC hDC,
+ HGDIOBJ oldBrush)
+{
+ HGDIOBJ goneBrush;
+
+ goneBrush = SelectObject(hDC, oldBrush);
+ DeleteObject(goneBrush);
+ return 1;
+}
+
+/*
+ * Utility functions from elsewhere in Tcl.
+ * Functions have removed reliance on X and Tk libraries, as well as removing
+ * the need for TkWindows.
+ * GdiGetColor is a copy of a TkpGetColor from tkWinColor.c
+ */
+typedef struct {
+ const char *name;
+ int index;
+} SystemColorEntry;
+
+static const SystemColorEntry sysColors[] = {
+ {"3dDarkShadow", COLOR_3DDKSHADOW},
+ {"3dLight", COLOR_3DLIGHT},
+ {"ActiveBorder", COLOR_ACTIVEBORDER},
+ {"ActiveCaption", COLOR_ACTIVECAPTION},
+ {"AppWorkspace", COLOR_APPWORKSPACE},
+ {"Background", COLOR_BACKGROUND},
+ {"ButtonFace", COLOR_BTNFACE},
+ {"ButtonHighlight", COLOR_BTNHIGHLIGHT},
+ {"ButtonShadow", COLOR_BTNSHADOW},
+ {"ButtonText", COLOR_BTNTEXT},
+ {"CaptionText", COLOR_CAPTIONTEXT},
+ {"DisabledText", COLOR_GRAYTEXT},
+ {"GrayText", COLOR_GRAYTEXT},
+ {"Highlight", COLOR_HIGHLIGHT},
+ {"HighlightText", COLOR_HIGHLIGHTTEXT},
+ {"InactiveBorder", COLOR_INACTIVEBORDER},
+ {"InactiveCaption", COLOR_INACTIVECAPTION},
+ {"InactiveCaptionText", COLOR_INACTIVECAPTIONTEXT},
+ {"InfoBackground", COLOR_INFOBK},
+ {"InfoText", COLOR_INFOTEXT},
+ {"Menu", COLOR_MENU},
+ {"MenuText", COLOR_MENUTEXT},
+ {"Scrollbar", COLOR_SCROLLBAR},
+ {"Window", COLOR_WINDOW},
+ {"WindowFrame", COLOR_WINDOWFRAME},
+ {"WindowText", COLOR_WINDOWTEXT}
+};
+
+static int numsyscolors = 0;
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiGetColor --
+ *
+ * Convert color name to color specification.
+ *
+ * Results:
+ * Color name converted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiGetColor(
+ const char *name,
+ COLORREF *color)
+{
+ if (numsyscolors == 0) {
+ numsyscolors = sizeof(sysColors) / sizeof(SystemColorEntry);
+ }
+ if (_strnicmp(name, "system", 6) == 0) {
+ int i, l, u, r;
+
+ l = 0;
+ u = numsyscolors;
+ while (l <= u) {
+ i = (l + u) / 2;
+ if ((r = _strcmpi(name+6, sysColors[i].name)) == 0) {
+ break;
+ }
+ if (r < 0) {
+ u = i - 1;
+ } else {
+ l = i + 1;
+ }
+ }
+ if (l > u) {
+ return 0;
+ }
+ *color = GetSysColor(sysColors[i].index);
+ return 1;
+ } else {
+ int result;
+ XColor xcolor;
+ result = XParseColor(NULL, 0, name, &xcolor);
+ *color = ((xcolor.red & 0xFF00)>>8) | (xcolor.green & 0xFF00)
+ | ((xcolor.blue & 0xFF00)<<8);
+ return result;
+ }
+}
+
+/*
+ * Beginning of functions for screen-to-dib translations.
+ *
+ * Several of these functions are based on those in the WINCAP32 program
+ * provided as a sample by Microsoft on the VC++ 5.0 disk. The copyright on
+ * these functions is retained, even for those with significant changes.
+ */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CopyToDIB --
+ *
+ * Copy window bits to a DIB.
+ *
+ * Results:
+ * Color specification converted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HANDLE CopyToDIB(
+ HWND hWnd,
+ enum PrintType type)
+{
+ HANDLE hDIB;
+ HBITMAP hBitmap;
+ HPALETTE hPalette;
+
+ /* Check for a valid window handle. */
+
+ if (!hWnd) {
+ return NULL;
+ }
+
+ switch (type) {
+ case PTWindow: { /* Copy entire window. */
+ RECT rectWnd;
+
+ /* Get the window rectangle. */
+
+ GetWindowRect(hWnd, &rectWnd);
+
+ /*
+ * Get the DIB of the window by calling CopyScreenToDIB and passing it
+ * the window rect.
+ */
+
+ hDIB = CopyScreenToDIB(&rectWnd);
+ break;
+ }
+
+ case PTClient: { /* Copy client area. */
+ RECT rectClient;
+ POINT pt1, pt2;
+
+ /* Get the client area dimensions. */
+
+ GetClientRect(hWnd, &rectClient);
+
+ /* Convert client coords to screen coords. */
+
+ pt1.x = rectClient.left;
+ pt1.y = rectClient.top;
+ pt2.x = rectClient.right;
+ pt2.y = rectClient.bottom;
+ ClientToScreen(hWnd, &pt1);
+ ClientToScreen(hWnd, &pt2);
+ rectClient.left = pt1.x;
+ rectClient.top = pt1.y;
+ rectClient.right = pt2.x;
+ rectClient.bottom = pt2.y;
+
+ /*
+ * Get the DIB of the client area by calling CopyScreenToDIB and
+ * passing it the client rect.
+ */
+
+ hDIB = CopyScreenToDIB(&rectClient);
+ break;
+ }
+
+ case PTScreen: { /* Entire screen. */
+ RECT Rect;
+
+ /*
+ * Get the device-dependent bitmap in lpRect by calling
+ * CopyScreenToBitmap and passing it the rectangle to grab.
+ */
+ Rect.top = Rect.left = 0;
+ GetDisplaySize(&Rect.right, &Rect.bottom);
+
+ hBitmap = CopyScreenToBitmap(&Rect);
+
+ /* Check for a valid bitmap handle. */
+
+ if (!hBitmap) {
+ return NULL;
+ }
+
+ /* Get the current palette. */
+
+ hPalette = GetSystemPalette();
+
+ /* Convert the bitmap to a DIB. */
+
+ hDIB = BitmapToDIB(hBitmap, hPalette);
+
+ /* Clean up. */
+
+ DeleteObject(hPalette);
+ DeleteObject(hBitmap);
+
+ /* Return handle to the packed-DIB. */
+ break;
+ }
+ default: /* Invalid print area. */
+ return NULL;
+ }
+
+ /* Return the handle to the DIB. */
+ return hDIB;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetDisplaySize--
+ *
+ * GetDisplaySize does just that. There may be an easier way, but it is
+ * not apparent.
+ *
+ * Results:
+ * Returns display size.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void GetDisplaySize(
+ LONG *width,
+ LONG *height)
+{
+ HDC hDC;
+
+ hDC = CreateDCW(L"DISPLAY", 0, 0, 0);
+ *width = GetDeviceCaps(hDC, HORZRES);
+ *height = GetDeviceCaps(hDC, VERTRES);
+ DeleteDC(hDC);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CopyScreenToBitmap--
+ *
+ * Copies screen to bitmap.
+ *
+ * Results:
+ * Screen is copied.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HBITMAP CopyScreenToBitmap(
+ LPRECT lpRect)
+{
+ HDC hScrDC, hMemDC; /* Screen DC and memory DC. */
+ HBITMAP hBitmap, hOldBitmap; /* Handles to deice-dependent bitmaps. */
+ int nX, nY, nX2, nY2; /* Coordinates of rectangle to grab. */
+ int nWidth, nHeight; /* DIB width and height */
+ int xScrn, yScrn; /* Screen resolution. */
+
+ /* Check for an empty rectangle. */
+
+ if (IsRectEmpty(lpRect)) {
+ return NULL;
+ }
+
+ /*
+ * Create a DC for the screen and create a memory DC compatible to screen
+ * DC.
+ */
+
+ hScrDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
+ hMemDC = CreateCompatibleDC(hScrDC);
+
+ /* Get points of rectangle to grab. */
+
+ nX = lpRect->left;
+ nY = lpRect->top;
+ nX2 = lpRect->right;
+ nY2 = lpRect->bottom;
+
+ /* Get screen resolution. */
+
+ xScrn = GetDeviceCaps(hScrDC, HORZRES);
+ yScrn = GetDeviceCaps(hScrDC, VERTRES);
+
+ /* Make sure bitmap rectangle is visible. */
+
+ if (nX < 0) {
+ nX = 0;
+ }
+ if (nY < 0) {
+ nY = 0;
+ }
+ if (nX2 > xScrn) {
+ nX2 = xScrn;
+ }
+ if (nY2 > yScrn) {
+ nY2 = yScrn;
+ }
+
+ nWidth = nX2 - nX;
+ nHeight = nY2 - nY;
+
+ /* Create a bitmap compatible with the screen DC. */
+ hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);
+
+ /* Select new bitmap into memory DC. */
+ hOldBitmap = SelectObject(hMemDC, hBitmap);
+
+ /* Bitblt screen DC to memory DC. */
+ BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);
+
+ /*
+ * Select old bitmap back into memory DC and get handle to bitmap of the
+ * screen.
+ */
+
+ hBitmap = SelectObject(hMemDC, hOldBitmap);
+
+ /* Clean up. */
+
+ DeleteDC(hScrDC);
+ DeleteDC(hMemDC);
+
+ /* Return handle to the bitmap. */
+
+ return hBitmap;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * BitmapToDIB--
+ *
+ * Converts bitmap to DIB.
+ *
+ * Results:
+ * Bitmap converted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HANDLE BitmapToDIB(
+ HBITMAP hBitmap,
+ HPALETTE hPal)
+{
+ BITMAP bm;
+ BITMAPINFOHEADER bi;
+ LPBITMAPINFOHEADER lpbi;
+ DWORD dwLen;
+ HANDLE hDIB;
+ HANDLE h;
+ HDC hDC;
+ WORD biBits;
+
+ /* Check if bitmap handle is valid. */
+
+ if (!hBitmap) {
+ return NULL;
+ }
+
+ /* Fill in BITMAP structure, return NULL if it didn't work. */
+
+ if (!GetObjectW(hBitmap, sizeof(bm), (LPWSTR)&bm)) {
+ return NULL;
+ }
+
+ /* Ff no palette is specified, use default palette. */
+
+ if (hPal == NULL) {
+ hPal = GetStockObject(DEFAULT_PALETTE);
+ }
+
+ /* Calculate bits per pixel. */
+
+ biBits = bm.bmPlanes * bm.bmBitsPixel;
+
+ /* Make sure bits per pixel is valid. */
+
+ if (biBits <= 1) {
+ biBits = 1;
+ } else if (biBits <= 4) {
+ biBits = 4;
+ } else if (biBits <= 8) {
+ biBits = 8;
+ } else { /* If greater than 8-bit, force to 24-bit. */
+ biBits = 24;
+ }
+
+ /* Initialize BITMAPINFOHEADER. */
+
+ bi.biSize = sizeof(BITMAPINFOHEADER);
+ bi.biWidth = bm.bmWidth;
+ bi.biHeight = bm.bmHeight;
+ bi.biPlanes = 1;
+ bi.biBitCount = biBits;
+ bi.biCompression = BI_RGB;
+ bi.biSizeImage = 0;
+ bi.biXPelsPerMeter = 0;
+ bi.biYPelsPerMeter = 0;
+ bi.biClrUsed = 0;
+ bi.biClrImportant = 0;
+
+ /* Calculate size of memory block required to store BITMAPINFO. */
+
+ dwLen = bi.biSize + DIBNumColors(&bi) * sizeof(RGBQUAD);
+
+ /* Get a DC. */
+
+ hDC = GetDC(NULL);
+
+ /* Select and realize our palette. */
+
+ hPal = SelectPalette(hDC, hPal, FALSE);
+ RealizePalette(hDC);
+
+ /* Alloc memory block to store our bitmap. */
+
+ hDIB = GlobalAlloc(GHND, dwLen);
+
+ /* If we couldn't get memory block. */
+
+ if (!hDIB) {
+ /* clean up and return NULL. */
+
+ SelectPalette(hDC, hPal, TRUE);
+ RealizePalette(hDC);
+ ReleaseDC(NULL, hDC);
+ return NULL;
+ }
+
+ /* Lock memory and get pointer to it. */
+
+ lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
+
+ /* Use our bitmap info. to fill BITMAPINFOHEADER. */
+
+ *lpbi = bi;
+
+ /* Call GetDIBits with a NULL lpBits param, so it will calculate the
+ * biSizeImage field for us
+ */
+
+ GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, NULL, (LPBITMAPINFO)lpbi,
+ DIB_RGB_COLORS);
+
+ /* get the info. returned by GetDIBits and unlock memory block. */
+
+ bi = *lpbi;
+ GlobalUnlock(hDIB);
+
+ /* If the driver did not fill in the biSizeImage field, make one up. */
+ if (bi.biSizeImage == 0) {
+ bi.biSizeImage = (((((DWORD)bm.bmWidth * biBits) + 31) / 32) * 4)
+ * bm.bmHeight;
+ }
+
+ /* Realloc the buffer big enough to hold all the bits. */
+
+ dwLen = bi.biSize + DIBNumColors(&bi) * sizeof(RGBQUAD) + bi.biSizeImage;
+
+ if ((h = GlobalReAlloc(hDIB, dwLen, 0)) != 0) {
+ hDIB = h;
+ } else {
+ /* Clean up and return NULL. */
+
+ GlobalFree(hDIB);
+ SelectPalette(hDC, hPal, TRUE);
+ RealizePalette(hDC);
+ ReleaseDC(NULL, hDC);
+ return NULL;
+ }
+
+ /* Lock memory block and get pointer to it. */
+
+ lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
+
+ /* Call GetDIBits with a NON-NULL lpBits param, and actualy get the
+ * bits this time.
+ */
+
+ if (GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, (LPSTR)lpbi +
+ (WORD)lpbi->biSize + DIBNumColors(lpbi) * sizeof(RGBQUAD),
+ (LPBITMAPINFO)lpbi, DIB_RGB_COLORS) == 0) {
+ /* Clean up and return NULL. */
+
+ GlobalUnlock(hDIB);
+ SelectPalette(hDC, hPal, TRUE);
+ RealizePalette(hDC);
+ ReleaseDC(NULL, hDC);
+ return NULL;
+ }
+
+ bi = *lpbi;
+
+ /* Clean up. */
+ GlobalUnlock(hDIB);
+ SelectPalette(hDC, hPal, TRUE);
+ RealizePalette(hDC);
+ ReleaseDC(NULL, hDC);
+
+ /* Return handle to the DIB. */
+ return hDIB;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CopyScreenToDIB--
+ *
+ * Copies screen to DIB.
+ *
+ * Results:
+ * Screen copied.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HANDLE CopyScreenToDIB(
+ LPRECT lpRect)
+{
+ HBITMAP hBitmap;
+ HPALETTE hPalette;
+ HANDLE hDIB;
+
+ /*
+ * Get the device-dependent bitmap in lpRect by calling CopyScreenToBitmap
+ * and passing it the rectangle to grab.
+ */
+
+ hBitmap = CopyScreenToBitmap(lpRect);
+
+ /* Check for a valid bitmap handle. */
+
+ if (!hBitmap) {
+ return NULL;
+ }
+
+ /* Get the current palette. */
+
+ hPalette = GetSystemPalette();
+
+ /* convert the bitmap to a DIB. */
+
+ hDIB = BitmapToDIB(hBitmap, hPalette);
+
+ /* Clean up. */
+
+ DeleteObject(hPalette);
+ DeleteObject(hBitmap);
+
+ /* Return handle to the packed-DIB. */
+ return hDIB;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetSystemPalette--
+ *
+ * Obtains the system palette.
+ *
+ * Results:
+ * Returns palette.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HPALETTE GetSystemPalette(void)
+{
+ HDC hDC; /* Handle to a DC. */
+ static HPALETTE hPal = NULL; /* Handle to a palette. */
+ HANDLE hLogPal; /* Handle to a logical palette. */
+ LPLOGPALETTE lpLogPal; /* Pointer to a logical palette. */
+ int nColors; /* Number of colors. */
+
+ /* Find out how many palette entries we want.. */
+
+ hDC = GetDC(NULL);
+ if (!hDC) {
+ return NULL;
+ }
+
+ nColors = PalEntriesOnDevice(hDC); /* Number of palette entries. */
+
+ /* Allocate room for the palette and lock it.. */
+
+ hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) + nColors *
+ sizeof(PALETTEENTRY));
+ if (!hLogPal) {
+ /* If we didn't get a logical palette, return NULL. */
+
+ return NULL;
+ }
+
+ /* get a pointer to the logical palette. */
+
+ lpLogPal = (LPLOGPALETTE)GlobalLock(hLogPal);
+
+ /* Set some important fields. */
+
+ lpLogPal->palVersion = 0x300;
+ lpLogPal->palNumEntries = nColors;
+
+ /* Copy the current system palette into our logical palette. */
+
+ GetSystemPaletteEntries(hDC, 0, nColors,
+ (LPPALETTEENTRY) lpLogPal->palPalEntry);
+
+ /*
+ * Go ahead and create the palette. Once it's created, we no longer need
+ * the LOGPALETTE, so free it.
+ */
+
+ hPal = CreatePalette(lpLogPal);
+
+ /* Clean up. */
+
+ GlobalUnlock(hLogPal);
+ GlobalFree(hLogPal);
+ ReleaseDC(NULL, hDC);
+
+ return hPal;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * PalEntriesOnDevice--
+ *
+ * Returns the palettes on the device.
+ *
+ * Results:
+ * Returns palettes.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int PalEntriesOnDevice(
+ HDC hDC)
+{
+ return (1 << (GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES)));
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * Winprint_Init--
+ *
+ * Initializes printing module on Windows.
+ *
+ * Results:
+ * Module initialized.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int Winprint_Init(
+ Tcl_Interp * interp)
+{
+ size_t i;
+ Tcl_Namespace *namespacePtr;
+ static const char *gdiName = "::tk::print::_gdi";
+ static const size_t numCommands =
+ sizeof(gdi_commands) / sizeof(struct gdi_command);
+
+ /*
+ * Set up the low-level [_gdi] command.
+ */
+
+ namespacePtr = Tcl_CreateNamespace(interp, gdiName,
+ (ClientData) NULL, (Tcl_NamespaceDeleteProc *) NULL);
+ for (i=0; i<numCommands; i++) {
+ char buffer[100];
+
+ sprintf(buffer, "%s::%s", gdiName, gdi_commands[i].command_string);
+ Tcl_CreateCommand(interp, buffer, gdi_commands[i].command,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) 0);
+ Tcl_Export(interp, namespacePtr, gdi_commands[i].command_string, 0);
+ }
+ Tcl_CreateEnsemble(interp, gdiName, namespacePtr, 0);
+
+ /*
+ * The other printing-related commands.
+ */
+
+ Tcl_CreateObjCommand(interp, "::tk::print::_selectprinter",
+ PrintSelectPrinter, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_openprinter",
+ PrintOpenPrinter, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_closeprinter",
+ PrintClosePrinter, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_opendoc",
+ PrintOpenDoc, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_closedoc",
+ PrintCloseDoc, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_openpage",
+ PrintOpenPage, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_closepage",
+ PrintClosePage, NULL, NULL);
+ return TCL_OK;
+}
+
+/* Print API functions. */
+
+/*----------------------------------------------------------------------
+ *
+ * PrintSelectPrinter--
+ *
+ * Main dialog for selecting printer and initializing data for print job.
+ *
+ * Results:
+ * Printer selected.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int PrintSelectPrinter(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj* const*))
+{
+ LPCWSTR printerName = NULL;
+ PDEVMODEW returnedDevmode = NULL;
+ PDEVMODEW localDevmode = NULL;
+
+ copies = 0;
+ paper_width = 0;
+ paper_height = 0;
+ dpi_x = 0;
+ dpi_y = 0;
+
+ /* Set up print dialog and initalize property structure. */
+
+ ZeroMemory(&pd, sizeof(pd));
+ pd.lStructSize = sizeof(pd);
+ pd.hwndOwner = GetDesktopWindow();
+ pd.Flags = PD_HIDEPRINTTOFILE | PD_DISABLEPRINTTOFILE | PD_NOSELECTION;
+
+ if (PrintDlgW(&pd) == TRUE) {
+
+ /*Get document info.*/
+ ZeroMemory(&di, sizeof(di));
+ di.cbSize = sizeof(di);
+ di.lpszDocName = L"Tk Print Output";
+
+ /* Copy print attributes to local structure. */
+ returnedDevmode = (PDEVMODEW) GlobalLock(pd.hDevMode);
+ devnames = (LPDEVNAMES) GlobalLock(pd.hDevNames);
+ printerName = (LPCWSTR) devnames + devnames->wDeviceOffset;
+ localDevmode = (LPDEVMODEW) HeapAlloc(GetProcessHeap(),
+ HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS,
+ returnedDevmode->dmSize);
+
+ if (localDevmode != NULL) {
+ memcpy((LPVOID)localDevmode, (LPVOID)returnedDevmode,
+ returnedDevmode->dmSize);
+
+ /* Get values from user-set and built-in properties. */
+ localPrinterName = localDevmode->dmDeviceName;
+ dpi_y = localDevmode->dmYResolution;
+ dpi_x = localDevmode->dmPrintQuality;
+ /* Convert height and width to logical points. */
+ paper_height = (int) localDevmode->dmPaperLength / 0.254;
+ paper_width = (int) localDevmode->dmPaperWidth / 0.254;
+ copies = pd.nCopies;
+ /* Set device context here for all GDI printing operations. */
+ printDC = CreateDCW(L"WINSPOOL", printerName, NULL, localDevmode);
+ } else {
+ localDevmode = NULL;
+ }
+ }
+
+ if (pd.hDevMode != NULL) {
+ GlobalFree(pd.hDevMode);
+ }
+
+ /*
+ * Store print properties and link variables so they can be accessed from
+ * script level.
+ */
+ if (localPrinterName != NULL) {
+ char* varlink1 = (char*)Tcl_Alloc(100 * sizeof(char));
+ char** varlink2 = (char**)Tcl_Alloc(sizeof(char*));
+ *varlink2 = varlink1;
+ WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, 0, NULL, NULL);
+
+ Tcl_LinkVar(interp, "::tk::print::printer_name", (char*)varlink2,
+ TCL_LINK_STRING | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::copies", (char*)&copies,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::dpi_x", (char*)&dpi_x,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::dpi_y", (char*)&dpi_y,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::paper_width", (char*)&paper_width,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::paper_height", (char*)&paper_height,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintOpenPrinter--
+ *
+ * Open the given printer.
+ *
+ * Results:
+ * Opens the selected printer.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintOpenPrinter(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const objv[])
+{
+ Tcl_DString ds;
+
+ if (argc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "printer");
+ return TCL_ERROR;
+ }
+
+ /*Start an individual page.*/
+ if (StartPage(printDC) <= 0) {
+ return TCL_ERROR;
+ }
+
+ const char *printer = Tcl_GetString(objv[1]);
+
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", NULL);
+ return TCL_ERROR;
+ }
+
+ Tcl_DStringInit(&ds);
+ if ((OpenPrinterW(Tcl_UtfToWCharDString(printer, -1, &ds),
+ (LPHANDLE)&printDC, NULL)) == FALSE) {
+ Tcl_AppendResult(interp, "unable to open printer", NULL);
+ Tcl_DStringFree(&ds);
+ return TCL_ERROR;
+ }
+
+ Tcl_DStringFree(&ds);
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintClosePrinter--
+ *
+ * Closes the given printer.
+ *
+ * Results:
+ * Printer closed.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintClosePrinter(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", NULL);
+ return TCL_ERROR;
+ }
+
+ ClosePrinter(printDC);
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintOpenDoc--
+ *
+ * Opens the document for printing.
+ *
+ * Results:
+ * Opens the print document.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintOpenDoc(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ int output = 0;
+
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Start printing.
+ */
+ output = StartDocW(printDC, &di);
+ if (output <= 0) {
+ Tcl_AppendResult(interp, "unable to start document", NULL);
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintCloseDoc--
+ *
+ * Closes the document for printing.
+ *
+ * Results:
+ * Closes the print document.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintCloseDoc(
+ TCL_UNUSED(ClientData),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", NULL);
+ return TCL_ERROR;
+ }
+
+ if (EndDoc(printDC) <= 0) {
+ Tcl_AppendResult(interp, "unable to establish close document", NULL);
+ return TCL_ERROR;
+ }
+ DeleteDC(printDC);
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintOpenPage--
+ *
+ * Opens a page for printing.
+ *
+ * Results:
+ * Opens the print page.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintOpenPage(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", NULL);
+ return TCL_ERROR;
+ }
+
+ /*Start an individual page.*/
+ if (StartPage(printDC) <= 0) {
+ Tcl_AppendResult(interp, "unable to start page", NULL);
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintClosePage--
+ *
+ * Closes the printed page.
+ *
+ * Results:
+ * Closes the page.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintClosePage(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", NULL);
+ return TCL_ERROR;
+ }
+
+ if (EndPage(printDC) <= 0) {
+ Tcl_AppendResult(interp, "unable to close page", NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinIco.c b/win/tkWinIco.c
new file mode 100644
index 0000000..4485787
--- /dev/null
+++ b/win/tkWinIco.c
@@ -0,0 +1,227 @@
+/*
+ * tkWinIco.c --
+ *
+ * This file contains functions for icon-manipulation routines
+ * in Windows.
+ *
+ * Copyright © 1995-1996 Microsoft Corp.
+ * Copyright © 1998 Brueckner & Jarosch Ing.GmbH, Erfurt, Germany
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkWinIco.h"
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DIBNumColors --
+ *
+ * Calculates the number of entries in the color table, given by LPSTR
+ * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
+ *
+ * Results:
+ * WORD - Number of entries in the color table.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static WORD
+DIBNumColors(
+ LPSTR lpbi)
+{
+ WORD wBitCount;
+ DWORD dwClrUsed;
+
+ dwClrUsed = ((LPBITMAPINFOHEADER) lpbi)->biClrUsed;
+
+ if (dwClrUsed) {
+ return (WORD) dwClrUsed;
+ }
+
+ wBitCount = ((LPBITMAPINFOHEADER) lpbi)->biBitCount;
+
+ switch (wBitCount) {
+ case 1:
+ return 2;
+ case 4:
+ return 16;
+ case 8:
+ return 256;
+ default:
+ return 0;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * PaletteSize --
+ *
+ * Calculates the number of bytes in the color table, as given by LPSTR
+ * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
+ *
+ * Results:
+ * Number of bytes in the color table
+ *
+ *----------------------------------------------------------------------
+ */
+static WORD
+PaletteSize(
+ LPSTR lpbi)
+{
+ return (WORD) (DIBNumColors(lpbi) * sizeof(RGBQUAD));
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FindDIBits --
+ *
+ * Locate the image bits in a CF_DIB format DIB, as given by LPSTR lpbi -
+ * pointer to the CF_DIB memory block. Used by titlebar icon code.
+ *
+ * Results:
+ * pointer to the image bits
+ *
+ * Side effects: None
+ *
+ *
+ *----------------------------------------------------------------------
+ */
+
+LPSTR
+FindDIBBits(
+ LPSTR lpbi)
+{
+ return lpbi + *((LPDWORD) lpbi) + PaletteSize(lpbi);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * BytesPerLine --
+ *
+ * Calculates the number of bytes in one scan line, as given by
+ * LPBITMAPINFOHEADER lpBMIH - pointer to the BITMAPINFOHEADER that
+ * begins the CF_DIB block. Used by titlebar icon code.
+ *
+ * Results:
+ * number of bytes in one scan line (DWORD aligned)
+ *
+ *----------------------------------------------------------------------
+ */
+
+DWORD
+BytesPerLine(
+ LPBITMAPINFOHEADER lpBMIH)
+{
+ return WIDTHBYTES(lpBMIH->biWidth * lpBMIH->biPlanes * lpBMIH->biBitCount);
+}
+/*
+ *----------------------------------------------------------------------
+ *
+ * CreateIcoFromPhoto --
+ *
+ * Create ico pointer from Tk photo block.
+ *
+ * Results:
+ * Icon image is created from a valid Tk photo image.
+ *
+ * Side effects:
+ * Icon is created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+HICON
+CreateIcoFromPhoto(
+ int width, /* Width of image. */
+ int height, /* Height of image. */
+ Tk_PhotoImageBlock block) /* Image block to convert. */
+{
+ int idx, bufferSize;
+ union {unsigned char *ptr; void *voidPtr;} bgraPixel;
+ union {unsigned char *ptr; void *voidPtr;} bgraMask;
+ HICON hIcon;
+ BITMAPINFO bmInfo;
+ ICONINFO iconInfo;
+
+ /*
+ * Don't use CreateIcon to create the icon, as it requires color
+ * bitmap data in device-dependent format. Instead we use
+ * CreateIconIndirect which takes device-independent bitmaps and
+ * converts them as required. Initialise icon info structure.
+ */
+
+ ZeroMemory(&iconInfo, sizeof(iconInfo));
+ iconInfo.fIcon = TRUE;
+
+ /*
+ * Create device-independent color bitmap.
+ */
+
+ ZeroMemory(&bmInfo, sizeof bmInfo);
+ bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmInfo.bmiHeader.biWidth = width;
+ bmInfo.bmiHeader.biHeight = -height;
+ bmInfo.bmiHeader.biPlanes = 1;
+ bmInfo.bmiHeader.biBitCount = 32;
+ bmInfo.bmiHeader.biCompression = BI_RGB;
+
+ iconInfo.hbmColor = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
+ &bgraPixel.voidPtr, NULL, 0);
+ if (!iconInfo.hbmColor) {
+ return NULL;
+ }
+
+ /*
+ * Convert the photo image data into BGRA format (RGBQUAD).
+ */
+
+ bufferSize = height * width * 4;
+ for (idx = 0 ; idx < bufferSize ; idx += 4) {
+ bgraPixel.ptr[idx] = block.pixelPtr[idx+2];
+ bgraPixel.ptr[idx+1] = block.pixelPtr[idx+1];
+ bgraPixel.ptr[idx+2] = block.pixelPtr[idx+0];
+ bgraPixel.ptr[idx+3] = block.pixelPtr[idx+3];
+ }
+
+ /*
+ * Create a dummy mask bitmap. The contents of this don't appear to
+ * matter, as CreateIconIndirect will setup the icon mask based on the
+ * alpha channel in our color bitmap.
+ */
+
+ bmInfo.bmiHeader.biBitCount = 1;
+
+ iconInfo.hbmMask = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
+ &bgraMask.voidPtr, NULL, 0);
+ if (!iconInfo.hbmMask) {
+ DeleteObject(iconInfo.hbmColor);
+ return NULL;
+ }
+
+ ZeroMemory(bgraMask.ptr, width*height/8);
+
+ /*
+ * Create an icon from the bitmaps.
+ */
+
+ hIcon = CreateIconIndirect(&iconInfo);
+ DeleteObject(iconInfo.hbmColor);
+ DeleteObject(iconInfo.hbmMask);
+ if (hIcon == NULL) {
+ return NULL;
+ }
+
+ return hIcon;
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinIco.h b/win/tkWinIco.h
new file mode 100644
index 0000000..16cbb77
--- /dev/null
+++ b/win/tkWinIco.h
@@ -0,0 +1,102 @@
+/*
+ * tkWinIco.h --
+ *
+ * This file contains declarations for icon-manipulation routines
+ * in Windows.
+ *
+ * Copyright © 1995-1996 Microsoft Corp.
+ * Copyright © 1998 Brueckner & Jarosch Ing.GmbH, Erfurt, Germany
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkWin.h"
+#include <windows.h>
+#include <shellapi.h>
+
+/*
+ * These structures represent the contents of a icon, in terms of its image
+ * or resource.
+ */
+
+typedef struct {
+ UINT Width, Height, Colors; /* Width, Height and bpp */
+ LPBYTE lpBits; /* Ptr to DIB bits */
+ DWORD dwNumBytes; /* How many bytes? */
+ LPBITMAPINFO lpbi; /* Ptr to header */
+ LPBYTE lpXOR; /* Ptr to XOR image bits */
+ LPBYTE lpAND; /* Ptr to AND image bits */
+ HICON hIcon; /* DAS ICON */
+} ICONIMAGE, *LPICONIMAGE;
+
+typedef struct {
+ BOOL bHasChanged; // Has image changed?
+ TCHAR szOriginalICOFileName[MAX_PATH]; // Original name
+ TCHAR szOriginalDLLFileName[MAX_PATH]; // Original name
+ int nNumImages; // How many images?
+ ICONIMAGE IconImages[1]; // Image entries
+} ICONRESOURCE, *LPICONRESOURCE;
+
+/*
+ * This structure is how we represent a block of the above items. We will
+ * reallocate these structures according to how many images they need to
+ * contain.
+ */
+
+typedef struct {
+ int nNumImages; /* How many images? */
+ ICONIMAGE IconImages[1]; /* Image entries */
+} BlockOfIconImages, *BlockOfIconImagesPtr;
+
+/*
+ * These two structures are used to read in icons from an 'icon directory'
+ * (i.e. the contents of a .icr file, say). We only use these structures
+ * temporarily, since we copy the information we want into a
+ * BlockOfIconImages.
+ */
+
+typedef struct {
+ BYTE bWidth; /* Width of the image */
+ BYTE bHeight; /* Height of the image (times 2) */
+ BYTE bColorCount; /* Number of colors in image (0 if >=8bpp) */
+ BYTE bReserved; /* Reserved */
+ WORD wPlanes; /* Color Planes */
+ WORD wBitCount; /* Bits per pixel */
+ DWORD dwBytesInRes; /* How many bytes in this resource? */
+ DWORD dwImageOffset; /* Where in the file is this image */
+} ICONDIRENTRY, *LPICONDIRENTRY;
+
+typedef struct {
+ WORD idReserved; /* Reserved */
+ WORD idType; /* Resource type (1 for icons) */
+ WORD idCount; /* How many images? */
+ ICONDIRENTRY idEntries[1]; /* The entries for each image */
+} ICONDIR, *LPICONDIR;
+
+/*
+ * Used in BytesPerLine
+ */
+
+#define WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2)
+
+/*
+ * The following are implemented in tkWinIco.c and also used in tkWinWm.c and tkWinSysTray.c.
+ */
+
+DWORD BytesPerLine(LPBITMAPINFOHEADER lpBMIH);
+LPSTR FindDIBBits(LPSTR lpbi);
+HICON CreateIcoFromPhoto(int width, int height,
+ Tk_PhotoImageBlock block);
+
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
+
+
+
diff --git a/win/tkWinImage.c b/win/tkWinImage.c
index e1660a9..fc48b95 100644
--- a/win/tkWinImage.c
+++ b/win/tkWinImage.c
@@ -3,7 +3,7 @@
*
* This file contains routines for manipulation full-color images.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -212,7 +212,10 @@ XCreateImage(
int bitmap_pad,
int bytes_per_line)
{
- XImage* imagePtr = ckalloc(sizeof(XImage));
+ XImage* imagePtr = (XImage*)ckalloc(sizeof(XImage));
+ (void)display;
+ (void)visual;
+
imagePtr->width = width;
imagePtr->height = height;
imagePtr->xoffset = offset;
@@ -274,7 +277,7 @@ XCreateImage(
* None.
*
* This procedure is adapted from the XGetImage implementation in TkNT. That
- * code is Copyright (c) 1994 Software Research Associates, Inc.
+ * code is Copyright © 1994 Software Research Associates, Inc.
*
*----------------------------------------------------------------------
*/
@@ -300,6 +303,7 @@ XGetImageZPixmap(
unsigned char *data;
TkWinDCState state;
BOOL ret;
+ (void)plane_mask;
if (format != ZPixmap) {
TkpDisplayWarning("Only ZPixmap types are implemented",
@@ -315,7 +319,7 @@ XGetImageZPixmap(
hbmp = CreateCompatibleBitmap(hdc, (int) width, (int) height);
hdcMem = CreateCompatibleDC(hdc);
- hbmpPrev = SelectObject(hdcMem, hbmp);
+ hbmpPrev = (HBITMAP)SelectObject(hdcMem, hbmp);
hPal = state.palette;
if (hPal) {
hPalPrev1 = SelectPalette(hdcMem, hPal, FALSE);
@@ -350,7 +354,7 @@ XGetImageZPixmap(
if (depth <= 8) {
size += sizeof(unsigned short) << depth;
}
- bmInfo = ckalloc(size);
+ bmInfo = (BITMAPINFO *)ckalloc(size);
bmInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmInfo->bmiHeader.biWidth = width;
@@ -368,7 +372,7 @@ XGetImageZPixmap(
unsigned char *p, *pend;
GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS);
- data = ckalloc(bmInfo->bmiHeader.biSizeImage);
+ data = (unsigned char *)ckalloc(bmInfo->bmiHeader.biSizeImage);
if (!data) {
/* printf("Failed to allocate data area for XImage.\n"); */
ret_image = NULL;
@@ -404,7 +408,7 @@ XGetImageZPixmap(
unsigned char *p;
GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS);
- data = ckalloc(bmInfo->bmiHeader.biSizeImage);
+ data = (unsigned char *)ckalloc(bmInfo->bmiHeader.biSizeImage);
if (!data) {
/* printf("Failed to allocate data area for XImage.\n"); */
ret_image = NULL;
@@ -435,7 +439,7 @@ XGetImageZPixmap(
}
} else if (depth == 16) {
GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS);
- data = ckalloc(bmInfo->bmiHeader.biSizeImage);
+ data = (unsigned char *)ckalloc(bmInfo->bmiHeader.biSizeImage);
if (!data) {
/* printf("Failed to allocate data area for XImage.\n"); */
ret_image = NULL;
@@ -461,7 +465,7 @@ XGetImageZPixmap(
}
} else {
GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS);
- data = ckalloc(width * height * 4);
+ data = (unsigned char *)ckalloc(width * height * 4);
if (!data) {
/* printf("Failed to allocate data area for XImage.\n"); */
ret_image = NULL;
@@ -484,7 +488,7 @@ XGetImageZPixmap(
unsigned int byte_width, h, w;
byte_width = ((width * 3 + 3) & ~(unsigned)3);
- smallBitBase = ckalloc(byte_width * height);
+ smallBitBase = (unsigned char *)ckalloc(byte_width * height);
if (!smallBitBase) {
ckfree(ret_image->data);
ckfree(ret_image);
@@ -614,7 +618,7 @@ XGetImage(
imagePtr = XCreateImage(display, NULL, 32, format, 0, NULL,
width, height, 32, 0);
size = imagePtr->bytes_per_line * imagePtr->height;
- imagePtr->data = ckalloc(size);
+ imagePtr->data = (char *)ckalloc(size);
ZeroMemory(imagePtr->data, size);
for (yy = 0; yy < height; yy++) {
@@ -661,7 +665,7 @@ XGetImage(
imagePtr = XCreateImage(display, NULL, 1, XYBitmap, 0, NULL,
width, height, 32, 0);
- imagePtr->data = ckalloc(imagePtr->bytes_per_line * imagePtr->height);
+ imagePtr->data = (char *)ckalloc(imagePtr->bytes_per_line * imagePtr->height);
dc = GetDC(NULL);
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index 854d62f..42ff46f 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.c
@@ -4,7 +4,7 @@
* This file contains Windows-specific interpreter initialization
* functions.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -38,9 +38,12 @@ TkpInit(
(void)interp;
/*
* This is necessary for static initialization, and is ok otherwise
- * because TkWinXInit flips a static bit to do its work just once.
+ * because TkWinXInit flips a static bit to do its work just once. Also,
+ * initialize printing and systray API's here.
*/
+ WinIcoInit(interp);
+ Winprint_Init(interp);
TkWinXInit(Tk_GetHINSTANCE());
return TCL_OK;
}
@@ -124,7 +127,7 @@ TkpDisplayWarning(
/* If running on Cygwin and we have a stderr channel, use it. */
#if !defined(STATIC_BUILD)
- if (tclStubsPtr->reserved9) {
+ if (tclStubsPtr->tcl_CreateFileHandler) {
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
Tcl_WriteChars(errChannel, title, -1);
diff --git a/win/tkWinInt.h b/win/tkWinInt.h
index ccc57db..30e8c88 100644
--- a/win/tkWinInt.h
+++ b/win/tkWinInt.h
@@ -5,7 +5,7 @@
* Windows-specific parts of Tk, but aren't used by the rest of Tk.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 by Scriptics Corporation.
+ * Copyright (c) 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -142,6 +142,9 @@ MODULE_SCOPE const int tkpWinBltModes[];
#include "tkIntPlatDecls.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
/*
* Special proc needed as tsd accessor function between
* tkWinX.c:GenerateXEvent and tkWinClipboard.c:UpdateClipboard
@@ -201,6 +204,10 @@ MODULE_SCOPE long TkpWinToplevelOverrideRedirect(TkWindow *winPtr,
MODULE_SCOPE void TkpWinToplevelDetachWindow(TkWindow *winPtr);
MODULE_SCOPE int TkpWmGetState(TkWindow *winPtr);
+MODULE_SCOPE int TkTranslateWinEvent(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam, LRESULT *result);
+MODULE_SCOPE void TkWinPointerEvent(HWND hwnd, int x, int y);
+
/*
* The following is implemented in tkWinPointer.c and also used in tkWinWindow.c
*/
@@ -208,6 +215,24 @@ MODULE_SCOPE int TkpWmGetState(TkWindow *winPtr);
MODULE_SCOPE void TkSetCursorPos(int x, int y);
/*
+ * The following is implemented in tkWinSysTray.c
+ */
+
+MODULE_SCOPE int WinIcoInit (Tcl_Interp* interp);
+
+/*
+ * The following is implemented in tkWinGDI.c
+ */
+
+MODULE_SCOPE int Winprint_Init(Tcl_Interp* interp);
+
+/*
+ * The following is implemented in tkWinSysTray.c
+ */
+
+MODULE_SCOPE int WinIcoInit (Tcl_Interp* interp);
+
+/*
* Common routines used in Windows implementation
*/
MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError);
@@ -242,4 +267,8 @@ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError);
#define GWLP_ID GWL_ID
#endif /* !GWLP_WNDPROC */
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _TKWININT */
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index 0cd086c..1183eaa 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -4,7 +4,7 @@
* This file contains X emulation routines for keyboard related
* functions.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -44,7 +44,7 @@ static const KeySym keymap[] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*75 0x4B*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*80 0x50*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*85 0x55*/
- NoSymbol, XK_Win_L, XK_Win_R, XK_App, NoSymbol, /*90 0x5A*/
+ NoSymbol, XK_Super_L, XK_Super_R, XK_Menu, NoSymbol, /*90 0x5A*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*95 0x5F*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*100 0x64*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*105 0x69*/
@@ -99,6 +99,7 @@ TkpGetString(
XKeyEvent *keyEv = &eventPtr->xkey;
int len;
char buf[6];
+ (void)winPtr;
Tcl_DStringInit(dsPtr);
if (keyEv->send_event == -1) {
@@ -156,6 +157,24 @@ XKeycodeToKeysym(
int index)
{
int state = 0;
+ (void)display;
+
+ if (index & 0x01) {
+ state |= ShiftMask;
+ }
+ return KeycodeToKeysym(keycode, state, 0);
+}
+
+KeySym
+XkbKeycodeToKeysym(
+ Display *display,
+ unsigned int keycode,
+ int group,
+ int index)
+{
+ int state = 0;
+ (void)display;
+ (void)group;
if (index & 0x01) {
state |= ShiftMask;
@@ -505,7 +524,7 @@ TkpInitKeymapInfo(
}
dispPtr->numModKeyCodes = 0;
arraySize = KEYCODE_ARRAY_SIZE;
- dispPtr->modKeyCodes = ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode));
+ dispPtr->modKeyCodes = (KeyCode *)ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode));
for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) {
if (*codePtr == 0) {
continue;
@@ -521,18 +540,18 @@ TkpInitKeymapInfo(
}
}
if (dispPtr->numModKeyCodes >= arraySize) {
- KeyCode *new;
+ KeyCode *newKey;
/*
* Ran out of space in the array; grow it.
*/
arraySize *= 2;
- new = ckalloc(arraySize * sizeof(KeyCode));
- memcpy(new, dispPtr->modKeyCodes,
+ newKey = (KeyCode *)ckalloc(arraySize * sizeof(KeyCode));
+ memcpy(newKey, dispPtr->modKeyCodes,
dispPtr->numModKeyCodes * sizeof(KeyCode));
ckfree(dispPtr->modKeyCodes);
- dispPtr->modKeyCodes = new;
+ dispPtr->modKeyCodes = newKey;
}
dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr;
dispPtr->numModKeyCodes++;
@@ -543,7 +562,7 @@ TkpInitKeymapInfo(
/*
* When mapping from a keysym to a keycode, need information about the
- * modifier state that should be used so that when they call XKeycodeToKeysym
+ * modifier state that should be used so that when they call XkbKeycodeToKeysym
* taking into account the xkey.state, they will get back the original keysym.
*/
@@ -556,6 +575,7 @@ TkpSetKeycodeAndState(
int i;
SHORT result;
int shift;
+ (void)tkwin;
eventPtr->xkey.keycode = 0;
if (keySym == NoSymbol) {
@@ -612,6 +632,7 @@ XKeysymToKeycode(
{
int i;
SHORT result;
+ (void)display;
/*
* We check our private map first for a virtual keycode, as VkKeyScan will
@@ -657,10 +678,11 @@ XModifierKeymap *
XGetModifierMapping(
Display *display)
{
- XModifierKeymap *map = ckalloc(sizeof(XModifierKeymap));
+ XModifierKeymap *map = (XModifierKeymap *)ckalloc(sizeof(XModifierKeymap));
+ (void)display;
map->max_keypermod = 1;
- map->modifiermap = ckalloc(sizeof(KeyCode) * 8);
+ map->modifiermap = (KeyCode *)ckalloc(sizeof(KeyCode) * 8);
map->modifiermap[ShiftMapIndex] = VK_SHIFT;
map->modifiermap[LockMapIndex] = VK_CAPITAL;
map->modifiermap[ControlMapIndex] = VK_CONTROL;
@@ -718,6 +740,8 @@ KeySym
XStringToKeysym(
_Xconst char *string)
{
+ (void)string;
+
return NoSymbol;
}
@@ -741,6 +765,8 @@ char *
XKeysymToString(
KeySym keysym)
{
+ (void)keysym;
+
return NULL;
}
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 22e84cb..24e64f1 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -4,8 +4,8 @@
* This module implements the Windows platform-specific features of
* menus.
*
- * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1996-1998 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -686,7 +686,7 @@ ReconfigureWindowsMenu(
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds,
- Tk_PathName(menuPtr->masterMenuPtr->tkwin), -1);
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin), -1);
Tcl_DStringAppend(&ds, ".system", 7);
menuRefPtr = TkFindMenuReferences(menuPtr->interp,
@@ -697,7 +697,7 @@ ReconfigureWindowsMenu(
if ((menuRefPtr != NULL)
&& (menuRefPtr->menuPtr != NULL)
&& (menuPtr->parentTopLevelPtr != NULL)
- && (systemMenuPtr->masterMenuPtr
+ && (systemMenuPtr->mainMenuPtr
== menuRefPtr->menuPtr)) {
HMENU systemMenuHdl = (HMENU) systemMenuPtr->platformData;
HWND wrapper = TkWinGetWrapperWindow(menuPtr
@@ -785,7 +785,7 @@ TkpPostMenu(
return result;
}
- if (index >= menuPtr->numEntries) {
+ if (index >= (int)menuPtr->numEntries) {
index = menuPtr->numEntries - 1;
}
if (index >= 0) {
@@ -843,7 +843,7 @@ TkpPostMenu(
Tcl_SetServiceMode(oldServiceMode);
GetCursorPos(&point);
- Tk_PointerEvent(NULL, point.x, point.y);
+ TkWinPointerEvent(NULL, point.x, point.y);
if (tsdPtr->inPostMenu) {
tsdPtr->inPostMenu = 0;
@@ -882,7 +882,7 @@ TkpPostTearoffMenu(
int result;
(void)dummy;
- if (index >= menuPtr->numEntries) {
+ if (index >= (int)menuPtr->numEntries) {
index = menuPtr->numEntries - 1;
}
if (index >= 0) {
@@ -1253,7 +1253,8 @@ TkWinHandleMenuEvent(
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
*plParam);
if (hashEntryPtr != NULL) {
- int i, len, underline;
+ TkSizeT i, len;
+ int underline;
Tcl_Obj *labelPtr;
WCHAR *wlabel;
int menuChar;
@@ -1280,7 +1281,7 @@ TkWinHandleMenuEvent(
Tcl_DStringFree(&ds);
Tcl_DStringInit(&ds);
wlabel = Tcl_UtfToWCharDString(src, len, &ds);
- if ((underline + 1 < len + 1) && (menuChar ==
+ if (((TkSizeT)underline + 1 < len + 1) && (menuChar ==
Tcl_UniCharToUpper(wlabel[underline]))) {
*plResult = (2 << 16) | i;
returnResult = 1;
@@ -1417,7 +1418,7 @@ TkWinHandleMenuEvent(
}
mePtr = NULL;
if (flags != 0xFFFF) {
- if ((flags&MF_POPUP) && (entryIndex<menuPtr->numEntries)) {
+ if ((flags&MF_POPUP) && (entryIndex < (int)menuPtr->numEntries)) {
mePtr = menuPtr->entries[entryIndex];
} else {
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable,
@@ -1431,7 +1432,7 @@ TkWinHandleMenuEvent(
if ((mePtr == NULL) || (mePtr->state == ENTRY_DISABLED)) {
TkActivateMenuEntry(menuPtr, -1);
} else {
- if (mePtr->index >= menuPtr->numEntries) {
+ if (mePtr->index >= (int)menuPtr->numEntries) {
Tcl_Panic("Trying to activate an entry which doesn't exist");
}
TkActivateMenuEntry(menuPtr, mePtr->index);
@@ -1468,7 +1469,7 @@ void
RecursivelyClearActiveMenu(
TkMenu *menuPtr) /* The menu to reset. */
{
- int i;
+ TkSizeT i;
TkMenuEntry *mePtr;
TkActivateMenuEntry(menuPtr, -1);
@@ -2139,7 +2140,7 @@ DrawMenuUnderline(
int ch;
label = Tcl_GetString(mePtr->labelPtr);
- start = TkUtfAtIndex(label, mePtr->underline);
+ start = Tcl_UtfAtIndex(label, mePtr->underline);
end = start + TkUtfToUniChar(start, &ch);
Tk_UnderlineChars(menuPtr->display, d,
gc, tkfont, label, x + mePtr->indicatorSpace,
@@ -2329,13 +2330,13 @@ TkpInitializeMenuBindings(
"<KeyRelease-Alt_R>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
- "<Alt-KeyPress>", "tk::WinMenuKey %W %N", 0);
+ "<Alt-Key>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
"<Alt-KeyRelease>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
- "<KeyPress-F10>", "tk::WinMenuKey %W %N", 0);
+ "<Key-F10>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
"<KeyRelease-F10>", "tk::WinMenuKey %W %N", 0);
@@ -2968,10 +2969,26 @@ DrawMenuEntryBackground(
{
if (mePtr->state == ENTRY_ACTIVE
|| (mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)!=0 ) {
+ int relief;
+ int activeBorderWidth;
+
bgBorder = activeBorder;
+
+ if ((menuPtr->menuType == MENUBAR)
+ && ((menuPtr->postedCascade == NULL)
+ || (menuPtr->postedCascade != mePtr))) {
+ relief = TK_RELIEF_FLAT;
+ } else {
+ Tk_GetReliefFromObj(NULL, menuPtr->activeReliefPtr, &relief);
+ }
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
+ menuPtr->activeBorderWidthPtr, &activeBorderWidth);
+ Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height,
+ activeBorderWidth, relief);
+ } else {
+ Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0,
+ TK_RELIEF_FLAT);
}
- Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0,
- TK_RELIEF_FLAT);
}
/*
@@ -3029,7 +3046,7 @@ TkpComputeStandardMenuGeometry(
Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin,
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
- for (i = 0; i < menuPtr->numEntries; i++) {
+ for (i = 0; i < (int)menuPtr->numEntries; i++) {
if (menuPtr->entries[i]->fontPtr == NULL) {
tkfont = menuFont;
fmPtr = &menuMetrics;
@@ -3113,7 +3130,7 @@ TkpComputeStandardMenuGeometry(
if (accelWidth != 0) {
labelWidth += accelSpace;
}
- for (j = lastColumnBreak; j < menuPtr->numEntries; j++) {
+ for (j = lastColumnBreak; j < (int)menuPtr->numEntries; j++) {
menuPtr->entries[j]->indicatorSpace = indicatorSpace;
menuPtr->entries[j]->labelWidth = labelWidth;
menuPtr->entries[j]->width = indicatorSpace + labelWidth
@@ -3214,7 +3231,7 @@ TkpMenuNotifyToplevelCreate(
if ((menuName != NULL) && (menuName[0] != '\0')) {
menuRefPtr = TkFindMenuReferences(interp, menuName);
if ((menuRefPtr != NULL) && (menuRefPtr->menuPtr != NULL)) {
- for (menuPtr = menuRefPtr->menuPtr->masterMenuPtr; menuPtr != NULL;
+ for (menuPtr = menuRefPtr->menuPtr->mainMenuPtr; menuPtr != NULL;
menuPtr = menuPtr->nextInstancePtr) {
if (menuPtr->menuType == MENUBAR) {
ScheduleMenuReconfigure(menuPtr);
@@ -3346,7 +3363,7 @@ TkWinGetMenuSystemDefault(
if ((strcmp(dbName, "activeBorderWidth") == 0) ||
(strcmp(dbName, "borderWidth") == 0)) {
- valuePtr = Tcl_NewIntObj(defaultBorderWidth);
+ valuePtr = Tcl_NewWideIntObj(defaultBorderWidth);
} else if (strcmp(dbName, "font") == 0) {
valuePtr = Tcl_NewStringObj(Tcl_DStringValue(&menuFontDString), -1);
}
@@ -3385,12 +3402,7 @@ SetDefaults(
int pointSize;
HFONT menuFont;
/* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */
- struct {
- NONCLIENTMETRICSW metrics;
-#if (WINVER < 0x0600)
- int padding;
-#endif
- } nc;
+ NONCLIENTMETRICSW metrics;
/*
* Set all of the default options. The loop will terminate when we run out
@@ -3408,15 +3420,15 @@ SetDefaults(
}
Tcl_DStringInit(&menuFontDString);
- nc.metrics.cbSize = sizeof(nc);
+ metrics.cbSize = sizeof(metrics);
if (TkWinGetPlatformTheme() != TK_THEME_WIN_VISTA) {
- nc.metrics.cbSize -= sizeof(int);
+ metrics.cbSize -= sizeof(int);
}
- SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize,
- &nc.metrics, 0);
- menuFont = CreateFontIndirectW(&nc.metrics.lfMenuFont);
+ SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, metrics.cbSize,
+ &metrics, 0);
+ menuFont = CreateFontIndirectW(&metrics.lfMenuFont);
SelectObject(scratchDC, menuFont);
GetTextMetricsW(scratchDC, &tm);
GetTextFaceA(scratchDC, LF_FACESIZE, faceName);
diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c
index e28f348..d87fb34 100644
--- a/win/tkWinPixmap.c
+++ b/win/tkWinPixmap.c
@@ -4,7 +4,7 @@
* This file contains the Xlib emulation functions pertaining to creating
* and destroying pixmaps.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -42,7 +42,7 @@ Tk_GetPixmap(
display->request++;
- newTwdPtr = ckalloc(sizeof(TkWinDrawable));
+ newTwdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable));
newTwdPtr->type = TWD_BITMAP;
newTwdPtr->bitmap.depth = depth;
twdPtr = (TkWinDrawable *) d;
@@ -208,6 +208,12 @@ XGetGeometry(
unsigned int *depth_return)
{
TkWinDrawable *twdPtr = (TkWinDrawable *)d;
+ (void)display;
+ (void)root_return;
+ (void)x_return;
+ (void)y_return;
+ (void)border_width_return;
+ (void)depth_return;
if (twdPtr->type == TWD_BITMAP) {
HDC dc;
diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c
index 8f42dcd..46dbaa2 100644
--- a/win/tkWinPointer.c
+++ b/win/tkWinPointer.c
@@ -3,8 +3,8 @@
*
* Windows specific mouse tracking code.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -93,7 +93,7 @@ TkWinGetModifierState(void)
/*
*----------------------------------------------------------------------
*
- * Tk_PointerEvent --
+ * TkWinPointerEvent --
*
* This procedure is called for each pointer-related event. It converts
* the position to root coords and updates the global pointer state
@@ -109,7 +109,7 @@ TkWinGetModifierState(void)
*/
void
-Tk_PointerEvent(
+TkWinPointerEvent(
HWND hwnd, /* Window for coords, or NULL for the root
* window. */
int x, int y) /* Coords relative to hwnd, or screen if hwnd
@@ -179,6 +179,12 @@ XGrabKeyboard(
int keyboard_mode,
Time time)
{
+ (void)display;
+ (void)owner_events;
+ (void)pointer_mode;
+ (void)keyboard_mode;
+ (void)time;
+
keyboardWinPtr = TkWinGetWinPtr(grab_window);
return GrabSuccess;
}
@@ -204,6 +210,9 @@ XUngrabKeyboard(
Display *display,
Time time)
{
+ (void)display;
+ (void)time;
+
keyboardWinPtr = NULL;
return Success;
}
@@ -226,14 +235,15 @@ XUngrabKeyboard(
void
MouseTimerProc(
- ClientData clientData)
+ ClientData dummy)
{
POINT pos;
+ (void)dummy;
mouseTimerSet = 0;
GetCursorPos(&pos);
- Tk_PointerEvent(NULL, pos.x, pos.y);
+ TkWinPointerEvent(NULL, pos.x, pos.y);
}
/*
@@ -285,6 +295,7 @@ TkGetPointerCoords(
int *xPtr, int *yPtr) /* Store pointer coordinates here. */
{
POINT point;
+ (void)tkwin;
GetCursorPos(&point);
*xPtr = point.x;
@@ -322,6 +333,12 @@ XQueryPointer(
int *win_y_return,
unsigned int *mask_return)
{
+ (void)w;
+ (void)root_return;
+ (void)child_return;
+ (void)win_x_return;
+ (void)win_y_return;
+
display->request++;
TkGetPointerCoords(NULL, root_x_return, root_y_return);
*mask_return = TkWinGetModifierState();
@@ -396,6 +413,12 @@ XWarpPointer(
int dest_y)
{
RECT r;
+ (void)display;
+ (void)src_w;
+ (void)src_x;
+ (void)src_y;
+ (void)src_width;
+ (void)src_height;
GetWindowRect(Tk_GetHWND(dest_w), &r);
TkSetCursorPos(r.left+dest_x, r.top+dest_y);
@@ -440,7 +463,7 @@ XGetInputFocus(
{
Tk_Window tkwin = Tk_HWNDToWindow(GetFocus());
- *focus_return = tkwin ? Tk_WindowId(tkwin) : None;
+ *focus_return = tkwin ? Tk_WindowId(tkwin) : 0;
*revert_to_return = RevertToParent;
display->request++;
return Success;
@@ -470,6 +493,9 @@ XSetInputFocus(
int revert_to,
Time time)
{
+ (void)revert_to;
+ (void)time;
+
display->request++;
if (focus != None) {
SetFocus(Tk_GetHWND(focus));
diff --git a/win/tkWinRegion.c b/win/tkWinRegion.c
index a2f6fd7..95ddc8b 100644
--- a/win/tkWinRegion.c
+++ b/win/tkWinRegion.c
@@ -3,7 +3,7 @@
*
* Tk Region emulation code.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -11,13 +11,6 @@
#include "tkWinInt.h"
-#undef TkCreateRegion
-#undef TkDestroyRegion
-#undef TkClipBox
-#undef TkIntersectRegion
-#undef TkUnionRectWithRegion
-#undef TkRectInRegion
-#undef TkSubtractRegion
/*
*----------------------------------------------------------------------
diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c
index 409a6db..4557bca 100644
--- a/win/tkWinScrlbr.c
+++ b/win/tkWinScrlbr.c
@@ -4,7 +4,7 @@
* This file implements the Windows specific portion of the scrollbar
* widget.
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -497,7 +497,7 @@ ScrollbarProc(
int code;
GetCursorPos(&point);
- Tk_TranslateWinEvent(NULL, WM_MOUSEMOVE, 0,
+ TkTranslateWinEvent(NULL, WM_MOUSEMOVE, 0,
MAKELPARAM(point.x, point.y), &result);
if (command == SB_ENDSCROLL) {
@@ -564,7 +564,7 @@ ScrollbarProc(
}
default:
- if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ if (TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
return result;
}
}
@@ -591,10 +591,11 @@ ScrollbarProc(
void
TkpConfigureScrollbar(
- TCL_UNUSED(TkScrollbar *))
+ TkScrollbar *scrollPtr)
/* Information about widget; may or may not
* already have values for some fields. */
{
+ (void)scrollPtr;
}
/*
diff --git a/win/tkWinSend.c b/win/tkWinSend.c
index d1d6777..f21af01 100644
--- a/win/tkWinSend.c
+++ b/win/tkWinSend.c
@@ -4,8 +4,8 @@
* This file provides functions that implement the "send" command,
* allowing commands to be passed from interpreter to interpreter.
*
- * Copyright (c) 1997 by Sun Microsystems, Inc.
- * Copyright (c) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * Copyright © 1997 Sun Microsystems, Inc.
+ * Copyright © 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c
index 536c6c1..b783ee3 100644
--- a/win/tkWinSendCom.c
+++ b/win/tkWinSendCom.c
@@ -13,7 +13,7 @@
* In other words the Send methods takes a string and evaluates this in the
* Tcl interpreter. The result is returned as another string.
*
- * Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * Copyright © 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -432,7 +432,7 @@ Async(
static HRESULT
Send(
- TkWinSendCom *obj,
+ TkWinSendCom *comobj,
VARIANT vCmd,
VARIANT *pvResult,
EXCEPINFO *pExcepInfo,
@@ -441,7 +441,7 @@ Send(
HRESULT hr = S_OK;
int result = TCL_OK;
VARIANT v;
- Tcl_Interp *interp = obj->interp;
+ Tcl_Interp *interp = comobj->interp;
Tcl_Obj *scriptPtr;
Tcl_DString ds;
(void)puArgErr;
diff --git a/win/tkWinSendCom.h b/win/tkWinSendCom.h
index cd6ec18..d20b48c 100644
--- a/win/tkWinSendCom.h
+++ b/win/tkWinSendCom.h
@@ -5,7 +5,7 @@
* command, allowing commands to be passed from interpreter to
* interpreter.
*
- * Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * Copyright © 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/win/tkWinSysTray.c b/win/tkWinSysTray.c
new file mode 100644
index 0000000..aca9eb9
--- /dev/null
+++ b/win/tkWinSysTray.c
@@ -0,0 +1,1193 @@
+/*
+ * tkWinSysTray.c --
+ *
+ * tkWinSysTray.c implements a "systray" Tcl command which permits to
+ * change the system tray/taskbar icon of a Tk toplevel window and
+ * a "sysnotify" command to post system notifications.
+ *
+ * Copyright © 1995-1996 Microsoft Corp.
+ * Copyright © 1998 Brueckner & Jarosch Ing.GmbH, Erfurt, Germany
+ * Copyright © 2020 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 2020 Eric Boudaillier.
+ * Copyright © 2020 Francois Vogel.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkInt.h"
+#include <windows.h>
+#include <shellapi.h>
+#include "tkWin.h"
+#include "tkWinInt.h"
+#include "tkWinIco.h"
+
+/*
+ * Based extensively on the winico extension and sample code from Microsoft.
+ * Some of the code was adapted into tkWinWM.c to implement the "wm iconphoto"
+ * command (TIP 159), and here we are borrowing that code to use Tk images
+ * to create system tray icons instead of ico files. Additionally, we are
+ * removing obsolete parts of the winico extension, and implementing
+ * more of the Shell_Notification API to add balloon/system notifications.
+ */
+
+#define GETHINSTANCE Tk_GetHINSTANCE()
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+#ifdef _MSC_VER
+/*
+ * Earlier versions of MSVC don't know snprintf, but _snprintf is compatible.
+ * Note that sprintf is deprecated.
+ */
+# define snprintf _snprintf
+#endif
+
+typedef struct IcoInfo {
+ HICON hIcon; /* icon handle returned by LoadIcon. */
+ unsigned id; /* Identifier for command; used to
+ * cancel it. */
+ Tcl_Obj *taskbar_txt; /* text to display in the taskbar */
+ Tcl_Interp *interp; /* interp which created the icon */
+ Tcl_Obj *taskbar_command; /* command to eval if events in the taskbar
+ * arrive */
+ int taskbar_flags; /* taskbar related flags*/
+ HWND hwndFocus;
+ struct IcoInfo *nextPtr;
+} IcoInfo;
+
+/* Per-interp struture */
+typedef struct IcoInterpInfo {
+ HWND hwnd; /* Handler window */
+ int counter; /* Counter for IcoInfo id generation */
+ IcoInfo *firstIcoPtr; /* List of created IcoInfo */
+ struct IcoInterpInfo *nextPtr;
+} IcoInterpInfo;
+
+#define TASKBAR_ICON 1
+#define ICON_MESSAGE WM_USER + 1234
+
+#define HANDLER_CLASS "Wtk_TaskbarHandler"
+static HWND CreateTaskbarHandlerWindow(void);
+
+static IcoInterpInfo *firstIcoInterpPtr = NULL;
+static Tk_EventProc WinIcoDestroy;
+
+/*
+ * If someone wants to see the several masks somewhere on the screen...
+ * set the ICO_DRAW define and feel free to make some Tcl commands
+ * for accessing it. The normal drawing of an Icon to a DC is really easy:
+ * DrawIcon(hdc,x,y,hIcon) or , more complicated
+ * DrawIconEx32PlusMoreParameters ...
+ */
+
+/* #define ICO_DRAW */
+#ifdef ICO_DRAW
+#define RectWidth(r)((r).right - (r).left + 1)
+#define RectHeight(r)((r).bottom - (r).top + 1)
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawXORMask --
+ *
+ * Using DIB functions, draw XOR mask on hDC in Rect.
+ *
+ * Results:
+ * Icon is rendered.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static BOOL
+DrawXORMask(
+ HDC hDC,
+ RECT Rect,
+ LPLPICONIMAGE lpIcon)
+{
+ int x, y;
+
+ /* Sanity checks */
+ if (lpIcon == NULL)
+ return FALSE;
+ if (lpIcon->lpBits == NULL)
+ return FALSE;
+
+ /* Account for height*2 thing */
+ lpIcon->lpbi->bmiHeader.biHeight /= 2;
+
+ /* Locate it */
+ x = Rect.left + ((RectWidth(Rect) - lpIcon->lpbi->bmiHeader.biWidth) / 2);
+ y = Rect.top + ((RectHeight(Rect) - lpIcon->lpbi->bmiHeader.biHeight) / 2);
+
+ /* Blast it to the screen */
+ SetDIBitsToDevice(hDC, x, y,
+ lpIcon->lpbi->bmiHeader.biWidth,
+ lpIcon->lpbi->bmiHeader.biHeight,
+ 0, 0, 0, lpIcon->lpbi->bmiHeader.biHeight,
+ lpIcon->lpXOR, lpIcon->lpbi, DIB_RGB_COLORS);
+
+ /* UnAccount for height*2 thing */
+ lpIcon->lpbi->bmiHeader.biHeight *= 2;
+
+ return TRUE;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawANDMask --
+ *
+ * Using DIB functions, draw AND mask on hDC in Rect.
+ *
+ * Results:
+ * Icon is rendered.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+BOOL
+DrawANDMask(
+ HDC hDC,
+ RECT Rect,
+ LPLPICONIMAGE lpIcon)
+{
+ LPBITMAPINFO lpbi;
+ int x, y;
+
+ /* Sanity checks */
+ if (lpIcon == NULL)
+ return FALSE;
+ if (lpIcon->lpBits == NULL)
+ return FALSE;
+
+ /* Need a bitmap header for the mono mask */
+ lpbi = ckalloc(sizeof(BITMAPINFO) + (2 * sizeof(RGBQUAD)));
+ lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ lpbi->bmiHeader.biWidth = lpIcon->lpbi->bmiHeader.biWidth;
+ lpbi->bmiHeader.biHeight = lpIcon->lpbi->bmiHeader.biHeight / 2;
+ lpbi->bmiHeader.biPlanes = 1;
+ lpbi->bmiHeader.biBitCount = 1;
+ lpbi->bmiHeader.biCompression = BI_RGB;
+ lpbi->miHeader.biSizeImage = 0;
+ lpbi->bmiHeader.biXPelsPerMeter = 0;
+ lpbi->bmiHeader.biYPelsPerMeter = 0;
+ lpbi->bmiHeader.biClrUsed = 0;
+ lpbi->bmiHeader.biClrImportant = 0;
+ lpbi->bmiColors[0].rgbRed = 0;
+ lpbi->bmiColors[0].rgbGreen = 0;
+ lpbi->bmiColors[0].rgbBlue = 0;
+ lpbi->bmiColors[0].rgbReserved = 0;
+ lpbi->bmiColors[1].rgbRed = 255;
+ lpbi->bmiColors[1].rgbGreen = 255;
+ lpbi->bmiColors[1].rgbBlue = 255;
+ lpbi->bmiColors[1].rgbReserved = 0;
+
+ /* Locate it */
+ x = Rect.left + ((RectWidth(Rect) - lpbi->bmiHeader.biWidth) / 2);
+ y = Rect.top + ((RectHeight(Rect) - lpbi->bmiHeader.biHeight) / 2);
+
+ /* Blast it to the screen */
+ SetDIBitsToDevice(hDC, x, y,
+ lpbi->bmiHeader.biWidth,
+ lpbi->bmiHeader.biHeight,
+ 0, 0, 0, lpbi->bmiHeader.biHeight,
+ lpIcon->lpAND, lpbi, DIB_RGB_COLORS);
+
+ /* clean up */
+ ckfree((char *) lpbi);
+
+ return TRUE;
+}
+#endif /* ICO_DRAW */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TaskbarOperation --
+ *
+ * Management of icon display.
+ *
+ * Results:
+ * Icon is displayed or deleted.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TaskbarOperation(
+ IcoInterpInfo *icoInterpPtr,
+ IcoInfo *icoPtr,
+ int oper)
+{
+ NOTIFYICONDATAW ni;
+ WCHAR *str;
+
+ ni.cbSize = sizeof(NOTIFYICONDATAW);
+ ni.hWnd = icoInterpPtr->hwnd;
+ ni.uID = icoPtr->id;
+ ni.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
+ ni.uCallbackMessage = ICON_MESSAGE;
+ ni.hIcon = icoPtr->hIcon;
+
+ if (icoPtr->taskbar_txt != NULL) {
+ Tcl_DString dst;
+ Tcl_DStringInit(&dst);
+ str = (WCHAR *)Tcl_UtfToWCharDString(Tcl_GetString(icoPtr->taskbar_txt), -1, &dst);
+ wcsncpy(ni.szTip, str, (Tcl_DStringLength(&dst) + 2) / 2);
+ Tcl_DStringFree(&dst);
+ } else {
+ ni.szTip[0] = 0;
+ }
+
+ if (Shell_NotifyIconW(oper, &ni) == 1) {
+ if (oper == NIM_ADD || oper == NIM_MODIFY) {
+ icoPtr->taskbar_flags |= TASKBAR_ICON;
+ }
+ if (oper == NIM_DELETE) {
+ icoPtr->taskbar_flags &= ~TASKBAR_ICON;
+ }
+ }
+ /* Silently ignore error? */
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * NewIcon --
+ *
+ * Create icon for display in system tray.
+ *
+ * Results:
+ * Icon is created for display.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static IcoInfo *
+NewIcon(
+ Tcl_Interp *interp,
+ IcoInterpInfo *icoInterpPtr,
+ HICON hIcon)
+{
+ IcoInfo *icoPtr;
+
+ icoPtr = (IcoInfo *)ckalloc(sizeof(IcoInfo));
+ memset(icoPtr, 0, sizeof(IcoInfo));
+ icoPtr->id = ++icoInterpPtr->counter;
+ icoPtr->hIcon = hIcon;
+ icoPtr->taskbar_txt = NULL;
+ icoPtr->interp = interp;
+ icoPtr->taskbar_command = NULL;
+ icoPtr->taskbar_flags = 0;
+ icoPtr->hwndFocus = NULL;
+ icoPtr->nextPtr = icoInterpPtr->firstIcoPtr;
+ icoInterpPtr->firstIcoPtr = icoPtr;
+ return icoPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FreeIcoPtr --
+ *
+ * Delete icon and free memory.
+ *
+ * Results:
+ * Icon is removed from display.
+ *
+ * Side effects:
+ * Memory/resources freed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+FreeIcoPtr(
+ IcoInterpInfo *icoInterpPtr,
+ IcoInfo *icoPtr)
+{
+ IcoInfo *prevPtr;
+ if (icoInterpPtr->firstIcoPtr == icoPtr) {
+ icoInterpPtr->firstIcoPtr = icoPtr->nextPtr;
+ } else {
+ for (prevPtr = icoInterpPtr->firstIcoPtr; prevPtr->nextPtr != icoPtr;
+ prevPtr = prevPtr->nextPtr) {
+ /* Empty loop body. */
+ }
+ prevPtr->nextPtr = icoPtr->nextPtr;
+ }
+ if (icoPtr->taskbar_flags & TASKBAR_ICON) {
+ TaskbarOperation(icoInterpPtr, icoPtr, NIM_DELETE);
+ }
+ if (icoPtr->taskbar_txt != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_txt);
+ }
+ if (icoPtr->taskbar_command != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_command);
+ }
+ ckfree(icoPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetIcoPtr --
+ *
+ * Get pointer to icon for display.
+ *
+ * Results:
+ * Icon is obtained for display.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static IcoInfo *
+GetIcoPtr(
+ Tcl_Interp *interp,
+ IcoInterpInfo *icoInterpPtr,
+ const char *string)
+{
+ IcoInfo *icoPtr;
+ unsigned id;
+ const char *start;
+ char *end;
+
+ if (strncmp(string, "ico#", 4) != 0) {
+ goto notfound;
+ }
+ start = string + 4;
+ id = strtoul(start, &end, 10);
+ if ((end == start) || (*end != 0)) {
+ goto notfound;
+ }
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
+ if (icoPtr->id == id) {
+ return icoPtr;
+ }
+ }
+
+notfound:
+ Tcl_AppendResult(interp, "icon \"", string,
+ "\" doesn't exist", (char *) NULL);
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetInt --
+ *
+ * Utility function for calculating buffer length.
+ *
+ * Results:
+ * Length.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GetInt(
+ long theint,
+ char *buffer,
+ size_t len)
+{
+ snprintf(buffer, len, "0x%lx", theint);
+ buffer[len - 1] = 0;
+ return (int) strlen(buffer);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetIntDec --
+ *
+ * Utility function for calculating buffer length.
+ *
+ * Results:
+ * Length.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GetIntDec(
+ long theint,
+ char *buffer,
+ size_t len)
+{
+ snprintf(buffer, len - 1, "%ld", theint);
+ buffer[len - 1] = 0;
+ return (int) strlen(buffer);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TaskbarExpandPercents --
+ *
+ * Parse strings in taskbar display.
+ *
+ * Results:
+ * Strings.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static char*
+TaskbarExpandPercents(
+ IcoInfo *icoPtr,
+ const char *msgstring,
+ WPARAM wParam,
+ LPARAM lParam,
+ char *before,
+ char *after,
+ int *aftersize)
+{
+#define SPACELEFT (*aftersize-(dst-after)-1)
+#define AFTERLEN ((*aftersize>0)?(*aftersize*2):1024)
+#define ALLOCLEN ((len>AFTERLEN)?(len*2):AFTERLEN)
+ char buffer[TCL_INTEGER_SPACE + 5];
+ char* dst;
+ dst = after;
+ while (*before) {
+ const char *ptr = before;
+ int len = 1;
+ if(*before == '%') {
+ switch(before[1]){
+ case 'M':
+ case 'm': {
+ before++;
+ len = strlen(msgstring);
+ ptr = msgstring;
+ break;
+ }
+ /* case 'W': {
+ before++;
+ len = (int)strlen(winstring);
+ ptr = winstring;
+ break;
+ }
+ */
+ case 'i': {
+ before++;
+ snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id);
+ len = strlen(buffer);
+ ptr = buffer;
+ break;
+ }
+ case 'w': {
+ before++;
+ len = GetInt((long)wParam,buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'l': {
+ before++;
+ len = GetInt((long)lParam,buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 't': {
+ before++;
+ len = GetInt((long)GetTickCount(), buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'x': {
+ POINT pt;
+ GetCursorPos(&pt);
+ before++;
+ len = GetIntDec((long)pt.x, buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'y': {
+ POINT pt;
+ GetCursorPos(&pt);
+ before++;
+ len = GetIntDec((long)pt.y,buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'X': {
+ DWORD dw;
+ dw = GetMessagePos();
+ before++;
+ len = GetIntDec((long)LOWORD(dw),buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'Y': {
+ DWORD dw;
+ dw = GetMessagePos();
+ before++;
+ len = GetIntDec((long)HIWORD(dw),buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'H': {
+ before++;
+ len = GetInt(PTR2INT(icoPtr->hwndFocus), buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case '%': {
+ before++;
+ len = 1;
+ ptr = "%";
+ break;
+ }
+ }
+ }
+ if (SPACELEFT < len) {
+ char *newspace;
+ ptrdiff_t dist = dst - after;
+ int alloclen = ALLOCLEN;
+ newspace = (char *)ckalloc(alloclen);
+ if (dist>0)
+ memcpy(newspace, after, dist);
+ if (after && *aftersize) {
+ ckfree(after);
+ }
+ *aftersize =alloclen;
+ after = newspace;
+ dst = after + dist;
+ }
+ if (len > 0) {
+ memcpy(dst, ptr, len);
+ }
+ dst += len;
+ if ((dst-after)>(*aftersize-1)) {
+ printf("oops\n");
+ }
+ before++;
+ }
+ *dst = 0;
+ return after;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TaskbarEval --
+ *
+ * Parse mouse and keyboard events over taskbar.
+ *
+ * Results:
+ * Event processing.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TaskbarEval(
+ IcoInfo *icoPtr,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ const char *msgstring = "none";
+ char evalspace[200];
+ int evalsize = 200;
+ char *expanded;
+ int fixup = 0;
+
+ switch (lParam) {
+ case WM_MOUSEMOVE:
+ msgstring = "WM_MOUSEMOVE";
+ icoPtr->hwndFocus = GetFocus();
+ break;
+ case WM_LBUTTONDOWN:
+ msgstring = "WM_LBUTTONDOWN";
+ fixup = 1;
+ break;
+ case WM_LBUTTONUP:
+ msgstring = "WM_LBUTTONUP";
+ fixup = 1;
+ break;
+ case WM_LBUTTONDBLCLK:
+ msgstring = "WM_LBUTTONDBLCLK";
+ fixup = 1;
+ break;
+ case WM_RBUTTONDOWN:
+ msgstring = "WM_RBUTTONDOWN";
+ fixup = 1;
+ break;
+ case WM_RBUTTONUP:
+ msgstring = "WM_RBUTTONUP";
+ fixup = 1;
+ break;
+ case WM_RBUTTONDBLCLK:
+ msgstring = "WM_RBUTTONDBLCLK";
+ fixup = 1;
+ break;
+ case WM_MBUTTONDOWN:
+ msgstring = "WM_MBUTTONDOWN";
+ fixup = 1;
+ break;
+ case WM_MBUTTONUP:
+ msgstring = "WM_MBUTTONUP";
+ fixup = 1;
+ break;
+ case WM_MBUTTONDBLCLK:
+ msgstring = "WM_MBUTTONDBLCLK";
+ fixup = 1;
+ break;
+ default:
+ msgstring = "WM_NULL";
+ fixup = 0;
+ }
+ expanded = TaskbarExpandPercents(icoPtr, msgstring, wParam, lParam,
+ Tcl_GetString(icoPtr->taskbar_command), evalspace, &evalsize);
+ if (icoPtr->interp != NULL) {
+ int result;
+ HWND hwnd = NULL;
+
+ /* See http://support.microsoft.com/kb/q135788/
+ * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */
+ if (fixup) {
+ if (icoPtr->hwndFocus != NULL && IsWindow(icoPtr->hwndFocus)) {
+ hwnd = icoPtr->hwndFocus;
+ } else {
+ Tk_Window tkwin = Tk_MainWindow(icoPtr->interp);
+ if (tkwin != NULL) {
+ hwnd = Tk_GetHWND(Tk_WindowId(tkwin));
+ }
+ }
+ if (hwnd != NULL) {
+ SetForegroundWindow(hwnd);
+ }
+ }
+
+ result = Tcl_GlobalEval(icoPtr->interp, expanded);
+
+ if (hwnd != NULL) {
+ /* See http://support.microsoft.com/kb/q135788/
+ * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */
+ PostMessageW(hwnd, WM_NULL, 0, 0);
+ }
+ if (result != TCL_OK) {
+ char buffer[100];
+ sprintf(buffer, "\n (command bound to taskbar-icon ico#%d)", icoPtr->id);
+ Tcl_AddErrorInfo(icoPtr->interp, buffer);
+ Tcl_BackgroundError(icoPtr->interp);
+ }
+ }
+ if (expanded != evalspace) {
+ ckfree(expanded);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TaskbarHandlerProc --
+ *
+ * Windows callback procedure, if ICON_MESSAGE arrives, try to execute
+ * the taskbar_command.
+ *
+ * Results:
+ * Command execution.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static LRESULT CALLBACK
+TaskbarHandlerProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ static UINT msgTaskbarCreated = 0;
+ IcoInterpInfo *icoInterpPtr;
+ IcoInfo *icoPtr;
+
+ switch (message) {
+ case WM_CREATE:
+ msgTaskbarCreated = RegisterWindowMessage(TEXT("TaskbarCreated"));
+ break;
+
+ case ICON_MESSAGE:
+ for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) {
+ if (icoInterpPtr->hwnd == hwnd) {
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
+ if (icoPtr->id == wParam) {
+ if (icoPtr->taskbar_command != NULL) {
+ TaskbarEval(icoPtr, wParam, lParam);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ break;
+
+ default:
+ /*
+ * Check to see if explorer has been restarted and we need to
+ * re-add our icons.
+ */
+ if (message == msgTaskbarCreated) {
+ for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) {
+ if (icoInterpPtr->hwnd == hwnd) {
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
+ if (icoPtr->taskbar_flags & TASKBAR_ICON) {
+ TaskbarOperation(icoInterpPtr, icoPtr, NIM_ADD);
+ }
+ }
+ break;
+ }
+ }
+ }
+ return DefWindowProc(hwnd, message, wParam, lParam);
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RegisterHandlerClass --
+ *
+ * Registers the handler window class.
+ *
+ * Results:
+ * Handler class registered.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+RegisterHandlerClass(
+ HINSTANCE hInstance)
+{
+ WNDCLASS wndclass;
+ memset(&wndclass, 0, sizeof(WNDCLASS));
+ wndclass.style = 0;
+ wndclass.lpfnWndProc = TaskbarHandlerProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = hInstance;
+ wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wndclass.lpszMenuName = NULL;
+ wndclass.lpszClassName = HANDLER_CLASS;
+ return RegisterClass(&wndclass);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CreateTaskbarHandlerWindow --
+ *
+ * Creates a hidden window to handle taskbar messages.
+ *
+ * Results:
+ * Hidden window created.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HWND
+CreateTaskbarHandlerWindow(void) {
+ static int registered = 0;
+ HINSTANCE hInstance = GETHINSTANCE;
+ if (!registered) {
+ if (!RegisterHandlerClass(hInstance))
+ return 0;
+ registered = 1;
+ }
+ return CreateWindow(HANDLER_CLASS, "", WS_OVERLAPPED, 0, 0,
+ CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WinIcoDestroy --
+ *
+ * Event handler to delete systray icons when interp main window
+ * is deleted, either by destroy, interp deletion or application
+ * exit.
+ *
+ * Results:
+ * Icon/window removed and memory freed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+WinIcoDestroy(
+ ClientData clientData,
+ XEvent *eventPtr)
+{
+ IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData;
+ IcoInterpInfo *prevIcoInterpPtr;
+ IcoInfo *icoPtr;
+ IcoInfo *nextPtr;
+
+ if (eventPtr->type != DestroyNotify) {
+ return;
+ }
+
+ if (firstIcoInterpPtr == icoInterpPtr) {
+ firstIcoInterpPtr = icoInterpPtr->nextPtr;
+ } else {
+ for (prevIcoInterpPtr = firstIcoInterpPtr; prevIcoInterpPtr->nextPtr != icoInterpPtr;
+ prevIcoInterpPtr = prevIcoInterpPtr->nextPtr) {
+ /* Empty loop body. */
+ }
+ prevIcoInterpPtr->nextPtr = icoInterpPtr->nextPtr;
+ }
+
+ DestroyWindow(icoInterpPtr->hwnd);
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = nextPtr) {
+ nextPtr = icoPtr->nextPtr;
+ FreeIcoPtr(icoInterpPtr, icoPtr);
+ }
+ ckfree((char *) icoInterpPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WinSystrayCmd --
+ *
+ * Main command for creating, displaying, and removing icons from taskbar.
+ *
+ * Results:
+ * Management of icon display in taskbar/system tray.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WinSystrayCmd(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ static const char *const cmdStrings[] = {
+ "add", "delete", "modify", NULL
+ };
+ enum { CMD_ADD, CMD_DELETE, CMD_MODIFY };
+ static const char *const optStrings[] = {
+ "-image", "-text", "-callback", NULL
+ };
+ enum { OPT_IMAGE, OPT_TEXT, OPT_CALLBACK };
+ int cmd, opt;
+
+ HICON hIcon;
+ int i;
+ IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData;
+ IcoInfo *icoPtr = NULL;
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "command ...");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(interp, objv[1], cmdStrings, "command",
+ 0, &cmd) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ switch (cmd) {
+ case CMD_ADD:
+ case CMD_MODIFY: {
+ Tcl_Obj *imageObj = NULL, *textObj = NULL, *callbackObj = NULL;
+ int optStart;
+ int oper;
+ if (cmd == CMD_ADD) {
+ optStart = 2;
+ oper = NIM_ADD;
+ } else {
+ optStart = 3;
+ oper = NIM_MODIFY;
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "id option value");
+ return TCL_ERROR;
+ }
+ icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
+ if (icoPtr == NULL) {
+ return TCL_ERROR;
+ }
+ }
+ for (i = optStart; i < objc; i += 2) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option",
+ 0, &opt) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (i+1 >= objc) {
+ Tcl_AppendResult(interp,
+ "missing value for option \"", Tcl_GetString(objv[i]),
+ "\"", NULL);
+ return TCL_ERROR;
+ }
+ switch (opt) {
+ case OPT_IMAGE:
+ imageObj = objv[i+1];
+ break;
+ case OPT_TEXT:
+ textObj = objv[i+1];
+ break;
+ case OPT_CALLBACK:
+ callbackObj = objv[i+1];
+ break;
+ }
+ }
+ if (cmd == CMD_ADD && imageObj == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("missing required option \"-image\"", -1));
+ return TCL_ERROR;
+ }
+ if (imageObj != NULL) {
+ Tk_PhotoHandle photo;
+ int width, height;
+ Tk_PhotoImageBlock block;
+
+ photo = Tk_FindPhoto(interp, Tcl_GetString(imageObj));
+ if (photo == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "image \"%s\" doesn't exist", Tcl_GetString(imageObj)));
+ return TCL_ERROR;
+ }
+ Tk_PhotoGetSize(photo, &width, &height);
+ Tk_PhotoGetImage(photo, &block);
+ hIcon = CreateIcoFromPhoto(width, height, block);
+ if (hIcon == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "failed to create an iconphoto with image \"%s\"", Tcl_GetString(imageObj)));
+ return TCL_ERROR;
+ }
+ }
+ if (cmd == CMD_ADD) {
+ icoPtr = NewIcon(interp, icoInterpPtr, hIcon);
+ } else {
+ if (imageObj != NULL) {
+ DestroyIcon(icoPtr->hIcon);
+ icoPtr->hIcon = hIcon;
+ }
+ }
+ if (callbackObj != NULL) {
+ if (icoPtr->taskbar_command != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_command);
+ }
+ icoPtr->taskbar_command = callbackObj;
+ Tcl_IncrRefCount(icoPtr->taskbar_command);
+ }
+ if (textObj != NULL) {
+ if (icoPtr->taskbar_txt != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_txt);
+ }
+ icoPtr->taskbar_txt = textObj;
+ Tcl_IncrRefCount(icoPtr->taskbar_txt);
+ }
+ TaskbarOperation(icoInterpPtr, icoPtr, oper);
+ if (cmd == CMD_ADD) {
+ char buffer[5 + TCL_INTEGER_SPACE];
+ int n;
+ n = _snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id);
+ buffer[n] = 0;
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, n));
+ }
+ return TCL_OK;
+ }
+ case CMD_DELETE:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "id");
+ return TCL_ERROR;
+ }
+ icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
+ if (icoPtr == NULL) {
+ return TCL_ERROR;
+ }
+ FreeIcoPtr(icoInterpPtr, icoPtr);
+ return TCL_OK;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WinSysNotifyCmd --
+ *
+ * Main command for creating and displaying notifications/balloons from system tray.
+ *
+ * Results:
+ * Display of notifications.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WinSysNotifyCmd(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData;
+ IcoInfo *icoPtr;
+ Tcl_DString infodst;
+ Tcl_DString titledst;
+ NOTIFYICONDATAW ni;
+ char *msgtitle;
+ char *msginfo;
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "command ...");
+ return TCL_ERROR;
+ }
+ if (strcmp(Tcl_GetString(objv[1]), "notify") != 0) {
+ Tcl_AppendResult(interp, "unknown subcommand \"", Tcl_GetString(objv[1]),
+ "\": must be notify", NULL);
+ return TCL_ERROR;
+ }
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "id title detail");
+ return TCL_ERROR;
+ }
+
+ icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
+ if (icoPtr == NULL) {
+ return TCL_ERROR;
+ }
+
+ ni.cbSize = sizeof(NOTIFYICONDATAW);
+ ni.hWnd = icoInterpPtr->hwnd;
+ ni.uID = icoPtr->id;
+ ni.uFlags = NIF_INFO;
+ ni.uCallbackMessage = ICON_MESSAGE;
+ ni.hIcon = icoPtr->hIcon;
+ ni.dwInfoFlags = NIIF_INFO; /* Use a sane platform-specific icon here.*/
+
+ msgtitle = Tcl_GetString(objv[3]);
+ msginfo = Tcl_GetString(objv[4]);
+
+ /* Balloon notification for system tray icon. */
+ if (msgtitle != NULL) {
+ WCHAR *title;
+ Tcl_DStringInit(&titledst);
+ title = Tcl_UtfToWCharDString(msgtitle, -1, &titledst);
+ wcsncpy(ni.szInfoTitle, title, (Tcl_DStringLength(&titledst) + 2) / 2);
+ Tcl_DStringFree(&titledst);
+ }
+ if (msginfo != NULL) {
+ WCHAR *info;
+ Tcl_DStringInit(&infodst);
+ info = Tcl_UtfToWCharDString(msginfo, -1, &infodst);
+ wcsncpy(ni.szInfo, info, (Tcl_DStringLength(&infodst) + 2) / 2);
+ Tcl_DStringFree(&infodst);
+ }
+
+ Shell_NotifyIconW(NIM_MODIFY, &ni);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WinIcoInit --
+ *
+ * Initialize this package and create script-level commands.
+ *
+ * Results:
+ * Initialization of code.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+WinIcoInit(
+ Tcl_Interp *interp)
+{
+ IcoInterpInfo *icoInterpPtr;
+ Tk_Window mainWindow;
+
+ mainWindow = Tk_MainWindow(interp);
+ if (mainWindow == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("main window has been destroyed", -1));
+ return TCL_ERROR;
+ }
+
+ icoInterpPtr = (IcoInterpInfo*) ckalloc(sizeof(IcoInterpInfo));
+ icoInterpPtr->counter = 0;
+ icoInterpPtr->firstIcoPtr = NULL;
+ icoInterpPtr->hwnd = CreateTaskbarHandlerWindow();
+ icoInterpPtr->nextPtr = firstIcoInterpPtr;
+ firstIcoInterpPtr = icoInterpPtr;
+ Tcl_CreateObjCommand(interp, "::tk::systray::_systray", WinSystrayCmd,
+ (ClientData) icoInterpPtr, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", WinSysNotifyCmd,
+ (ClientData) icoInterpPtr, NULL);
+
+ Tk_CreateEventHandler(mainWindow, StructureNotifyMask,
+ WinIcoDestroy, (ClientData) icoInterpPtr);
+
+ return TCL_OK;
+}
+
+/*
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index a202ba5..105ee72 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -4,9 +4,9 @@
* Contains commands for platform specific tests for the Windows
* platform.
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
- * Copyright (c) 2000 by Scriptics Corporation.
- * Copyright (c) 2001 by ActiveState Corporation.
+ * Copyright © 1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Scriptics Corporation.
+ * Copyright © 2001 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -290,6 +290,16 @@ TestwineventObjCmd(
static const TkStateMap messageMap[] = {
{WM_LBUTTONDOWN, "WM_LBUTTONDOWN"},
{WM_LBUTTONUP, "WM_LBUTTONUP"},
+ {WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK"},
+ {WM_MBUTTONDOWN, "WM_MBUTTONDOWN"},
+ {WM_MBUTTONUP, "WM_MBUTTONUP"},
+ {WM_MBUTTONDBLCLK, "WM_MBUTTONDBLCLK"},
+ {WM_RBUTTONDOWN, "WM_RBUTTONDOWN"},
+ {WM_RBUTTONUP, "WM_RBUTTONUP"},
+ {WM_RBUTTONDBLCLK, "WM_RBUTTONDBLCLK"},
+ {WM_XBUTTONDOWN, "WM_XBUTTONDOWN"},
+ {WM_XBUTTONUP, "WM_XBUTTONUP"},
+ {WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK"},
{WM_CHAR, "WM_CHAR"},
{WM_GETTEXT, "WM_GETTEXT"},
{WM_SETTEXT, "WM_SETTEXT"},
@@ -312,7 +322,7 @@ TestwineventObjCmd(
return TCL_ERROR;
}
- hwnd = INT2PTR(strtol(Tcl_GetString(objv[1]), &rest, 0));
+ hwnd = (HWND)INT2PTR(strtol(Tcl_GetString(objv[1]), &rest, 0));
if (rest == Tcl_GetString(objv[1])) {
hwnd = FindWindowA(NULL, Tcl_GetString(objv[1]));
if (hwnd == NULL) {
@@ -385,6 +395,7 @@ TestwineventObjCmd(
Tcl_ObjPrintf("Could not find control with id %d", id));
return TCL_ERROR;
}
+ Tcl_DStringInit(&ds);
Tcl_UtfToExternalDString(NULL, Tcl_GetString(objv[4]), -1, &ds);
result = SendMessageA(control, WM_SETTEXT, 0,
(LPARAM) Tcl_DStringValue(&ds));
@@ -420,7 +431,7 @@ TestwineventObjCmd(
/*
* testfindwindow title ?class?
- * Find a Windows window using the FindWindowW API call. This takes the window
+ * Find a Windows window using the FindWindow API call. This takes the window
* title and optionally the window class and if found returns the HWND and
* raises an error if the window is not found.
* eg: testfindwindow Console TkTopLevel
@@ -482,7 +493,7 @@ TestfindwindowObjCmd(
AppendSystemError(interp, GetLastError());
r = TCL_ERROR;
} else {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)(((size_t)hwnd) + 1) - 1));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(PTR2INT(hwnd)));
}
Tcl_DStringFree(&titleString);
@@ -498,7 +509,7 @@ EnumChildrenProc(
{
Tcl_Obj *listObj = (Tcl_Obj *) lParam;
- Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewWideIntObj((Tcl_WideInt)(((size_t)hwnd) + 1) - 1));
+ Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewWideIntObj(PTR2INT(hwnd)));
return TRUE;
}
@@ -525,7 +536,7 @@ TestgetwindowinfoObjCmd(
if (Tcl_GetWideIntFromObj(interp, objv[1], &hwnd) != TCL_OK)
return TCL_ERROR;
- cch = GetClassNameW(INT2PTR(hwnd), buf, cchBuf);
+ cch = GetClassNameW((HWND)INT2PTR(hwnd), buf, cchBuf);
if (cch == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", -1));
AppendSystemError(interp, GetLastError());
@@ -540,9 +551,9 @@ TestgetwindowinfoObjCmd(
dictObj = Tcl_NewDictObj();
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
- Tcl_NewWideIntObj(GetWindowLongPtrW(INT2PTR(hwnd), GWL_ID)));
+ Tcl_NewWideIntObj(GetWindowLongPtr((HWND)(size_t)hwnd, GWL_ID)));
- cch = GetWindowTextW(INT2PTR(hwnd), buf, cchBuf);
+ cch = GetWindowTextW((HWND)INT2PTR(hwnd), buf, cchBuf);
Tcl_DStringInit(&ds);
Tcl_WCharToUtfDString(buf, cch, &ds);
textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
@@ -550,10 +561,10 @@ TestgetwindowinfoObjCmd(
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),
- Tcl_NewWideIntObj((Tcl_WideInt)(((size_t)GetParent((INT2PTR(hwnd)))) + 1) - 1));
+ Tcl_NewWideIntObj(PTR2INT(GetParent((HWND)(size_t)hwnd))));
childrenObj = Tcl_NewListObj(0, NULL);
- EnumChildWindows(INT2PTR(hwnd), EnumChildrenProc, (LPARAM)childrenObj);
+ EnumChildWindows((HWND)(size_t)hwnd, EnumChildrenProc, (LPARAM)childrenObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("children", -1), childrenObj);
Tcl_SetObjResult(interp, dictObj);
@@ -573,7 +584,7 @@ TestwinlocaleObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj((int)GetThreadLocale()));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(GetThreadLocale()));
return TCL_OK;
}
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index 56fc87c..572bccd 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -4,7 +4,7 @@
* Xlib emulation routines for Windows related to creating, displaying
* and destroying windows.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -49,7 +49,7 @@ Tk_AttachHWND(
Tk_Window tkwin,
HWND hwnd)
{
- int new;
+ int isNew;
Tcl_HashEntry *entryPtr;
TkWinDrawable *twdPtr = (TkWinDrawable *) Tk_WindowId(tkwin);
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -66,12 +66,12 @@ Tk_AttachHWND(
*/
if (twdPtr == NULL) {
- twdPtr = ckalloc(sizeof(TkWinDrawable));
+ twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable));
twdPtr->type = TWD_WINDOW;
twdPtr->window.winPtr = (TkWindow *) tkwin;
} else if (twdPtr->window.handle != NULL) {
entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable,
- (char *)twdPtr->window.handle);
+ twdPtr->window.handle);
Tcl_DeleteHashEntry(entryPtr);
}
@@ -80,7 +80,7 @@ Tk_AttachHWND(
*/
twdPtr->window.handle = hwnd;
- entryPtr = Tcl_CreateHashEntry(&tsdPtr->windowTable, (char *)hwnd, &new);
+ entryPtr = Tcl_CreateHashEntry(&tsdPtr->windowTable, (char *)hwnd, &isNew);
Tcl_SetHashValue(entryPtr, tkwin);
return (Window)twdPtr;
@@ -115,7 +115,7 @@ Tk_HWNDToWindow(
Tcl_InitHashTable(&tsdPtr->windowTable, TCL_ONE_WORD_KEYS);
tsdPtr->initialized = 1;
}
- entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, (char *) hwnd);
+ entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, hwnd);
if (entryPtr != NULL) {
return (Tk_Window) Tcl_GetHashValue(entryPtr);
}
@@ -314,7 +314,7 @@ XDestroyWindow(
TkPointerDeadWindow(winPtr);
- entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, (char*)hwnd);
+ entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, hwnd);
if (entryPtr != NULL) {
Tcl_DeleteHashEntry(entryPtr);
}
@@ -756,33 +756,6 @@ XChangeWindowAttributes(
/*
*----------------------------------------------------------------------
*
- * XReparentWindow --
- *
- * TODO: currently placeholder to satisfy Xlib stubs.
- *
- * Results:
- * None.
- *
- * Side effects:
- * TODO.
- *
- *----------------------------------------------------------------------
- */
-
-int
-XReparentWindow(
- Display *display,
- Window w,
- Window parent,
- int x,
- int y)
-{
- return BadWindow;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkWinSetWindowPos --
*
* Adjust the stacking order of a window relative to a second window (or
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index d2602f7..28f4838 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -6,14 +6,15 @@
* the "wm" command and passes geometry information to the window
* manager.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 by Scriptics Corporation.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
+#include "tkWinIco.h"
#include <shellapi.h>
/*
@@ -66,7 +67,7 @@ typedef struct ProtocolHandler {
} ProtocolHandler;
#define HANDLER_SIZE(cmdLength) \
- ((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength)
+ (offsetof(ProtocolHandler, command) + 1 + cmdLength)
/*
* Helper type passed via lParam to TkWmStackorderToplevelEnumProc
@@ -77,58 +78,6 @@ typedef struct TkWmStackorderToplevelPair {
TkWindow **windowPtr;
} TkWmStackorderToplevelPair;
-/*
- * This structure represents the contents of a icon, in terms of its image.
- * The HICON is an internal Windows format. Most of these icon-specific
- * structures originated with the Winico extension. We stripped out unused
- * parts of that code, and integrated the code more naturally with Tcl.
- */
-
-typedef struct {
- UINT Width, Height, Colors; /* Width, Height and bpp */
- LPBYTE lpBits; /* Ptr to DIB bits */
- DWORD dwNumBytes; /* How many bytes? */
- LPBITMAPINFO lpbi; /* Ptr to header */
- LPBYTE lpXOR; /* Ptr to XOR image bits */
- LPBYTE lpAND; /* Ptr to AND image bits */
- HICON hIcon; /* DAS ICON */
-} ICONIMAGE, *LPICONIMAGE;
-
-/*
- * This structure is how we represent a block of the above items. We will
- * reallocate these structures according to how many images they need to
- * contain.
- */
-
-typedef struct {
- int nNumImages; /* How many images? */
- ICONIMAGE IconImages[1]; /* Image entries */
-} BlockOfIconImages, *BlockOfIconImagesPtr;
-
-/*
- * These two structures are used to read in icons from an 'icon directory'
- * (i.e. the contents of a .icr file, say). We only use these structures
- * temporarily, since we copy the information we want into a
- * BlockOfIconImages.
- */
-
-typedef struct {
- BYTE bWidth; /* Width of the image */
- BYTE bHeight; /* Height of the image (times 2) */
- BYTE bColorCount; /* Number of colors in image (0 if >=8bpp) */
- BYTE bReserved; /* Reserved */
- WORD wPlanes; /* Color Planes */
- WORD wBitCount; /* Bits per pixel */
- DWORD dwBytesInRes; /* How many bytes in this resource? */
- DWORD dwImageOffset; /* Where in the file is this image */
-} ICONDIRENTRY, *LPICONDIRENTRY;
-
-typedef struct {
- WORD idReserved; /* Reserved */
- WORD idType; /* Resource type (1 for icons) */
- WORD idCount; /* How many images? */
- ICONDIRENTRY idEntries[1]; /* The entries for each image */
-} ICONDIR, *LPICONDIR;
/*
* A pointer to one of these strucutures is associated with each toplevel.
@@ -358,13 +307,13 @@ typedef struct TkWmInfo {
* of top-level windows.
*/
-static void TopLevelReqProc(void *, Tk_Window);
+static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
static void RemapWindows(TkWindow *winPtr, HWND parentHWND);
static const Tk_GeomMgr wmMgrType = {
"wm", /* name */
TopLevelReqProc, /* requestProc */
- NULL, /* lostSlaveProc */
+ NULL, /* lostContentProc */
};
typedef struct {
@@ -544,187 +493,6 @@ static int WmWithdrawCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr);
-
-/*
- * Used in BytesPerLine
- */
-
-#define WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2)
-
-/*
- *----------------------------------------------------------------------
- *
- * DIBNumColors --
- *
- * Calculates the number of entries in the color table, given by LPSTR
- * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
- *
- * Results:
- * WORD - Number of entries in the color table.
- *
- *----------------------------------------------------------------------
- */
-
-static WORD
-DIBNumColors(
- LPSTR lpbi)
-{
- WORD wBitCount;
- DWORD dwClrUsed;
-
- dwClrUsed = ((LPBITMAPINFOHEADER) lpbi)->biClrUsed;
-
- if (dwClrUsed) {
- return (WORD) dwClrUsed;
- }
-
- wBitCount = ((LPBITMAPINFOHEADER) lpbi)->biBitCount;
-
- switch (wBitCount) {
- case 1:
- return 2;
- case 4:
- return 16;
- case 8:
- return 256;
- default:
- return 0;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * PaletteSize --
- *
- * Calculates the number of bytes in the color table, as given by LPSTR
- * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
- *
- * Results:
- * Number of bytes in the color table
- *
- *----------------------------------------------------------------------
- */
-static WORD
-PaletteSize(
- LPSTR lpbi)
-{
- return (WORD) (DIBNumColors(lpbi) * sizeof(RGBQUAD));
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FindDIBits --
- *
- * Locate the image bits in a CF_DIB format DIB, as given by LPSTR lpbi -
- * pointer to the CF_DIB memory block. Used by titlebar icon code.
- *
- * Results:
- * pointer to the image bits
- *
- * Side effects: None
- *
- *
- *----------------------------------------------------------------------
- */
-
-static LPSTR
-FindDIBBits(
- LPSTR lpbi)
-{
- return lpbi + *((LPDWORD) lpbi) + PaletteSize(lpbi);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * BytesPerLine --
- *
- * Calculates the number of bytes in one scan line, as given by
- * LPBITMAPINFOHEADER lpBMIH - pointer to the BITMAPINFOHEADER that
- * begins the CF_DIB block. Used by titlebar icon code.
- *
- * Results:
- * number of bytes in one scan line (DWORD aligned)
- *
- *----------------------------------------------------------------------
- */
-
-static DWORD
-BytesPerLine(
- LPBITMAPINFOHEADER lpBMIH)
-{
- return WIDTHBYTES(lpBMIH->biWidth * lpBMIH->biPlanes * lpBMIH->biBitCount);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AdjustIconImagePointers --
- *
- * Adjusts internal pointers in icon resource struct, as given by
- * LPICONIMAGE lpImage - the resource to handle. Used by titlebar icon
- * code.
- *
- * Results:
- * BOOL - TRUE for success, FALSE for failure
- *
- *----------------------------------------------------------------------
- */
-
-static BOOL
-AdjustIconImagePointers(
- LPICONIMAGE lpImage)
-{
- /*
- * Sanity check.
- */
-
- if (lpImage == NULL) {
- return FALSE;
- }
-
- /*
- * BITMAPINFO is at beginning of bits.
- */
-
- lpImage->lpbi = (LPBITMAPINFO) lpImage->lpBits;
-
- /*
- * Width - simple enough.
- */
-
- lpImage->Width = lpImage->lpbi->bmiHeader.biWidth;
-
- /*
- * Icons are stored in funky format where height is doubled so account for
- * that.
- */
-
- lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2;
-
- /*
- * How many colors?
- */
-
- lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes
- * lpImage->lpbi->bmiHeader.biBitCount;
-
- /*
- * XOR bits follow the header and color table.
- */
-
- lpImage->lpXOR = (LPBYTE) FindDIBBits((LPSTR) lpImage->lpbi);
-
- /*
- * AND bits follow the XOR bits.
- */
-
- lpImage->lpAND = lpImage->lpXOR +
- lpImage->Height*BytesPerLine((LPBITMAPINFOHEADER) lpImage->lpbi);
- return TRUE;
-}
/*
*----------------------------------------------------------------------
@@ -1298,6 +1066,75 @@ ReadIconFromFile(
return titlebaricon;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * AdjustIconImagePointers --
+ *
+ * Adjusts internal pointers in icon resource struct, as given by
+ * LPICONIMAGE lpImage - the resource to handle. Used by titlebar icon
+ * code.
+ *
+ * Results:
+ * BOOL - TRUE for success, FALSE for failure
+ *
+ *----------------------------------------------------------------------
+ */
+
+static BOOL
+AdjustIconImagePointers(
+ LPICONIMAGE lpImage)
+{
+ /*
+ * Sanity check.
+ */
+
+ if (lpImage == NULL) {
+ return FALSE;
+ }
+
+ /*
+ * BITMAPINFO is at beginning of bits.
+ */
+
+ lpImage->lpbi = (LPBITMAPINFO) lpImage->lpBits;
+
+ /*
+ * Width - simple enough.
+ */
+
+ lpImage->Width = lpImage->lpbi->bmiHeader.biWidth;
+
+ /*
+ * Icons are stored in funky format where height is doubled so account for
+ * that.
+ */
+
+ lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2;
+
+ /*
+ * How many colors?
+ */
+
+ lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes
+ * lpImage->lpbi->bmiHeader.biBitCount;
+
+ /*
+ * XOR bits follow the header and color table.
+ */
+
+ lpImage->lpXOR = (LPBYTE) FindDIBBits((LPSTR) lpImage->lpbi);
+
+ /*
+ * AND bits follow the XOR bits.
+ */
+
+ lpImage->lpAND = lpImage->lpXOR +
+ lpImage->Height*BytesPerLine((LPBITMAPINFOHEADER) lpImage->lpbi);
+ return TRUE;
+}
+
/*
*----------------------------------------------------------------------
*
@@ -2740,8 +2577,10 @@ TkWmDeadWindow(
void
TkWmSetClass(
- TCL_UNUSED(TkWindow *)) /* Newly-created top-level window. */
+ TkWindow *winPtr) /* Newly-created top-level window. */
{
+ (void)winPtr;
+
/* Do nothing */
return;
}
@@ -2796,7 +2635,7 @@ Tk_WmObjCmd(
WMOPT_WITHDRAW
};
int index;
- int length;
+ TkSizeT length;
const char *argv1;
TkWindow *winPtr, **winPtrPtr = &winPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -2817,8 +2656,8 @@ Tk_WmObjCmd(
return TCL_ERROR;
}
if (objc == 2) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- dispPtr->flags & TK_DISPLAY_WM_TRACING));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
+ (dispPtr->flags & TK_DISPLAY_WM_TRACING) != 0));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing) != TCL_OK) {
@@ -2944,7 +2783,7 @@ Tk_WmObjCmd(
static int
WmAspectCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2952,6 +2791,7 @@ WmAspectCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int numer1, denom1, numer2, denom2;
+ (void)tkwin;
if ((objc != 3) && (objc != 7)) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2962,10 +2802,10 @@ WmAspectCmd(
if (wmPtr->sizeHintsFlags & PAspect) {
Tcl_Obj *results[4];
- results[0] = Tcl_NewIntObj(wmPtr->minAspect.x);
- results[1] = Tcl_NewIntObj(wmPtr->minAspect.y);
- results[2] = Tcl_NewIntObj(wmPtr->maxAspect.x);
- results[3] = Tcl_NewIntObj(wmPtr->maxAspect.y);
+ results[0] = Tcl_NewWideIntObj(wmPtr->minAspect.x);
+ results[1] = Tcl_NewWideIntObj(wmPtr->minAspect.y);
+ results[2] = Tcl_NewWideIntObj(wmPtr->maxAspect.x);
+ results[3] = Tcl_NewWideIntObj(wmPtr->maxAspect.y);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
@@ -3024,7 +2864,7 @@ WmAttributesCmd(
LONG style, exStyle, styleBit, *stylePtr = NULL;
const char *string;
int i, boolean;
- int length;
+ TkSizeT length;
int config_fullscreen = 0, updatewrapper = 0;
int fullscreen_attr_changed = 0, fullscreen_attr = 0;
@@ -3054,19 +2894,19 @@ WmAttributesCmd(
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewStringObj("-disabled", -1));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewBooleanObj((style & WS_DISABLED)));
+ Tcl_NewWideIntObj((style & WS_DISABLED) != 0));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewStringObj("-fullscreen", -1));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewBooleanObj((wmPtr->flags & WM_FULLSCREEN)));
+ Tcl_NewWideIntObj((wmPtr->flags & WM_FULLSCREEN) != 0));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewStringObj("-toolwindow", -1));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewBooleanObj((exStyle & WS_EX_TOOLWINDOW)));
+ Tcl_NewWideIntObj((exStyle & WS_EX_TOOLWINDOW) != 0));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewStringObj("-topmost", -1));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewBooleanObj((exStyle & WS_EX_TOPMOST)));
+ Tcl_NewWideIntObj((exStyle & WS_EX_TOPMOST) != 0));
Tcl_SetObjResult(interp, objPtr);
return TCL_OK;
}
@@ -3205,8 +3045,8 @@ WmAttributesCmd(
}
if (config_fullscreen) {
if (objc == 4) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- wmPtr->flags & WM_FULLSCREEN));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
+ (wmPtr->flags & WM_FULLSCREEN) != 0));
} else {
fullscreen_attr_changed = 1;
fullscreen_attr = boolean;
@@ -3214,7 +3054,7 @@ WmAttributesCmd(
config_fullscreen = 0;
} else if (objc == 4) {
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(*stylePtr & styleBit));
+ Tcl_NewWideIntObj((*stylePtr & styleBit) != 0));
} else if (boolean) {
*stylePtr |= styleBit;
} else {
@@ -3313,7 +3153,7 @@ WmAttributesCmd(
static int
WmClientCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3321,7 +3161,8 @@ WmClientCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
+ TkSizeT length;
+ (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -3407,7 +3248,7 @@ WmColormapwindowsCmd(
break;
}
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window) wmPtr->cmapList[i]));
+ Tk_NewWindowObj((Tk_Window) wmPtr->cmapList[i]));
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
@@ -3477,7 +3318,7 @@ WmColormapwindowsCmd(
static int
WmCommandCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3487,6 +3328,7 @@ WmCommandCmd(
const char *argv3;
int cmdArgc;
const char **cmdArgv;
+ (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?value?");
@@ -3546,13 +3388,14 @@ WmCommandCmd(
static int
WmDeiconifyCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
+ (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -3598,7 +3441,7 @@ WmDeiconifyCmd(
static int
WmFocusmodelCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3612,6 +3455,7 @@ WmFocusmodelCmd(
OPT_ACTIVE, OPT_PASSIVE
};
int index;
+ (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?");
@@ -3654,13 +3498,17 @@ WmFocusmodelCmd(
static int
WmForgetCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel or Frame to work with */
- Tcl_Interp *interp, /* Current interpreter. */
- TCL_UNUSED(int), /* Number of arguments. */
- TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
+ Tcl_Interp *dummy, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window frameWin = (Tk_Window) winPtr;
+ (void)tkwin;
+ (void)dummy;
+ (void)objc;
+ (void)objv;
if (Tk_IsTopLevel(frameWin)) {
Tk_UnmapWindow(frameWin);
@@ -3668,10 +3516,10 @@ WmForgetCmd(
Tk_MakeWindowExist((Tk_Window)winPtr->parentPtr);
RemapWindows(winPtr, Tk_GetHWND(winPtr->parentPtr->window));
- /*
- * Make sure wm no longer manages this window
- */
- Tk_ManageGeometry(frameWin, NULL, NULL);
+ /*
+ * Make sure wm no longer manages this window
+ */
+ Tk_ManageGeometry(frameWin, NULL, NULL);
TkWmDeadWindow(winPtr);
/* flags (above) must be cleared before calling */
@@ -3702,7 +3550,7 @@ WmForgetCmd(
static int
WmFrameCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3711,6 +3559,7 @@ WmFrameCmd(
WmInfo *wmPtr = winPtr->wmInfoPtr;
HWND hwnd;
char buf[TCL_INTEGER_SPACE];
+ (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -3747,7 +3596,7 @@ WmFrameCmd(
static int
WmGeometryCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3757,6 +3606,7 @@ WmGeometryCmd(
char xSign, ySign;
int width, height;
const char *argv3;
+ (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?");
@@ -3815,7 +3665,7 @@ WmGeometryCmd(
static int
WmGridCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3823,6 +3673,7 @@ WmGridCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int reqWidth, reqHeight, widthInc, heightInc;
+ (void)tkwin;
if ((objc != 3) && (objc != 7)) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -3833,10 +3684,10 @@ WmGridCmd(
if (wmPtr->sizeHintsFlags & PBaseSize) {
Tcl_Obj *results[4];
- results[0] = Tcl_NewIntObj(wmPtr->reqGridWidth);
- results[1] = Tcl_NewIntObj(wmPtr->reqGridHeight);
- results[2] = Tcl_NewIntObj(wmPtr->widthInc);
- results[3] = Tcl_NewIntObj(wmPtr->heightInc);
+ results[0] = Tcl_NewWideIntObj(wmPtr->reqGridWidth);
+ results[1] = Tcl_NewWideIntObj(wmPtr->reqGridHeight);
+ results[2] = Tcl_NewWideIntObj(wmPtr->widthInc);
+ results[3] = Tcl_NewWideIntObj(wmPtr->heightInc);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
@@ -3922,7 +3773,7 @@ WmGroupCmd(
WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
const char *argv3;
- int length;
+ TkSizeT length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
@@ -3976,7 +3827,7 @@ WmGroupCmd(
static int
WmIconbitmapCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3985,6 +3836,7 @@ WmIconbitmapCmd(
WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */
const char *string;
+ (void)tkwin;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? ?image?");
@@ -4112,13 +3964,14 @@ WmIconbitmapCmd(
static int
WmIconifyCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
+ (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -4127,7 +3980,7 @@ WmIconifyCmd(
if (winPtr->flags & TK_EMBEDDED) {
if (!SendMessageW(wmPtr->wrapper, TK_ICONIFY, 0, 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: the container does not support the request",
+ "can't iconify \"%s\": the container does not support the request",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL);
return TCL_ERROR;
@@ -4150,7 +4003,7 @@ WmIconifyCmd(
}
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an icon for %s",
+ "can't iconify \"%s\": it is an icon for \"%s\"",
winPtr->pathName, Tk_PathName(wmPtr->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL);
return TCL_ERROR;
@@ -4236,7 +4089,7 @@ WmIconmaskCmd(
static int
WmIconnameCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -4244,7 +4097,8 @@ WmIconnameCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
+ TkSizeT length;
+ (void)tkwin;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
@@ -4287,7 +4141,7 @@ WmIconnameCmd(
static int
WmIconphotoCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -4296,15 +4150,12 @@ WmIconphotoCmd(
TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */
Tk_PhotoHandle photo;
Tk_PhotoImageBlock block;
- int i, width, height, idx, bufferSize, startObj = 3;
- union {unsigned char *ptr; void *voidPtr;} bgraPixel;
- union {unsigned char *ptr; void *voidPtr;} bgraMask;
+ int i, width, height, startObj = 3;
BlockOfIconImagesPtr lpIR;
WinIconPtr titlebaricon = NULL;
HICON hIcon;
unsigned size;
- BITMAPINFO bmInfo;
- ICONINFO iconInfo;
+ (void)tkwin;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -4348,95 +4199,16 @@ WmIconphotoCmd(
}
ZeroMemory(lpIR, size);
- lpIR->nNumImages = objc - startObj;
-
for (i = startObj; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
Tk_PhotoGetSize(photo, &width, &height);
Tk_PhotoGetImage(photo, &block);
- /*
- * Don't use CreateIcon to create the icon, as it requires color
- * bitmap data in device-dependent format. Instead we use
- * CreateIconIndirect which takes device-independent bitmaps and
- * converts them as required. Initialise icon info structure.
- */
-
- ZeroMemory(&iconInfo, sizeof(iconInfo));
- iconInfo.fIcon = TRUE;
-
- /*
- * Create device-independent color bitmap.
- */
-
- ZeroMemory(&bmInfo, sizeof bmInfo);
- bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- bmInfo.bmiHeader.biWidth = width;
- bmInfo.bmiHeader.biHeight = -height;
- bmInfo.bmiHeader.biPlanes = 1;
- bmInfo.bmiHeader.biBitCount = 32;
- bmInfo.bmiHeader.biCompression = BI_RGB;
-
- iconInfo.hbmColor = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
- &bgraPixel.voidPtr, NULL, 0);
- if (!iconInfo.hbmColor) {
- ckfree(lpIR);
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "failed to create an iconphoto with image \"%s\"",
- Tcl_GetString(objv[i])));
- Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "IMAGE", NULL);
- return TCL_ERROR;
- }
-
- /*
- * Convert the photo image data into BGRA format (RGBQUAD).
- */
-
- bufferSize = height * width * 4;
- for (idx = 0 ; idx < bufferSize ; idx += 4) {
- bgraPixel.ptr[idx] = block.pixelPtr[idx+2];
- bgraPixel.ptr[idx+1] = block.pixelPtr[idx+1];
- bgraPixel.ptr[idx+2] = block.pixelPtr[idx+0];
- bgraPixel.ptr[idx+3] = block.pixelPtr[idx+3];
- }
-
- /*
- * Create a dummy mask bitmap. The contents of this don't appear to
- * matter, as CreateIconIndirect will setup the icon mask based on the
- * alpha channel in our color bitmap.
- */
-
- bmInfo.bmiHeader.biBitCount = 1;
-
- iconInfo.hbmMask = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
- &bgraMask.voidPtr, NULL, 0);
- if (!iconInfo.hbmMask) {
- DeleteObject(iconInfo.hbmColor);
- ckfree(lpIR);
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "failed to create mask bitmap for \"%s\"",
- Tcl_GetString(objv[i])));
- Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "MASK", NULL);
- return TCL_ERROR;
- }
-
- ZeroMemory(bgraMask.ptr, width*height/8);
-
- /*
- * Create an icon from the bitmaps.
- */
-
- hIcon = CreateIconIndirect(&iconInfo);
- DeleteObject(iconInfo.hbmColor);
- DeleteObject(iconInfo.hbmMask);
+ hIcon = CreateIcoFromPhoto(width, height, block);
if (hIcon == NULL) {
- /*
- * XXX should free up created icons.
- */
-
- ckfree(lpIR);
+ FreeIconBlock(lpIR);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "failed to create icon for \"%s\"",
+ "failed to create an iconphoto with image \"%s\"",
Tcl_GetString(objv[i])));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "ICON", NULL);
return TCL_ERROR;
@@ -4445,6 +4217,7 @@ WmIconphotoCmd(
lpIR->IconImages[i-startObj].Height = height;
lpIR->IconImages[i-startObj].Colors = 4;
lpIR->IconImages[i-startObj].hIcon = hIcon;
+ lpIR->nNumImages++;
}
titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance));
@@ -4480,7 +4253,7 @@ WmIconphotoCmd(
static int
WmIconpositionCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -4488,6 +4261,7 @@ WmIconpositionCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y;
+ (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?");
@@ -4497,8 +4271,8 @@ WmIconpositionCmd(
if (wmPtr->hints.flags & IconPositionHint) {
Tcl_Obj *results[2];
- results[0] = Tcl_NewIntObj(wmPtr->hints.icon_x);
- results[1] = Tcl_NewIntObj(wmPtr->hints.icon_y);
+ results[0] = Tcl_NewWideIntObj(wmPtr->hints.icon_x);
+ results[1] = Tcl_NewWideIntObj(wmPtr->hints.icon_y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
}
return TCL_OK;
@@ -4553,7 +4327,7 @@ WmIconwindowCmd(
}
if (objc == 3) {
if (wmPtr->icon != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(wmPtr->icon));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(wmPtr->icon));
}
return TCL_OK;
}
@@ -4646,14 +4420,17 @@ WmIconwindowCmd(
static int
WmManageCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel or Frame to work with */
Tcl_Interp *interp, /* Current interpreter. */
- TCL_UNUSED(int), /* Number of arguments. */
- TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window frameWin = (Tk_Window) winPtr;
WmInfo *wmPtr = winPtr->wmInfoPtr;
+ (void)tkwin;
+ (void)objc;
+ (void)objv;
if (!Tk_IsTopLevel(frameWin)) {
if (!Tk_IsManageable(frameWin)) {
@@ -4700,7 +4477,7 @@ WmManageCmd(
static int
WmMaxsizeCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -4708,6 +4485,7 @@ WmMaxsizeCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
+ (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
@@ -4717,8 +4495,8 @@ WmMaxsizeCmd(
Tcl_Obj *results[2];
GetMaxSize(wmPtr, &width, &height);
- results[0] = Tcl_NewIntObj(width);
- results[1] = Tcl_NewIntObj(height);
+ results[0] = Tcl_NewWideIntObj(width);
+ results[1] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
@@ -4751,7 +4529,7 @@ WmMaxsizeCmd(
static int
WmMinsizeCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -4759,6 +4537,7 @@ WmMinsizeCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
+ (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
@@ -4768,8 +4547,8 @@ WmMinsizeCmd(
Tcl_Obj *results[2];
GetMinSize(wmPtr, &width, &height);
- results[0] = Tcl_NewIntObj(width);
- results[1] = Tcl_NewIntObj(height);
+ results[0] = Tcl_NewWideIntObj(width);
+ results[1] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
@@ -4802,7 +4581,7 @@ WmMinsizeCmd(
static int
WmOverrideredirectCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -4811,6 +4590,7 @@ WmOverrideredirectCmd(
WmInfo *wmPtr = winPtr->wmInfoPtr;
int boolean, curValue;
XSetWindowAttributes atts;
+ (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
@@ -4828,7 +4608,7 @@ WmOverrideredirectCmd(
curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect;
}
if (objc == 3) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(curValue));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(curValue != 0));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) {
@@ -4874,7 +4654,7 @@ WmOverrideredirectCmd(
static int
WmPositionfromCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -4888,6 +4668,7 @@ WmPositionfromCmd(
OPT_PROGRAM, OPT_USER
};
int index;
+ (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?");
@@ -4942,7 +4723,7 @@ WmPositionfromCmd(
static int
WmProtocolCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -4952,8 +4733,9 @@ WmProtocolCmd(
ProtocolHandler *protPtr, *prevPtr;
Atom protocol;
const char *cmd;
- int cmdLength;
+ TkSizeT cmdLength;
Tcl_Obj *resultObj;
+ (void)tkwin;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?");
@@ -5038,7 +4820,7 @@ WmProtocolCmd(
static int
WmResizableCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -5046,6 +4828,7 @@ WmResizableCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
+ (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
@@ -5054,8 +4837,8 @@ WmResizableCmd(
if (objc == 3) {
Tcl_Obj *results[2];
- results[0] = Tcl_NewBooleanObj(!(wmPtr->flags&WM_WIDTH_NOT_RESIZABLE));
- results[1] = Tcl_NewBooleanObj(!(wmPtr->flags&WM_HEIGHT_NOT_RESIZABLE));
+ results[0] = Tcl_NewWideIntObj(!(wmPtr->flags&WM_WIDTH_NOT_RESIZABLE));
+ results[1] = Tcl_NewWideIntObj(!(wmPtr->flags&WM_HEIGHT_NOT_RESIZABLE));
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
@@ -5100,7 +4883,7 @@ WmResizableCmd(
static int
WmSizefromCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -5114,6 +4897,7 @@ WmSizefromCmd(
OPT_PROGRAM, OPT_USER
};
int index;
+ (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?");
@@ -5196,7 +4980,7 @@ WmStackorderCmd(
resultObj = Tcl_NewObj();
for (windowPtr = windows; *windowPtr ; windowPtr++) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window) *windowPtr));
+ Tk_NewWindowObj((Tk_Window) *windowPtr));
}
Tcl_SetObjResult(interp, resultObj);
ckfree(windows);
@@ -5273,7 +5057,7 @@ WmStackorderCmd(
} else { /* OPT_ISBELOW */
result = index1 < index2;
}
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result));
return TCL_OK;
}
}
@@ -5297,7 +5081,7 @@ WmStackorderCmd(
static int
WmStateCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -5311,6 +5095,7 @@ WmStateCmd(
OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED
};
int index;
+ (void)tkwin;
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?state?");
@@ -5437,7 +5222,7 @@ WmStateCmd(
static int
WmTitleCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -5445,8 +5230,9 @@ WmTitleCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
+ TkSizeT length;
HWND wrapper;
+ (void)tkwin;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?");
@@ -5525,12 +5311,12 @@ WmTransientCmd(
WmInfo *wmPtr2;
if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?master?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?window?");
return TCL_ERROR;
}
if (objc == 3) {
if (containerPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) containerPtr));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) containerPtr));
}
return TCL_OK;
}
@@ -5574,7 +5360,7 @@ WmTransientCmd(
if (wmPtr2->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't make \"%s\" a master: it is an icon for %s",
+ "can't make \"%s\" a container: it is an icon for %s",
Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
return TCL_ERROR;
@@ -5583,7 +5369,7 @@ WmTransientCmd(
w = (TkWindow *)w->wmInfoPtr->containerPtr) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "setting \"%s\" as master creates a transient/master cycle",
+ "can't set \"%s\" as container: would cause management loop",
Tk_PathName(containerPtr)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
return TCL_ERROR;
@@ -5642,13 +5428,14 @@ WmTransientCmd(
static int
WmWithdrawCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
+ (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -5957,11 +5744,12 @@ TopLevelEventProc(
static void
TopLevelReqProc(
- TCL_UNUSED(void *),
+ ClientData dummy, /* Not used. */
Tk_Window tkwin) /* Information about window. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr;
+ (void)dummy;
wmPtr = winPtr->wmInfoPtr;
if (wmPtr) {
@@ -6508,13 +6296,15 @@ Tk_CoordsToWindow(
void
Tk_GetVRootGeometry(
- TCL_UNUSED(Tk_Window), /* Window whose virtual root is to be
+ Tk_Window tkwin, /* Window whose virtual root is to be
* queried. */
int *xPtr, int *yPtr, /* Store x and y offsets of virtual root
* here. */
int *widthPtr, int *heightPtr)
/* Store dimensions of virtual root here. */
{
+ (void)tkwin;
+
*xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN);
*yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN);
*widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN);
@@ -6674,7 +6464,7 @@ TkWmStackorderToplevelEnumProc(
/*fprintf(stderr, "Looking up HWND %d\n", hwnd);*/
- hPtr = Tcl_FindHashEntry(pair->table, (char *) hwnd);
+ hPtr = Tcl_FindHashEntry(pair->table, hwnd);
if (hPtr != NULL) {
childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr);
@@ -8093,7 +7883,7 @@ WmProc(
if (message == WM_SETFOCUS) {
SetFocus(child);
result = 0;
- } else if (!Tk_TranslateWinEvent(child, message, wParam, lParam,
+ } else if (!TkTranslateWinEvent(child, message, wParam, lParam,
&result)) {
result = DefWindowProcW(hwnd, message, wParam, lParam);
}
diff --git a/win/tkWinX.c b/win/tkWinX.c
index df8c004..4a2e514 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -3,9 +3,9 @@
*
* This file contains Windows emulation procedures for X routines.
*
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- * Copyright (c) 1994 Software Research Associates, Inc.
- * Copyright (c) 1998-2000 by Scriptics Corporation.
+ * Copyright © 1995-1996 Sun Microsystems, Inc.
+ * Copyright © 1994 Software Research Associates, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -13,16 +13,6 @@
#include "tkWinInt.h"
-/*
- * The w32api 1.1 package (included in Mingw 1.1) does not define _WIN32_IE by
- * default. Define it here to gain access to the InitCommonControlsEx API in
- * commctrl.h.
- */
-
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x0550 /* IE 5.5 */
-#endif
-
#include <commctrl.h>
#ifdef _MSC_VER
# pragma comment (lib, "comctl32.lib")
@@ -90,10 +80,9 @@ typedef struct {
* screen. */
int updatingClipboard; /* If 1, we are updating the clipboard. */
int surrogateBuffer; /* Buffer for first of surrogate pair. */
- DWORD vWheelTickPrev; /* For high resolution wheels (vertical). */
- DWORD hWheelTickPrev; /* For high resolution wheels (horizontal). */
- short vWheelAcc; /* For high resolution wheels (vertical). */
- short hWheelAcc; /* For high resolution wheels (horizontal). */
+ DWORD wheelTickPrev; /* For high resolution wheels. */
+ int vWheelAcc; /* For high resolution wheels (vertical). */
+ int hWheelAcc; /* For high resolution wheels (horizontal). */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -135,15 +124,10 @@ TkGetServerInfo(
{
static char buffer[32]; /* Empty string means not initialized yet. */
OSVERSIONINFOW os;
+ (void)tkwin;
if (!buffer[0]) {
- HANDLE handle = GetModuleHandleW(L"NTDLL");
- int(__stdcall *getversion)(void *) = (int(__stdcall *)(void *))
- (void *)GetProcAddress(handle, "RtlGetVersion");
- os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
- if (!getversion || getversion(&os)) {
- GetVersionExW(&os);
- }
+ GetVersionExW(&os);
/* Write the first character last, preventing multi-thread issues. */
sprintf(buffer+1, "indows %d.%d %d %s", (int)os.dwMajorVersion,
(int)os.dwMinorVersion, (int)os.dwBuildNumber,
@@ -269,7 +253,7 @@ TkWinXInit(
if (GetLocaleInfoW(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))),
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
(LPWSTR) &lpCP, sizeof(lpCP)/sizeof(WCHAR))
- && TranslateCharsetInfo(INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) {
+ && TranslateCharsetInfo((DWORD *)INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) {
UpdateInputLanguage((int) lpCs.ciCharset);
}
@@ -277,7 +261,7 @@ TkWinXInit(
* Make sure we cleanup on finalize.
*/
- TkCreateExitHandler(TkWinXCleanup, (ClientData) hInstance);
+ TkCreateExitHandler(TkWinXCleanup, hInstance);
}
/*
@@ -300,7 +284,7 @@ void
TkWinXCleanup(
ClientData clientData)
{
- HINSTANCE hInstance = (HINSTANCE) clientData;
+ HINSTANCE hInstance = (HINSTANCE)clientData;
/*
* Clean up our own class.
@@ -390,30 +374,6 @@ TkWinGetPlatformTheme(void)
/*
*----------------------------------------------------------------------
*
- * TkWinGetPlatformId --
- *
- * Determines whether running under NT, 95, or Win32s, to allow runtime
- * conditional code. Win32s is no longer supported.
- *
- * Results:
- * The return value is always:
- * VER_PLATFORM_WIN32_NT Win32 on Windows XP, Vista, Windows 7, Windows 8
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkWinGetPlatformId(void)
-{
- return VER_PLATFORM_WIN32_NT;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkGetDefaultScreenName --
*
* Returns the name of the screen that Tk should use during
@@ -430,9 +390,11 @@ TkWinGetPlatformId(void)
const char *
TkGetDefaultScreenName(
- Tcl_Interp *interp, /* Not used. */
+ Tcl_Interp *dummy, /* Not used. */
const char *screenName) /* If NULL, use default string. */
{
+ (void)dummy;
+
if ((screenName == NULL) || (screenName[0] == '\0')) {
screenName = winScreenName;
}
@@ -485,13 +447,13 @@ TkWinDisplayChanged(
* the HWND and we'll just get blank spots copied onto the screen.
*/
- screen->ext_data = INT2PTR(GetDeviceCaps(dc, PLANES));
+ screen->ext_data = (XExtData *)INT2PTR(GetDeviceCaps(dc, PLANES));
screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * PTR2INT(screen->ext_data);
if (screen->root_visual != NULL) {
ckfree(screen->root_visual);
}
- screen->root_visual = ckalloc(sizeof(Visual));
+ screen->root_visual = (Visual *)ckalloc(sizeof(Visual));
screen->root_visual->visualid = 0;
if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) {
screen->root_visual->map_entries = GetDeviceCaps(dc, SIZEPALETTE);
@@ -537,7 +499,7 @@ TkWinDisplayChanged(
/*
*----------------------------------------------------------------------
*
- * TkpOpenDisplay --
+ * TkpOpenDisplay/XkbOpenDisplay --
*
* Create the Display structure and fill it with device specific
* information.
@@ -555,12 +517,9 @@ TkDisplay *
TkpOpenDisplay(
const char *display_name)
{
- Screen *screen;
- TkWinDrawable *twdPtr;
Display *display;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- DWORD initialWheelTick;
if (tsdPtr->winDisplay != NULL) {
if (!strcmp(tsdPtr->winDisplay->display->display_name, display_name)) {
@@ -570,33 +529,45 @@ TkpOpenDisplay(
}
}
- display = ckalloc(sizeof(Display));
- ZeroMemory(display, sizeof(Display));
-
- display->display_name = ckalloc(strlen(display_name) + 1);
- strcpy(display->display_name, display_name);
+ display = XkbOpenDisplay((char *)display_name, NULL, NULL, NULL, NULL, NULL);
+ TkWinDisplayChanged(display);
- display->cursor_font = 1;
- display->nscreens = 1;
- display->request = 1;
- display->qlen = 0;
+ tsdPtr->winDisplay =(TkDisplay *) ckalloc(sizeof(TkDisplay));
+ ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay));
+ tsdPtr->winDisplay->display = display;
+ tsdPtr->updatingClipboard = FALSE;
+ tsdPtr->wheelTickPrev = GetTickCount();
+ tsdPtr->vWheelAcc = 0;
+ tsdPtr->hWheelAcc = 0;
- screen = ckalloc(sizeof(Screen));
- ZeroMemory(screen, sizeof(Screen));
- screen->display = display;
+ /*
+ * Key map info must be available immediately, because of "send event".
+ */
+ TkpInitKeymapInfo(tsdPtr->winDisplay);
/*
- * Set up the root window.
+ * Key map info must be available immediately, because of "send event".
*/
+ TkpInitKeymapInfo(tsdPtr->winDisplay);
- twdPtr = ckalloc(sizeof(TkWinDrawable));
- if (twdPtr == NULL) {
- return NULL;
- }
- twdPtr->type = TWD_WINDOW;
- twdPtr->window.winPtr = NULL;
- twdPtr->window.handle = NULL;
- screen->root = (Window)twdPtr;
+ return tsdPtr->winDisplay;
+}
+
+Display *
+XkbOpenDisplay(
+ const char *name,
+ int *ev_rtrn,
+ int *err_rtrn,
+ int *major_rtrn,
+ int *minor_rtrn,
+ int *reason)
+{
+ Display *display = (Display *)ckalloc(sizeof(Display));
+ Screen *screen = (Screen *)ckalloc(sizeof(Screen));
+ TkWinDrawable *twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable));
+
+ ZeroMemory(screen, sizeof(Screen));
+ ZeroMemory(display, sizeof(Display));
/*
* Note that these pixel values are not palette relative.
@@ -610,24 +581,27 @@ TkpOpenDisplay(
display->nscreens = 1;
display->default_screen = 0;
- TkWinDisplayChanged(display);
+ twdPtr->type = TWD_WINDOW;
+ twdPtr->window.winPtr = NULL;
+ twdPtr->window.handle = NULL;
+ screen->root = (Window)twdPtr;
+ screen->display = display;
- tsdPtr->winDisplay = ckalloc(sizeof(TkDisplay));
- ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay));
- tsdPtr->winDisplay->display = display;
- tsdPtr->updatingClipboard = FALSE;
- initialWheelTick = GetTickCount();
- tsdPtr->vWheelTickPrev = initialWheelTick;
- tsdPtr->hWheelTickPrev = initialWheelTick;
- tsdPtr->vWheelAcc = 0;
- tsdPtr->hWheelAcc = 0;
+ display->display_name = (char *)ckalloc(strlen(name) + 1);
+ strcpy(display->display_name, name);
- /*
- * Key map info must be available immediately, because of "send event".
- */
- TkpInitKeymapInfo(tsdPtr->winDisplay);
+ display->cursor_font = 1;
+ display->nscreens = 1;
+ display->request = 1;
+ display->qlen = 0;
- return tsdPtr->winDisplay;
+ if (ev_rtrn) *ev_rtrn = 0;
+ if (err_rtrn) *err_rtrn = 0;
+ if (major_rtrn) *major_rtrn = 0;
+ if (minor_rtrn) *minor_rtrn = 0;
+ if (reason) *reason = 0;
+
+ return display;
}
/*
@@ -670,7 +644,7 @@ TkpCloseDisplay(
ckfree(display->screens->root_visual);
}
if (display->screens->root != None) {
- ckfree(display->screens->root);
+ ckfree((char *)display->screens->root);
}
if (display->screens->cmap != None) {
XFreeColormap(display, display->screens->cmap);
@@ -710,7 +684,7 @@ TkClipCleanup(
dispPtr->windowAtom);
Tk_DestroyWindow(dispPtr->clipWindow);
- Tcl_Release((ClientData) dispPtr->clipWindow);
+ Tcl_Release(dispPtr->clipWindow);
dispPtr->clipWindow = NULL;
}
}
@@ -736,6 +710,9 @@ XBell(
Display *display,
int percent)
{
+ (void)display;
+ (void)percent;
+
MessageBeep(MB_OK);
return Success;
}
@@ -821,7 +798,7 @@ TkWinChildProc(
result = 1;
} else {
/* If the event was translated, we must return 0 */
- if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ if (TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
result = 0;
} else {
result = 1;
@@ -830,7 +807,7 @@ TkWinChildProc(
break;
default:
- if (!Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ if (!TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
result = DefWindowProcW(hwnd, message, wParam, lParam);
}
break;
@@ -847,7 +824,7 @@ TkWinChildProc(
/*
*----------------------------------------------------------------------
*
- * Tk_TranslateWinEvent --
+ * TkTranslateWinEvent --
*
* This function is called by widget window functions to handle the
* translation from Win32 events to Tk events.
@@ -862,7 +839,7 @@ TkWinChildProc(
*/
int
-Tk_TranslateWinEvent(
+TkTranslateWinEvent(
HWND hwnd,
UINT message,
WPARAM wParam,
@@ -931,7 +908,7 @@ Tk_TranslateWinEvent(
case WM_RBUTTONUP:
case WM_XBUTTONUP:
case WM_MOUSEMOVE:
- Tk_PointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam));
+ TkWinPointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam));
return 1;
case WM_SYSKEYDOWN:
@@ -1160,14 +1137,15 @@ GenerateXEvent(
*/
DWORD wheelTick = GetTickCount();
+ BOOL timeout = wheelTick - tsdPtr->wheelTickPrev >= 300;
+ int intDelta;
- if (wheelTick - tsdPtr->vWheelTickPrev < 1500) {
- tsdPtr->vWheelAcc += (short) HIWORD(wParam);
- } else {
- tsdPtr->vWheelAcc = (short) HIWORD(wParam);
+ tsdPtr->wheelTickPrev = wheelTick;
+ if (timeout) {
+ tsdPtr->vWheelAcc = tsdPtr->hWheelAcc = 0;
}
- tsdPtr->vWheelTickPrev = wheelTick;
- if (abs(tsdPtr->vWheelAcc) < WHEEL_DELTA) {
+ tsdPtr->vWheelAcc += (short) HIWORD(wParam);
+ if (!tsdPtr->vWheelAcc || (!timeout && abs(tsdPtr->vWheelAcc) < WHEEL_DELTA * 6 / 10)) {
return;
}
@@ -1179,11 +1157,17 @@ GenerateXEvent(
* TkpGetString. [Bug 1118340].
*/
+ intDelta = (abs(tsdPtr->vWheelAcc) + WHEEL_DELTA/2) / WHEEL_DELTA * WHEEL_DELTA;
+ if (intDelta == 0) {
+ intDelta = (tsdPtr->vWheelAcc < 0) ? -WHEEL_DELTA : WHEEL_DELTA;
+ } else if (tsdPtr->vWheelAcc < 0) {
+ intDelta = -intDelta;
+ }
event.x.type = MouseWheelEvent;
event.x.xany.send_event = -1;
event.key.nbytes = 0;
- event.x.xkey.keycode = tsdPtr->vWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
- tsdPtr->vWheelAcc = tsdPtr->vWheelAcc % WHEEL_DELTA;
+ event.x.xkey.keycode = intDelta;
+ tsdPtr->vWheelAcc -= intDelta;
break;
}
case WM_MOUSEHWHEEL: {
@@ -1192,14 +1176,15 @@ GenerateXEvent(
*/
DWORD wheelTick = GetTickCount();
+ BOOL timeout = wheelTick - tsdPtr->wheelTickPrev >= 300;
+ int intDelta;
- if (wheelTick - tsdPtr->hWheelTickPrev < 1500) {
- tsdPtr->hWheelAcc -= (short) HIWORD(wParam);
- } else {
- tsdPtr->hWheelAcc = -((short) HIWORD(wParam));
+ tsdPtr->wheelTickPrev = wheelTick;
+ if (timeout) {
+ tsdPtr->vWheelAcc = tsdPtr->hWheelAcc = 0;
}
- tsdPtr->hWheelTickPrev = wheelTick;
- if (abs(tsdPtr->hWheelAcc) < WHEEL_DELTA) {
+ tsdPtr->hWheelAcc -= (short) HIWORD(wParam);
+ if (!tsdPtr->hWheelAcc || (!timeout && abs(tsdPtr->hWheelAcc) < WHEEL_DELTA * 6 / 10)) {
return;
}
@@ -1211,12 +1196,18 @@ GenerateXEvent(
* TkpGetString. [Bug 1118340].
*/
+ intDelta = (abs(tsdPtr->hWheelAcc) + WHEEL_DELTA/2) / WHEEL_DELTA * WHEEL_DELTA;
+ if (intDelta == 0) {
+ intDelta = (tsdPtr->hWheelAcc < 0) ? -WHEEL_DELTA : WHEEL_DELTA;
+ } else if (tsdPtr->hWheelAcc < 0) {
+ intDelta = -intDelta;
+ }
event.x.type = MouseWheelEvent;
event.x.xany.send_event = -1;
event.key.nbytes = 0;
event.x.xkey.state |= ShiftMask;
- event.x.xkey.keycode = tsdPtr->hWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
- tsdPtr->hWheelAcc = tsdPtr->hWheelAcc % WHEEL_DELTA;
+ event.x.xkey.keycode = intDelta;
+ tsdPtr->hWheelAcc -= intDelta;
break;
}
case WM_SYSKEYDOWN:
@@ -1520,7 +1511,7 @@ UpdateInputLanguage(
if (keyInputCharset == charset) {
return;
}
- if (TranslateCharsetInfo(INT2PTR(charset), &charsetInfo,
+ if (TranslateCharsetInfo((DWORD*)INT2PTR(charset), &charsetInfo,
TCI_SRCCHARSET) == 0) {
/*
* Some mysterious failure.
@@ -1718,30 +1709,6 @@ HandleIMEComposition(
/*
*----------------------------------------------------------------------
*
- * Tk_FreeXId --
- *
- * This interface is not needed under Windows.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_FreeXId(
- Display *display,
- XID xid)
-{
- /* Do nothing */
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkWinResendEvent --
*
* This function converts an X event into a Windows event and invokes the
@@ -1783,11 +1750,11 @@ TkWinResendEvent(
msg = WM_RBUTTONDOWN;
wparam = MK_RBUTTON;
break;
- case Button4:
+ case Button8:
msg = WM_XBUTTONDOWN;
wparam = MAKEWPARAM(MK_XBUTTON1, XBUTTON1);
break;
- case Button5:
+ case Button9:
msg = WM_XBUTTONDOWN;
wparam = MAKEWPARAM(MK_XBUTTON2, XBUTTON2);
break;
@@ -1979,8 +1946,8 @@ Tk_SetCaretPos(
* Return the number of milliseconds the user was inactive.
*
* Results:
- * Milliseconds of user inactive time or -1 if the user32.dll doesn't
- * have the symbol GetLastInputInfo or GetLastInputInfo returns an error.
+ * Milliseconds of user inactive time or -1 if GetLastInputInfo
+ * returns an error.
*
* Side effects:
* None.
@@ -1993,9 +1960,10 @@ Tk_GetUserInactiveTime(
Display *dpy) /* Ignored on Windows */
{
LASTINPUTINFO li;
+ (void)dpy;
li.cbSize = sizeof(li);
- if (!(BOOL)GetLastInputInfo(&li)) {
+ if (!GetLastInputInfo(&li)) {
return -1;
}
@@ -2017,7 +1985,7 @@ Tk_GetUserInactiveTime(
* none
*
* Side effects:
- * The user inactivity timer of the underlaying windowing system is reset
+ * The user inactivity timer of the underlying windowing system is reset
* to zero.
*
*----------------------------------------------------------------------
@@ -2028,6 +1996,7 @@ Tk_ResetUserInactiveTime(
Display *dpy)
{
INPUT inp;
+ (void)dpy;
inp.type = INPUT_MOUSE;
inp.mi.dx = 0;
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
index ae026b3..1d31c1c 100644
--- a/win/ttkWinMonitor.c
+++ b/win/ttkWinMonitor.c
@@ -22,7 +22,7 @@ typedef struct {
int index;
} SystemColorEntry;
-static SystemColorEntry sysColors[] = {
+static const SystemColorEntry sysColors[] = {
{ "System3dDarkShadow", COLOR_3DDKSHADOW },
{ "System3dLight", COLOR_3DLIGHT },
{ "SystemActiveBorder", COLOR_ACTIVEBORDER },
@@ -55,7 +55,7 @@ static SystemColorEntry sysColors[] = {
static void RegisterSystemColors(Tcl_Interp *interp)
{
Ttk_ResourceCache cache = Ttk_GetResourceCache(interp);
- SystemColorEntry *sysColor;
+ const SystemColorEntry *sysColor;
for (sysColor = sysColors; sysColor->name; ++sysColor) {
DWORD pixel = GetSysColor(sysColor->index);
@@ -152,7 +152,7 @@ MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp)
HWND hwnd;
hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp);
- Ttk_RegisterCleanup(interp, (ClientData)hwnd, DestroyThemeMonitorWindow);
+ Ttk_RegisterCleanup(interp, hwnd, DestroyThemeMonitorWindow);
TtkWinTheme_Init(interp, hwnd);
TtkXPTheme_Init(interp, hwnd);
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c
index bd066fc..d3277f2 100644
--- a/win/ttkWinTheme.c
+++ b/win/ttkWinTheme.c
@@ -1,4 +1,4 @@
-/* winTheme.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
+/* winTheme.c - Copyright © 2004 Pat Thoyts <patthoyts@users.sf.net>
*/
#ifdef _MSC_VER
@@ -54,7 +54,7 @@ static unsigned int ReliefToEdge(int relief)
* +++ State tables for FrameControlElements.
*/
-static Ttk_StateTable checkbutton_statemap[] = { /* see also SF#1865898 */
+static const Ttk_StateTable checkbutton_statemap[] = { /* see also SF#1865898 */
{ DFCS_BUTTON3STATE|DFCS_CHECKED|DFCS_INACTIVE,
TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0 },
{ DFCS_BUTTON3STATE|DFCS_CHECKED|DFCS_PUSHED,
@@ -75,14 +75,14 @@ static Ttk_StateTable checkbutton_statemap[] = { /* see also SF#1865898 */
{ 0, 0, 0 },
};
-static Ttk_StateTable pushbutton_statemap[] = {
+static const Ttk_StateTable pushbutton_statemap[] = {
{ DFCS_INACTIVE, TTK_STATE_DISABLED, 0 },
{ DFCS_PUSHED, TTK_STATE_PRESSED, 0 },
{ DFCS_HOT, TTK_STATE_ACTIVE, 0 },
{ 0, 0, 0 }
};
-static Ttk_StateTable arrow_statemap[] = {
+static const Ttk_StateTable arrow_statemap[] = {
{ DFCS_INACTIVE, TTK_STATE_DISABLED, 0 },
{ DFCS_PUSHED | DFCS_FLAT, TTK_STATE_PRESSED, 0 },
{ 0, 0, 0 }
@@ -96,20 +96,20 @@ typedef struct {
const char *name; /* element name */
int classId; /* class id for DrawFrameControl */
int partId; /* part id for DrawFrameControl */
- int cxId; /* system metric ids for width/height... */
- int cyId; /* ... or size if FIXEDSIZE bit set */
- Ttk_StateTable *stateMap; /* map Tk states to Win32 flags */
+ unsigned cxId; /* system metric ids for width/height... */
+ unsigned cyId; /* ... or size if FIXEDSIZE bit set */
+ const Ttk_StateTable *stateMap; /* map Tk states to Win32 flags */
Ttk_Padding margins; /* additional placement padding */
} FrameControlElementData;
-#define _FIXEDSIZE 0x80000000L
-#define _HALFMETRIC 0x40000000L
+#define _FIXEDSIZE 0x80000000UL
+#define _HALFMETRIC 0x40000000UL
#define FIXEDSIZE(id) (id|_FIXEDSIZE)
#define HALFMETRIC(id) (id|_HALFMETRIC)
#define GETMETRIC(m) \
- ((m) & _FIXEDSIZE ? (int)((m) & ~_FIXEDSIZE) : GetSystemMetrics((m)&0x0fffffff))
+ ((m) & _FIXEDSIZE ? (int)((m) & ~_FIXEDSIZE) : GetSystemMetrics((m)&0xFFFFFFF))
-static FrameControlElementData FrameControlElements[] = {
+static const FrameControlElementData FrameControlElements[] = {
{ "Checkbutton.indicator",
DFC_BUTTON, DFCS_BUTTONCHECK, FIXEDSIZE(13), FIXEDSIZE(13),
checkbutton_statemap, {0,0,4,0} },
@@ -147,9 +147,13 @@ static void FrameControlElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- FrameControlElementData *p = clientData;
+ FrameControlElementData *p = (FrameControlElementData *)clientData;
int cx = GETMETRIC(p->cxId);
int cy = GETMETRIC(p->cyId);
+ (void)elementRecord;
+ (void)tkwin;
+ (void)paddingPtr;
+
if (p->cxId & _HALFMETRIC) cx /= 2;
if (p->cyId & _HALFMETRIC) cy /= 2;
*widthPtr = cx + Ttk_PaddingWidth(p->margins);
@@ -160,10 +164,11 @@ static void FrameControlElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- FrameControlElementData *elementData = clientData;
+ FrameControlElementData *elementData = (FrameControlElementData *)clientData;
RECT rc = BoxToRect(Ttk_PadBox(b, elementData->margins));
TkWinDCState dcState;
HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ (void)elementRecord;
DrawFrameControl(hdc, &rc,
elementData->classId,
@@ -171,7 +176,7 @@ static void FrameControlElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec FrameControlElementSpec = {
+static const Ttk_ElementSpec FrameControlElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -187,28 +192,36 @@ typedef struct {
Tcl_Obj *reliefObj;
} BorderElement;
-static Ttk_ElementOptionSpec BorderElementOptions[] = {
- { "-relief",TK_OPTION_RELIEF,Tk_Offset(BorderElement,reliefObj), "flat" },
- {NULL, 0, 0, NULL}
+static const Ttk_ElementOptionSpec BorderElementOptions[] = {
+ { "-relief",TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" },
+ {NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void BorderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+
paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE);
paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE);
}
static void BorderElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- BorderElement *border = elementRecord;
+ BorderElement *border = (BorderElement *)elementRecord;
RECT rc = BoxToRect(b);
int relief = TK_RELIEF_FLAT;
TkWinDCState dcState;
HDC hdc;
+ (void)dummy;
+ (void)state;
Tk_GetReliefFromObj(NULL, border->reliefObj, &relief);
@@ -220,7 +233,7 @@ static void BorderElementDraw(
}
}
-static Ttk_ElementSpec BorderElementSpec = {
+static const Ttk_ElementSpec BorderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(BorderElement),
BorderElementOptions,
@@ -237,29 +250,37 @@ typedef struct {
Tcl_Obj *backgroundObj;
} FieldElement;
-static Ttk_ElementOptionSpec FieldElementOptions[] = {
+static const Ttk_ElementOptionSpec FieldElementOptions[] = {
{ "-fieldbackground", TK_OPTION_BORDER,
- Tk_Offset(FieldElement,backgroundObj), "white" },
- { NULL, 0, 0, NULL }
+ offsetof(FieldElement,backgroundObj), "white" },
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void FieldElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+
paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE);
paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE);
}
static void FieldElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- FieldElement *field = elementRecord;
+ FieldElement *field = (FieldElement *)elementRecord;
Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj);
RECT rc = BoxToRect(b);
TkWinDCState dcState;
HDC hdc;
+ (void)dummy;
+ (void)state;
Tk_Fill3DRectangle(
tkwin, d, bg, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT);
@@ -269,7 +290,7 @@ static void FieldElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec FieldElementSpec = {
+static const Ttk_ElementSpec FieldElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FieldElement),
FieldElementOptions,
@@ -288,24 +309,28 @@ typedef struct {
Tcl_Obj *defaultStateObj;
} ButtonBorderElement;
-static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = {
+static const Ttk_ElementOptionSpec ButtonBorderElementOptions[] = {
{ "-relief",TK_OPTION_RELIEF,
- Tk_Offset(ButtonBorderElement,reliefObj), "flat" },
+ offsetof(ButtonBorderElement,reliefObj), "flat" },
{ "-highlightcolor",TK_OPTION_COLOR,
- Tk_Offset(ButtonBorderElement,highlightColorObj), "black" },
+ offsetof(ButtonBorderElement,highlightColorObj), "black" },
{ "-default", TK_OPTION_ANY,
- Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" },
- {NULL, 0, 0, NULL}
+ offsetof(ButtonBorderElement,defaultStateObj), "disabled" },
+ {NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void ButtonBorderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ButtonBorderElement *bd = elementRecord;
+ ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord;
int relief = TK_RELIEF_RAISED;
- int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED;
short int cx, cy;
+ (void)dummy;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief);
Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
@@ -327,15 +352,16 @@ static void ButtonBorderElementSize(
}
static void ButtonBorderElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- ButtonBorderElement *bd = elementRecord;
+ ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord;
int relief = TK_RELIEF_FLAT;
- int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED;
TkWinDCState dcState;
HDC hdc;
RECT rc;
+ (void)dummy;
Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief);
Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
@@ -367,7 +393,7 @@ static void ButtonBorderElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec ButtonBorderElementSpec = {
+static const Ttk_ElementSpec ButtonBorderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ButtonBorderElement),
ButtonBorderElementOptions,
@@ -381,16 +407,25 @@ static Ttk_ElementSpec ButtonBorderElementSpec = {
*/
static void FocusElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+
*paddingPtr = Ttk_UniformPadding(1);
}
static void FocusElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
+ (void)dummy;
+ (void)elementRecord;
+
if (state & TTK_STATE_FOCUS) {
RECT rc = BoxToRect(b);
TkWinDCState dcState;
@@ -400,7 +435,7 @@ static void FocusElementDraw(
}
}
-static Ttk_ElementSpec FocusElementSpec = {
+static const Ttk_ElementSpec FocusElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -416,18 +451,20 @@ typedef struct {
Tcl_Obj *fillColorObj;
} FillFocusElement;
-static Ttk_ElementOptionSpec FillFocusElementOptions[] = {
+static const Ttk_ElementOptionSpec FillFocusElementOptions[] = {
{ "-focusfill", TK_OPTION_COLOR,
- Tk_Offset(FillFocusElement,fillColorObj), "white" },
- {NULL, 0, 0, NULL}
+ offsetof(FillFocusElement,fillColorObj), "white" },
+ {NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
/* @@@ FIX THIS */
static void FillFocusElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- FillFocusElement *focus = elementRecord;
+ FillFocusElement *focus = (FillFocusElement *)elementRecord;
+ (void)dummy;
+
if (state & TTK_STATE_FOCUS) {
RECT rc = BoxToRect(b);
TkWinDCState dcState;
@@ -455,7 +492,7 @@ static void ComboboxFocusElementDraw(
}
}
-static Ttk_ElementSpec ComboboxFocusElementSpec = {
+static const Ttk_ElementSpec ComboboxFocusElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FillFocusElement),
FillFocusElementOptions,
@@ -482,7 +519,7 @@ static const WORD Pattern[] = {
static void TroughClientDataDeleteProc(void *clientData)
{
- TroughClientData *cd = clientData;
+ TroughClientData *cd = (TroughClientData *)clientData;
DeleteObject(cd->PatternBrush);
DeleteObject(cd->PatternBitmap);
ckfree(clientData);
@@ -490,7 +527,7 @@ static void TroughClientDataDeleteProc(void *clientData)
static TroughClientData *TroughClientDataInit(Tcl_Interp *interp)
{
- TroughClientData *cd = ckalloc(sizeof(*cd));
+ TroughClientData *cd = (TroughClientData *)ckalloc(sizeof(*cd));
cd->PatternBitmap = CreateBitmap(8, 8, 1, 1, Pattern);
cd->PatternBrush = CreatePatternBrush(cd->PatternBitmap);
Ttk_RegisterCleanup(interp, cd, TroughClientDataDeleteProc);
@@ -501,13 +538,15 @@ static void TroughElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- TroughClientData *cd = clientData;
+ TroughClientData *cd = (TroughClientData *)clientData;
TkWinDCState dcState;
HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
HBRUSH hbr;
COLORREF bk, oldbk, oldtxt;
+ (void)elementRecord;
+ (void)state;
- hbr = SelectObject(hdc, GetSysColorBrush(COLOR_SCROLLBAR));
+ hbr = (HBRUSH)SelectObject(hdc, GetSysColorBrush(COLOR_SCROLLBAR));
bk = GetSysColor(COLOR_3DHIGHLIGHT);
oldtxt = SetTextColor(hdc, GetSysColor(COLOR_3DFACE));
oldbk = SetBkColor(hdc, bk);
@@ -525,7 +564,7 @@ static void TroughElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec TroughElementSpec = {
+static const Ttk_ElementSpec TroughElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -541,19 +580,22 @@ typedef struct {
Tcl_Obj *orientObj;
} ThumbElement;
-static Ttk_ElementOptionSpec ThumbElementOptions[] = {
- { "-orient", TK_OPTION_ANY,Tk_Offset(ThumbElement,orientObj),"horizontal"},
- { NULL, 0, 0, NULL }
+static const Ttk_ElementOptionSpec ThumbElementOptions[] = {
+ { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"},
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void ThumbElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ThumbElement *thumbPtr = elementRecord;
- int orient;
+ ThumbElement *thumbPtr = (ThumbElement *)elementRecord;
+ Ttk_Orient orient;
+ (void)dummy;
+ (void)tkwin;
+ (void)paddingPtr;
- Ttk_GetOrientFromObj(NULL, thumbPtr->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, thumbPtr->orientObj, &orient);
if (orient == TTK_ORIENT_HORIZONTAL) {
*widthPtr = GetSystemMetrics(SM_CXHTHUMB);
*heightPtr = GetSystemMetrics(SM_CYHSCROLL);
@@ -564,12 +606,14 @@ static void ThumbElementSize(
}
static void ThumbElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
RECT rc = BoxToRect(b);
TkWinDCState dcState;
HDC hdc;
+ (void)dummy;
+ (void)elementRecord;
/* Windows doesn't show a thumb when the scrollbar is disabled */
if (state & TTK_STATE_DISABLED)
@@ -580,7 +624,7 @@ static void ThumbElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec ThumbElementSpec = {
+static const Ttk_ElementSpec ThumbElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ThumbElement),
ThumbElementOptions,
@@ -597,20 +641,23 @@ typedef struct {
Tcl_Obj *orientObj; /* orientation of the slider widget */
} SliderElement;
-static Ttk_ElementOptionSpec SliderElementOptions[] = {
- { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj),
+static const Ttk_ElementOptionSpec SliderElementOptions[] = {
+ { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj),
"horizontal" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void SliderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- SliderElement *slider = elementRecord;
- int orient;
+ SliderElement *slider = (SliderElement *)elementRecord;
+ Ttk_Orient orient;
+ (void)dummy;
+ (void)tkwin;
+ (void)paddingPtr;
- Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, slider->orientObj, &orient);
if (orient == TTK_ORIENT_HORIZONTAL) {
*widthPtr = (GetSystemMetrics(SM_CXHTHUMB) / 2) | 1;
*heightPtr = GetSystemMetrics(SM_CYHSCROLL);
@@ -621,19 +668,22 @@ static void SliderElementSize(
}
static void SliderElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
RECT rc = BoxToRect(b);
TkWinDCState dcState;
HDC hdc;
+ (void)dummy;
+ (void)elementRecord;
+ (void)state;
hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE);
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec SliderElementSpec = {
+static const Ttk_ElementSpec SliderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SliderElement),
SliderElementOptions,
@@ -646,25 +696,35 @@ static Ttk_ElementSpec SliderElementSpec = {
*/
static void ClientElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+
paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE);
paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE);
}
static void ClientElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
RECT rc = BoxToRect(b);
TkWinDCState dcState;
HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ (void)dummy;
+ (void)elementRecord;
+ (void)state;
+
DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_SOFT);
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec ClientElementSpec = {
+static const Ttk_ElementSpec ClientElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -698,7 +758,8 @@ MODULE_SCOPE
int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd)
{
Ttk_Theme themePtr, parentPtr;
- FrameControlElementData *fce = FrameControlElements;
+ const FrameControlElementData *fce = FrameControlElements;
+ (void)hwnd;
parentPtr = Ttk_GetTheme(interp, "alt");
themePtr = Ttk_CreateTheme(interp, "winnative", parentPtr);
@@ -722,7 +783,7 @@ int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd)
for (fce = FrameControlElements; fce->name != 0; ++fce) {
Ttk_RegisterElementSpec(themePtr, fce->name,
- &FrameControlElementSpec, fce);
+ &FrameControlElementSpec, (void *)fce);
}
Ttk_RegisterLayouts(themePtr, LayoutTable);
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 1c543d0..3fedff7 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -2,9 +2,9 @@
* Tk theme engine which uses the Windows XP "Visual Styles" API
* Adapted from Georgios Petasis' XP theme patch.
*
- * Copyright (c) 2003 by Georgios Petasis, petasis@iit.demokritos.gr.
- * Copyright (c) 2003 by Joe English
- * Copyright (c) 2003 by Pat Thoyts
+ * Copyright © 2003 Georgios Petasis, petasis@iit.demokritos.gr.
+ * Copyright © 2003 Joe English
+ * Copyright © 2003 Pat Thoyts
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -15,8 +15,6 @@
* shellcc/platform/commctls/userex/refentry.asp >
*/
-#define WINVER 0x0501 /* Requires Windows XP APIs */
-
#include <tkWinInt.h>
#ifndef HAVE_UXTHEME_H
/* Stub for platforms that lack the XP theme API headers: */
@@ -170,12 +168,12 @@ BoxToRect(Ttk_Box b)
/*
* Map Tk state bitmaps to XP style enumerated values.
*/
-static Ttk_StateTable null_statemap[] = { {0,0,0} };
+static const Ttk_StateTable null_statemap[] = { {0,0,0} };
/*
* Pushbuttons (Tk: "Button")
*/
-static Ttk_StateTable pushbutton_statemap[] =
+static const Ttk_StateTable pushbutton_statemap[] =
{
{ PBS_DISABLED, TTK_STATE_DISABLED, 0 },
{ PBS_PRESSED, TTK_STATE_PRESSED, 0 },
@@ -187,7 +185,7 @@ static Ttk_StateTable pushbutton_statemap[] =
/*
* Checkboxes (Tk: "Checkbutton")
*/
-static Ttk_StateTable checkbox_statemap[] =
+static const Ttk_StateTable checkbox_statemap[] =
{
{CBS_MIXEDDISABLED, TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0},
{CBS_MIXEDPRESSED, TTK_STATE_ALTERNATE|TTK_STATE_PRESSED, 0},
@@ -206,7 +204,7 @@ static Ttk_StateTable checkbox_statemap[] =
/*
* Radiobuttons:
*/
-static Ttk_StateTable radiobutton_statemap[] =
+static const Ttk_StateTable radiobutton_statemap[] =
{
{RBS_UNCHECKEDDISABLED, TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0},
{RBS_UNCHECKEDNORMAL, TTK_STATE_ALTERNATE, 0},
@@ -223,7 +221,7 @@ static Ttk_StateTable radiobutton_statemap[] =
/*
* Groupboxes (tk: "frame")
*/
-static Ttk_StateTable groupbox_statemap[] =
+static const Ttk_StateTable groupbox_statemap[] =
{
{GBS_DISABLED, TTK_STATE_DISABLED, 0},
{GBS_NORMAL, 0,0 }
@@ -232,7 +230,7 @@ static Ttk_StateTable groupbox_statemap[] =
/*
* Edit fields (tk: "entry")
*/
-static Ttk_StateTable edittext_statemap[] =
+static const Ttk_StateTable edittext_statemap[] =
{
{ ETS_DISABLED, TTK_STATE_DISABLED, 0 },
{ ETS_READONLY, TTK_STATE_READONLY, 0 },
@@ -247,7 +245,7 @@ static Ttk_StateTable edittext_statemap[] =
* Same as edittext_statemap, but doesn't use ETS_READONLY
* (fixes: #1032409)
*/
-static Ttk_StateTable combotext_statemap[] =
+static const Ttk_StateTable combotext_statemap[] =
{
{ ETS_DISABLED, TTK_STATE_DISABLED, 0 },
{ ETS_FOCUSED, TTK_STATE_FOCUS, 0 },
@@ -258,7 +256,7 @@ static Ttk_StateTable combotext_statemap[] =
/*
* Combobox button: (CBP_DROPDOWNBUTTON)
*/
-static Ttk_StateTable combobox_statemap[] = {
+static const Ttk_StateTable combobox_statemap[] = {
{ CBXS_DISABLED, TTK_STATE_DISABLED, 0 },
{ CBXS_PRESSED, TTK_STATE_PRESSED, 0 },
{ CBXS_HOT, TTK_STATE_ACTIVE, 0 },
@@ -269,7 +267,7 @@ static Ttk_StateTable combobox_statemap[] = {
/*
* Toolbar buttons (TP_BUTTON):
*/
-static Ttk_StateTable toolbutton_statemap[] = {
+static const Ttk_StateTable toolbutton_statemap[] = {
{ TS_DISABLED, TTK_STATE_DISABLED, 0 },
{ TS_PRESSED, TTK_STATE_PRESSED, 0 },
{ TS_HOTCHECKED, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0 },
@@ -281,7 +279,7 @@ static Ttk_StateTable toolbutton_statemap[] = {
/*
* Scrollbars (Tk: "Scrollbar.thumb")
*/
-static Ttk_StateTable scrollbar_statemap[] =
+static const Ttk_StateTable scrollbar_statemap[] =
{
{ SCRBS_DISABLED, TTK_STATE_DISABLED, 0 },
{ SCRBS_PRESSED, TTK_STATE_PRESSED, 0 },
@@ -289,7 +287,7 @@ static Ttk_StateTable scrollbar_statemap[] =
{ SCRBS_NORMAL, 0, 0 }
};
-static Ttk_StateTable uparrow_statemap[] =
+static const Ttk_StateTable uparrow_statemap[] =
{
{ ABS_UPDISABLED, TTK_STATE_DISABLED, 0 },
{ ABS_UPPRESSED, TTK_STATE_PRESSED, 0 },
@@ -297,7 +295,7 @@ static Ttk_StateTable uparrow_statemap[] =
{ ABS_UPNORMAL, 0, 0 }
};
-static Ttk_StateTable downarrow_statemap[] =
+static const Ttk_StateTable downarrow_statemap[] =
{
{ ABS_DOWNDISABLED, TTK_STATE_DISABLED, 0 },
{ ABS_DOWNPRESSED, TTK_STATE_PRESSED, 0 },
@@ -305,7 +303,7 @@ static Ttk_StateTable downarrow_statemap[] =
{ ABS_DOWNNORMAL, 0, 0 }
};
-static Ttk_StateTable leftarrow_statemap[] =
+static const Ttk_StateTable leftarrow_statemap[] =
{
{ ABS_LEFTDISABLED, TTK_STATE_DISABLED, 0 },
{ ABS_LEFTPRESSED, TTK_STATE_PRESSED, 0 },
@@ -313,7 +311,7 @@ static Ttk_StateTable leftarrow_statemap[] =
{ ABS_LEFTNORMAL, 0, 0 }
};
-static Ttk_StateTable rightarrow_statemap[] =
+static const Ttk_StateTable rightarrow_statemap[] =
{
{ ABS_RIGHTDISABLED,TTK_STATE_DISABLED, 0 },
{ ABS_RIGHTPRESSED, TTK_STATE_PRESSED, 0 },
@@ -321,7 +319,7 @@ static Ttk_StateTable rightarrow_statemap[] =
{ ABS_RIGHTNORMAL, 0, 0 }
};
-static Ttk_StateTable spinbutton_statemap[] =
+static const Ttk_StateTable spinbutton_statemap[] =
{
{ DNS_DISABLED, TTK_STATE_DISABLED, 0 },
{ DNS_PRESSED, TTK_STATE_PRESSED, 0 },
@@ -332,7 +330,7 @@ static Ttk_StateTable spinbutton_statemap[] =
/*
* Trackbar thumb: (Tk: "scale slider")
*/
-static Ttk_StateTable scale_statemap[] =
+static const Ttk_StateTable scale_statemap[] =
{
{ TUS_DISABLED, TTK_STATE_DISABLED, 0 },
{ TUS_PRESSED, TTK_STATE_PRESSED, 0 },
@@ -341,7 +339,7 @@ static Ttk_StateTable scale_statemap[] =
{ TUS_NORMAL, 0, 0 }
};
-static Ttk_StateTable tabitem_statemap[] =
+static const Ttk_StateTable tabitem_statemap[] =
{
{ TIS_DISABLED, TTK_STATE_DISABLED, 0 },
{ TIS_SELECTED, TTK_STATE_SELECTED, 0 },
@@ -376,11 +374,11 @@ static Ttk_StateTable tabitem_statemap[] =
typedef struct /* XP element specifications */
{
const char *elementName; /* Tk theme engine element name */
- Ttk_ElementSpec *elementSpec;
+ const Ttk_ElementSpec *elementSpec;
/* Element spec (usually GenericElementSpec) */
LPCWSTR className; /* Windows window class name */
int partId; /* BP_PUSHBUTTON, BP_CHECKBUTTON, etc. */
- Ttk_StateTable *statemap; /* Map Tk states to XP states */
+ const Ttk_StateTable *statemap; /* Map Tk states to XP states */
Ttk_Padding padding; /* See NOTE-GetThemeMargins */
unsigned flags;
# define IGNORE_THEMESIZE 0x80000000U /* See NOTE-GetThemePartSize */
@@ -558,7 +556,7 @@ static void GenericElementDraw(
FreeElementData(elementData);
}
-static Ttk_ElementSpec GenericElementSpec =
+static const Ttk_ElementSpec GenericElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -598,7 +596,7 @@ GenericSizedElementSize(
*widthPtr /= 2;
}
-static Ttk_ElementSpec GenericSizedElementSpec = {
+static const Ttk_ElementSpec GenericSizedElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -628,7 +626,7 @@ SpinboxArrowElementSize(
*heightPtr /= 2;
}
-static Ttk_ElementSpec SpinboxArrowElementSpec = {
+static const Ttk_ElementSpec SpinboxArrowElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -666,7 +664,7 @@ static void ThumbElementDraw(
FreeElementData(elementData);
}
-static Ttk_ElementSpec ThumbElementSpec =
+static const Ttk_ElementSpec ThumbElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -698,7 +696,7 @@ static void PbarElementSize(
}
}
-static Ttk_ElementSpec PbarElementSpec =
+static const Ttk_ElementSpec PbarElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -740,7 +738,7 @@ static void TabElementDraw(
FreeElementData(elementData);
}
-static Ttk_ElementSpec TabElementSpec =
+static const Ttk_ElementSpec TabElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -758,14 +756,14 @@ static Ttk_ElementSpec TabElementSpec =
#define TTK_STATE_OPEN TTK_STATE_USER1
#define TTK_STATE_LEAF TTK_STATE_USER2
-static Ttk_StateTable header_statemap[] =
+static const Ttk_StateTable header_statemap[] =
{
{ HIS_PRESSED, TTK_STATE_PRESSED, 0 },
{ HIS_HOT, TTK_STATE_ACTIVE, 0 },
{ HIS_NORMAL, 0,0 },
};
-static Ttk_StateTable treeview_statemap[] =
+static const Ttk_StateTable treeview_statemap[] =
{
{ TREIS_DISABLED, TTK_STATE_DISABLED, 0 },
{ TREIS_SELECTED, TTK_STATE_SELECTED, 0},
@@ -773,7 +771,7 @@ static Ttk_StateTable treeview_statemap[] =
{ TREIS_NORMAL, 0,0 },
};
-static Ttk_StateTable tvpglyph_statemap[] =
+static const Ttk_StateTable tvpglyph_statemap[] =
{
{ GLPS_OPENED, TTK_STATE_OPEN, 0 },
{ GLPS_CLOSED, 0,0 },
@@ -788,7 +786,7 @@ static void TreeIndicatorElementDraw(
}
}
-static Ttk_ElementSpec TreeIndicatorElementSpec =
+static const Ttk_ElementSpec TreeIndicatorElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -819,9 +817,9 @@ typedef struct
static const Ttk_ElementOptionSpec TextElementOptions[] =
{
{ "-text", TK_OPTION_STRING,
- Tk_Offset(TextElement,textObj), "" },
+ offsetof(TextElement,textObj), "" },
{ "-font", TK_OPTION_FONT,
- Tk_Offset(TextElement,fontObj), DEFAULT_FONT },
+ offsetof(TextElement,fontObj), DEFAULT_FONT },
{ NULL }
};
@@ -834,7 +832,7 @@ static void TextElementSize(
RECT rc = {0, 0};
HRESULT hr = S_OK;
const char *src;
- int len;
+ TkSizeT len;
Tcl_DString ds;
if (!InitElementData(elementData, tkwin, 0))
@@ -873,7 +871,7 @@ static void TextElementDraw(
RECT rc = BoxToRect(b);
HRESULT hr = S_OK;
const char *src;
- int len;
+ TkSizeT len;
Tcl_DString ds;
if (!InitElementData(elementData, tkwin, d))
@@ -896,7 +894,7 @@ static void TextElementDraw(
FreeElementData(elementData);
}
-static Ttk_ElementSpec TextElementSpec =
+static const Ttk_ElementSpec TextElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(TextElement),
@@ -962,7 +960,7 @@ TTK_END_LAYOUT_TABLE
/* name spec className partId statemap padding flags */
-static ElementInfo ElementInfoTable[] = {
+static const ElementInfo ElementInfoTable[] = {
{ "Checkbutton.indicator", &GenericElementSpec, L"BUTTON",
BP_CHECKBOX, checkbox_statemap, PAD(0, 0, 4, 0), PAD_MARGINS },
{ "Radiobutton.indicator", &GenericElementSpec, L"BUTTON",
@@ -1122,10 +1120,10 @@ Ttk_CreateVsapiElement(
Ttk_StateTable *stateTable;
Ttk_Padding pad = {0, 0, 0, 0};
int flags = 0;
- int length = 0;
+ TkSizeT length = 0;
char *name;
LPWSTR wname;
- Ttk_ElementSpec *elementSpec = &GenericElementSpec;
+ const Ttk_ElementSpec *elementSpec = &GenericElementSpec;
Tcl_DString classBuf;
static const char *const optionStrings[] =
diff --git a/win/winMain.c b/win/winMain.c
index 14eb718..9c23037 100644
--- a/win/winMain.c
+++ b/win/winMain.c
@@ -28,10 +28,11 @@
int _CRT_glob = 0;
#endif /* __GNUC__ */
-#ifdef TK_TEST
#ifdef __cplusplus
extern "C" {
#endif
+
+#ifdef TK_TEST
extern Tcl_LibraryInitProc Tktest_Init;
#endif /* TK_TEST */
@@ -171,6 +172,9 @@ _tWinMain(
#ifdef TK_LOCAL_MAIN_HOOK
TK_LOCAL_MAIN_HOOK(&argc, &argv);
+#elif defined(UNICODE) && ((TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION > 6))
+ /* This doesn't work on Windows without UNICODE, neither does it work with Tcl 8.6 */
+ TclZipfs_AppHook(&argc, &argv);
#endif
Tk_Main(argc, argv, TK_LOCAL_APPINIT);
diff --git a/win/wish.exe.manifest.in b/win/wish.exe.manifest.in
index 4829471..9fefac9 100644
--- a/win/wish.exe.manifest.in
+++ b/win/wish.exe.manifest.in
@@ -28,8 +28,6 @@
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
- <!-- Windows Vista -->
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
<asmv3:application>
diff --git a/xlib/X11/X.h b/xlib/X11/X.h
index c2c57af..0e2d152 100644
--- a/xlib/X11/X.h
+++ b/xlib/X11/X.h
@@ -1,15 +1,34 @@
-/*
- * $XConsortium: X.h,v 1.66 88/09/06 15:55:56 jim Exp $
- */
-
/* Definitions for the X window system likely to be used by applications */
#ifndef X_H
#define X_H
/***********************************************************
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -17,7 +36,7 @@ Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or MIT not be
+supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
@@ -30,14 +49,10 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+
#define X_PROTOCOL 11 /* current protocol version */
#define X_PROTOCOL_REVISION 0 /* current minor version */
-#if defined(MAC_OSX_TK)
-# define Cursor XCursor
-# define Region XRegion
-#endif
-
/* Resources */
#ifdef _WIN64
@@ -48,7 +63,10 @@ typedef unsigned long XID;
typedef XID Window;
typedef XID Drawable;
+#ifndef _XTYPEDEF_FONT
+# define _XTYPEDEF_FONT
typedef XID Font;
+#endif
typedef XID Pixmap;
typedef XID Cursor;
typedef XID Colormap;
@@ -63,7 +81,7 @@ typedef unsigned long VisualID;
typedef unsigned long Time;
-typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs
+typedef unsigned int KeyCode; /* In order to use IME, the Macintosh needs
* to pack 3 bytes into the keyCode field in
* the XEvent. In the real X.h, a KeyCode is
* defined as a short, which wouldn't be big
@@ -73,9 +91,7 @@ typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs
* RESERVED RESOURCE AND CONSTANT DEFINITIONS
*****************************************************************/
-#ifndef _WIN32
-# define None 0L /* See bug [9e31fd9449] and below */
-#endif
+/* #define None 0L See bug [9e31fd9449] and below */
#define ParentRelative 1L /* background pixmap in CreateWindow
and ChangeWindowAttributes */
@@ -173,7 +189,8 @@ are reserved in the protocol for errors and replies. */
#define ColormapNotify 32
#define ClientMessage 33
#define MappingNotify 34
-#define LASTEvent 35 /* must be bigger than any event # */
+#define GenericEvent 35
+#define LASTEvent 36 /* must be bigger than any event # */
/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
@@ -181,9 +198,7 @@ are reserved in the protocol for errors and replies. */
#define ShiftMask (1<<0)
#define LockMask (1<<1)
-#ifndef _WIN32
-# define ControlMask (1<<2) /* See bug [9e31fd9449] and below */
-#endif
+/* #define ControlMask (1<<2) See bug [9e31fd9449] and below */
#define Mod1Mask (1<<3)
#define Mod2Mask (1<<4)
#define Mod3Mask (1<<5)
@@ -191,9 +206,7 @@ are reserved in the protocol for errors and replies. */
#define Mod5Mask (1<<7)
/* See bug [9e31fd9449], this way prevents conflicts with Win32 headers */
-#ifdef _WIN32
enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) };
-#endif
/* modifier names. Used to build a SetModifierMapping request or
to read a GetModifierMapping request. These correspond to the
@@ -263,9 +276,13 @@ enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) };
/* protocol families */
-#define FamilyInternet 0
+#define FamilyInternet 0 /* IPv4 */
#define FamilyDECnet 1
#define FamilyChaos 2
+#define FamilyInternet6 6 /* IPv6 */
+
+/* authentication families not tied to a specific protocol */
+#define FamilyServerInterpreted 5
/* Property notification */
@@ -678,9 +695,4 @@ enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) };
#define LSBFirst 0
#define MSBFirst 1
-#if defined(MAC_OSX_TK)
-# undef Cursor
-# undef Region
-#endif
-
#endif /* X_H */
diff --git a/xlib/X11/Xfuncproto.h b/xlib/X11/Xfuncproto.h
index 6d63002..89bc96f 100644
--- a/xlib/X11/Xfuncproto.h
+++ b/xlib/X11/Xfuncproto.h
@@ -1,16 +1,26 @@
-/* $XConsortium: Xfuncproto.h,v 1.7 91/05/13 20:49:21 rws Exp $ */
/*
- * Copyright 1989, 1991 by the Massachusetts Institute of Technology
*
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in advertising
- * or publicity pertaining to distribution of the software without specific,
- * written prior permission. M.I.T. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
+Copyright 1989, 1991, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
*
*/
@@ -24,7 +34,7 @@
#endif /* NeedFunctionPrototypes */
#ifndef NeedVarargsPrototypes
-#define NeedVarargsPrototypes 0
+#define NeedVarargsPrototypes 1
#endif /* NeedVarargsPrototypes */
#if NeedFunctionPrototypes
@@ -37,6 +47,15 @@
#define _Xconst const
#endif /* _Xconst */
+/* Function prototype configuration (see configure for more info) */
+#if !defined(NARROWPROTO) && \
+ (defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__))
+#define NARROWPROTO
+#endif
+#ifndef FUNCPROTO
+#define FUNCPROTO 15
+#endif
+
#ifndef NeedWidePrototypes
#ifdef NARROWPROTO
#define NeedWidePrototypes 0
@@ -47,14 +66,156 @@
#endif /* NeedFunctionPrototypes */
-#ifdef __cplusplus
-#define _XFUNCPROTOBEGIN extern "C" {
-#define _XFUNCPROTOEND }
-#endif
-
#ifndef _XFUNCPROTOBEGIN
+#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
+#define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
+#define _XFUNCPROTOEND }
+#else
#define _XFUNCPROTOBEGIN
#define _XFUNCPROTOEND
+#endif
#endif /* _XFUNCPROTOBEGIN */
+/* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute */
+#ifndef __has_attribute
+# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+#endif
+#ifndef __has_feature
+# define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
+#endif
+#ifndef __has_extension
+# define __has_extension(x) 0 /* Compatibility with non-clang compilers. */
+#endif
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4))
+# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x)))
+#else
+# define _X_SENTINEL(x)
+#endif /* GNUC >= 4 */
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if (__has_attribute(visibility) || (defined(__GNUC__) && (__GNUC__ >= 4))) \
+ && !defined(__CYGWIN__) && !defined(__MINGW32__)
+# define _X_EXPORT __attribute__((visibility("default")))
+# define _X_HIDDEN __attribute__((visibility("hidden")))
+# define _X_INTERNAL __attribute__((visibility("internal")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define _X_EXPORT __global
+# define _X_HIDDEN __hidden
+# define _X_INTERNAL __hidden
+#else /* not gcc >= 4 and not Sun Studio >= 8 */
+# define _X_EXPORT
+# define _X_HIDDEN
+# define _X_INTERNAL
+#endif /* GNUC >= 4 */
+
+/* Branch prediction hints for individual conditionals */
+/* requires xproto >= 7.0.9 */
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
+# define _X_LIKELY(x) __builtin_expect(!!(x), 1)
+# define _X_UNLIKELY(x) __builtin_expect(!!(x), 0)
+#else /* not gcc >= 3.3 */
+# define _X_LIKELY(x) (x)
+# define _X_UNLIKELY(x) (x)
+#endif
+
+/* Bulk branch prediction hints via marking error path functions as "cold" */
+/* requires xproto >= 7.0.25 */
+#if __has_attribute(__cold__) || \
+ (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) /* 4.3+ */
+# define _X_COLD __attribute__((__cold__))
+#else
+# define _X_COLD /* nothing */
+#endif
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if __has_attribute(deprecated) \
+ || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)) \
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5130))
+# define _X_DEPRECATED __attribute__((deprecated))
+#else /* not gcc >= 3.1 */
+# define _X_DEPRECATED
+#endif
+
+/* requires xproto >= 7.0.30 */
+#if __has_extension(attribute_deprecated_with_message) || \
+ (defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
+# define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg)))
+#else
+# define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED
+#endif
+
+/* requires xproto >= 7.0.17 */
+#if __has_attribute(noreturn) \
+ || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define _X_NORETURN __attribute((noreturn))
+#else
+# define _X_NORETURN
+#endif /* GNUC */
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if __has_attribute(__format__) \
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
+# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
+#else /* not gcc >= 2.3 */
+# define _X_ATTRIBUTE_PRINTF(x,y)
+#endif
+
+/* requires xproto >= 7.0.22 - since this uses either gcc or C99 variable
+ argument macros, must be only used inside #ifdef _X_NONNULL guards, as
+ many legacy X clients are compiled in C89 mode still. */
+#if __has_attribute(nonnull) \
+ && defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
+#define _X_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
+#elif __has_attribute(nonnull) \
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
+#define _X_NONNULL(args...) __attribute__((nonnull(args)))
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
+#define _X_NONNULL(...) /* */
+#endif
+
+/* requires xproto >= 7.0.22 */
+#if __has_attribute(__unused__) \
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
+#define _X_UNUSED __attribute__((__unused__))
+#else
+#define _X_UNUSED /* */
+#endif
+
+/* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */
+/* requires xproto >= 7.0.9
+ (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */
+#if defined(inline) /* assume autoconf set it correctly */ || \
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \
+ (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550))
+# define _X_INLINE inline
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
+# define _X_INLINE __inline__
+#else
+# define _X_INLINE
+#endif
+
+/* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */
+/* requires xproto >= 7.0.21 */
+#ifndef _X_RESTRICT_KYWD
+# if defined(restrict) /* assume autoconf set it correctly */ || \
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \
+ && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */
+# define _X_RESTRICT_KYWD restrict
+# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
+# define _X_RESTRICT_KYWD __restrict__
+# else
+# define _X_RESTRICT_KYWD
+# endif
+#endif
+
+/* requires xproto >= 7.0.30 */
+#if __has_attribute(no_sanitize_thread)
+# define _X_NOTSAN __attribute__((no_sanitize_thread))
+#else
+# define _X_NOTSAN
+#endif
+
#endif /* _XFUNCPROTO_H_ */
diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h
index 56d049c..e0879d5 100644
--- a/xlib/X11/Xlib.h
+++ b/xlib/X11/Xlib.h
@@ -1,20 +1,28 @@
-/* $XConsortium: Xlib.h,v 11.221 93/07/02 14:13:28 gildea Exp $ */
/*
- * Copyright 1985, 1986, 1987, 1991 by the Massachusetts Institute of Technology
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in advertising
- * or publicity pertaining to distribution of the software without specific,
- * written prior permission. M.I.T. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * X Window System is a Trademark of MIT.
- *
- */
+
+Copyright 1985, 1986, 1987, 1991, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
/*
@@ -22,35 +30,64 @@
* interface library (Xlib) to the X Window System Protocol (V11).
* Structures and symbols starting with "_" are private to the library.
*/
-#ifndef _XLIB_H_
-#define _XLIB_H_
+#ifndef _X11_XLIB_H_
+#define _X11_XLIB_H_
-#define XlibSpecificationRelease 5
+#define XlibSpecificationRelease 6
-#if !defined(MAC_OSX_TK)
-# include <X11/X.h>
-#endif
-#ifdef MAC_OSX_TK
-# include <X11/X.h>
-# define Cursor XCursor
-# define Region XRegion
+#include <sys/types.h>
+
+#if defined(__SCO__) || defined(__UNIXWARE__)
+#include <stdint.h>
#endif
+#include <X11/X.h>
+
/* applications should not depend on these two headers being included! */
#include <X11/Xfuncproto.h>
#ifndef X_WCHAR
-#ifdef X_NOT_STDC_ENV
-#define X_WCHAR
-#endif
-#endif
-
-#ifndef X_WCHAR
#include <stddef.h>
#else
+#ifdef __UNIXOS2__
+#include <stdlib.h>
+#else
/* replace this with #include or typedef appropriate for your system */
typedef unsigned long wchar_t;
#endif
+#endif
+
+#ifndef EXTERN
+# define EXTERN extern TCL_STORAGE_CLASS
+#endif
+#if defined(STATIC_BUILD) || !defined(_WIN32)
+# ifndef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS
+# endif
+#elif defined(BUILD_tk)
+# undef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS __declspec(dllexport)
+#elif !defined(TCL_STORAGE_CLASS)
+# define TCL_STORAGE_CLASS __declspec(dllimport)
+#endif
+
+EXTERN int
+_Xmblen(
+ char *str,
+ int len
+ );
+
+/* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in
+ November 2000. Its presence is indicated through the following macro. */
+#define X_HAVE_UTF8_STRING 1
+
+/* The Xlib structs are full of implicit padding to properly align members.
+ We can't clean that up without breaking ABI, so tell clang not to bother
+ complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
typedef char *XPointer;
@@ -128,7 +165,9 @@ typedef int Status;
typedef struct _XExtData {
int number; /* number returned by XRegisterExtension */
struct _XExtData *next; /* next item on list of data for structure */
- int (*free_private)(); /* called to free private storage */
+ int (*free_private)( /* called to free private storage */
+ struct _XExtData *extension
+ );
XPointer private_data; /* data private to this extension. */
} XExtData;
@@ -221,6 +260,9 @@ typedef struct {
* implementation dependent. A Screen should be treated as opaque
* by application code.
*/
+
+struct _XDisplay; /* Forward declare before use for C++ */
+
typedef struct {
XExtData *ext_data; /* hook for extension to hang data */
struct _XDisplay *display;/* back pointer to display structure */
@@ -312,6 +354,16 @@ typedef struct {
} XHostAddress;
/*
+ * Data structure for ServerFamilyInterpreted addresses in host routines
+ */
+typedef struct {
+ int typelength; /* length of type string, in bytes */
+ int valuelength; /* length of value string, in bytes */
+ char *type; /* pointer to where to find the type string */
+ char *value; /* pointer to where to find the address */
+} XServerInterpretedAddress;
+
+/*
* Data structure for "image" data, used by image manipulation routines.
*/
typedef struct _XImage {
@@ -331,20 +383,22 @@ typedef struct _XImage {
unsigned long blue_mask;
XPointer obdata; /* hook for the object routines to hang on */
struct funcs { /* image manipulation routines */
- struct _XImage *(*create_image)();
-#if NeedFunctionPrototypes
+ struct _XImage *(*create_image)(
+ struct _XDisplay* /* display */,
+ Visual* /* visual */,
+ unsigned int /* depth */,
+ int /* format */,
+ int /* offset */,
+ char* /* data */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* bitmap_pad */,
+ int /* bytes_per_line */);
int (*destroy_image) (struct _XImage *);
unsigned long (*get_pixel) (struct _XImage *, int, int);
int (*put_pixel) (struct _XImage *, int, int, unsigned long);
struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int);
int (*add_pixel) (struct _XImage *, long);
-#else
- int (*destroy_image)();
- unsigned long (*get_pixel)();
- int (*put_pixel)();
- struct _XImage *(*sub_image)();
- int (*add_pixel)();
-#endif
} f;
} XImage;
@@ -440,46 +494,51 @@ typedef struct {
*/
typedef struct _XDisplay {
XExtData *ext_data; /* hook for extension to hang data */
- struct _XFreeFuncs *free_funcs; /* internal free functions */
+ struct _XPrivate *private1;
int fd; /* Network socket. */
- int conn_checker; /* ugly thing used by _XEventsQueued */
- int proto_major_version;/* maj. version of server's X protocol */
+ int private2;
+ int proto_major_version;/* major version of server's X protocol */
int proto_minor_version;/* minor version of servers X protocol */
char *vendor; /* vendor of the server hardware */
- XID resource_base; /* resource ID base */
- XID resource_mask; /* resource ID mask bits */
- XID resource_id; /* allocator current ID */
- int resource_shift; /* allocator shift to correct bits */
- XID (*resource_alloc)(); /* allocator function */
+ XID private3;
+ XID private4;
+ XID private5;
+ int private6;
+ XID (*resource_alloc)( /* allocator function */
+ struct _XDisplay*
+ );
int byte_order; /* screen byte order, LSBFirst, MSBFirst */
int bitmap_unit; /* padding and data requirements */
int bitmap_pad; /* padding requirements on bitmaps */
int bitmap_bit_order; /* LeastSignificant or MostSignificant */
int nformats; /* number of pixmap formats in list */
ScreenFormat *pixmap_format; /* pixmap format list */
- int vnumber; /* Xlib's X protocol version number. */
+ int private8;
int release; /* release of the server */
- struct _XSQEvent *head, *tail; /* Input event queue. */
+ struct _XPrivate *private9, *private10;
int qlen; /* Length of input event queue */
+ unsigned long last_request_read; /* seq number of last event read */
unsigned long request; /* sequence number of last request. */
- char *last_req; /* beginning of last request, or dummy */
- char *buffer; /* Output buffer starting address. */
- char *bufptr; /* Output buffer index pointer. */
- char *bufmax; /* Output buffer maximum+1 address. */
+ XPointer private11;
+ XPointer private12;
+ XPointer private13;
+ XPointer private14;
unsigned max_request_size; /* maximum number 32 bit words in request*/
struct _XrmHashBucketRec *db;
- int (*synchandler)(); /* Synchronization handler */
+ int (*private15)(
+ struct _XDisplay*
+ );
char *display_name; /* "host:display" string used on this connect*/
int default_screen; /* default screen for operations */
int nscreens; /* number of screens on this server*/
Screen *screens; /* pointer to list of screens */
unsigned long motion_buffer; /* size of motion buffer */
- unsigned long flags; /* internal connection flags */
+ unsigned long private16;
int min_keycode; /* minimum defined keycode */
int max_keycode; /* maximum defined keycode */
- KeySym *keysyms; /* This server's keysyms */
- XModifierKeymap *modifiermap; /* This server's modifier keymap */
- int keysyms_per_keycode;/* number of rows */
+ XPointer private17;
+ XPointer private18;
+ int private19;
char *xdefaults; /* contents of defaults from server */
char *scratch_buffer; /* place to hang scratch buffer */
unsigned long scratch_length; /* length of scratch buffer */
@@ -493,8 +552,8 @@ typedef struct _XDisplay {
* list to find the right procedure for each event might be
* expensive if many extensions are being used.
*/
- Bool (*event_vec[128])(); /* vector for wire to event */
- Status (*wire_vec[128])(); /* vector for event to wire */
+ Bool (*event_vec[128])(void); /* vector for wire to event */
+ Status (*wire_vec[128])(void); /* vector for event to wire */
KeySym lock_meaning; /* for XLookupString */
struct _XLockInfo *lock; /* multi-thread state, display lock */
struct _XInternalAsync *async_handlers; /* for internal async */
@@ -506,7 +565,7 @@ typedef struct _XDisplay {
struct _XDisplayAtoms *atoms; /* for XInternAtom */
unsigned int mode_switch; /* keyboard group modifiers */
struct _XContextDB *context_db; /* context database */
- Bool (**error_vec)(); /* vector for wire to error */
+ Bool (**error_vec)(void); /* vector for wire to error */
/*
* Xcms information
*/
@@ -519,7 +578,7 @@ typedef struct _XDisplay {
struct _XIMFilter *im_filters;
struct _XSQEvent *qfree; /* unallocated event queue elements */
unsigned long next_event_serial_num; /* inserted into next queue elt */
- int (*savedsynchandler)(); /* user synchandler when Xlib usurps */
+ int (*savedsynchandler)(void); /* user synchandler when Xlib usurps */
} Display;
#if NeedFunctionPrototypes /* prototypes require event type definitions */
@@ -615,7 +674,8 @@ typedef struct {
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* window of event */
- int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
+ int mode; /* NotifyNormal, NotifyWhileGrabbed,
+ NotifyGrab, NotifyUngrab */
int detail;
/*
* NotifyAncestor, NotifyVirtual, NotifyInferior,
@@ -916,6 +976,33 @@ typedef struct {
Window window; /* window on which event was requested in event mask */
} XAnyEvent;
+
+/***************************************************************
+ *
+ * GenericEvent. This event is the standard event for all newer extensions.
+ */
+
+typedef struct
+ {
+ int type; /* of event. Always GenericEvent */
+ unsigned long serial; /* # of last request processed */
+ Bool send_event; /* true if from SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* major opcode of extension that caused the event */
+ int evtype; /* actual event type. */
+ } XGenericEvent;
+
+typedef struct {
+ int type; /* of event. Always GenericEvent */
+ unsigned long serial; /* # of last request processed */
+ Bool send_event; /* true if from SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* major opcode of extension that caused the event */
+ int evtype; /* actual event type. */
+ unsigned int cookie;
+ void *data;
+} XGenericEventCookie;
+
/*
* this union is defined so Xlib can always use the same sized
* event structure internally, to avoid memory fragmentation.
@@ -953,6 +1040,8 @@ typedef union _XEvent {
XMappingEvent xmapping;
XErrorEvent xerror;
XKeymapEvent xkeymap;
+ XGenericEvent xgeneric;
+ XGenericEventCookie xcookie;
XID pad[24];
} XEvent;
#endif
@@ -1034,7 +1123,12 @@ typedef struct {
XRectangle max_logical_extent;
} XFontSetExtents;
-typedef struct _XFontSet *XFontSet;
+/* unused:
+typedef void (*XOMProc)();
+ */
+
+typedef struct _XOM *XOM;
+typedef struct _XOC *XOC, *XFontSet;
typedef struct {
char *chars;
@@ -1050,11 +1144,62 @@ typedef struct {
XFontSet font_set;
} XwcTextItem;
-typedef void (*XIMProc)();
+#define XNRequiredCharSet "requiredCharSet"
+#define XNQueryOrientation "queryOrientation"
+#define XNBaseFontName "baseFontName"
+#define XNOMAutomatic "omAutomatic"
+#define XNMissingCharSet "missingCharSet"
+#define XNDefaultString "defaultString"
+#define XNOrientation "orientation"
+#define XNDirectionalDependentDrawing "directionalDependentDrawing"
+#define XNContextualDrawing "contextualDrawing"
+#define XNFontInfo "fontInfo"
+
+typedef struct {
+ int charset_count;
+ char **charset_list;
+} XOMCharSetList;
+
+typedef enum {
+ XOMOrientation_LTR_TTB,
+ XOMOrientation_RTL_TTB,
+ XOMOrientation_TTB_LTR,
+ XOMOrientation_TTB_RTL,
+ XOMOrientation_Context
+} XOrientation;
+
+typedef struct {
+ int num_orientation;
+ XOrientation *orientation; /* Input Text description */
+} XOMOrientation;
+
+typedef struct {
+ int num_font;
+ XFontStruct **font_struct_list;
+ char **font_name_list;
+} XOMFontInfo;
typedef struct _XIM *XIM;
typedef struct _XIC *XIC;
+typedef void (*XIMProc)(
+ XIM,
+ XPointer,
+ XPointer
+);
+
+typedef Bool (*XICProc)(
+ XIC,
+ XPointer,
+ XPointer
+);
+
+typedef void (*XIDProc)(
+ Display*,
+ XPointer,
+ XPointer
+);
+
typedef unsigned long XIMStyle;
typedef struct {
@@ -1073,17 +1218,20 @@ typedef struct {
#define XIMStatusNone 0x0800L
#define XNVaNestedList "XNVaNestedList"
+#define XNQueryInputStyle "queryInputStyle"
#define XNClientWindow "clientWindow"
#define XNInputStyle "inputStyle"
#define XNFocusWindow "focusWindow"
#define XNResourceName "resourceName"
#define XNResourceClass "resourceClass"
#define XNGeometryCallback "geometryCallback"
+#define XNDestroyCallback "destroyCallback"
#define XNFilterEvents "filterEvents"
#define XNPreeditStartCallback "preeditStartCallback"
#define XNPreeditDoneCallback "preeditDoneCallback"
#define XNPreeditDrawCallback "preeditDrawCallback"
#define XNPreeditCaretCallback "preeditCaretCallback"
+#define XNPreeditStateNotifyCallback "preeditStateNotifyCallback"
#define XNPreeditAttributes "preeditAttributes"
#define XNStatusStartCallback "statusStartCallback"
#define XNStatusDoneCallback "statusDoneCallback"
@@ -1101,31 +1249,47 @@ typedef struct {
#define XNLineSpace "lineSpace"
#define XNCursor "cursor"
+#define XNQueryIMValuesList "queryIMValuesList"
+#define XNQueryICValuesList "queryICValuesList"
+#define XNVisiblePosition "visiblePosition"
+#define XNR6PreeditCallback "r6PreeditCallback"
+#define XNStringConversionCallback "stringConversionCallback"
+#define XNStringConversion "stringConversion"
+#define XNResetState "resetState"
+#define XNHotKey "hotKey"
+#define XNHotKeyState "hotKeyState"
+#define XNPreeditState "preeditState"
+#define XNSeparatorofNestedList "separatorofNestedList"
+
#define XBufferOverflow -1
#define XLookupNone 1
#define XLookupChars 2
#define XLookupKeySym 3
#define XLookupBoth 4
-#if NeedFunctionPrototypes
typedef void *XVaNestedList;
-#else
-typedef XPointer XVaNestedList;
-#endif
typedef struct {
XPointer client_data;
XIMProc callback;
} XIMCallback;
+typedef struct {
+ XPointer client_data;
+ XICProc callback;
+} XICCallback;
+
typedef unsigned long XIMFeedback;
-#define XIMReverse 1
-#define XIMUnderline (1<<1)
-#define XIMHighlight (1<<2)
-#define XIMPrimary (1<<5)
-#define XIMSecondary (1<<6)
-#define XIMTertiary (1<<7)
+#define XIMReverse 1L
+#define XIMUnderline (1L<<1)
+#define XIMHighlight (1L<<2)
+#define XIMPrimary (1L<<5)
+#define XIMSecondary (1L<<6)
+#define XIMTertiary (1L<<7)
+#define XIMVisibleToForward (1L<<8)
+#define XIMVisibleToBackword (1L<<9)
+#define XIMVisibleToCenter (1L<<10)
typedef struct _XIMText {
unsigned short length;
@@ -1137,12 +1301,53 @@ typedef struct _XIMText {
} string;
} XIMText;
-typedef struct _XIMPreeditDrawCallbackStruct {
- int caret; /* Cursor offset within pre-edit string */
- int chg_first; /* Starting change position */
- int chg_length; /* Length of the change in character count */
- XIMText *text;
-} XIMPreeditDrawCallbackStruct;
+typedef unsigned long XIMPreeditState;
+
+#define XIMPreeditUnKnown 0L
+#define XIMPreeditEnable 1L
+#define XIMPreeditDisable (1L<<1)
+
+typedef struct _XIMPreeditStateNotifyCallbackStruct {
+ XIMPreeditState state;
+} XIMPreeditStateNotifyCallbackStruct;
+
+typedef unsigned long XIMResetState;
+
+#define XIMInitialState 1L
+#define XIMPreserveState (1L<<1)
+
+typedef unsigned long XIMStringConversionFeedback;
+
+#define XIMStringConversionLeftEdge (0x00000001)
+#define XIMStringConversionRightEdge (0x00000002)
+#define XIMStringConversionTopEdge (0x00000004)
+#define XIMStringConversionBottomEdge (0x00000008)
+#define XIMStringConversionConcealed (0x00000010)
+#define XIMStringConversionWrapped (0x00000020)
+
+typedef struct _XIMStringConversionText {
+ unsigned short length;
+ XIMStringConversionFeedback *feedback;
+ Bool encoding_is_wchar;
+ union {
+ char *mbs;
+ wchar_t *wcs;
+ } string;
+} XIMStringConversionText;
+
+typedef unsigned short XIMStringConversionPosition;
+
+typedef unsigned short XIMStringConversionType;
+
+#define XIMStringConversionBuffer (0x0001)
+#define XIMStringConversionLine (0x0002)
+#define XIMStringConversionWord (0x0003)
+#define XIMStringConversionChar (0x0004)
+
+typedef unsigned short XIMStringConversionOperation;
+
+#define XIMStringConversionSubstitution (0x0001)
+#define XIMStringConversionRetrieval (0x0002)
typedef enum {
XIMForwardChar, XIMBackwardChar,
@@ -1154,6 +1359,21 @@ typedef enum {
XIMDontChange
} XIMCaretDirection;
+typedef struct _XIMStringConversionCallbackStruct {
+ XIMStringConversionPosition position;
+ XIMCaretDirection direction;
+ XIMStringConversionOperation operation;
+ unsigned short factor;
+ XIMStringConversionText *text;
+} XIMStringConversionCallbackStruct;
+
+typedef struct _XIMPreeditDrawCallbackStruct {
+ int caret; /* Cursor offset within pre-edit string */
+ int chg_first; /* Starting change position */
+ int chg_length; /* Length of the change in character count */
+ XIMText *text;
+} XIMPreeditDrawCallbackStruct;
+
typedef enum {
XIMIsInvisible, /* Disable caret feedback */
XIMIsPrimary, /* UI defined caret feedback */
@@ -1179,24 +1399,2655 @@ typedef struct _XIMStatusDrawCallbackStruct {
} data;
} XIMStatusDrawCallbackStruct;
+typedef struct _XIMHotKeyTrigger {
+ KeySym keysym;
+ int modifier;
+ int modifier_mask;
+} XIMHotKeyTrigger;
+
+typedef struct _XIMHotKeyTriggers {
+ int num_hot_key;
+ XIMHotKeyTrigger *key;
+} XIMHotKeyTriggers;
+
+typedef unsigned long XIMHotKeyState;
+
+#define XIMHotKeyStateON (0x0001L)
+#define XIMHotKeyStateOFF (0x0002L)
+
+typedef struct {
+ unsigned short count_values;
+ char **supported_values;
+} XIMValuesList;
+
+_XFUNCPROTOBEGIN
+
+#if defined(WIN32) && !defined(_XLIBINT_)
+#define _Xdebug *_Xdebug_p
+#endif
+
+EXTERN int _Xdebug;
+
+EXTERN XFontStruct *XLoadQueryFont(
+ Display* /* display */,
+ _Xconst char* /* name */
+);
+
+EXTERN XFontStruct *XQueryFont(
+ Display* /* display */,
+ XID /* font_ID */
+);
+
+
+EXTERN XTimeCoord *XGetMotionEvents(
+ Display* /* display */,
+ Window /* w */,
+ Time /* start */,
+ Time /* stop */,
+ int* /* nevents_return */
+);
+
+EXTERN XModifierKeymap *XDeleteModifiermapEntry(
+ XModifierKeymap* /* modmap */,
+#if NeedWidePrototypes
+ unsigned int /* keycode_entry */,
+#else
+ KeyCode /* keycode_entry */,
+#endif
+ int /* modifier */
+);
+
+EXTERN XModifierKeymap *XGetModifierMapping(
+ Display* /* display */
+);
+
+EXTERN XModifierKeymap *XInsertModifiermapEntry(
+ XModifierKeymap* /* modmap */,
+#if NeedWidePrototypes
+ unsigned int /* keycode_entry */,
+#else
+ KeyCode /* keycode_entry */,
+#endif
+ int /* modifier */
+);
+
+EXTERN XModifierKeymap *XNewModifiermap(
+ int /* max_keys_per_mod */
+);
+
+EXTERN XImage *XCreateImage(
+ Display* /* display */,
+ Visual* /* visual */,
+ unsigned int /* depth */,
+ int /* format */,
+ int /* offset */,
+ char* /* data */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* bitmap_pad */,
+ int /* bytes_per_line */
+);
+EXTERN Status XInitImage(
+ XImage* /* image */
+);
+EXTERN XImage *XGetImage(
+ Display* /* display */,
+ Drawable /* d */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned long /* plane_mask */,
+ int /* format */
+);
+EXTERN XImage *XGetSubImage(
+ Display* /* display */,
+ Drawable /* d */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned long /* plane_mask */,
+ int /* format */,
+ XImage* /* dest_image */,
+ int /* dest_x */,
+ int /* dest_y */
+);
+
+/*
+ * X function declarations.
+ */
+EXTERN Display *XOpenDisplay(
+ _Xconst char* /* display_name */
+);
+
+EXTERN void XrmInitialize(
+ void
+);
+
+EXTERN char *XFetchBytes(
+ Display* /* display */,
+ int* /* nbytes_return */
+);
+EXTERN char *XFetchBuffer(
+ Display* /* display */,
+ int* /* nbytes_return */,
+ int /* buffer */
+);
+EXTERN char *XGetAtomName(
+ Display* /* display */,
+ Atom /* atom */
+);
+EXTERN Status XGetAtomNames(
+ Display* /* dpy */,
+ Atom* /* atoms */,
+ int /* count */,
+ char** /* names_return */
+);
+EXTERN char *XGetDefault(
+ Display* /* display */,
+ _Xconst char* /* program */,
+ _Xconst char* /* option */
+);
+EXTERN char *XDisplayName(
+ _Xconst char* /* string */
+);
+EXTERN char *XKeysymToString(
+ KeySym /* keysym */
+);
+
+EXTERN int (*XSynchronize(
+ Display* /* display */,
+ Bool /* onoff */
+))(
+ Display* /* display */
+);
+EXTERN int (*XSetAfterFunction(
+ Display* /* display */,
+ int (*) (
+ Display* /* display */
+ ) /* procedure */
+))(
+ Display* /* display */
+);
+EXTERN Atom XInternAtom(
+ Display* /* display */,
+ _Xconst char* /* atom_name */,
+ Bool /* only_if_exists */
+);
+EXTERN Status XInternAtoms(
+ Display* /* dpy */,
+ char** /* names */,
+ int /* count */,
+ Bool /* onlyIfExists */,
+ Atom* /* atoms_return */
+);
+EXTERN Colormap XCopyColormapAndFree(
+ Display* /* display */,
+ Colormap /* colormap */
+);
+EXTERN Colormap XCreateColormap(
+ Display* /* display */,
+ Window /* w */,
+ Visual* /* visual */,
+ int /* alloc */
+);
+EXTERN Cursor XCreatePixmapCursor(
+ Display* /* display */,
+ Pixmap /* source */,
+ Pixmap /* mask */,
+ XColor* /* foreground_color */,
+ XColor* /* background_color */,
+ unsigned int /* x */,
+ unsigned int /* y */
+);
+EXTERN Cursor XCreateGlyphCursor(
+ Display* /* display */,
+ Font /* source_font */,
+ Font /* mask_font */,
+ unsigned int /* source_char */,
+ unsigned int /* mask_char */,
+ XColor _Xconst * /* foreground_color */,
+ XColor _Xconst * /* background_color */
+);
+EXTERN Cursor XCreateFontCursor(
+ Display* /* display */,
+ unsigned int /* shape */
+);
+EXTERN Font XLoadFont(
+ Display* /* display */,
+ _Xconst char* /* name */
+);
+EXTERN GC XCreateGC(
+ Display* /* display */,
+ Drawable /* d */,
+ unsigned long /* valuemask */,
+ XGCValues* /* values */
+);
+EXTERN GContext XGContextFromGC(
+ GC /* gc */
+);
+EXTERN void XFlushGC(
+ Display* /* display */,
+ GC /* gc */
+);
+EXTERN Pixmap XCreatePixmap(
+ Display* /* display */,
+ Drawable /* d */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int /* depth */
+);
+EXTERN Pixmap XCreateBitmapFromData(
+ Display* /* display */,
+ Drawable /* d */,
+ _Xconst char* /* data */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+EXTERN Pixmap XCreatePixmapFromBitmapData(
+ Display* /* display */,
+ Drawable /* d */,
+ char* /* data */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned long /* fg */,
+ unsigned long /* bg */,
+ unsigned int /* depth */
+);
+EXTERN Window XCreateSimpleWindow(
+ Display* /* display */,
+ Window /* parent */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int /* border_width */,
+ unsigned long /* border */,
+ unsigned long /* background */
+);
+EXTERN Window XGetSelectionOwner(
+ Display* /* display */,
+ Atom /* selection */
+);
+EXTERN Window XCreateWindow(
+ Display* /* display */,
+ Window /* parent */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int /* border_width */,
+ int /* depth */,
+ unsigned int /* class */,
+ Visual* /* visual */,
+ unsigned long /* valuemask */,
+ XSetWindowAttributes* /* attributes */
+);
+EXTERN Colormap *XListInstalledColormaps(
+ Display* /* display */,
+ Window /* w */,
+ int* /* num_return */
+);
+EXTERN char **XListFonts(
+ Display* /* display */,
+ _Xconst char* /* pattern */,
+ int /* maxnames */,
+ int* /* actual_count_return */
+);
+EXTERN char **XListFontsWithInfo(
+ Display* /* display */,
+ _Xconst char* /* pattern */,
+ int /* maxnames */,
+ int* /* count_return */,
+ XFontStruct** /* info_return */
+);
+EXTERN char **XGetFontPath(
+ Display* /* display */,
+ int* /* npaths_return */
+);
+EXTERN char **XListExtensions(
+ Display* /* display */,
+ int* /* nextensions_return */
+);
+EXTERN Atom *XListProperties(
+ Display* /* display */,
+ Window /* w */,
+ int* /* num_prop_return */
+);
+EXTERN XHostAddress *XListHosts(
+ Display* /* display */,
+ int* /* nhosts_return */,
+ Bool* /* state_return */
+);
+EXTERN _X_DEPRECATED KeySym XKeycodeToKeysym(
+ Display* /* display */,
+#if NeedWidePrototypes
+ unsigned int /* keycode */,
+#else
+ KeyCode /* keycode */,
+#endif
+ int /* index */
+);
+EXTERN KeySym XLookupKeysym(
+ XKeyEvent* /* key_event */,
+ int /* index */
+);
+EXTERN KeySym *XGetKeyboardMapping(
+ Display* /* display */,
+#if NeedWidePrototypes
+ unsigned int /* first_keycode */,
+#else
+ KeyCode /* first_keycode */,
+#endif
+ int /* keycode_count */,
+ int* /* keysyms_per_keycode_return */
+);
+EXTERN KeySym XStringToKeysym(
+ _Xconst char* /* string */
+);
+EXTERN long XMaxRequestSize(
+ Display* /* display */
+);
+EXTERN long XExtendedMaxRequestSize(
+ Display* /* display */
+);
+EXTERN char *XResourceManagerString(
+ Display* /* display */
+);
+EXTERN char *XScreenResourceString(
+ Screen* /* screen */
+);
+EXTERN unsigned long XDisplayMotionBufferSize(
+ Display* /* display */
+);
+EXTERN VisualID XVisualIDFromVisual(
+ Visual* /* visual */
+);
+
+/* multithread routines */
+
+EXTERN Status XInitThreads(
+ void
+);
+
+EXTERN void XLockDisplay(
+ Display* /* display */
+);
+
+EXTERN void XUnlockDisplay(
+ Display* /* display */
+);
+
+/* routines for dealing with extensions */
+
+EXTERN XExtCodes *XInitExtension(
+ Display* /* display */,
+ _Xconst char* /* name */
+);
+
+EXTERN XExtCodes *XAddExtension(
+ Display* /* display */
+);
+EXTERN XExtData *XFindOnExtensionList(
+ XExtData** /* structure */,
+ int /* number */
+);
+EXTERN XExtData **XEHeadOfExtensionList(
+ XEDataObject /* object */
+);
+
+/* these are routines for which there are also macros */
+EXTERN Window XRootWindow(
+ Display* /* display */,
+ int /* screen_number */
+);
+EXTERN Window XDefaultRootWindow(
+ Display* /* display */
+);
+EXTERN Window XRootWindowOfScreen(
+ Screen* /* screen */
+);
+EXTERN Visual *XDefaultVisual(
+ Display* /* display */,
+ int /* screen_number */
+);
+EXTERN Visual *XDefaultVisualOfScreen(
+ Screen* /* screen */
+);
+EXTERN GC XDefaultGC(
+ Display* /* display */,
+ int /* screen_number */
+);
+EXTERN GC XDefaultGCOfScreen(
+ Screen* /* screen */
+);
+EXTERN unsigned long XBlackPixel(
+ Display* /* display */,
+ int /* screen_number */
+);
+EXTERN unsigned long XWhitePixel(
+ Display* /* display */,
+ int /* screen_number */
+);
+EXTERN unsigned long XAllPlanes(
+ void
+);
+EXTERN unsigned long XBlackPixelOfScreen(
+ Screen* /* screen */
+);
+EXTERN unsigned long XWhitePixelOfScreen(
+ Screen* /* screen */
+);
+EXTERN unsigned long XNextRequest(
+ Display* /* display */
+);
+EXTERN unsigned long XLastKnownRequestProcessed(
+ Display* /* display */
+);
+EXTERN char *XServerVendor(
+ Display* /* display */
+);
+EXTERN char *XDisplayString(
+ Display* /* display */
+);
+EXTERN Colormap XDefaultColormap(
+ Display* /* display */,
+ int /* screen_number */
+);
+EXTERN Colormap XDefaultColormapOfScreen(
+ Screen* /* screen */
+);
+EXTERN Display *XDisplayOfScreen(
+ Screen* /* screen */
+);
+EXTERN Screen *XScreenOfDisplay(
+ Display* /* display */,
+ int /* screen_number */
+);
+EXTERN Screen *XDefaultScreenOfDisplay(
+ Display* /* display */
+);
+EXTERN long XEventMaskOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XScreenNumberOfScreen(
+ Screen* /* screen */
+);
+
typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */
-#if NeedFunctionPrototypes
Display* /* display */,
XErrorEvent* /* error_event */
-#endif
);
-_XFUNCPROTOBEGIN
+EXTERN XErrorHandler XSetErrorHandler (
+ XErrorHandler /* handler */
+);
+typedef int (*XIOErrorHandler) ( /* WARNING, this type not in Xlib spec */
+ Display* /* display */
+);
-#include "tkIntXlibDecls.h"
+EXTERN XIOErrorHandler XSetIOErrorHandler (
+ XIOErrorHandler /* handler */
+);
-_XFUNCPROTOEND
-#if defined(MAC_OSX_TK)
-# undef Cursor
-# undef Region
+EXTERN XPixmapFormatValues *XListPixmapFormats(
+ Display* /* display */,
+ int* /* count_return */
+);
+EXTERN int *XListDepths(
+ Display* /* display */,
+ int /* screen_number */,
+ int* /* count_return */
+);
+
+/* ICCCM routines for things that don't require special include files; */
+/* other declarations are given in Xutil.h */
+EXTERN Status XReconfigureWMWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* screen_number */,
+ unsigned int /* mask */,
+ XWindowChanges* /* changes */
+);
+
+EXTERN Status XGetWMProtocols(
+ Display* /* display */,
+ Window /* w */,
+ Atom** /* protocols_return */,
+ int* /* count_return */
+);
+EXTERN Status XSetWMProtocols(
+ Display* /* display */,
+ Window /* w */,
+ Atom* /* protocols */,
+ int /* count */
+);
+EXTERN Status XIconifyWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* screen_number */
+);
+EXTERN Status XWithdrawWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* screen_number */
+);
+EXTERN Status XGetCommand(
+ Display* /* display */,
+ Window /* w */,
+ char*** /* argv_return */,
+ int* /* argc_return */
+);
+EXTERN Status XGetWMColormapWindows(
+ Display* /* display */,
+ Window /* w */,
+ Window** /* windows_return */,
+ int* /* count_return */
+);
+EXTERN Status XSetWMColormapWindows(
+ Display* /* display */,
+ Window /* w */,
+ Window* /* colormap_windows */,
+ int /* count */
+);
+EXTERN void XFreeStringList(
+ char** /* list */
+);
+EXTERN int XSetTransientForHint(
+ Display* /* display */,
+ Window /* w */,
+ Window /* prop_window */
+);
+
+/* The following are given in alphabetical order */
+
+EXTERN int XActivateScreenSaver(
+ Display* /* display */
+);
+
+EXTERN int XAddHost(
+ Display* /* display */,
+ XHostAddress* /* host */
+);
+
+EXTERN int XAddHosts(
+ Display* /* display */,
+ XHostAddress* /* hosts */,
+ int /* num_hosts */
+);
+
+EXTERN int XAddToExtensionList(
+ struct _XExtData** /* structure */,
+ XExtData* /* ext_data */
+);
+
+EXTERN int XAddToSaveSet(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN Status XAllocColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* screen_in_out */
+);
+
+EXTERN Status XAllocColorCells(
+ Display* /* display */,
+ Colormap /* colormap */,
+ Bool /* contig */,
+ unsigned long* /* plane_masks_return */,
+ unsigned int /* nplanes */,
+ unsigned long* /* pixels_return */,
+ unsigned int /* npixels */
+);
+
+EXTERN Status XAllocColorPlanes(
+ Display* /* display */,
+ Colormap /* colormap */,
+ Bool /* contig */,
+ unsigned long* /* pixels_return */,
+ int /* ncolors */,
+ int /* nreds */,
+ int /* ngreens */,
+ int /* nblues */,
+ unsigned long* /* rmask_return */,
+ unsigned long* /* gmask_return */,
+ unsigned long* /* bmask_return */
+);
+
+EXTERN Status XAllocNamedColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ _Xconst char* /* color_name */,
+ XColor* /* screen_def_return */,
+ XColor* /* exact_def_return */
+);
+
+EXTERN int XAllowEvents(
+ Display* /* display */,
+ int /* event_mode */,
+ Time /* time */
+);
+
+EXTERN int XAutoRepeatOff(
+ Display* /* display */
+);
+
+EXTERN int XAutoRepeatOn(
+ Display* /* display */
+);
+
+EXTERN int XBell(
+ Display* /* display */,
+ int /* percent */
+);
+
+EXTERN int XBitmapBitOrder(
+ Display* /* display */
+);
+
+EXTERN int XBitmapPad(
+ Display* /* display */
+);
+
+EXTERN int XBitmapUnit(
+ Display* /* display */
+);
+
+EXTERN int XCellsOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XChangeActivePointerGrab(
+ Display* /* display */,
+ unsigned int /* event_mask */,
+ Cursor /* cursor */,
+ Time /* time */
+);
+
+EXTERN int XChangeGC(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* valuemask */,
+ XGCValues* /* values */
+);
+
+EXTERN int XChangeKeyboardControl(
+ Display* /* display */,
+ unsigned long /* value_mask */,
+ XKeyboardControl* /* values */
+);
+
+EXTERN int XChangeKeyboardMapping(
+ Display* /* display */,
+ int /* first_keycode */,
+ int /* keysyms_per_keycode */,
+ KeySym* /* keysyms */,
+ int /* num_codes */
+);
+
+EXTERN int XChangePointerControl(
+ Display* /* display */,
+ Bool /* do_accel */,
+ Bool /* do_threshold */,
+ int /* accel_numerator */,
+ int /* accel_denominator */,
+ int /* threshold */
+);
+
+EXTERN int XChangeProperty(
+ Display* /* display */,
+ Window /* w */,
+ Atom /* property */,
+ Atom /* type */,
+ int /* format */,
+ int /* mode */,
+ _Xconst unsigned char* /* data */,
+ int /* nelements */
+);
+
+EXTERN int XChangeSaveSet(
+ Display* /* display */,
+ Window /* w */,
+ int /* change_mode */
+);
+
+EXTERN int XChangeWindowAttributes(
+ Display* /* display */,
+ Window /* w */,
+ unsigned long /* valuemask */,
+ XSetWindowAttributes* /* attributes */
+);
+
+EXTERN Bool XCheckIfEvent(
+ Display* /* display */,
+ XEvent* /* event_return */,
+ Bool (*) (
+ Display* /* display */,
+ XEvent* /* event */,
+ XPointer /* arg */
+ ) /* predicate */,
+ XPointer /* arg */
+);
+
+EXTERN Bool XCheckMaskEvent(
+ Display* /* display */,
+ long /* event_mask */,
+ XEvent* /* event_return */
+);
+
+EXTERN Bool XCheckTypedEvent(
+ Display* /* display */,
+ int /* event_type */,
+ XEvent* /* event_return */
+);
+
+EXTERN Bool XCheckTypedWindowEvent(
+ Display* /* display */,
+ Window /* w */,
+ int /* event_type */,
+ XEvent* /* event_return */
+);
+
+EXTERN Bool XCheckWindowEvent(
+ Display* /* display */,
+ Window /* w */,
+ long /* event_mask */,
+ XEvent* /* event_return */
+);
+
+EXTERN int XCirculateSubwindows(
+ Display* /* display */,
+ Window /* w */,
+ int /* direction */
+);
+
+EXTERN int XCirculateSubwindowsDown(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XCirculateSubwindowsUp(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XClearArea(
+ Display* /* display */,
+ Window /* w */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ Bool /* exposures */
+);
+
+EXTERN int XClearWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XCloseDisplay(
+ Display* /* display */
+);
+
+EXTERN int XConfigureWindow(
+ Display* /* display */,
+ Window /* w */,
+ unsigned int /* value_mask */,
+ XWindowChanges* /* values */
+);
+
+EXTERN int XConnectionNumber(
+ Display* /* display */
+);
+
+EXTERN int XConvertSelection(
+ Display* /* display */,
+ Atom /* selection */,
+ Atom /* target */,
+ Atom /* property */,
+ Window /* requestor */,
+ Time /* time */
+);
+
+EXTERN int XCopyArea(
+ Display* /* display */,
+ Drawable /* src */,
+ Drawable /* dest */,
+ GC /* gc */,
+ int /* src_x */,
+ int /* src_y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* dest_x */,
+ int /* dest_y */
+);
+
+EXTERN int XCopyGC(
+ Display* /* display */,
+ GC /* src */,
+ unsigned long /* valuemask */,
+ GC /* dest */
+);
+
+EXTERN int XCopyPlane(
+ Display* /* display */,
+ Drawable /* src */,
+ Drawable /* dest */,
+ GC /* gc */,
+ int /* src_x */,
+ int /* src_y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* dest_x */,
+ int /* dest_y */,
+ unsigned long /* plane */
+);
+
+EXTERN int XDefaultDepth(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+EXTERN int XDefaultDepthOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XDefaultScreen(
+ Display* /* display */
+);
+
+EXTERN int XDefineCursor(
+ Display* /* display */,
+ Window /* w */,
+ Cursor /* cursor */
+);
+
+EXTERN int XDeleteProperty(
+ Display* /* display */,
+ Window /* w */,
+ Atom /* property */
+);
+
+EXTERN int XDestroyWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XDestroySubwindows(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XDoesBackingStore(
+ Screen* /* screen */
+);
+
+EXTERN Bool XDoesSaveUnders(
+ Screen* /* screen */
+);
+
+EXTERN int XDisableAccessControl(
+ Display* /* display */
+);
+
+
+EXTERN int XDisplayCells(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+EXTERN int XDisplayHeight(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+EXTERN int XDisplayHeightMM(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+EXTERN int XDisplayKeycodes(
+ Display* /* display */,
+ int* /* min_keycodes_return */,
+ int* /* max_keycodes_return */
+);
+
+EXTERN int XDisplayPlanes(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+EXTERN int XDisplayWidth(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+EXTERN int XDisplayWidthMM(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+EXTERN int XDrawArc(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* angle1 */,
+ int /* angle2 */
+);
+
+EXTERN int XDrawArcs(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XArc* /* arcs */,
+ int /* narcs */
+);
+
+EXTERN int XDrawImageString(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* string */,
+ int /* length */
+);
+
+EXTERN int XDrawImageString16(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst XChar2b* /* string */,
+ int /* length */
+);
+
+EXTERN int XDrawLine(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x1 */,
+ int /* y1 */,
+ int /* x2 */,
+ int /* y2 */
+);
+
+EXTERN int XDrawLines(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XPoint* /* points */,
+ int /* npoints */,
+ int /* mode */
+);
+
+EXTERN int XDrawPoint(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */
+);
+
+EXTERN int XDrawPoints(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XPoint* /* points */,
+ int /* npoints */,
+ int /* mode */
+);
+
+EXTERN int XDrawRectangle(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+EXTERN int XDrawRectangles(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XRectangle* /* rectangles */,
+ int /* nrectangles */
+);
+
+EXTERN int XDrawSegments(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XSegment* /* segments */,
+ int /* nsegments */
+);
+
+EXTERN int XDrawString(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* string */,
+ int /* length */
+);
+
+EXTERN int XDrawString16(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst XChar2b* /* string */,
+ int /* length */
+);
+
+EXTERN int XDrawText(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XTextItem* /* items */,
+ int /* nitems */
+);
+
+EXTERN int XDrawText16(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XTextItem16* /* items */,
+ int /* nitems */
+);
+
+EXTERN int XEnableAccessControl(
+ Display* /* display */
+);
+
+EXTERN int XEventsQueued(
+ Display* /* display */,
+ int /* mode */
+);
+
+EXTERN Status XFetchName(
+ Display* /* display */,
+ Window /* w */,
+ char** /* window_name_return */
+);
+
+EXTERN int XFillArc(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* angle1 */,
+ int /* angle2 */
+);
+
+EXTERN int XFillArcs(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XArc* /* arcs */,
+ int /* narcs */
+);
+
+EXTERN int XFillPolygon(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XPoint* /* points */,
+ int /* npoints */,
+ int /* shape */,
+ int /* mode */
+);
+
+EXTERN int XFillRectangle(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+EXTERN int XFillRectangles(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XRectangle* /* rectangles */,
+ int /* nrectangles */
+);
+
+EXTERN int XFlush(
+ Display* /* display */
+);
+
+EXTERN int XForceScreenSaver(
+ Display* /* display */,
+ int /* mode */
+);
+
+EXTERN int XFree(
+ void* /* data */
+);
+
+EXTERN int XFreeColormap(
+ Display* /* display */,
+ Colormap /* colormap */
+);
+
+EXTERN int XFreeColors(
+ Display* /* display */,
+ Colormap /* colormap */,
+ unsigned long* /* pixels */,
+ int /* npixels */,
+ unsigned long /* planes */
+);
+
+EXTERN int XFreeCursor(
+ Display* /* display */,
+ Cursor /* cursor */
+);
+
+EXTERN int XFreeExtensionList(
+ char** /* list */
+);
+
+EXTERN int XFreeFont(
+ Display* /* display */,
+ XFontStruct* /* font_struct */
+);
+
+EXTERN int XFreeFontInfo(
+ char** /* names */,
+ XFontStruct* /* free_info */,
+ int /* actual_count */
+);
+
+EXTERN int XFreeFontNames(
+ char** /* list */
+);
+
+EXTERN int XFreeFontPath(
+ char** /* list */
+);
+
+EXTERN int XFreeGC(
+ Display* /* display */,
+ GC /* gc */
+);
+
+EXTERN int XFreeModifiermap(
+ XModifierKeymap* /* modmap */
+);
+
+EXTERN int XFreePixmap(
+ Display* /* display */,
+ Pixmap /* pixmap */
+);
+
+EXTERN int XGeometry(
+ Display* /* display */,
+ int /* screen */,
+ _Xconst char* /* position */,
+ _Xconst char* /* default_position */,
+ unsigned int /* bwidth */,
+ unsigned int /* fwidth */,
+ unsigned int /* fheight */,
+ int /* xadder */,
+ int /* yadder */,
+ int* /* x_return */,
+ int* /* y_return */,
+ int* /* width_return */,
+ int* /* height_return */
+);
+
+EXTERN int XGetErrorDatabaseText(
+ Display* /* display */,
+ _Xconst char* /* name */,
+ _Xconst char* /* message */,
+ _Xconst char* /* default_string */,
+ char* /* buffer_return */,
+ int /* length */
+);
+
+EXTERN int XGetErrorText(
+ Display* /* display */,
+ int /* code */,
+ char* /* buffer_return */,
+ int /* length */
+);
+
+EXTERN Bool XGetFontProperty(
+ XFontStruct* /* font_struct */,
+ Atom /* atom */,
+ unsigned long* /* value_return */
+);
+
+EXTERN Status XGetGCValues(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* valuemask */,
+ XGCValues* /* values_return */
+);
+
+EXTERN Status XGetGeometry(
+ Display* /* display */,
+ Drawable /* d */,
+ Window* /* root_return */,
+ int* /* x_return */,
+ int* /* y_return */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */,
+ unsigned int* /* border_width_return */,
+ unsigned int* /* depth_return */
+);
+
+EXTERN Status XGetIconName(
+ Display* /* display */,
+ Window /* w */,
+ char** /* icon_name_return */
+);
+
+EXTERN int XGetInputFocus(
+ Display* /* display */,
+ Window* /* focus_return */,
+ int* /* revert_to_return */
+);
+
+EXTERN int XGetKeyboardControl(
+ Display* /* display */,
+ XKeyboardState* /* values_return */
+);
+
+EXTERN int XGetPointerControl(
+ Display* /* display */,
+ int* /* accel_numerator_return */,
+ int* /* accel_denominator_return */,
+ int* /* threshold_return */
+);
+
+EXTERN int XGetPointerMapping(
+ Display* /* display */,
+ unsigned char* /* map_return */,
+ int /* nmap */
+);
+
+EXTERN int XGetScreenSaver(
+ Display* /* display */,
+ int* /* timeout_return */,
+ int* /* interval_return */,
+ int* /* prefer_blanking_return */,
+ int* /* allow_exposures_return */
+);
+
+EXTERN Status XGetTransientForHint(
+ Display* /* display */,
+ Window /* w */,
+ Window* /* prop_window_return */
+);
+
+EXTERN int XGetWindowProperty(
+ Display* /* display */,
+ Window /* w */,
+ Atom /* property */,
+ long /* long_offset */,
+ long /* long_length */,
+ Bool /* delete */,
+ Atom /* req_type */,
+ Atom* /* actual_type_return */,
+ int* /* actual_format_return */,
+ unsigned long* /* nitems_return */,
+ unsigned long* /* bytes_after_return */,
+ unsigned char** /* prop_return */
+);
+
+EXTERN Status XGetWindowAttributes(
+ Display* /* display */,
+ Window /* w */,
+ XWindowAttributes* /* window_attributes_return */
+);
+
+EXTERN int XGrabButton(
+ Display* /* display */,
+ unsigned int /* button */,
+ unsigned int /* modifiers */,
+ Window /* grab_window */,
+ Bool /* owner_events */,
+ unsigned int /* event_mask */,
+ int /* pointer_mode */,
+ int /* keyboard_mode */,
+ Window /* confine_to */,
+ Cursor /* cursor */
+);
+
+EXTERN int XGrabKey(
+ Display* /* display */,
+ int /* keycode */,
+ unsigned int /* modifiers */,
+ Window /* grab_window */,
+ Bool /* owner_events */,
+ int /* pointer_mode */,
+ int /* keyboard_mode */
+);
+
+EXTERN int XGrabKeyboard(
+ Display* /* display */,
+ Window /* grab_window */,
+ Bool /* owner_events */,
+ int /* pointer_mode */,
+ int /* keyboard_mode */,
+ Time /* time */
+);
+
+EXTERN int XGrabPointer(
+ Display* /* display */,
+ Window /* grab_window */,
+ Bool /* owner_events */,
+ unsigned int /* event_mask */,
+ int /* pointer_mode */,
+ int /* keyboard_mode */,
+ Window /* confine_to */,
+ Cursor /* cursor */,
+ Time /* time */
+);
+
+EXTERN int XGrabServer(
+ Display* /* display */
+);
+
+EXTERN int XHeightMMOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XHeightOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XIfEvent(
+ Display* /* display */,
+ XEvent* /* event_return */,
+ Bool (*) (
+ Display* /* display */,
+ XEvent* /* event */,
+ XPointer /* arg */
+ ) /* predicate */,
+ XPointer /* arg */
+);
+
+EXTERN int XImageByteOrder(
+ Display* /* display */
+);
+
+EXTERN int XInstallColormap(
+ Display* /* display */,
+ Colormap /* colormap */
+);
+
+EXTERN KeyCode XKeysymToKeycode(
+ Display* /* display */,
+ KeySym /* keysym */
+);
+
+EXTERN int XKillClient(
+ Display* /* display */,
+ XID /* resource */
+);
+
+EXTERN Status XLookupColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ _Xconst char* /* color_name */,
+ XColor* /* exact_def_return */,
+ XColor* /* screen_def_return */
+);
+
+EXTERN int XLowerWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XMapRaised(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XMapSubwindows(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XMapWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XMaskEvent(
+ Display* /* display */,
+ long /* event_mask */,
+ XEvent* /* event_return */
+);
+
+EXTERN int XMaxCmapsOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XMinCmapsOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XMoveResizeWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+EXTERN int XMoveWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* x */,
+ int /* y */
+);
+
+EXTERN int XNextEvent(
+ Display* /* display */,
+ XEvent* /* event_return */
+);
+
+EXTERN int XNoOp(
+ Display* /* display */
+);
+
+EXTERN Status XParseColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ _Xconst char* /* spec */,
+ XColor* /* exact_def_return */
+);
+
+EXTERN int XParseGeometry(
+ _Xconst char* /* parsestring */,
+ int* /* x_return */,
+ int* /* y_return */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+EXTERN int XPeekEvent(
+ Display* /* display */,
+ XEvent* /* event_return */
+);
+
+EXTERN int XPeekIfEvent(
+ Display* /* display */,
+ XEvent* /* event_return */,
+ Bool (*) (
+ Display* /* display */,
+ XEvent* /* event */,
+ XPointer /* arg */
+ ) /* predicate */,
+ XPointer /* arg */
+);
+
+EXTERN int XPending(
+ Display* /* display */
+);
+
+EXTERN int XPlanesOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XProtocolRevision(
+ Display* /* display */
+);
+
+EXTERN int XProtocolVersion(
+ Display* /* display */
+);
+
+
+EXTERN int XPutBackEvent(
+ Display* /* display */,
+ XEvent* /* event */
+);
+
+EXTERN int XPutImage(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XImage* /* image */,
+ int /* src_x */,
+ int /* src_y */,
+ int /* dest_x */,
+ int /* dest_y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+EXTERN int XQLength(
+ Display* /* display */
+);
+
+EXTERN Status XQueryBestCursor(
+ Display* /* display */,
+ Drawable /* d */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+EXTERN Status XQueryBestSize(
+ Display* /* display */,
+ int /* class */,
+ Drawable /* which_screen */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+EXTERN Status XQueryBestStipple(
+ Display* /* display */,
+ Drawable /* which_screen */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+EXTERN Status XQueryBestTile(
+ Display* /* display */,
+ Drawable /* which_screen */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+EXTERN int XQueryColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* def_in_out */
+);
+
+EXTERN int XQueryColors(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* defs_in_out */,
+ int /* ncolors */
+);
+
+EXTERN Bool XQueryExtension(
+ Display* /* display */,
+ _Xconst char* /* name */,
+ int* /* major_opcode_return */,
+ int* /* first_event_return */,
+ int* /* first_error_return */
+);
+
+EXTERN int XQueryKeymap(
+ Display* /* display */,
+ char [32] /* keys_return */
+);
+
+EXTERN Bool XQueryPointer(
+ Display* /* display */,
+ Window /* w */,
+ Window* /* root_return */,
+ Window* /* child_return */,
+ int* /* root_x_return */,
+ int* /* root_y_return */,
+ int* /* win_x_return */,
+ int* /* win_y_return */,
+ unsigned int* /* mask_return */
+);
+
+EXTERN int XQueryTextExtents(
+ Display* /* display */,
+ XID /* font_ID */,
+ _Xconst char* /* string */,
+ int /* nchars */,
+ int* /* direction_return */,
+ int* /* font_ascent_return */,
+ int* /* font_descent_return */,
+ XCharStruct* /* overall_return */
+);
+
+EXTERN int XQueryTextExtents16(
+ Display* /* display */,
+ XID /* font_ID */,
+ _Xconst XChar2b* /* string */,
+ int /* nchars */,
+ int* /* direction_return */,
+ int* /* font_ascent_return */,
+ int* /* font_descent_return */,
+ XCharStruct* /* overall_return */
+);
+
+EXTERN Status XQueryTree(
+ Display* /* display */,
+ Window /* w */,
+ Window* /* root_return */,
+ Window* /* parent_return */,
+ Window** /* children_return */,
+ unsigned int* /* nchildren_return */
+);
+
+EXTERN int XRaiseWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XReadBitmapFile(
+ Display* /* display */,
+ Drawable /* d */,
+ _Xconst char* /* filename */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */,
+ Pixmap* /* bitmap_return */,
+ int* /* x_hot_return */,
+ int* /* y_hot_return */
+);
+
+EXTERN int XReadBitmapFileData(
+ _Xconst char* /* filename */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */,
+ unsigned char** /* data_return */,
+ int* /* x_hot_return */,
+ int* /* y_hot_return */
+);
+
+EXTERN int XRebindKeysym(
+ Display* /* display */,
+ KeySym /* keysym */,
+ KeySym* /* list */,
+ int /* mod_count */,
+ _Xconst unsigned char* /* string */,
+ int /* bytes_string */
+);
+
+EXTERN int XRecolorCursor(
+ Display* /* display */,
+ Cursor /* cursor */,
+ XColor* /* foreground_color */,
+ XColor* /* background_color */
+);
+
+EXTERN int XRefreshKeyboardMapping(
+ XMappingEvent* /* event_map */
+);
+
+EXTERN int XRemoveFromSaveSet(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XRemoveHost(
+ Display* /* display */,
+ XHostAddress* /* host */
+);
+
+EXTERN int XRemoveHosts(
+ Display* /* display */,
+ XHostAddress* /* hosts */,
+ int /* num_hosts */
+);
+
+EXTERN int XReparentWindow(
+ Display* /* display */,
+ Window /* w */,
+ Window /* parent */,
+ int /* x */,
+ int /* y */
+);
+
+EXTERN int XResetScreenSaver(
+ Display* /* display */
+);
+
+EXTERN int XResizeWindow(
+ Display* /* display */,
+ Window /* w */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+EXTERN int XRestackWindows(
+ Display* /* display */,
+ Window* /* windows */,
+ int /* nwindows */
+);
+
+EXTERN int XRotateBuffers(
+ Display* /* display */,
+ int /* rotate */
+);
+
+EXTERN int XRotateWindowProperties(
+ Display* /* display */,
+ Window /* w */,
+ Atom* /* properties */,
+ int /* num_prop */,
+ int /* npositions */
+);
+
+EXTERN int XScreenCount(
+ Display* /* display */
+);
+
+EXTERN int XSelectInput(
+ Display* /* display */,
+ Window /* w */,
+ long /* event_mask */
+);
+
+EXTERN Status XSendEvent(
+ Display* /* display */,
+ Window /* w */,
+ Bool /* propagate */,
+ long /* event_mask */,
+ XEvent* /* event_send */
+);
+
+EXTERN int XSetAccessControl(
+ Display* /* display */,
+ int /* mode */
+);
+
+EXTERN int XSetArcMode(
+ Display* /* display */,
+ GC /* gc */,
+ int /* arc_mode */
+);
+
+EXTERN int XSetBackground(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* background */
+);
+
+EXTERN int XSetClipMask(
+ Display* /* display */,
+ GC /* gc */,
+ Pixmap /* pixmap */
+);
+
+EXTERN int XSetClipOrigin(
+ Display* /* display */,
+ GC /* gc */,
+ int /* clip_x_origin */,
+ int /* clip_y_origin */
+);
+
+EXTERN int XSetClipRectangles(
+ Display* /* display */,
+ GC /* gc */,
+ int /* clip_x_origin */,
+ int /* clip_y_origin */,
+ XRectangle* /* rectangles */,
+ int /* n */,
+ int /* ordering */
+);
+
+EXTERN int XSetCloseDownMode(
+ Display* /* display */,
+ int /* close_mode */
+);
+
+EXTERN int XSetCommand(
+ Display* /* display */,
+ Window /* w */,
+ char** /* argv */,
+ int /* argc */
+);
+
+EXTERN int XSetDashes(
+ Display* /* display */,
+ GC /* gc */,
+ int /* dash_offset */,
+ _Xconst char* /* dash_list */,
+ int /* n */
+);
+
+EXTERN int XSetFillRule(
+ Display* /* display */,
+ GC /* gc */,
+ int /* fill_rule */
+);
+
+EXTERN int XSetFillStyle(
+ Display* /* display */,
+ GC /* gc */,
+ int /* fill_style */
+);
+
+EXTERN int XSetFont(
+ Display* /* display */,
+ GC /* gc */,
+ Font /* font */
+);
+
+EXTERN int XSetFontPath(
+ Display* /* display */,
+ char** /* directories */,
+ int /* ndirs */
+);
+
+EXTERN int XSetForeground(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* foreground */
+);
+
+EXTERN int XSetFunction(
+ Display* /* display */,
+ GC /* gc */,
+ int /* function */
+);
+
+EXTERN int XSetGraphicsExposures(
+ Display* /* display */,
+ GC /* gc */,
+ Bool /* graphics_exposures */
+);
+
+EXTERN int XSetIconName(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* icon_name */
+);
+
+EXTERN int XSetInputFocus(
+ Display* /* display */,
+ Window /* focus */,
+ int /* revert_to */,
+ Time /* time */
+);
+
+EXTERN int XSetLineAttributes(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned int /* line_width */,
+ int /* line_style */,
+ int /* cap_style */,
+ int /* join_style */
+);
+
+EXTERN int XSetModifierMapping(
+ Display* /* display */,
+ XModifierKeymap* /* modmap */
+);
+
+EXTERN int XSetPlaneMask(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* plane_mask */
+);
+
+EXTERN int XSetPointerMapping(
+ Display* /* display */,
+ _Xconst unsigned char* /* map */,
+ int /* nmap */
+);
+
+EXTERN int XSetScreenSaver(
+ Display* /* display */,
+ int /* timeout */,
+ int /* interval */,
+ int /* prefer_blanking */,
+ int /* allow_exposures */
+);
+
+EXTERN int XSetSelectionOwner(
+ Display* /* display */,
+ Atom /* selection */,
+ Window /* owner */,
+ Time /* time */
+);
+
+EXTERN int XSetState(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* foreground */,
+ unsigned long /* background */,
+ int /* function */,
+ unsigned long /* plane_mask */
+);
+
+EXTERN int XSetStipple(
+ Display* /* display */,
+ GC /* gc */,
+ Pixmap /* stipple */
+);
+
+EXTERN int XSetSubwindowMode(
+ Display* /* display */,
+ GC /* gc */,
+ int /* subwindow_mode */
+);
+
+EXTERN int XSetTSOrigin(
+ Display* /* display */,
+ GC /* gc */,
+ int /* ts_x_origin */,
+ int /* ts_y_origin */
+);
+
+EXTERN int XSetTile(
+ Display* /* display */,
+ GC /* gc */,
+ Pixmap /* tile */
+);
+
+EXTERN int XSetWindowBackground(
+ Display* /* display */,
+ Window /* w */,
+ unsigned long /* background_pixel */
+);
+
+EXTERN int XSetWindowBackgroundPixmap(
+ Display* /* display */,
+ Window /* w */,
+ Pixmap /* background_pixmap */
+);
+
+EXTERN int XSetWindowBorder(
+ Display* /* display */,
+ Window /* w */,
+ unsigned long /* border_pixel */
+);
+
+EXTERN int XSetWindowBorderPixmap(
+ Display* /* display */,
+ Window /* w */,
+ Pixmap /* border_pixmap */
+);
+
+EXTERN int XSetWindowBorderWidth(
+ Display* /* display */,
+ Window /* w */,
+ unsigned int /* width */
+);
+
+EXTERN int XSetWindowColormap(
+ Display* /* display */,
+ Window /* w */,
+ Colormap /* colormap */
+);
+
+EXTERN int XStoreBuffer(
+ Display* /* display */,
+ _Xconst char* /* bytes */,
+ int /* nbytes */,
+ int /* buffer */
+);
+
+EXTERN int XStoreBytes(
+ Display* /* display */,
+ _Xconst char* /* bytes */,
+ int /* nbytes */
+);
+
+EXTERN int XStoreColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* color */
+);
+
+EXTERN int XStoreColors(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* color */,
+ int /* ncolors */
+);
+
+EXTERN int XStoreName(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* window_name */
+);
+
+EXTERN int XStoreNamedColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ _Xconst char* /* color */,
+ unsigned long /* pixel */,
+ int /* flags */
+);
+
+EXTERN int XSync(
+ Display* /* display */,
+ Bool /* discard */
+);
+
+EXTERN int XTextExtents(
+ XFontStruct* /* font_struct */,
+ _Xconst char* /* string */,
+ int /* nchars */,
+ int* /* direction_return */,
+ int* /* font_ascent_return */,
+ int* /* font_descent_return */,
+ XCharStruct* /* overall_return */
+);
+
+EXTERN int XTextExtents16(
+ XFontStruct* /* font_struct */,
+ _Xconst XChar2b* /* string */,
+ int /* nchars */,
+ int* /* direction_return */,
+ int* /* font_ascent_return */,
+ int* /* font_descent_return */,
+ XCharStruct* /* overall_return */
+);
+
+EXTERN int XTextWidth(
+ XFontStruct* /* font_struct */,
+ _Xconst char* /* string */,
+ int /* count */
+);
+
+EXTERN int XTextWidth16(
+ XFontStruct* /* font_struct */,
+ _Xconst XChar2b* /* string */,
+ int /* count */
+);
+
+EXTERN Bool XTranslateCoordinates(
+ Display* /* display */,
+ Window /* src_w */,
+ Window /* dest_w */,
+ int /* src_x */,
+ int /* src_y */,
+ int* /* dest_x_return */,
+ int* /* dest_y_return */,
+ Window* /* child_return */
+);
+
+EXTERN int XUndefineCursor(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XUngrabButton(
+ Display* /* display */,
+ unsigned int /* button */,
+ unsigned int /* modifiers */,
+ Window /* grab_window */
+);
+
+EXTERN int XUngrabKey(
+ Display* /* display */,
+ int /* keycode */,
+ unsigned int /* modifiers */,
+ Window /* grab_window */
+);
+
+EXTERN int XUngrabKeyboard(
+ Display* /* display */,
+ Time /* time */
+);
+
+EXTERN int XUngrabPointer(
+ Display* /* display */,
+ Time /* time */
+);
+
+EXTERN int XUngrabServer(
+ Display* /* display */
+);
+
+EXTERN int XUninstallColormap(
+ Display* /* display */,
+ Colormap /* colormap */
+);
+
+EXTERN int XUnloadFont(
+ Display* /* display */,
+ Font /* font */
+);
+
+EXTERN int XUnmapSubwindows(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XUnmapWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+EXTERN int XVendorRelease(
+ Display* /* display */
+);
+
+EXTERN int XWarpPointer(
+ Display* /* display */,
+ Window /* src_w */,
+ Window /* dest_w */,
+ int /* src_x */,
+ int /* src_y */,
+ unsigned int /* src_width */,
+ unsigned int /* src_height */,
+ int /* dest_x */,
+ int /* dest_y */
+);
+
+EXTERN int XWidthMMOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XWidthOfScreen(
+ Screen* /* screen */
+);
+
+EXTERN int XWindowEvent(
+ Display* /* display */,
+ Window /* w */,
+ long /* event_mask */,
+ XEvent* /* event_return */
+);
+
+EXTERN int XWriteBitmapFile(
+ Display* /* display */,
+ _Xconst char* /* filename */,
+ Pixmap /* bitmap */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* x_hot */,
+ int /* y_hot */
+);
+
+EXTERN Bool XSupportsLocale (void);
+
+EXTERN char *XSetLocaleModifiers(
+ const char* /* modifier_list */
+);
+
+EXTERN XOM XOpenOM(
+ Display* /* display */,
+ struct _XrmHashBucketRec* /* rdb */,
+ _Xconst char* /* res_name */,
+ _Xconst char* /* res_class */
+);
+
+EXTERN Status XCloseOM(
+ XOM /* om */
+);
+
+EXTERN char *XSetOMValues(
+ XOM /* om */,
+ ...
+) _X_SENTINEL(0);
+
+EXTERN char *XGetOMValues(
+ XOM /* om */,
+ ...
+) _X_SENTINEL(0);
+
+EXTERN Display *XDisplayOfOM(
+ XOM /* om */
+);
+
+EXTERN char *XLocaleOfOM(
+ XOM /* om */
+);
+
+EXTERN XOC XCreateOC(
+ XOM /* om */,
+ ...
+) _X_SENTINEL(0);
+
+EXTERN void XDestroyOC(
+ XOC /* oc */
+);
+
+EXTERN XOM XOMOfOC(
+ XOC /* oc */
+);
+
+EXTERN char *XSetOCValues(
+ XOC /* oc */,
+ ...
+) _X_SENTINEL(0);
+
+EXTERN char *XGetOCValues(
+ XOC /* oc */,
+ ...
+) _X_SENTINEL(0);
+
+EXTERN XFontSet XCreateFontSet(
+ Display* /* display */,
+ _Xconst char* /* base_font_name_list */,
+ char*** /* missing_charset_list */,
+ int* /* missing_charset_count */,
+ char** /* def_string */
+);
+
+EXTERN void XFreeFontSet(
+ Display* /* display */,
+ XFontSet /* font_set */
+);
+
+EXTERN int XFontsOfFontSet(
+ XFontSet /* font_set */,
+ XFontStruct*** /* font_struct_list */,
+ char*** /* font_name_list */
+);
+
+EXTERN char *XBaseFontNameListOfFontSet(
+ XFontSet /* font_set */
+);
+
+EXTERN char *XLocaleOfFontSet(
+ XFontSet /* font_set */
+);
+
+EXTERN Bool XContextDependentDrawing(
+ XFontSet /* font_set */
+);
+
+EXTERN Bool XDirectionalDependentDrawing(
+ XFontSet /* font_set */
+);
+
+EXTERN Bool XContextualDrawing(
+ XFontSet /* font_set */
+);
+
+EXTERN XFontSetExtents *XExtentsOfFontSet(
+ XFontSet /* font_set */
+);
+
+EXTERN int XmbTextEscapement(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+EXTERN int XwcTextEscapement(
+ XFontSet /* font_set */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */
+);
+
+EXTERN int Xutf8TextEscapement(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+EXTERN int XmbTextExtents(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+EXTERN int XwcTextExtents(
+ XFontSet /* font_set */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+EXTERN int Xutf8TextExtents(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+EXTERN Status XmbTextPerCharExtents(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */,
+ XRectangle* /* ink_extents_buffer */,
+ XRectangle* /* logical_extents_buffer */,
+ int /* buffer_size */,
+ int* /* num_chars */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+EXTERN Status XwcTextPerCharExtents(
+ XFontSet /* font_set */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */,
+ XRectangle* /* ink_extents_buffer */,
+ XRectangle* /* logical_extents_buffer */,
+ int /* buffer_size */,
+ int* /* num_chars */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+EXTERN Status Xutf8TextPerCharExtents(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */,
+ XRectangle* /* ink_extents_buffer */,
+ XRectangle* /* logical_extents_buffer */,
+ int /* buffer_size */,
+ int* /* num_chars */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+EXTERN void XmbDrawText(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XmbTextItem* /* text_items */,
+ int /* nitems */
+);
+
+EXTERN void XwcDrawText(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XwcTextItem* /* text_items */,
+ int /* nitems */
+);
+
+EXTERN void Xutf8DrawText(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XmbTextItem* /* text_items */,
+ int /* nitems */
+);
+
+EXTERN void XmbDrawString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+EXTERN void XwcDrawString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */
+);
+
+EXTERN void Xutf8DrawString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+EXTERN void XmbDrawImageString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+EXTERN void XwcDrawImageString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */
+);
+
+EXTERN void Xutf8DrawImageString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+EXTERN XIM XOpenIM(
+ Display* /* dpy */,
+ struct _XrmHashBucketRec* /* rdb */,
+ char* /* res_name */,
+ char* /* res_class */
+);
+
+EXTERN Status XCloseIM(
+ XIM /* im */
+);
+
+EXTERN char *XGetIMValues(
+ XIM /* im */, ...
+) _X_SENTINEL(0);
+
+EXTERN char *XSetIMValues(
+ XIM /* im */, ...
+) _X_SENTINEL(0);
+
+EXTERN Display *XDisplayOfIM(
+ XIM /* im */
+);
+
+EXTERN char *XLocaleOfIM(
+ XIM /* im*/
+);
+
+EXTERN XIC XCreateIC(
+ XIM /* im */, ...
+) _X_SENTINEL(0);
+
+EXTERN void XDestroyIC(
+ XIC /* ic */
+);
+
+EXTERN void XSetICFocus(
+ XIC /* ic */
+);
+
+EXTERN void XUnsetICFocus(
+ XIC /* ic */
+);
+
+EXTERN wchar_t *XwcResetIC(
+ XIC /* ic */
+);
+
+EXTERN char *XmbResetIC(
+ XIC /* ic */
+);
+
+EXTERN char *Xutf8ResetIC(
+ XIC /* ic */
+);
+
+EXTERN char *XSetICValues(
+ XIC /* ic */, ...
+) _X_SENTINEL(0);
+
+EXTERN char *XGetICValues(
+ XIC /* ic */, ...
+) _X_SENTINEL(0);
+
+EXTERN XIM XIMOfIC(
+ XIC /* ic */
+);
+
+EXTERN Bool XFilterEvent(
+ XEvent* /* event */,
+ Window /* window */
+);
+
+EXTERN int XmbLookupString(
+ XIC /* ic */,
+ XKeyPressedEvent* /* event */,
+ char* /* buffer_return */,
+ int /* bytes_buffer */,
+ KeySym* /* keysym_return */,
+ Status* /* status_return */
+);
+
+EXTERN int XwcLookupString(
+ XIC /* ic */,
+ XKeyPressedEvent* /* event */,
+ wchar_t* /* buffer_return */,
+ int /* wchars_buffer */,
+ KeySym* /* keysym_return */,
+ Status* /* status_return */
+);
+
+EXTERN int Xutf8LookupString(
+ XIC /* ic */,
+ XKeyPressedEvent* /* event */,
+ char* /* buffer_return */,
+ int /* bytes_buffer */,
+ KeySym* /* keysym_return */,
+ Status* /* status_return */
+);
+
+EXTERN XVaNestedList XVaCreateNestedList(
+ int /*unused*/, ...
+) _X_SENTINEL(0);
+
+/* internal connections for IMs */
+
+EXTERN Bool XRegisterIMInstantiateCallback(
+ Display* /* dpy */,
+ struct _XrmHashBucketRec* /* rdb */,
+ char* /* res_name */,
+ char* /* res_class */,
+ XIDProc /* callback */,
+ XPointer /* client_data */
+);
+
+EXTERN Bool XUnregisterIMInstantiateCallback(
+ Display* /* dpy */,
+ struct _XrmHashBucketRec* /* rdb */,
+ char* /* res_name */,
+ char* /* res_class */,
+ XIDProc /* callback */,
+ XPointer /* client_data */
+);
+
+typedef void (*XConnectionWatchProc)(
+ Display* /* dpy */,
+ XPointer /* client_data */,
+ int /* fd */,
+ Bool /* opening */, /* open or close flag */
+ XPointer* /* watch_data */ /* open sets, close uses */
+);
+
+
+EXTERN Status XInternalConnectionNumbers(
+ Display* /* dpy */,
+ int** /* fd_return */,
+ int* /* count_return */
+);
+
+EXTERN void XProcessInternalConnection(
+ Display* /* dpy */,
+ int /* fd */
+);
+
+EXTERN Status XAddConnectionWatch(
+ Display* /* dpy */,
+ XConnectionWatchProc /* callback */,
+ XPointer /* client_data */
+);
+
+EXTERN void XRemoveConnectionWatch(
+ Display* /* dpy */,
+ XConnectionWatchProc /* callback */,
+ XPointer /* client_data */
+);
+
+EXTERN void XSetAuthorization(
+ char * /* name */,
+ int /* namelen */,
+ char * /* data */,
+ int /* datalen */
+);
+
+EXTERN int _Xmbtowc(
+ wchar_t * /* wstr */,
+ char * /* str */,
+ int /* len */
+);
+
+EXTERN int _Xwctomb(
+ char * /* str */,
+ wchar_t /* wc */
+);
+
+EXTERN Bool XGetEventData(
+ Display* /* dpy */,
+ XGenericEventCookie* /* cookie*/
+);
+
+EXTERN void XFreeEventData(
+ Display* /* dpy */,
+ XGenericEventCookie* /* cookie*/
+);
+
+#include "tkIntXlibDecls.h"
+
+#ifdef __clang__
+#pragma clang diagnostic pop
#endif
-#endif /* _XLIB_H_ */
+_XFUNCPROTOEND
+
+#endif /* _X11_XLIB_H_ */
diff --git a/xlib/X11/Xutil.h b/xlib/X11/Xutil.h
index bf372fb..6a22c97 100644
--- a/xlib/X11/Xutil.h
+++ b/xlib/X11/Xutil.h
@@ -1,8 +1,30 @@
-/* $XConsortium: Xutil.h,v 11.73 91/07/30 16:21:37 rws Exp $ */
/***********************************************************
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -10,7 +32,7 @@ Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or MIT not be
+supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
@@ -24,13 +46,19 @@ SOFTWARE.
******************************************************************/
-#ifndef _XUTIL_H_
-#define _XUTIL_H_
+#ifndef _X11_XUTIL_H_
+#define _X11_XUTIL_H_
/* You must include <X11/Xlib.h> before including this file */
+#include <X11/Xlib.h>
+#include <X11/keysym.h>
-#if defined(MAC_OSX_TK)
-# define Region XRegion
+/* The Xlib structs are full of implicit padding to properly align members.
+ We can't clean that up without breaking ABI, so tell clang not to bother
+ complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
#endif
/*
@@ -112,6 +140,7 @@ typedef struct {
#define WindowGroupHint (1L << 6)
#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
IconPositionHint|IconMaskHint|WindowGroupHint)
+#define XUrgencyHint (1L << 8)
/* definitions for initial window state */
#define WithdrawnState 0 /* for windows that are not mapped */
@@ -146,7 +175,9 @@ typedef enum {
XStringStyle, /* STRING */
XCompoundTextStyle, /* COMPOUND_TEXT */
XTextStyle, /* text in owner's encoding (current locale)*/
- XStdICCTextStyle /* STRING, else COMPOUND_TEXT */
+ XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */
+ /* The following is an XFree86 extension, introduced in November 2000 */
+ XUTF8StringStyle /* UTF8_STRING */
} XICCEncodingStyle;
typedef struct {
@@ -160,6 +191,38 @@ typedef struct {
char *res_class;
} XClassHint;
+#ifndef EXTERN
+# define EXTERN extern TCL_STORAGE_CLASS
+#endif
+#if defined(STATIC_BUILD) || !defined(_WIN32)
+# ifndef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS
+# endif
+#elif defined(BUILD_tk)
+# undef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS __declspec(dllexport)
+#elif !defined(TCL_STORAGE_CLASS)
+# define TCL_STORAGE_CLASS __declspec(dllimport)
+#endif
+
+#ifdef XUTIL_DEFINE_FUNCTIONS
+EXTERN int XDestroyImage(
+ XImage *ximage);
+EXTERN unsigned long XGetPixel(
+ XImage *ximage,
+ int x, int y);
+EXTERN int XPutPixel(
+ XImage *ximage,
+ int x, int y,
+ unsigned long pixel);
+EXTERN XImage *XSubImage(
+ XImage *ximage,
+ int x, int y,
+ unsigned int width, unsigned int height);
+EXTERN int XAddPixel(
+ XImage *ximage,
+ long value);
+#else
/*
* These macros are used to give some sugar to the image routines so that
* naive people are more comfortable with them.
@@ -174,6 +237,7 @@ typedef struct {
((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
#define XAddPixel(ximage, value) \
((*((ximage)->f.add_pixel))((ximage), (value)))
+#endif
/*
* Compose sequence status structure, used in calling XLookupString.
@@ -187,24 +251,36 @@ typedef struct _XComposeStatus {
* Keysym macros, used on Keysyms to test for classes of symbols
*/
#define IsKeypadKey(keysym) \
- (((unsigned)(keysym) >= XK_KP_Space) && ((unsigned)(keysym) <= XK_KP_Equal))
+ (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
+
+#define IsPrivateKeypadKey(keysym) \
+ (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
#define IsCursorKey(keysym) \
- (((unsigned)(keysym) >= XK_Home) && ((unsigned)(keysym) < XK_Select))
+ (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
#define IsPFKey(keysym) \
- (((unsigned)(keysym) >= XK_KP_F1) && ((unsigned)(keysym) <= XK_KP_F4))
+ (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
#define IsFunctionKey(keysym) \
- (((unsigned)(keysym) >= XK_F1) && ((unsigned)(keysym) <= XK_F35))
+ (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
#define IsMiscFunctionKey(keysym) \
- (((unsigned)(keysym) >= XK_Select) && ((unsigned)(keysym) <= XK_Break))
+ (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
+#ifdef XK_XKB_KEYS
+#define IsModifierKey(keysym) \
+ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
+ || (((KeySym)(keysym) >= XK_ISO_Lock) && \
+ ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \
+ || ((KeySym)(keysym) == XK_Mode_switch) \
+ || ((KeySym)(keysym) == XK_Num_Lock))
+#else
#define IsModifierKey(keysym) \
- ((((unsigned)(keysym) >= XK_Shift_L) && ((unsigned)(keysym) <= XK_Hyper_R)) \
- || ((unsigned)(keysym) == XK_Mode_switch) \
- || ((unsigned)(keysym) == XK_Num_Lock))
+ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
+ || ((KeySym)(keysym) == XK_Mode_switch) \
+ || ((KeySym)(keysym) == XK_Num_Lock))
+#endif
/*
* opaque reference to Region data type
*/
@@ -301,329 +377,258 @@ _XFUNCPROTOBEGIN
/* The following declarations are alphabetized. */
-extern XClassHint *XAllocClassHint (
-#if NeedFunctionPrototypes
+EXTERN XClassHint *XAllocClassHint (
void
-#endif
);
-extern XIconSize *XAllocIconSize (
-#if NeedFunctionPrototypes
+EXTERN XIconSize *XAllocIconSize (
void
-#endif
);
-extern XSizeHints *XAllocSizeHints (
-#if NeedFunctionPrototypes
+EXTERN XSizeHints *XAllocSizeHints (
void
-#endif
);
-extern XStandardColormap *XAllocStandardColormap (
-#if NeedFunctionPrototypes
+EXTERN XStandardColormap *XAllocStandardColormap (
void
-#endif
);
-extern XWMHints *XAllocWMHints (
-#if NeedFunctionPrototypes
+EXTERN XWMHints *XAllocWMHints (
void
-#endif
);
-extern void XClipBox(
-#if NeedFunctionPrototypes
+EXTERN int XClipBox(
Region /* r */,
XRectangle* /* rect_return */
-#endif
);
-extern Region XCreateRegion(
-#if NeedFunctionPrototypes
+EXTERN Region XCreateRegion(
void
-#endif
);
-extern char *XDefaultString(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+EXTERN const char *XDefaultString (void);
-extern int XDeleteContext(
-#if NeedFunctionPrototypes
+EXTERN int XDeleteContext(
Display* /* display */,
XID /* rid */,
XContext /* context */
-#endif
);
-extern void XDestroyRegion(
-#if NeedFunctionPrototypes
+EXTERN int XDestroyRegion(
Region /* r */
-#endif
);
-extern Bool XEmptyRegion(
-#if NeedFunctionPrototypes
+EXTERN int XEmptyRegion(
Region /* r */
-#endif
);
-extern Bool XEqualRegion(
-#if NeedFunctionPrototypes
+EXTERN int XEqualRegion(
Region /* r1 */,
Region /* r2 */
-#endif
);
-extern int XFindContext(
-#if NeedFunctionPrototypes
+EXTERN int XFindContext(
Display* /* display */,
XID /* rid */,
XContext /* context */,
XPointer* /* data_return */
-#endif
);
-extern Status XGetClassHint(
-#if NeedFunctionPrototypes
+EXTERN Status XGetClassHint(
Display* /* display */,
Window /* w */,
XClassHint* /* class_hints_return */
-#endif
);
-extern Status XGetIconSizes(
-#if NeedFunctionPrototypes
+EXTERN Status XGetIconSizes(
Display* /* display */,
Window /* w */,
XIconSize** /* size_list_return */,
int* /* count_return */
-#endif
);
-extern Status XGetNormalHints(
-#if NeedFunctionPrototypes
+EXTERN Status XGetNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */
-#endif
);
-extern Status XGetRGBColormaps(
-#if NeedFunctionPrototypes
+EXTERN Status XGetRGBColormaps(
Display* /* display */,
Window /* w */,
XStandardColormap** /* stdcmap_return */,
int* /* count_return */,
Atom /* property */
-#endif
);
-extern Status XGetSizeHints(
-#if NeedFunctionPrototypes
+EXTERN Status XGetSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
Atom /* property */
-#endif
);
-extern Status XGetStandardColormap(
-#if NeedFunctionPrototypes
+EXTERN Status XGetStandardColormap(
Display* /* display */,
Window /* w */,
XStandardColormap* /* colormap_return */,
Atom /* property */
-#endif
);
-extern Status XGetTextProperty(
-#if NeedFunctionPrototypes
+EXTERN Status XGetTextProperty(
Display* /* display */,
Window /* window */,
XTextProperty* /* text_prop_return */,
Atom /* property */
-#endif
);
+EXTERN XVisualInfo *XGetVisualInfo(
+ Display* /* display */,
+ long /* vinfo_mask */,
+ XVisualInfo* /* vinfo_template */,
+ int* /* nitems_return */
+);
-extern Status XGetWMClientMachine(
-#if NeedFunctionPrototypes
+EXTERN Status XGetWMClientMachine(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
-#endif
);
-extern XWMHints *XGetWMHints(
-#if NeedFunctionPrototypes
+EXTERN XWMHints *XGetWMHints(
Display* /* display */,
Window /* w */
-#endif
);
-extern Status XGetWMIconName(
-#if NeedFunctionPrototypes
+EXTERN Status XGetWMIconName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
-#endif
);
-extern Status XGetWMName(
-#if NeedFunctionPrototypes
+EXTERN Status XGetWMName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
-#endif
);
-extern Status XGetWMNormalHints(
-#if NeedFunctionPrototypes
+EXTERN Status XGetWMNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
long* /* supplied_return */
-#endif
);
-extern Status XGetWMSizeHints(
-#if NeedFunctionPrototypes
+EXTERN Status XGetWMSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
long* /* supplied_return */,
Atom /* property */
-#endif
);
-extern Status XGetZoomHints(
-#if NeedFunctionPrototypes
+EXTERN Status XGetZoomHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* zhints_return */
-#endif
);
-extern void XIntersectRegion(
-#if NeedFunctionPrototypes
+EXTERN int XIntersectRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
-#endif
);
-extern int XLookupString(
-#if NeedFunctionPrototypes
+EXTERN void XConvertCase(
+ KeySym /* sym */,
+ KeySym* /* lower */,
+ KeySym* /* upper */
+);
+
+EXTERN int XLookupString(
XKeyEvent* /* event_struct */,
char* /* buffer_return */,
int /* bytes_buffer */,
KeySym* /* keysym_return */,
XComposeStatus* /* status_in_out */
-#endif
);
-extern Status XMatchVisualInfo(
-#if NeedFunctionPrototypes
+EXTERN Status XMatchVisualInfo(
Display* /* display */,
int /* screen */,
int /* depth */,
int /* class */,
XVisualInfo* /* vinfo_return */
-#endif
);
-extern int XOffsetRegion(
-#if NeedFunctionPrototypes
+EXTERN int XOffsetRegion(
Region /* r */,
int /* dx */,
int /* dy */
-#endif
);
-extern Bool XPointInRegion(
-#if NeedFunctionPrototypes
+EXTERN Bool XPointInRegion(
Region /* r */,
int /* x */,
int /* y */
-#endif
);
-extern Region XPolygonRegion(
-#if NeedFunctionPrototypes
+EXTERN Region XPolygonRegion(
XPoint* /* points */,
int /* n */,
int /* fill_rule */
-#endif
);
-extern int XRectInRegion(
-#if NeedFunctionPrototypes
+EXTERN int XRectInRegion(
Region /* r */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */
-#endif
);
-extern int XSaveContext(
-#if NeedFunctionPrototypes
+EXTERN int XSaveContext(
Display* /* display */,
XID /* rid */,
XContext /* context */,
_Xconst char* /* data */
-#endif
);
-extern void XSetClassHint(
-#if NeedFunctionPrototypes
+EXTERN int XSetClassHint(
Display* /* display */,
Window /* w */,
XClassHint* /* class_hints */
-#endif
);
-extern void XSetIconSizes(
-#if NeedFunctionPrototypes
+EXTERN int XSetIconSizes(
Display* /* display */,
Window /* w */,
XIconSize* /* size_list */,
int /* count */
-#endif
);
-extern void XSetNormalHints(
-#if NeedFunctionPrototypes
+EXTERN int XSetNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */
-#endif
);
-extern void XSetRGBColormaps(
-#if NeedFunctionPrototypes
+EXTERN void XSetRGBColormaps(
Display* /* display */,
Window /* w */,
XStandardColormap* /* stdcmaps */,
int /* count */,
Atom /* property */
-#endif
);
-extern void XSetSizeHints(
-#if NeedFunctionPrototypes
+EXTERN int XSetSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */,
Atom /* property */
-#endif
);
-extern void XSetStandardProperties(
-#if NeedFunctionPrototypes
+EXTERN int XSetStandardProperties(
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
@@ -632,52 +637,46 @@ extern void XSetStandardProperties(
char** /* argv */,
int /* argc */,
XSizeHints* /* hints */
-#endif
);
-extern void XSetTextProperty(
-#if NeedFunctionPrototypes
+EXTERN void XSetTextProperty(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */,
Atom /* property */
-#endif
);
-extern void XSetWMHints(
-#if NeedFunctionPrototypes
+EXTERN void XSetWMClientMachine(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop */
+);
+
+EXTERN int XSetWMHints(
Display* /* display */,
Window /* w */,
XWMHints* /* wm_hints */
-#endif
);
-extern void XSetWMIconName(
-#if NeedFunctionPrototypes
+EXTERN void XSetWMIconName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
-#endif
);
-extern void XSetWMName(
-#if NeedFunctionPrototypes
+EXTERN void XSetWMName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
-#endif
);
-extern void XSetWMNormalHints(
-#if NeedFunctionPrototypes
+EXTERN void XSetWMNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */
-#endif
);
-extern void XSetWMProperties(
-#if NeedFunctionPrototypes
+EXTERN void XSetWMProperties(
Display* /* display */,
Window /* w */,
XTextProperty* /* window_name */,
@@ -687,11 +686,21 @@ extern void XSetWMProperties(
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
-#endif
);
-extern void XmbSetWMProperties(
-#if NeedFunctionPrototypes
+EXTERN void XmbSetWMProperties(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* window_name */,
+ _Xconst char* /* icon_name */,
+ char** /* argv */,
+ int /* argc */,
+ XSizeHints* /* normal_hints */,
+ XWMHints* /* wm_hints */,
+ XClassHint* /* class_hints */
+);
+
+EXTERN void Xutf8SetWMProperties(
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
@@ -701,129 +710,120 @@ extern void XmbSetWMProperties(
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
-#endif
);
-extern void XSetWMSizeHints(
-#if NeedFunctionPrototypes
+EXTERN void XSetWMSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */,
Atom /* property */
-#endif
);
-extern void XSetRegion(
-#if NeedFunctionPrototypes
+EXTERN int XSetRegion(
Display* /* display */,
GC /* gc */,
Region /* r */
-#endif
);
-extern void XSetStandardColormap(
-#if NeedFunctionPrototypes
+EXTERN void XSetStandardColormap(
Display* /* display */,
Window /* w */,
XStandardColormap* /* colormap */,
Atom /* property */
-#endif
);
-extern void XSetZoomHints(
-#if NeedFunctionPrototypes
+EXTERN int XSetZoomHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* zhints */
-#endif
);
-extern void XShrinkRegion(
-#if NeedFunctionPrototypes
+EXTERN int XShrinkRegion(
Region /* r */,
int /* dx */,
int /* dy */
-#endif
);
-extern void XSubtractRegion(
-#if NeedFunctionPrototypes
+EXTERN Status XStringListToTextProperty(
+ char** /* list */,
+ int /* count */,
+ XTextProperty* /* text_prop_return */
+);
+
+EXTERN int XSubtractRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
-#endif
);
-extern int XmbTextListToTextProperty(
-#if NeedFunctionPrototypes
- Display* /* display */,
- char** /* list */,
- int /* count */,
- XICCEncodingStyle /* style */,
- XTextProperty* /* text_prop_return */
-#endif
+EXTERN int XmbTextListToTextProperty(
+ Display* display,
+ char** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
);
-extern int XwcTextListToTextProperty(
-#if NeedFunctionPrototypes
- Display* /* display */,
- wchar_t** /* list */,
- int /* count */,
- XICCEncodingStyle /* style */,
- XTextProperty* /* text_prop_return */
-#endif
+EXTERN int XwcTextListToTextProperty(
+ Display* display,
+ wchar_t** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
);
-extern void XwcFreeStringList(
-#if NeedFunctionPrototypes
- wchar_t** /* list */
-#endif
+EXTERN int Xutf8TextListToTextProperty(
+ Display* display,
+ char** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
);
-extern Status XTextPropertyToStringList(
-#if NeedFunctionPrototypes
- XTextProperty* /* text_prop */,
- char*** /* list_return */,
- int* /* count_return */
-#endif
+EXTERN void XwcFreeStringList(
+ wchar_t** list
);
-extern int XmbTextPropertyToTextList(
-#if NeedFunctionPrototypes
- Display* /* display */,
+EXTERN Status XTextPropertyToStringList(
XTextProperty* /* text_prop */,
char*** /* list_return */,
int* /* count_return */
-#endif
);
-extern int XwcTextPropertyToTextList(
-#if NeedFunctionPrototypes
- Display* /* display */,
- XTextProperty* /* text_prop */,
- wchar_t*** /* list_return */,
- int* /* count_return */
-#endif
+EXTERN int XmbTextPropertyToTextList(
+ Display* display,
+ const XTextProperty* text_prop,
+ char*** list_return,
+ int* count_return
+);
+
+EXTERN int XwcTextPropertyToTextList(
+ Display* display,
+ const XTextProperty* text_prop,
+ wchar_t*** list_return,
+ int* count_return
+);
+
+EXTERN int Xutf8TextPropertyToTextList(
+ Display* display,
+ const XTextProperty* text_prop,
+ char*** list_return,
+ int* count_return
);
-extern void XUnionRectWithRegion(
-#if NeedFunctionPrototypes
+EXTERN int XUnionRectWithRegion(
XRectangle* /* rectangle */,
Region /* src_region */,
Region /* dest_region_return */
-#endif
);
-extern int XUnionRegion(
-#if NeedFunctionPrototypes
+EXTERN int XUnionRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
-#endif
);
-extern int XWMGeometry(
-#if NeedFunctionPrototypes
+EXTERN int XWMGeometry(
Display* /* display */,
int /* screen_number */,
_Xconst char* /* user_geometry */,
@@ -835,21 +835,18 @@ extern int XWMGeometry(
int* /* width_return */,
int* /* height_return */,
int* /* gravity_return */
-#endif
);
-extern void XXorRegion(
-#if NeedFunctionPrototypes
+EXTERN int XXorRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
-#endif
);
-_XFUNCPROTOEND
-
-#if defined(MAC_OSX_TK)
-# undef Region
+#ifdef __clang__
+#pragma clang diagnostic pop
#endif
-#endif /* _XUTIL_H_ */
+_XFUNCPROTOEND
+
+#endif /* _X11_XUTIL_H_ */
diff --git a/xlib/X11/cursorfont.h b/xlib/X11/cursorfont.h
index 617274f..c69d508 100644
--- a/xlib/X11/cursorfont.h
+++ b/xlib/X11/cursorfont.h
@@ -1,4 +1,34 @@
-/* $XConsortium: cursorfont.h,v 1.2 88/09/06 16:44:27 jim Exp $ */
+/*
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifndef _X11_CURSORFONT_H_
+#define _X11_CURSORFONT_H_
+
#define XC_num_glyphs 154
#define XC_X_cursor 0
#define XC_arrow 2
@@ -77,3 +107,5 @@
#define XC_ur_angle 148
#define XC_watch 150
#define XC_xterm 152
+
+#endif /* _X11_CURSORFONT_H_ */
diff --git a/xlib/X11/keysym.h b/xlib/X11/keysym.h
index 2547abe..0ffdde4 100644
--- a/xlib/X11/keysym.h
+++ b/xlib/X11/keysym.h
@@ -47,16 +47,28 @@ SOFTWARE.
/* default keysyms */
#define XK_MISCELLANY
+#define XK_XKB_KEYS
#define XK_LATIN1
#define XK_LATIN2
#define XK_LATIN3
#define XK_LATIN4
+#define XK_LATIN8
#define XK_LATIN9
+#define XK_CAUCASUS
#define XK_GREEK
#define XK_KATAKANA
#define XK_ARABIC
#define XK_CYRILLIC
#define XK_HEBREW
+#define XK_THAI
+#define XK_KOREAN
+#define XK_ARMENIAN
+#define XK_GEORGIAN
+#define XK_VIETNAMESE
+#define XK_CURRENCY
+#define XK_MATHEMATICAL
+#define XK_BRAILLE
+#define XK_SINHALA
#include <X11/keysymdef.h>
diff --git a/xlib/X11/keysymdef.h b/xlib/X11/keysymdef.h
index 5c13c61..8f1833f 100644
--- a/xlib/X11/keysymdef.h
+++ b/xlib/X11/keysymdef.h
@@ -161,6 +161,11 @@ SOFTWARE.
#define XK_Kana_Shift 0xff2e /* Kana Shift */
#define XK_Eisu_Shift 0xff2f /* Alphanumeric Shift */
#define XK_Eisu_toggle 0xff30 /* Alphanumeric toggle */
+#define XK_Kanji_Bangou 0xff37 /* Codeinput */
+#define XK_Zen_Koho 0xff3d /* Multiple/All Candidate(s) */
+#define XK_Mae_Koho 0xff3e /* Previous Candidate */
+
+/* 0xff31 thru 0xff3f are under XK_KOREAN */
/* Cursor control & motion */
@@ -176,11 +181,14 @@ SOFTWARE.
#define XK_End 0xff57 /* EOL */
#define XK_Begin 0xff58 /* BOL */
+
+#ifndef TK_NO_DEPRECATED
/* Special Windows keyboard keys */
#define XK_Win_L 0xFF5B /* Left-hand Windows */
#define XK_Win_R 0xFF5C /* Right-hand Windows */
#define XK_App 0xFF5D /* Menu key */
+#endif
/* Misc functions */
@@ -331,6 +339,212 @@ SOFTWARE.
#endif /* XK_MISCELLANY */
/*
+ * Keyboard (XKB) Extension function and modifier keys
+ * (from Appendix C of "The X Keyboard Extension: Protocol Specification")
+ * Byte 3 = 0xfe
+ */
+
+#ifdef XK_XKB_KEYS
+#define XK_ISO_Lock 0xfe01
+#define XK_ISO_Level2_Latch 0xfe02
+#define XK_ISO_Level3_Shift 0xfe03
+#define XK_ISO_Level3_Latch 0xfe04
+#define XK_ISO_Level3_Lock 0xfe05
+#define XK_ISO_Level5_Shift 0xfe11
+#define XK_ISO_Level5_Latch 0xfe12
+#define XK_ISO_Level5_Lock 0xfe13
+#define XK_ISO_Group_Shift 0xff7e /* Alias for mode_switch */
+#define XK_ISO_Group_Latch 0xfe06
+#define XK_ISO_Group_Lock 0xfe07
+#define XK_ISO_Next_Group 0xfe08
+#define XK_ISO_Next_Group_Lock 0xfe09
+#define XK_ISO_Prev_Group 0xfe0a
+#define XK_ISO_Prev_Group_Lock 0xfe0b
+#define XK_ISO_First_Group 0xfe0c
+#define XK_ISO_First_Group_Lock 0xfe0d
+#define XK_ISO_Last_Group 0xfe0e
+#define XK_ISO_Last_Group_Lock 0xfe0f
+
+#define XK_ISO_Left_Tab 0xfe20
+#define XK_ISO_Move_Line_Up 0xfe21
+#define XK_ISO_Move_Line_Down 0xfe22
+#define XK_ISO_Partial_Line_Up 0xfe23
+#define XK_ISO_Partial_Line_Down 0xfe24
+#define XK_ISO_Partial_Space_Left 0xfe25
+#define XK_ISO_Partial_Space_Right 0xfe26
+#define XK_ISO_Set_Margin_Left 0xfe27
+#define XK_ISO_Set_Margin_Right 0xfe28
+#define XK_ISO_Release_Margin_Left 0xfe29
+#define XK_ISO_Release_Margin_Right 0xfe2a
+#define XK_ISO_Release_Both_Margins 0xfe2b
+#define XK_ISO_Fast_Cursor_Left 0xfe2c
+#define XK_ISO_Fast_Cursor_Right 0xfe2d
+#define XK_ISO_Fast_Cursor_Up 0xfe2e
+#define XK_ISO_Fast_Cursor_Down 0xfe2f
+#define XK_ISO_Continuous_Underline 0xfe30
+#define XK_ISO_Discontinuous_Underline 0xfe31
+#define XK_ISO_Emphasize 0xfe32
+#define XK_ISO_Center_Object 0xfe33
+#define XK_ISO_Enter 0xfe34
+
+#define XK_dead_grave 0xfe50
+#define XK_dead_acute 0xfe51
+#define XK_dead_circumflex 0xfe52
+#define XK_dead_tilde 0xfe53
+#define XK_dead_perispomeni 0xfe53 /* alias for dead_tilde */
+#define XK_dead_macron 0xfe54
+#define XK_dead_breve 0xfe55
+#define XK_dead_abovedot 0xfe56
+#define XK_dead_diaeresis 0xfe57
+#define XK_dead_abovering 0xfe58
+#define XK_dead_doubleacute 0xfe59
+#define XK_dead_caron 0xfe5a
+#define XK_dead_cedilla 0xfe5b
+#define XK_dead_ogonek 0xfe5c
+#define XK_dead_iota 0xfe5d
+#define XK_dead_voiced_sound 0xfe5e
+#define XK_dead_semivoiced_sound 0xfe5f
+#define XK_dead_belowdot 0xfe60
+#define XK_dead_hook 0xfe61
+#define XK_dead_horn 0xfe62
+#define XK_dead_stroke 0xfe63
+#define XK_dead_abovecomma 0xfe64
+#define XK_dead_psili 0xfe64 /* alias for dead_abovecomma */
+#define XK_dead_abovereversedcomma 0xfe65
+#define XK_dead_dasia 0xfe65 /* alias for dead_abovereversedcomma */
+#define XK_dead_doublegrave 0xfe66
+#define XK_dead_belowring 0xfe67
+#define XK_dead_belowmacron 0xfe68
+#define XK_dead_belowcircumflex 0xfe69
+#define XK_dead_belowtilde 0xfe6a
+#define XK_dead_belowbreve 0xfe6b
+#define XK_dead_belowdiaeresis 0xfe6c
+#define XK_dead_invertedbreve 0xfe6d
+#define XK_dead_belowcomma 0xfe6e
+#define XK_dead_currency 0xfe6f
+
+/* extra dead elements for German T3 layout */
+#define XK_dead_lowline 0xfe90
+#define XK_dead_aboveverticalline 0xfe91
+#define XK_dead_belowverticalline 0xfe92
+#define XK_dead_longsolidusoverlay 0xfe93
+
+/* dead vowels for universal syllable entry */
+#define XK_dead_a 0xfe80
+#define XK_dead_A 0xfe81
+#define XK_dead_e 0xfe82
+#define XK_dead_E 0xfe83
+#define XK_dead_i 0xfe84
+#define XK_dead_I 0xfe85
+#define XK_dead_o 0xfe86
+#define XK_dead_O 0xfe87
+#define XK_dead_u 0xfe88
+#define XK_dead_U 0xfe89
+#define XK_dead_small_schwa 0xfe8a
+#define XK_dead_capital_schwa 0xfe8b
+
+#define XK_dead_greek 0xfe8c
+
+#define XK_First_Virtual_Screen 0xfed0
+#define XK_Prev_Virtual_Screen 0xfed1
+#define XK_Next_Virtual_Screen 0xfed2
+#define XK_Last_Virtual_Screen 0xfed4
+#define XK_Terminate_Server 0xfed5
+
+#define XK_AccessX_Enable 0xfe70
+#define XK_AccessX_Feedback_Enable 0xfe71
+#define XK_RepeatKeys_Enable 0xfe72
+#define XK_SlowKeys_Enable 0xfe73
+#define XK_BounceKeys_Enable 0xfe74
+#define XK_StickyKeys_Enable 0xfe75
+#define XK_MouseKeys_Enable 0xfe76
+#define XK_MouseKeys_Accel_Enable 0xfe77
+#define XK_Overlay1_Enable 0xfe78
+#define XK_Overlay2_Enable 0xfe79
+#define XK_AudibleBell_Enable 0xfe7a
+
+#define XK_Pointer_Left 0xfee0
+#define XK_Pointer_Right 0xfee1
+#define XK_Pointer_Up 0xfee2
+#define XK_Pointer_Down 0xfee3
+#define XK_Pointer_UpLeft 0xfee4
+#define XK_Pointer_UpRight 0xfee5
+#define XK_Pointer_DownLeft 0xfee6
+#define XK_Pointer_DownRight 0xfee7
+#define XK_Pointer_Button_Dflt 0xfee8
+#define XK_Pointer_Button1 0xfee9
+#define XK_Pointer_Button2 0xfeea
+#define XK_Pointer_Button3 0xfeeb
+#define XK_Pointer_Button4 0xfeec
+#define XK_Pointer_Button5 0xfeed
+#define XK_Pointer_DblClick_Dflt 0xfeee
+#define XK_Pointer_DblClick1 0xfeef
+#define XK_Pointer_DblClick2 0xfef0
+#define XK_Pointer_DblClick3 0xfef1
+#define XK_Pointer_DblClick4 0xfef2
+#define XK_Pointer_DblClick5 0xfef3
+#define XK_Pointer_Drag_Dflt 0xfef4
+#define XK_Pointer_Drag1 0xfef5
+#define XK_Pointer_Drag2 0xfef6
+#define XK_Pointer_Drag3 0xfef7
+#define XK_Pointer_Drag4 0xfef8
+#define XK_Pointer_Drag5 0xfefd
+
+#define XK_Pointer_EnableKeys 0xfef9
+#define XK_Pointer_Accelerate 0xfefa
+#define XK_Pointer_DfltBtnNext 0xfefb
+#define XK_Pointer_DfltBtnPrev 0xfefc
+
+/* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */
+
+#define XK_ch 0xfea0
+#define XK_Ch 0xfea1
+#define XK_CH 0xfea2
+#define XK_c_h 0xfea3
+#define XK_C_h 0xfea4
+#define XK_C_H 0xfea5
+
+#endif /* XK_XKB_KEYS */
+
+/*
+ * 3270 Terminal Keys
+ * Byte 3 = 0xfd
+ */
+
+#ifdef XK_3270
+#define XK_3270_Duplicate 0xfd01
+#define XK_3270_FieldMark 0xfd02
+#define XK_3270_Right2 0xfd03
+#define XK_3270_Left2 0xfd04
+#define XK_3270_BackTab 0xfd05
+#define XK_3270_EraseEOF 0xfd06
+#define XK_3270_EraseInput 0xfd07
+#define XK_3270_Reset 0xfd08
+#define XK_3270_Quit 0xfd09
+#define XK_3270_PA1 0xfd0a
+#define XK_3270_PA2 0xfd0b
+#define XK_3270_PA3 0xfd0c
+#define XK_3270_Test 0xfd0d
+#define XK_3270_Attn 0xfd0e
+#define XK_3270_CursorBlink 0xfd0f
+#define XK_3270_AltCursor 0xfd10
+#define XK_3270_KeyClick 0xfd11
+#define XK_3270_Jump 0xfd12
+#define XK_3270_Ident 0xfd13
+#define XK_3270_Rule 0xfd14
+#define XK_3270_Copy 0xfd15
+#define XK_3270_Play 0xfd16
+#define XK_3270_Setup 0xfd17
+#define XK_3270_Record 0xfd18
+#define XK_3270_ChangeScreen 0xfd19
+#define XK_3270_DeleteWord 0xfd1a
+#define XK_3270_ExSelect 0xfd1b
+#define XK_3270_CursorSelect 0xfd1c
+#define XK_3270_PrintScreen 0xfd1d
+#define XK_3270_Enter 0xfd1e
+#endif /* XK_3270 */
+
+/*
* Latin 1
* (ISO/IEC 8859-1 = Unicode U+0020..U+00FF)
* Byte 3 = 0
@@ -526,6 +740,7 @@ SOFTWARE.
#define XK_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */
#define XK_division 0x00f7 /* U+00F7 DIVISION SIGN */
#define XK_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
+#define XK_ooblique 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
#define XK_ugrave 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */
#define XK_uacute 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */
#define XK_ucircumflex 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */
@@ -1282,10 +1497,251 @@ SOFTWARE.
#define XK_Hebrew_switch 0xff7e /* Alias for mode_switch */
#endif /* XK_HEBREW */
+/*
+ * Thai
+ * Byte 3 = 0x0d
+ */
+
+#ifdef XK_THAI
+#define XK_Thai_kokai 0x0da1 /* U+0E01 THAI CHARACTER KO KAI */
+#define XK_Thai_khokhai 0x0da2 /* U+0E02 THAI CHARACTER KHO KHAI */
+#define XK_Thai_khokhuat 0x0da3 /* U+0E03 THAI CHARACTER KHO KHUAT */
+#define XK_Thai_khokhwai 0x0da4 /* U+0E04 THAI CHARACTER KHO KHWAI */
+#define XK_Thai_khokhon 0x0da5 /* U+0E05 THAI CHARACTER KHO KHON */
+#define XK_Thai_khorakhang 0x0da6 /* U+0E06 THAI CHARACTER KHO RAKHANG */
+#define XK_Thai_ngongu 0x0da7 /* U+0E07 THAI CHARACTER NGO NGU */
+#define XK_Thai_chochan 0x0da8 /* U+0E08 THAI CHARACTER CHO CHAN */
+#define XK_Thai_choching 0x0da9 /* U+0E09 THAI CHARACTER CHO CHING */
+#define XK_Thai_chochang 0x0daa /* U+0E0A THAI CHARACTER CHO CHANG */
+#define XK_Thai_soso 0x0dab /* U+0E0B THAI CHARACTER SO SO */
+#define XK_Thai_chochoe 0x0dac /* U+0E0C THAI CHARACTER CHO CHOE */
+#define XK_Thai_yoying 0x0dad /* U+0E0D THAI CHARACTER YO YING */
+#define XK_Thai_dochada 0x0dae /* U+0E0E THAI CHARACTER DO CHADA */
+#define XK_Thai_topatak 0x0daf /* U+0E0F THAI CHARACTER TO PATAK */
+#define XK_Thai_thothan 0x0db0 /* U+0E10 THAI CHARACTER THO THAN */
+#define XK_Thai_thonangmontho 0x0db1 /* U+0E11 THAI CHARACTER THO NANGMONTHO */
+#define XK_Thai_thophuthao 0x0db2 /* U+0E12 THAI CHARACTER THO PHUTHAO */
+#define XK_Thai_nonen 0x0db3 /* U+0E13 THAI CHARACTER NO NEN */
+#define XK_Thai_dodek 0x0db4 /* U+0E14 THAI CHARACTER DO DEK */
+#define XK_Thai_totao 0x0db5 /* U+0E15 THAI CHARACTER TO TAO */
+#define XK_Thai_thothung 0x0db6 /* U+0E16 THAI CHARACTER THO THUNG */
+#define XK_Thai_thothahan 0x0db7 /* U+0E17 THAI CHARACTER THO THAHAN */
+#define XK_Thai_thothong 0x0db8 /* U+0E18 THAI CHARACTER THO THONG */
+#define XK_Thai_nonu 0x0db9 /* U+0E19 THAI CHARACTER NO NU */
+#define XK_Thai_bobaimai 0x0dba /* U+0E1A THAI CHARACTER BO BAIMAI */
+#define XK_Thai_popla 0x0dbb /* U+0E1B THAI CHARACTER PO PLA */
+#define XK_Thai_phophung 0x0dbc /* U+0E1C THAI CHARACTER PHO PHUNG */
+#define XK_Thai_fofa 0x0dbd /* U+0E1D THAI CHARACTER FO FA */
+#define XK_Thai_phophan 0x0dbe /* U+0E1E THAI CHARACTER PHO PHAN */
+#define XK_Thai_fofan 0x0dbf /* U+0E1F THAI CHARACTER FO FAN */
+#define XK_Thai_phosamphao 0x0dc0 /* U+0E20 THAI CHARACTER PHO SAMPHAO */
+#define XK_Thai_moma 0x0dc1 /* U+0E21 THAI CHARACTER MO MA */
+#define XK_Thai_yoyak 0x0dc2 /* U+0E22 THAI CHARACTER YO YAK */
+#define XK_Thai_rorua 0x0dc3 /* U+0E23 THAI CHARACTER RO RUA */
+#define XK_Thai_ru 0x0dc4 /* U+0E24 THAI CHARACTER RU */
+#define XK_Thai_loling 0x0dc5 /* U+0E25 THAI CHARACTER LO LING */
+#define XK_Thai_lu 0x0dc6 /* U+0E26 THAI CHARACTER LU */
+#define XK_Thai_wowaen 0x0dc7 /* U+0E27 THAI CHARACTER WO WAEN */
+#define XK_Thai_sosala 0x0dc8 /* U+0E28 THAI CHARACTER SO SALA */
+#define XK_Thai_sorusi 0x0dc9 /* U+0E29 THAI CHARACTER SO RUSI */
+#define XK_Thai_sosua 0x0dca /* U+0E2A THAI CHARACTER SO SUA */
+#define XK_Thai_hohip 0x0dcb /* U+0E2B THAI CHARACTER HO HIP */
+#define XK_Thai_lochula 0x0dcc /* U+0E2C THAI CHARACTER LO CHULA */
+#define XK_Thai_oang 0x0dcd /* U+0E2D THAI CHARACTER O ANG */
+#define XK_Thai_honokhuk 0x0dce /* U+0E2E THAI CHARACTER HO NOKHUK */
+#define XK_Thai_paiyannoi 0x0dcf /* U+0E2F THAI CHARACTER PAIYANNOI */
+#define XK_Thai_saraa 0x0dd0 /* U+0E30 THAI CHARACTER SARA A */
+#define XK_Thai_maihanakat 0x0dd1 /* U+0E31 THAI CHARACTER MAI HAN-AKAT */
+#define XK_Thai_saraaa 0x0dd2 /* U+0E32 THAI CHARACTER SARA AA */
+#define XK_Thai_saraam 0x0dd3 /* U+0E33 THAI CHARACTER SARA AM */
+#define XK_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */
+#define XK_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */
+#define XK_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */
+#define XK_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */
+#define XK_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */
+#define XK_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */
+#define XK_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */
+#define XK_Thai_maihanakat_maitho 0x0dde
+#define XK_Thai_baht 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */
+#define XK_Thai_sarae 0x0de0 /* U+0E40 THAI CHARACTER SARA E */
+#define XK_Thai_saraae 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */
+#define XK_Thai_sarao 0x0de2 /* U+0E42 THAI CHARACTER SARA O */
+#define XK_Thai_saraaimaimuan 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */
+#define XK_Thai_saraaimaimalai 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */
+#define XK_Thai_lakkhangyao 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */
+#define XK_Thai_maiyamok 0x0de6 /* U+0E46 THAI CHARACTER MAIYAMOK */
+#define XK_Thai_maitaikhu 0x0de7 /* U+0E47 THAI CHARACTER MAITAIKHU */
+#define XK_Thai_maiek 0x0de8 /* U+0E48 THAI CHARACTER MAI EK */
+#define XK_Thai_maitho 0x0de9 /* U+0E49 THAI CHARACTER MAI THO */
+#define XK_Thai_maitri 0x0dea /* U+0E4A THAI CHARACTER MAI TRI */
+#define XK_Thai_maichattawa 0x0deb /* U+0E4B THAI CHARACTER MAI CHATTAWA */
+#define XK_Thai_thanthakhat 0x0dec /* U+0E4C THAI CHARACTER THANTHAKHAT */
+#define XK_Thai_nikhahit 0x0ded /* U+0E4D THAI CHARACTER NIKHAHIT */
+#define XK_Thai_leksun 0x0df0 /* U+0E50 THAI DIGIT ZERO */
+#define XK_Thai_leknung 0x0df1 /* U+0E51 THAI DIGIT ONE */
+#define XK_Thai_leksong 0x0df2 /* U+0E52 THAI DIGIT TWO */
+#define XK_Thai_leksam 0x0df3 /* U+0E53 THAI DIGIT THREE */
+#define XK_Thai_leksi 0x0df4 /* U+0E54 THAI DIGIT FOUR */
+#define XK_Thai_lekha 0x0df5 /* U+0E55 THAI DIGIT FIVE */
+#define XK_Thai_lekhok 0x0df6 /* U+0E56 THAI DIGIT SIX */
+#define XK_Thai_lekchet 0x0df7 /* U+0E57 THAI DIGIT SEVEN */
+#define XK_Thai_lekpaet 0x0df8 /* U+0E58 THAI DIGIT EIGHT */
+#define XK_Thai_lekkao 0x0df9 /* U+0E59 THAI DIGIT NINE */
+#endif /* XK_THAI */
+
+/*
+ * Korean
+ * Byte 3 = 0x0e
+ */
+
+#ifdef XK_KOREAN
+
+#define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */
+#define XK_Hangul_Start 0xff32 /* Hangul start */
+#define XK_Hangul_End 0xff33 /* Hangul end, English start */
+#define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */
+#define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */
+#define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */
+#define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */
+#define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */
+#define XK_Hangul_Banja 0xff39 /* Banja mode */
+#define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */
+#define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */
+#define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */
+#define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */
+#define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */
+#define XK_Hangul_Special 0xff3f /* Special symbols */
+#define XK_Hangul_switch 0xff7e /* Alias for mode_switch */
+
+/* Hangul Consonant Characters */
+#define XK_Hangul_Kiyeog 0x0ea1 /* U+3131 HANGUL LETTER KIYEOK */
+#define XK_Hangul_SsangKiyeog 0x0ea2 /* U+3132 HANGUL LETTER SSANGKIYEOK */
+#define XK_Hangul_KiyeogSios 0x0ea3 /* U+3133 HANGUL LETTER KIYEOK-SIOS */
+#define XK_Hangul_Nieun 0x0ea4 /* U+3134 HANGUL LETTER NIEUN */
+#define XK_Hangul_NieunJieuj 0x0ea5 /* U+3135 HANGUL LETTER NIEUN-CIEUC */
+#define XK_Hangul_NieunHieuh 0x0ea6 /* U+3136 HANGUL LETTER NIEUN-HIEUH */
+#define XK_Hangul_Dikeud 0x0ea7 /* U+3137 HANGUL LETTER TIKEUT */
+#define XK_Hangul_SsangDikeud 0x0ea8 /* U+3138 HANGUL LETTER SSANGTIKEUT */
+#define XK_Hangul_Rieul 0x0ea9 /* U+3139 HANGUL LETTER RIEUL */
+#define XK_Hangul_RieulKiyeog 0x0eaa /* U+313A HANGUL LETTER RIEUL-KIYEOK */
+#define XK_Hangul_RieulMieum 0x0eab /* U+313B HANGUL LETTER RIEUL-MIEUM */
+#define XK_Hangul_RieulPieub 0x0eac /* U+313C HANGUL LETTER RIEUL-PIEUP */
+#define XK_Hangul_RieulSios 0x0ead /* U+313D HANGUL LETTER RIEUL-SIOS */
+#define XK_Hangul_RieulTieut 0x0eae /* U+313E HANGUL LETTER RIEUL-THIEUTH */
+#define XK_Hangul_RieulPhieuf 0x0eaf /* U+313F HANGUL LETTER RIEUL-PHIEUPH */
+#define XK_Hangul_RieulHieuh 0x0eb0 /* U+3140 HANGUL LETTER RIEUL-HIEUH */
+#define XK_Hangul_Mieum 0x0eb1 /* U+3141 HANGUL LETTER MIEUM */
+#define XK_Hangul_Pieub 0x0eb2 /* U+3142 HANGUL LETTER PIEUP */
+#define XK_Hangul_SsangPieub 0x0eb3 /* U+3143 HANGUL LETTER SSANGPIEUP */
+#define XK_Hangul_PieubSios 0x0eb4 /* U+3144 HANGUL LETTER PIEUP-SIOS */
+#define XK_Hangul_Sios 0x0eb5 /* U+3145 HANGUL LETTER SIOS */
+#define XK_Hangul_SsangSios 0x0eb6 /* U+3146 HANGUL LETTER SSANGSIOS */
+#define XK_Hangul_Ieung 0x0eb7 /* U+3147 HANGUL LETTER IEUNG */
+#define XK_Hangul_Jieuj 0x0eb8 /* U+3148 HANGUL LETTER CIEUC */
+#define XK_Hangul_SsangJieuj 0x0eb9 /* U+3149 HANGUL LETTER SSANGCIEUC */
+#define XK_Hangul_Cieuc 0x0eba /* U+314A HANGUL LETTER CHIEUCH */
+#define XK_Hangul_Khieuq 0x0ebb /* U+314B HANGUL LETTER KHIEUKH */
+#define XK_Hangul_Tieut 0x0ebc /* U+314C HANGUL LETTER THIEUTH */
+#define XK_Hangul_Phieuf 0x0ebd /* U+314D HANGUL LETTER PHIEUPH */
+#define XK_Hangul_Hieuh 0x0ebe /* U+314E HANGUL LETTER HIEUH */
+
+/* Hangul Vowel Characters */
+#define XK_Hangul_A 0x0ebf /* U+314F HANGUL LETTER A */
+#define XK_Hangul_AE 0x0ec0 /* U+3150 HANGUL LETTER AE */
+#define XK_Hangul_YA 0x0ec1 /* U+3151 HANGUL LETTER YA */
+#define XK_Hangul_YAE 0x0ec2 /* U+3152 HANGUL LETTER YAE */
+#define XK_Hangul_EO 0x0ec3 /* U+3153 HANGUL LETTER EO */
+#define XK_Hangul_E 0x0ec4 /* U+3154 HANGUL LETTER E */
+#define XK_Hangul_YEO 0x0ec5 /* U+3155 HANGUL LETTER YEO */
+#define XK_Hangul_YE 0x0ec6 /* U+3156 HANGUL LETTER YE */
+#define XK_Hangul_O 0x0ec7 /* U+3157 HANGUL LETTER O */
+#define XK_Hangul_WA 0x0ec8 /* U+3158 HANGUL LETTER WA */
+#define XK_Hangul_WAE 0x0ec9 /* U+3159 HANGUL LETTER WAE */
+#define XK_Hangul_OE 0x0eca /* U+315A HANGUL LETTER OE */
+#define XK_Hangul_YO 0x0ecb /* U+315B HANGUL LETTER YO */
+#define XK_Hangul_U 0x0ecc /* U+315C HANGUL LETTER U */
+#define XK_Hangul_WEO 0x0ecd /* U+315D HANGUL LETTER WEO */
+#define XK_Hangul_WE 0x0ece /* U+315E HANGUL LETTER WE */
+#define XK_Hangul_WI 0x0ecf /* U+315F HANGUL LETTER WI */
+#define XK_Hangul_YU 0x0ed0 /* U+3160 HANGUL LETTER YU */
+#define XK_Hangul_EU 0x0ed1 /* U+3161 HANGUL LETTER EU */
+#define XK_Hangul_YI 0x0ed2 /* U+3162 HANGUL LETTER YI */
+#define XK_Hangul_I 0x0ed3 /* U+3163 HANGUL LETTER I */
+
+/* Hangul syllable-final (JongSeong) Characters */
+#define XK_Hangul_J_Kiyeog 0x0ed4 /* U+11A8 HANGUL JONGSEONG KIYEOK */
+#define XK_Hangul_J_SsangKiyeog 0x0ed5 /* U+11A9 HANGUL JONGSEONG SSANGKIYEOK */
+#define XK_Hangul_J_KiyeogSios 0x0ed6 /* U+11AA HANGUL JONGSEONG KIYEOK-SIOS */
+#define XK_Hangul_J_Nieun 0x0ed7 /* U+11AB HANGUL JONGSEONG NIEUN */
+#define XK_Hangul_J_NieunJieuj 0x0ed8 /* U+11AC HANGUL JONGSEONG NIEUN-CIEUC */
+#define XK_Hangul_J_NieunHieuh 0x0ed9 /* U+11AD HANGUL JONGSEONG NIEUN-HIEUH */
+#define XK_Hangul_J_Dikeud 0x0eda /* U+11AE HANGUL JONGSEONG TIKEUT */
+#define XK_Hangul_J_Rieul 0x0edb /* U+11AF HANGUL JONGSEONG RIEUL */
+#define XK_Hangul_J_RieulKiyeog 0x0edc /* U+11B0 HANGUL JONGSEONG RIEUL-KIYEOK */
+#define XK_Hangul_J_RieulMieum 0x0edd /* U+11B1 HANGUL JONGSEONG RIEUL-MIEUM */
+#define XK_Hangul_J_RieulPieub 0x0ede /* U+11B2 HANGUL JONGSEONG RIEUL-PIEUP */
+#define XK_Hangul_J_RieulSios 0x0edf /* U+11B3 HANGUL JONGSEONG RIEUL-SIOS */
+#define XK_Hangul_J_RieulTieut 0x0ee0 /* U+11B4 HANGUL JONGSEONG RIEUL-THIEUTH */
+#define XK_Hangul_J_RieulPhieuf 0x0ee1 /* U+11B5 HANGUL JONGSEONG RIEUL-PHIEUPH */
+#define XK_Hangul_J_RieulHieuh 0x0ee2 /* U+11B6 HANGUL JONGSEONG RIEUL-HIEUH */
+#define XK_Hangul_J_Mieum 0x0ee3 /* U+11B7 HANGUL JONGSEONG MIEUM */
+#define XK_Hangul_J_Pieub 0x0ee4 /* U+11B8 HANGUL JONGSEONG PIEUP */
+#define XK_Hangul_J_PieubSios 0x0ee5 /* U+11B9 HANGUL JONGSEONG PIEUP-SIOS */
+#define XK_Hangul_J_Sios 0x0ee6 /* U+11BA HANGUL JONGSEONG SIOS */
+#define XK_Hangul_J_SsangSios 0x0ee7 /* U+11BB HANGUL JONGSEONG SSANGSIOS */
+#define XK_Hangul_J_Ieung 0x0ee8 /* U+11BC HANGUL JONGSEONG IEUNG */
+#define XK_Hangul_J_Jieuj 0x0ee9 /* U+11BD HANGUL JONGSEONG CIEUC */
+#define XK_Hangul_J_Cieuc 0x0eea /* U+11BE HANGUL JONGSEONG CHIEUCH */
+#define XK_Hangul_J_Khieuq 0x0eeb /* U+11BF HANGUL JONGSEONG KHIEUKH */
+#define XK_Hangul_J_Tieut 0x0eec /* U+11C0 HANGUL JONGSEONG THIEUTH */
+#define XK_Hangul_J_Phieuf 0x0eed /* U+11C1 HANGUL JONGSEONG PHIEUPH */
+#define XK_Hangul_J_Hieuh 0x0eee /* U+11C2 HANGUL JONGSEONG HIEUH */
+
+/* Ancient Hangul Consonant Characters */
+#define XK_Hangul_RieulYeorinHieuh 0x0eef /* U+316D HANGUL LETTER RIEUL-YEORINHIEUH */
+#define XK_Hangul_SunkyeongeumMieum 0x0ef0 /* U+3171 HANGUL LETTER KAPYEOUNMIEUM */
+#define XK_Hangul_SunkyeongeumPieub 0x0ef1 /* U+3178 HANGUL LETTER KAPYEOUNPIEUP */
+#define XK_Hangul_PanSios 0x0ef2 /* U+317F HANGUL LETTER PANSIOS */
+#define XK_Hangul_KkogjiDalrinIeung 0x0ef3 /* U+3181 HANGUL LETTER YESIEUNG */
+#define XK_Hangul_SunkyeongeumPhieuf 0x0ef4 /* U+3184 HANGUL LETTER KAPYEOUNPHIEUPH */
+#define XK_Hangul_YeorinHieuh 0x0ef5 /* U+3186 HANGUL LETTER YEORINHIEUH */
+
+/* Ancient Hangul Vowel Characters */
+#define XK_Hangul_AraeA 0x0ef6 /* U+318D HANGUL LETTER ARAEA */
+#define XK_Hangul_AraeAE 0x0ef7 /* U+318E HANGUL LETTER ARAEAE */
+
+/* Ancient Hangul syllable-final (JongSeong) Characters */
+#define XK_Hangul_J_PanSios 0x0ef8 /* U+11EB HANGUL JONGSEONG PANSIOS */
+#define XK_Hangul_J_KkogjiDalrinIeung 0x0ef9 /* U+11F0 HANGUL JONGSEONG YESIEUNG */
+#define XK_Hangul_J_YeorinHieuh 0x0efa /* U+11F9 HANGUL JONGSEONG YEORINHIEUH */
+
+/* Korean currency symbol */
+#define XK_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/
+
+#endif /* XK_KOREAN */
+
+#ifdef XK_CURRENCY
+#define XK_EuroSign 0x20ac /* U+20AC EURO SIGN */
+#endif /* XK_CURRENCY */
+
+#ifdef XK_BRAILLE
+#define XK_braille_dot_1 0xfff1
+#define XK_braille_dot_2 0xfff2
+#define XK_braille_dot_3 0xfff3
+#define XK_braille_dot_4 0xfff4
+#define XK_braille_dot_5 0xfff5
+#define XK_braille_dot_6 0xfff6
+#define XK_braille_dot_7 0xfff7
+#define XK_braille_dot_8 0xfff8
+#define XK_braille_dot_9 0xfff9
+#define XK_braille_dot_10 0xfffa
+#endif /* XK_BRAILLE */
+
/* Multimedia keys, defined same as on Linux
* /usr/include/pkg/libxkbcommon/xkbcommon/xkbcommon-keysyms.h
*/
+#ifndef TK_NO_DEPRECATED
#define XK_XF86AudioLowerVolume 0x1008FF11 /* Volume control down */
#define XK_XF86AudioMute 0x1008FF12 /* Mute sound from the system */
#define XK_XF86AudioRaiseVolume 0x1008FF13 /* Volume control up */
@@ -1293,4 +1749,5 @@ SOFTWARE.
#define XK_XF86AudioStop 0x1008FF15 /* Stop playing audio */
#define XK_XF86AudioPrev 0x1008FF16 /* Previous track */
#define XK_XF86AudioNext 0x1008FF17 /* Next track */
+#endif /* !TK_NO_DEPRECATED */
diff --git a/xlib/xcolors.c b/xlib/xcolors.c
index 31db297..96f7c5a 100644
--- a/xlib/xcolors.c
+++ b/xlib/xcolors.c
@@ -4,8 +4,8 @@
* This file contains the routines used to map from X color names to RGB
* and pixel values.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- * Copyright (c) 2012 by Jan Nijtmans
+ * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright (c) 2012 Jan Nijtmans
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -44,18 +44,18 @@ typedef char elem[32];
static const elem xColors[] = {
/* Colors starting with 'a' */
- "liceBlue\0 \360\370\377",
+ "liceBlue\0 \360\370\377\0",
"ntiqueWhite\0 \213\203\170\315\300\260\356\337\314\377\357\333\372\353\327\4",
- "qua\0 \000\377\377",
+ "qua\0 \000\377\377\0",
"quamarine\0 \105\213\164\146\315\252\166\356\306\177\377\324\177\377\324\4",
"zure\0 \203\213\213\301\315\315\340\356\356\360\377\377\360\377\377\4",
/* Colors starting with 'b' */
- "eige\0 \365\365\334",
+ "eige\0 \365\365\334\0",
"isque\0 \213\175\153\315\267\236\356\325\267\377\344\304\377\344\304\4",
- "lack\0 \000\000\000",
- "lanchedAlmond\0 \377\353\315",
+ "lack\0 \000\000\000\0",
+ "lanchedAlmond\0 \377\353\315\0",
"lue\0 \000\000\213\000\000\315\000\000\356\000\000\377\000\000\377\4",
- "lueViolet\0 \212\053\342",
+ "lueViolet\0 \212\053\342\0",
"rown\0 \213\043\043\315\063\063\356\073\073\377\100\100\245\052\052\4",
"urlywood\0 \213\163\125\315\252\175\356\305\221\377\323\233\336\270\207\4",
/* Colors starting with 'c' */
@@ -63,168 +63,168 @@ static const elem xColors[] = {
"hartreuse\0 \105\213\000\146\315\000\166\356\000\177\377\000\177\377\000\4",
"hocolate\0 \213\105\023\315\146\035\356\166\041\377\177\044\322\151\036\4",
"oral\0 \213\076\057\315\133\105\356\152\120\377\162\126\377\177\120\4",
- "ornflowerBlue\0 \144\225\355",
+ "ornflowerBlue\0 \144\225\355\0",
"ornsilk\0 \213\210\170\315\310\261\356\350\315\377\370\334\377\370\334\4",
- "rimson\0 \334\024\074",
+ "rimson\0 \334\024\074\0",
"yan\0 \000\213\213\000\315\315\000\356\356\000\377\377\000\377\377\4",
/* Colors starting with 'd' */
- "arkBlue\0 \000\000\213",
- "arkCyan\0 \000\213\213",
+ "arkBlue\0 \000\000\213\0",
+ "arkCyan\0 \000\213\213\0",
"arkGoldenrod\0 \213\145\010\315\225\014\356\255\016\377\271\017\270\206\013\4",
- "arkGray\0 \251\251\251",
- "arkGreen\0 \000\144\000",
- "arkGrey\0 \251\251\251",
- "arkKhaki\0 \275\267\153",
- "arkMagenta\0 \213\000\213",
+ "arkGray\0 \251\251\251\0",
+ "arkGreen\0 \000\144\000\0",
+ "arkGrey\0 \251\251\251\0",
+ "arkKhaki\0 \275\267\153\0",
+ "arkMagenta\0 \213\000\213\0",
"arkOliveGreen\0 \156\213\075\242\315\132\274\356\150\312\377\160\125\153\057\4",
"arkOrange\0 \213\105\000\315\146\000\356\166\000\377\177\000\377\214\000\4",
"arkOrchid\0 \150\042\213\232\062\315\262\072\356\277\076\377\231\062\314\4",
- "arkRed\0 \213\000\000",
- "arkSalmon\0 \351\226\172",
+ "arkRed\0 \213\000\000\0",
+ "arkSalmon\0 \351\226\172\0",
"arkSeaGreen\0 \151\213\151\233\315\233\264\356\264\301\377\301\217\274\217\4",
- "arkSlateBlue\0 \110\075\213",
+ "arkSlateBlue\0 \110\075\213\0",
"arkSlateGray\0 \122\213\213\171\315\315\215\356\356\227\377\377\057\117\117\4",
- "arkSlateGrey\0 \057\117\117",
- "arkTurquoise\0 \000\316\321",
- "arkViolet\0 \224\000\323",
+ "arkSlateGrey\0 \057\117\117\0",
+ "arkTurquoise\0 \000\316\321\0",
+ "arkViolet\0 \224\000\323\0",
"eepPink\0 \213\012\120\315\020\166\356\022\211\377\024\223\377\024\223\4",
"eepSkyBlue\0 \000\150\213\000\232\315\000\262\356\000\277\377\000\277\377\4",
- "imGray\0 \151\151\151",
- "imGrey\0 \151\151\151",
+ "imGray\0 \151\151\151\0",
+ "imGrey\0 \151\151\151\0",
"odgerBlue\0 \020\116\213\030\164\315\034\206\356\036\220\377\036\220\377\4",
/* Colors starting with 'e' */
- "\377" /* placeholder */,
+ "\377 \0" /* placeholder */,
/* Colors starting with 'f' */
"irebrick\0 \213\032\032\315\046\046\356\054\054\377\060\060\262\042\042\4",
- "loralWhite\0 \377\372\360",
- "orestGreen\0 \042\213\042",
- "uchsia\0 \377\000\377",
+ "loralWhite\0 \377\372\360\0",
+ "orestGreen\0 \042\213\042\0",
+ "uchsia\0 \377\000\377\0",
/* Colors starting with 'g' */
- "ainsboro\0 \334\334\334",
- "hostWhite\0 \370\370\377",
+ "ainsboro\0 \334\334\334\0",
+ "hostWhite\0 \370\370\377\0",
"old\0 \213\165\000\315\255\000\356\311\000\377\327\000\377\327\000\4",
"oldenrod\0 \213\151\024\315\233\035\356\264\042\377\301\045\332\245\040\4",
"ray\0\024\024\024\022\022\022\017\017\017\015\015\015\012\012\012"
"\010\010\010\005\005\005\003\003\003\200\200\200\10",
- "ray0\0 \000\000\000",
+ "ray0\0 \000\000\000\0",
"reen\0 \000\213\000\000\315\000\000\356\000\000\377\000\000\200\000\4",
- "reenYellow\0 \255\377\057",
+ "reenYellow\0 \255\377\057\0",
"rey\0\024\024\024\022\022\022\017\017\017\015\015\015\012\012\012"
"\010\010\010\005\005\005\003\003\003\200\200\200\10",
- "rey0\0 \000\000\000",
+ "rey0\0 \000\000\000\0",
/* Colors starting with 'h' */
"oneydew\0 \203\213\203\301\315\301\340\356\340\360\377\360\360\377\360\4",
"otPink\0 \213\072\142\315\140\220\356\152\247\377\156\264\377\151\264\4",
/* Colors starting with 'i' */
"ndianRed\0 \213\072\072\315\125\125\356\143\143\377\152\152\315\134\134\4",
- "ndigo\0 \113\000\202",
+ "ndigo\0 \113\000\202\0",
"vory\0 \213\213\203\315\315\301\356\356\340\377\377\360\377\377\360\4",
/* Colors starting with 'j' */
- "\377" /* placeholder */,
+ "\377 \0" /* placeholder */,
/* Colors starting with 'k' */
"haki\0 \213\206\116\315\306\163\356\346\205\377\366\217\360\346\214\4",
/* Colors starting with 'l' */
- "avender\0 \346\346\372",
+ "avender\0 \346\346\372\0",
"avenderBlush\0 \213\203\206\315\301\305\356\340\345\377\360\365\377\360\365\4",
- "awnGreen\0 \174\374\000",
+ "awnGreen\0 \174\374\000\0",
"emonChiffon\0 \213\211\160\315\311\245\356\351\277\377\372\315\377\372\315\4",
"ightBlue\0 \150\203\213\232\300\315\262\337\356\277\357\377\255\330\346\4",
- "ightCoral\0 \360\200\200",
+ "ightCoral\0 \360\200\200\0",
"ightCyan\0 \172\213\213\264\315\315\321\356\356\340\377\377\340\377\377\4",
"ightGoldenrod\0 \213\201\114\315\276\160\356\334\202\377\354\213\356\335\202\4",
- "ightGoldenrodYellow\0 \372\372\322",
- "ightGray\0 \323\323\323",
- "ightGreen\0 \220\356\220",
- "ightGrey\0 \323\323\323",
+ "ightGoldenrodYellow\0 \372\372\322\0",
+ "ightGray\0 \323\323\323\0",
+ "ightGreen\0 \220\356\220\0",
+ "ightGrey\0 \323\323\323\0",
"ightPink\0 \213\137\145\315\214\225\356\242\255\377\256\271\377\266\301\4",
"ightSalmon\0 \213\127\102\315\201\142\356\225\162\377\240\172\377\240\172\4",
- "ightSeaGreen\0 \040\262\252",
+ "ightSeaGreen\0 \040\262\252\0",
"ightSkyBlue\0 \140\173\213\215\266\315\244\323\356\260\342\377\207\316\372\4",
- "ightSlateBlue\0 \204\160\377",
- "ightSlateGray\0 \167\210\231",
- "ightSlateGrey\0 \167\210\231",
+ "ightSlateBlue\0 \204\160\377\0",
+ "ightSlateGray\0 \167\210\231\0",
+ "ightSlateGrey\0 \167\210\231\0",
"ightSteelBlue\0 \156\173\213\242\265\315\274\322\356\312\341\377\260\304\336\4",
"ightYellow\0 \213\213\172\315\315\264\356\356\321\377\377\340\377\377\340\4",
- "ime\0 \000\377\000",
- "imeGreen\0 \062\315\062",
- "inen\0 \372\360\346",
+ "ime\0 \000\377\000\0",
+ "imeGreen\0 \062\315\062\0",
+ "inen\0 \372\360\346\0",
/* Colors starting with 'm' */
"agenta\0 \213\000\213\315\000\315\356\000\356\377\000\377\377\000\377\4",
"aroon\0 \213\034\142\315\051\220\356\060\247\377\064\263\200\000\000\4",
- "ediumAquamarine\0 \146\315\252",
- "ediumBlue\0 \000\000\315",
+ "ediumAquamarine\0 \146\315\252\0",
+ "ediumBlue\0 \000\000\315\0",
"ediumOrchid\0 \172\067\213\264\122\315\321\137\356\340\146\377\272\125\323\4",
"ediumPurple\0 \135\107\213\211\150\315\237\171\356\253\202\377\223\160\333\4",
- "ediumSeaGreen\0 \074\263\161",
- "ediumSlateBlue\0 \173\150\356",
- "ediumSpringGreen\0 \000\372\232",
- "ediumTurquoise\0 \110\321\314",
- "ediumVioletRed\0 \307\025\205",
- "idnightBlue\0 \031\031\160",
- "intCream\0 \365\377\372",
+ "ediumSeaGreen\0 \074\263\161\0",
+ "ediumSlateBlue\0 \173\150\356\0",
+ "ediumSpringGreen\0 \000\372\232\0",
+ "ediumTurquoise\0 \110\321\314\0",
+ "ediumVioletRed\0 \307\025\205\0",
+ "idnightBlue\0 \031\031\160\0",
+ "intCream\0 \365\377\372\0",
"istyRose\0 \213\175\173\315\267\265\356\325\322\377\344\341\377\344\341\4",
- "occasin\0 \377\344\265",
+ "occasin\0 \377\344\265\0",
/* Colors starting with 'n' */
"avajoWhite\0 \213\171\136\315\263\213\356\317\241\377\336\255\377\336\255\4",
- "avy\0 \000\000\200",
- "avyBlue\0 \000\000\200",
+ "avy\0 \000\000\200\0",
+ "avyBlue\0 \000\000\200\0",
/* Colors starting with 'o' */
- "ldLace\0 \375\365\346",
- "live\0 \200\200\000",
+ "ldLace\0 \375\365\346\0",
+ "live\0 \200\200\000\0",
"liveDrab\0 \151\213\042\232\315\062\263\356\072\300\377\076\153\216\043\4",
"range\0 \213\132\000\315\205\000\356\232\000\377\245\000\377\245\000\4",
"rangeRed\0 \213\045\000\315\067\000\356\100\000\377\105\000\377\105\000\4",
"rchid\0 \213\107\211\315\151\311\356\172\351\377\203\372\332\160\326\4",
/* Colors starting with 'p' */
- "aleGoldenrod\0 \356\350\252",
+ "aleGoldenrod\0 \356\350\252\0",
"aleGreen\0 \124\213\124\174\315\174\220\356\220\232\377\232\230\373\230\4",
"aleTurquoise\0 \146\213\213\226\315\315\256\356\356\273\377\377\257\356\356\4",
"aleVioletRed\0 \213\107\135\315\150\211\356\171\237\377\202\253\333\160\223\4",
- "apayaWhip\0 \377\357\325",
+ "apayaWhip\0 \377\357\325\0",
"eachPuff\0 \213\167\145\315\257\225\356\313\255\377\332\271\377\332\271\4",
- "eru\0 \315\205\077",
+ "eru\0 \315\205\077\0",
"ink\0 \213\143\154\315\221\236\356\251\270\377\265\305\377\300\313\4",
"lum\0 \213\146\213\315\226\315\356\256\356\377\273\377\335\240\335\4",
- "owderBlue\0 \260\340\346",
+ "owderBlue\0 \260\340\346\0",
"urple\0 \125\032\213\175\046\315\221\054\356\233\060\377\200\000\200\4",
/* Colors starting with 'q' */
- "\377" /* placeholder */,
+ "\377 \0" /* placeholder */,
/* Colors starting with 'r' */
"ed\0 \213\000\000\315\000\000\356\000\000\377\000\000\377\000\000\4",
"osyBrown\0 \213\151\151\315\233\233\356\264\264\377\301\301\274\217\217\4",
"oyalBlue\0 \047\100\213\072\137\315\103\156\356\110\166\377\101\151\341\4",
/* Colors starting with 's' */
- "addleBrown\0 \213\105\023",
+ "addleBrown\0 \213\105\023\0",
"almon\0 \213\114\071\315\160\124\356\202\142\377\214\151\372\200\162\4",
- "andyBrown\0 \364\244\140",
+ "andyBrown\0 \364\244\140\0",
"eaGreen\0 \056\213\127\103\315\200\116\356\224\124\377\237\056\213\127\4",
"eashell\0 \213\206\202\315\305\277\356\345\336\377\365\356\377\365\356\4",
"ienna\0 \213\107\046\315\150\071\356\171\102\377\202\107\240\122\055\4",
- "ilver\0 \300\300\300",
+ "ilver\0 \300\300\300\0",
"kyBlue\0 \112\160\213\154\246\315\176\300\356\207\316\377\207\316\353\4",
"lateBlue\0 \107\074\213\151\131\315\172\147\356\203\157\377\152\132\315\4",
"lateGray\0 \154\173\213\237\266\315\271\323\356\306\342\377\160\200\220\4",
- "lateGrey\0 \160\200\220",
+ "lateGrey\0 \160\200\220\0",
"now\0 \213\211\211\315\311\311\356\351\351\377\372\372\377\372\372\4",
"pringGreen\0 \000\213\105\000\315\146\000\356\166\000\377\177\000\377\177\4",
"teelBlue\0 \066\144\213\117\224\315\134\254\356\143\270\377\106\202\264\4",
/* Colors starting with 't' */
"an\0 \213\132\053\315\205\077\356\232\111\377\245\117\322\264\214\4",
- "eal\0 \000\200\200",
+ "eal\0 \000\200\200\0",
"histle\0 \213\173\213\315\265\315\356\322\356\377\341\377\330\277\330\4",
"omato\0 \213\066\046\315\117\071\356\134\102\377\143\107\377\143\107\4",
"urquoise\0 \000\206\213\000\305\315\000\345\356\000\365\377\100\340\320\4",
/* Colors starting with 'u' */
- "\377" /* placeholder */,
+ "\377 \0" /* placeholder */,
/* Colors starting with 'v' */
- "iolet\0 \356\202\356",
+ "iolet\0 \356\202\356\0",
"ioletRed\0 \213\042\122\315\062\170\356\072\214\377\076\226\320\040\220\4",
/* Colors starting with 'w' */
"heat\0 \213\176\146\315\272\226\356\330\256\377\347\272\365\336\263\4",
- "hite\0 \377\377\377",
- "hiteSmoke\0 \365\365\365",
+ "hite\0 \377\377\377\0",
+ "hiteSmoke\0 \365\365\365\0",
/* Colors starting with 'x' */
- "\377" /* placeholder */,
+ "\377 \0" /* placeholder */,
/* Colors starting with 'y' */
"ellow\0 \213\213\000\315\315\000\356\356\000\377\377\000\377\377\000\4",
"ellowGreen\0 \232\315\062\0"
@@ -341,6 +341,9 @@ XParseColor(
const char *spec,
XColor *colorPtr)
{
+ (void)display;
+ (void)map;
+
if (spec[0] == '#') {
char *p;
Tcl_WideInt value = parseHex64bit(++spec, &p);
diff --git a/xlib/xgc.c b/xlib/xgc.c
index 043e322..873dcce 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -15,11 +15,8 @@
#include "tkInt.h"
#include <X11/Xlib.h>
#if defined(MAC_OSX_TK)
-# define Cursor XCursor
-# define Region XRegion
#endif
-#undef TkSetRegion
#define MAX_DASH_LIST_SIZE 10
typedef struct {
@@ -559,7 +556,6 @@ XDrawSegments(
}
#endif
-#if 0
char *
XFetchBuffer(
Display *display,
@@ -761,7 +757,6 @@ XPolygonRegion(
return 0;
}
-#endif
void
XDestroyIC(
@@ -812,7 +807,6 @@ XCreateGlyphCursor(
return (Cursor) NULL;
}
-#if 0
XFontSet
XCreateFontSet(
Display *display /* display */,
@@ -933,7 +927,6 @@ XSetIMValues(
return NULL;
}
-#endif
/*
* Local Variables:
diff --git a/xlib/xutil.c b/xlib/xutil.c
index d80b742..a5f3b99 100644
--- a/xlib/xutil.c
+++ b/xlib/xutil.c
@@ -36,6 +36,8 @@ XInternAtom(
Bool only_if_exists)
{
static Atom atom = XA_LAST_PREDEFINED;
+ (void)atom_name;
+ (void)only_if_exists;
display->request++;
return ++atom;
@@ -64,7 +66,7 @@ XGetVisualInfo(
XVisualInfo *vinfo_template,
int *nitems_return)
{
- XVisualInfo *info = ckalloc(sizeof(XVisualInfo));
+ XVisualInfo *info = (XVisualInfo *)ckalloc(sizeof(XVisualInfo));
info->visual = DefaultVisual(display, 0);
info->visualid = info->visual->visualid;