Cleaned up a bunch of stuff around "magicdnull", starting with not

linking it to Tk or X11 graphics.  Added new command "display" which
returns the display type, which is good for finding out if the
display is "NULL".  Added code to allow the wrapper to be defined
for NULL graphics with the Tk console, the main necessities of which
are to remove the "openwrapper" command, and to return immediately
from a number of tag callback functions.
This commit is contained in:
Tim Edwards 2022-03-30 10:55:08 -04:00
parent bfa4272481
commit e675decfc0
8 changed files with 107 additions and 31 deletions

View File

@ -1 +1 @@
8.3.283
8.3.284

34
scripts/configure vendored
View File

@ -656,6 +656,7 @@ gr_libs
TCL_LIB_DIR
TCLSH_EXE
WISH_EXE
LIB_SPECS_GRNULL
LIB_SPECS_NOSTUB
LIB_SPECS
INC_SPECS
@ -6073,8 +6074,7 @@ fi
if test "x$no_x" = "x"; then
usingX11=1
else
echo Unable to find X11---compiling without graphics.
echo Cannot find X11---will attempt to compile anyway.
echo Unable to find X11 or X11 disabled---compiling without graphics.
echo Graphics options will be NULL only!
if test $usingOGL ; then
echo "Cannot use OpenGL/GLX without X11, disabling."
@ -6084,10 +6084,10 @@ else
echo "Cannot use Cairo without X11, disabling."
usingCairo=
fi
if test $usingTcl ; then
echo "Cannot compile TCL version without X11, disabling."
usingTcl=
fi
# if test $usingTcl ; then
# echo "Cannot compile TCL version without X11, disabling."
# usingTcl=
# fi
fi
# For distributed installs, where the run-time files are installed in a
@ -7290,13 +7290,15 @@ fi
if test "x$enable_threads" = "xyes" ; then
usingThreads=1
$as_echo "#define HAVE_PTHREADS 1" >>confdefs.h
if test $usingX11 ; then
usingThreads=1
$as_echo "#define HAVE_PTHREADS 1" >>confdefs.h
gr_libs="$gr_libs -lpthread"
gr_srcs="$gr_srcs \${X11THREAD_SRCS}"
gr_hsrcs=""
gr_hprog=""
gr_libs="$gr_libs -lpthread"
gr_srcs="$gr_srcs \${X11THREAD_SRCS}"
gr_hsrcs=""
gr_hprog=""
fi
fi
# Check whether --enable-route was given.
@ -7703,6 +7705,10 @@ else
fi
fi
if test $usingX11 ; then
gr_libs="$gr_libs \${X11_LDFLAGS}"
fi
case $target in
*-linux*)
@ -7764,6 +7770,7 @@ esac
if test $usingTcl ; then
LIB_SPECS_NOSTUB="${LIB_SPECS}"
LIB_SPECS_GRNULL="${LIB_SPECS}"
# -----------------------------------------------------------------------
#
@ -7805,9 +7812,11 @@ if test $usingTcl ; then
"${TCL_LIB_DIR}" = "/usr/lib64" -o \
"${TCL_LIB_DIR}" = "${TK_LIB_DIR}" ; then
LIB_SPECS_NOSTUB="${LIB_SPECS_NOSTUB} ${TCL_LIB_SPEC}"
LIB_SPECS_GRNULL="${LIB_SPECS_GRNULL} ${TCL_LIB_SPEC}"
LIB_SPECS="${LIB_SPECS} ${TCL_STUB_LIB_SPEC}"
else
LIB_SPECS_NOSTUB="${LIB_SPECS_NOSTUB} -L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
LIB_SPECS_GRNULL="${LIB_SPECS_GRNULL} -L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
LIB_SPECS="${LIB_SPECS} -L${TCL_LIB_DIR} ${TCL_STUB_LIB_SPEC}"
if test "x${loader_run_path}" = "x" ; then
loader_run_path="${TCL_LIB_DIR}"
@ -8181,6 +8190,7 @@ fi
fi
if test "$GCC" = "yes" ; then

View File

@ -318,8 +318,7 @@ AC_PATH_XTRA
if test "x$no_x" = "x"; then
usingX11=1
else
echo Unable to find X11---compiling without graphics.
echo Cannot find X11---will attempt to compile anyway.
echo Unable to find X11 or X11 disabled---compiling without graphics.
echo Graphics options will be NULL only!
if test $usingOGL ; then
echo "Cannot use OpenGL/GLX without X11, disabling."
@ -329,10 +328,10 @@ else
echo "Cannot use Cairo without X11, disabling."
usingCairo=
fi
if test $usingTcl ; then
echo "Cannot compile TCL version without X11, disabling."
usingTcl=
fi
# if test $usingTcl ; then
# echo "Cannot compile TCL version without X11, disabling."
# usingTcl=
# fi
fi
# For distributed installs, where the run-time files are installed in a
@ -1074,12 +1073,14 @@ AC_ARG_ENABLE(threads,
])
if test "x$enable_threads" = "xyes" ; then
usingThreads=1
AC_DEFINE(HAVE_PTHREADS)
gr_libs="$gr_libs -lpthread"
gr_srcs="$gr_srcs \${X11THREAD_SRCS}"
gr_hsrcs=""
gr_hprog=""
if test $usingX11 ; then
usingThreads=1
AC_DEFINE(HAVE_PTHREADS)
gr_libs="$gr_libs -lpthread"
gr_srcs="$gr_srcs \${X11THREAD_SRCS}"
gr_hsrcs=""
gr_hprog=""
fi
fi
AC_ARG_ENABLE(route,
@ -1326,6 +1327,10 @@ else
fi
fi
if test $usingX11 ; then
gr_libs="$gr_libs \${X11_LDFLAGS}"
fi
dnl ----------------------------------------------------------------
dnl Define system-specific settings
dnl ----------------------------------------------------------------
@ -1380,6 +1385,7 @@ esac
if test $usingTcl ; then
LIB_SPECS_NOSTUB="${LIB_SPECS}"
LIB_SPECS_GRNULL="${LIB_SPECS}"
# -----------------------------------------------------------------------
#
@ -1421,9 +1427,11 @@ if test $usingTcl ; then
"${TCL_LIB_DIR}" = "/usr/lib64" -o \
"${TCL_LIB_DIR}" = "${TK_LIB_DIR}" ; then
LIB_SPECS_NOSTUB="${LIB_SPECS_NOSTUB} ${TCL_LIB_SPEC}"
LIB_SPECS_GRNULL="${LIB_SPECS_GRNULL} ${TCL_LIB_SPEC}"
LIB_SPECS="${LIB_SPECS} ${TCL_STUB_LIB_SPEC}"
else
LIB_SPECS_NOSTUB="${LIB_SPECS_NOSTUB} -L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
LIB_SPECS_GRNULL="${LIB_SPECS_GRNULL} -L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
LIB_SPECS="${LIB_SPECS} -L${TCL_LIB_DIR} ${TCL_STUB_LIB_SPEC}"
if test "x${loader_run_path}" = "x" ; then
loader_run_path="${TCL_LIB_DIR}"
@ -1743,6 +1751,7 @@ if test $usingTcl ; then
AC_SUBST(INC_SPECS)
AC_SUBST(LIB_SPECS)
AC_SUBST(LIB_SPECS_NOSTUB)
AC_SUBST(LIB_SPECS_GRNULL)
AC_SUBST(WISH_EXE)
AC_SUBST(TCLSH_EXE)
AC_SUBST(TCL_LIB_DIR)

View File

@ -66,6 +66,7 @@ LDDL_FLAGS = ${LDFLAGS} @LDDL_FLAGS@
LD_RUN_PATH = @LD_RUN_PATH@
LIB_SPECS = @LIB_SPECS@
LIB_SPECS_NOSTUB = @LIB_SPECS_NOSTUB@
LIB_SPECS_GRNULL = @LIB_SPECS_GRNULL@
WISH_EXE = @WISH_EXE@
TCL_LIB_DIR = @TCL_LIB_DIR@
MAGIC_VERSION = `cat ../VERSION | cut -d. -f1-2`
@ -92,7 +93,7 @@ EXEEXT = @EXEEXT@
GR_CFLAGS = @X_CFLAGS@ @gr_cflags@
GR_DFLAGS = @gr_dflags@ -DNDEBUG
GR_LIBS = @gr_libs@ ${X11_LDFLAGS} @X_LIBS@
GR_LIBS = @gr_libs@ @X_LIBS@
GR_SRCS = @gr_srcs@
GR_HELPER_SRCS = @gr_hsrcs@
GR_HELPER_PROG = @gr_hprog@

View File

@ -56,8 +56,7 @@ magicexec: magicexec.c ${MAGICDIR}/defs.mak
magicdnull: magicdnull.c ${MAGICDIR}/defs.mak
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS_NOSTUB} ${LDFLAGS} magicdnull.c \
-o magicdnull ${LD_RUN_PATH} ${LIB_SPECS_NOSTUB} ${LIBS} \
${GR_LIBS}
-o magicdnull ${LD_RUN_PATH} ${LIB_SPECS_GRNULL} ${LIBS}
magic.tcl: magic.tcl.in ${MAGICDIR}/defs.mak ${MAGICDIR}/VERSION
sed -e /MAGIC_VERSION/s%MAGIC_VERSION%${MAGIC_VERSION}%g \

View File

@ -359,10 +359,42 @@ drc off
if {[info commands magic::openwrapper] != {}} {
if {[windownames layout] == {}} {
set winname [magic::openwrapper]
if {[magic::display] == "NULL"} {
magic::openwindow
rename magic::openwrapper magic::_openwrapper
} else {
set winname [magic::openwrapper]
magic::scrollupdate $winname
}
magic::techmanager initall
magic::scrollupdate $winname
foreach cellname $celllist {
set fext [file extension $cellname]
puts stdout "handling file entry $cellname extension $fext"
switch $fext {
.lef -
.LEF {lef read $cellname}
.def -
.DEF {def read $cellname}
.gds -
.GDS -
.gds2 -
.GDS2 -
.gdsii -
.GDSII {gds read $cellname}
.cif -
.CIF {cif read $cellname}
.tcl {source $cellname}
.mag -
"" {magic::load $cellname}
default {puts stderr "don't know how to load file $cellname"}
}
}
}
} elseif {[info commands wm] == {}} {
# Magic running with Tcl but in NULL graphics mode.
if {[windownames layout] == {}} {
magic::openwindow
foreach cellname $celllist {
set fext [file extension $cellname]
puts stdout "handling file entry $cellname extension $fext"

View File

@ -710,6 +710,21 @@ _magic_flags(ClientData clientData,
return TCL_OK;
}
/*--------------------------------------------------------------*/
/* Pre-initialization: Return the state of the graphics type */
/* so that certain steps can be taken when NULL graphics are */
/* specified. */
/*--------------------------------------------------------------*/
static int
_magic_display(ClientData clientData,
Tcl_Interp *interp, int argc, char *argv[])
{
/* Set the result to the name of the graphics mode used. */
Tcl_SetResult(magicinterp, MainDisplayType, NULL);
return TCL_OK;
}
/*--------------------------------------------------------------*/
/* Post-initialization: read in the magic startup files and */
/* load any initial layout. Note that this is not done via */
@ -1223,6 +1238,8 @@ Tclmagic_Init(interp)
(ClientData)NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "magic::startup", (Tcl_CmdProc *)_magic_startup,
(ClientData)NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "magic::display", (Tcl_CmdProc *)_magic_display,
(ClientData)NULL, (Tcl_CmdDeleteProc *) NULL);
/* Initialize the command-tag callback feature */

View File

@ -15,7 +15,10 @@ global Glyph
global Opts
global Winopts
set tk_version $::tk_version
# Don't source this file in a non-graphics (no Tk) environment
if {[catch {set tk_version $::tk_version}]} {return}
# Simple console commands (like TkCon, but much simpler)
if {[lsearch [namespace children] ::tkshell] < 0} {
@ -495,6 +498,7 @@ proc magic::techmanager {{option "update"}} {
proc magic::captions {{subcommand {}}} {
global Opts
if {[magic::display] == "NULL"} {return}
if {$subcommand != {} && $subcommand != "writeable" && $subcommand != "load"} {
return
}
@ -611,6 +615,7 @@ proc magic::repaintwrapper { win } {
# infinite recursion.
proc magic::boxview {win {cmdstr ""}} {
if {[magic::display] == "NULL"} {return}
if {${cmdstr} == "exists" || ${cmdstr} == "help" || ${cmdstr} == ""} {
# do nothing. . . informational only, no change to the box
} elseif {${cmdstr} == "remove"} {
@ -685,6 +690,7 @@ proc magic::cursorview {win} {
proc magic::toolupdate {win {yesno "yes"} {layerlist "none"}} {
global Winopts
if {[magic::display] == "NULL"} {return}
if {$win == {}} {
set win [magic::windownames]
}
@ -897,6 +903,7 @@ proc magic::maketoolbar { framename } {
proc magic::techrebuild {winpath {cmdstr ""}} {
global Opts
if {[magic::display] == "NULL"} {return}
# For NULL window, find all layout windows and apply update to each.
if {$winpath == {}} {
set winlist [magic::windownames layout]
@ -970,6 +977,7 @@ proc magic::setscrollvalues {win} {
proc magic::scrollupdate {win} {
if {[magic::display] == "NULL"} {return}
if {[info level] <= 1} {
# For NULL window, find current window