From 6b4d5fe3f0846d698e10475b6e656896979548bd Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 19 Jul 2022 08:20:32 +1200 Subject: [PATCH] Remove remaining code to support macos9 This OS has been unsupported for over 20 years. We stopped providing macswig builds more than 20 years ago too: https://sourceforge.net/projects/swig/files/macswig/ The required SIOUX library doesn't seem to be available anywhere now either. Closes #2323 --- CHANGES.current | 4 + Lib/tcl/mactkinit.c | 233 ------------------------------------ Lib/tcl/tclsh.i | 22 +--- Lib/tcl/wish.i | 33 +---- Source/DOH/doh.h | 2 - Source/Modules/swigmain.cxx | 10 -- Source/Swig/include.c | 4 - Source/Swig/misc.c | 2 +- Source/Swig/swig.h | 2 - Source/Swig/swigfile.h | 4 +- 10 files changed, 9 insertions(+), 307 deletions(-) delete mode 100644 Lib/tcl/mactkinit.c diff --git a/CHANGES.current b/CHANGES.current index e312abaaa..645776f5c 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.1.0 (in progress) =========================== +2022-07-19: olly + Remove remaining support code for classic macos, which has not been + supported by Apple for over 20 years now. + 2022-07-12: wsfulton Performance optimisation for parameters passed by value that are C++11 movable. The C++ wrappers create a temporary variable for a parameter to be passed to a diff --git a/Lib/tcl/mactkinit.c b/Lib/tcl/mactkinit.c deleted file mode 100644 index 18f1f0203..000000000 --- a/Lib/tcl/mactkinit.c +++ /dev/null @@ -1,233 +0,0 @@ -/* ----------------------------------------------------------------------------- - * mactkinit.c - * - * This is a support file needed to build a new version of Wish. - * Normally, this capability is found in TkAppInit.c, but this creates - * tons of namespace problems for many applications. - * ----------------------------------------------------------------------------- */ - -#include -#include -#include -#include -#include -#include - -#include "tk.h" -#include "tkInt.h" -#include "tkMacInt.h" - -typedef int (*TclMacConvertEventPtr) _ANSI_ARGS_((EventRecord *eventPtr)); -Tcl_Interp *gStdoutInterp = NULL; - -void TclMacSetEventProc _ANSI_ARGS_((TclMacConvertEventPtr procPtr)); -int TkMacConvertEvent _ANSI_ARGS_((EventRecord *eventPtr)); - -/* - * Prototypes for functions the ANSI library needs to link against. - */ -short InstallConsole _ANSI_ARGS_((short fd)); -void RemoveConsole _ANSI_ARGS_((void)); -long WriteCharsToConsole _ANSI_ARGS_((char *buff, long n)); -long ReadCharsFromConsole _ANSI_ARGS_((char *buff, long n)); -char * __ttyname _ANSI_ARGS_((long fildes)); -short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event)); - -/* - * Forward declarations for procedures defined later in this file: - */ - -/* - *---------------------------------------------------------------------- - * - * MacintoshInit -- - * - * This procedure calls Mac specific initialization calls. Most of - * these calls must be made as soon as possible in the startup - * process. - * - * Results: - * Returns TCL_OK if everything went fine. If it didn't the - * application should probably fail. - * - * Side effects: - * Inits the application. - * - *---------------------------------------------------------------------- - */ - -int -MacintoshInit() -{ - int i; - long result, mask = 0x0700; /* mask = system 7.x */ - - /* - * Tk needs us to set the qd pointer it uses. This is needed - * so Tk doesn't have to assume the availiblity of the qd global - * variable. Which in turn allows Tk to be used in code resources. - */ - tcl_macQdPtr = &qd; - - InitGraf(&tcl_macQdPtr->thePort); - InitFonts(); - InitWindows(); - InitMenus(); - InitDialogs((long) NULL); - InitCursor(); - - /* - * Make sure we are running on system 7 or higher - */ - - if ((NGetTrapAddress(_Gestalt, ToolTrap) == - NGetTrapAddress(_Unimplemented, ToolTrap)) - || (((Gestalt(gestaltSystemVersion, &result) != noErr) - || (mask != (result & mask))))) { - panic("Tcl/Tk requires System 7 or higher."); - } - - /* - * Make sure we have color quick draw - * (this means we can't run on 68000 macs) - */ - - if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr) - || (result < gestalt32BitQD13))) { - panic("Tk requires Color QuickDraw."); - } - - - FlushEvents(everyEvent, 0); - SetEventMask(everyEvent); - - /* - * Set up stack & heap sizes - */ - /* TODO: stack size - size = StackSpace(); - SetAppLimit(GetAppLimit() - 8192); - */ - MaxApplZone(); - for (i = 0; i < 4; i++) { - (void) MoreMasters(); - } - - TclMacSetEventProc(TkMacConvertEvent); - TkConsoleCreate(); - - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * SetupMainInterp -- - * - * This procedure calls initialization routines require a Tcl - * interp as an argument. This call effectively makes the passed - * interpreter the "main" interpreter for the application. - * - * Results: - * Returns TCL_OK if everything went fine. If it didn't the - * application should probably fail. - * - * Side effects: - * More initialization. - * - *---------------------------------------------------------------------- - */ - -int -SetupMainInterp( - Tcl_Interp *interp) -{ - /* - * Initialize the console only if we are running as an interactive - * application. - */ - - TkMacInitAppleEvents(interp); - TkMacInitMenus(interp); - - if (strcmp(Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY), "1") - == 0) { - if (TkConsoleInit(interp) == TCL_ERROR) { - goto error; - } - } - - /* - * Attach the global interpreter to tk's expected global console - */ - - gStdoutInterp = interp; - - return TCL_OK; - -error: - panic(interp->result); - return TCL_ERROR; -} - -/* - *---------------------------------------------------------------------- - * - * InstallConsole, RemoveConsole, etc. -- - * - * The following functions provide the UI for the console package. - * Users wishing to replace SIOUX with their own console package - * need only provide the four functions below in a library. - * - * Results: - * See SIOUX documentation for details. - * - * Side effects: - * See SIOUX documentation for details. - * - *---------------------------------------------------------------------- - */ - -short -InstallConsole(short fd) -{ -#pragma unused (fd) - - return 0; -} - -void -RemoveConsole(void) -{ -} - -long -WriteCharsToConsole(char *buffer, long n) -{ - TkConsolePrint(gStdoutInterp, TCL_STDOUT, buffer, n); - return n; -} - -long -ReadCharsFromConsole(char *buffer, long n) -{ - return 0; -} - -extern char * -__ttyname(long fildes) -{ - static char *devicename = "null device"; - - if (fildes >= 0 && fildes <= 2) { - return (devicename); - } - - return (0L); -} - -short -SIOUXHandleOneEvent(EventRecord *event) -{ - return 0; -} diff --git a/Lib/tcl/tclsh.i b/Lib/tcl/tclsh.i index a119b93ac..21dc35af3 100644 --- a/Lib/tcl/tclsh.i +++ b/Lib/tcl/tclsh.i @@ -33,10 +33,6 @@ char *SWIG_RcFileName = "~/.myapprc"; #endif -#ifdef MAC_TCL -extern int MacintoshInit _ANSI_ARGS_((void)); -#endif - int Tcl_AppInit(Tcl_Interp *interp){ if (Tcl_Init(interp) == TCL_ERROR) @@ -47,27 +43,11 @@ int Tcl_AppInit(Tcl_Interp *interp){ if (SWIG_init(interp) == TCL_ERROR) return TCL_ERROR; Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); -#ifdef SWIG_RcRsrcName - Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL); -#endif - + return TCL_OK; } int main(int argc, char **argv) { -#ifdef MAC_TCL - char *newArgv[2]; - - if (MacintoshInit() != TCL_OK) { - Tcl_Exit(1); - } - - argc = 1; - newArgv[0] = "tclsh"; - newArgv[1] = NULL; - argv = newArgv; -#endif - Tcl_Main(argc, argv, Tcl_AppInit); return(0); diff --git a/Lib/tcl/wish.i b/Lib/tcl/wish.i index bfd2c5fa9..42902850d 100644 --- a/Lib/tcl/wish.i +++ b/Lib/tcl/wish.i @@ -35,11 +35,6 @@ as follows (this should be included in a code-block) : char *SWIG_RcFileName = "~/.wishrc"; #endif -#ifdef MAC_TCL -extern int MacintoshInit _ANSI_ARGS_((void)); -extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); -#endif - /* *---------------------------------------------------------------------- * @@ -61,10 +56,9 @@ extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); int Tcl_AppInit(Tcl_Interp *interp) { -#ifndef MAC_TCL Tk_Window main; main = Tk_MainWindow(interp); -#endif + /* * Call the init procedures for included packages. Each call should * look like this: @@ -93,10 +87,6 @@ int Tcl_AppInit(Tcl_Interp *interp) return TCL_ERROR; } -#ifdef MAC_TCL - SetupMainInterp(interp); -#endif - /* * Specify a user-specific startup file to invoke if the application * is run interactively. Typically the startup file is "~/.apprc" @@ -104,31 +94,12 @@ int Tcl_AppInit(Tcl_Interp *interp) * then no user-specific startup file will be run under any conditions. */ - Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); - -/* For Macintosh might also want this */ - -#ifdef MAC_TCL -#ifdef SWIG_RcRsrcName - Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL_ONLY); -#endif -#endif + Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); return TCL_OK; } #if TK_MAJOR_VERSION >= 4 int main(int argc, char **argv) { - -#ifdef MAC_TCL - char *newArgv[2]; - if (MacintoshInit() != TCL_OK) { - Tcl_Exit(1); - } - argc = 1; - newArgv[0] = "Wish"; - newArgv[1] = NULL; - argv = newArgv; -#endif Tk_Main(argc, argv, Tcl_AppInit); return(0); } diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h index 7631e4ed4..4ee0dfffa 100644 --- a/Source/DOH/doh.h +++ b/Source/DOH/doh.h @@ -14,9 +14,7 @@ #ifndef SWIG_DOH_H #define SWIG_DOH_H -#ifndef MACSWIG #include "swigconfig.h" -#endif #include #include diff --git a/Source/Modules/swigmain.cxx b/Source/Modules/swigmain.cxx index 7cb2c2398..6c8852adb 100644 --- a/Source/Modules/swigmain.cxx +++ b/Source/Modules/swigmain.cxx @@ -84,11 +84,6 @@ static TargetLanguageModule modules[] = { {NULL, NULL, NULL, Disabled} }; -#ifdef MACSWIG -#include -#include -#endif - //----------------------------------------------------------------- // main() // @@ -222,11 +217,6 @@ int main(int margc, char **margv) { SWIG_merge_envopt(getenv("SWIG_FEATURES"), margc, margv, &argc, &argv); merge_options_files(&argc, &argv); -#ifdef MACSWIG - SIOUXSettings.asktosaveonclose = false; - argc = ccommand(&argv); -#endif - Swig_init_args(argc, argv); /* Get options */ diff --git a/Source/Swig/include.c b/Source/Swig/include.c index ca43dbd65..a474d0458 100644 --- a/Source/Swig/include.c +++ b/Source/Swig/include.c @@ -110,11 +110,7 @@ static List *Swig_search_path_any(int syspath) { assert(slist); filename = NewStringEmpty(); assert(filename); -#ifdef MACSWIG - Printf(filename, "%s", SWIG_FILE_DELIMITER); -#else Printf(filename, ".%s", SWIG_FILE_DELIMITER); -#endif Append(slist, filename); Delete(filename); diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index 55306b1da..da7d1d0e3 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -218,7 +218,7 @@ void Swig_filename_correct(String *filename) { if (fname[0] == '/' && fname[1] == '/') network_path = 1; } -#if defined(_WIN32) || defined(MACSWIG) +#if defined(_WIN32) /* accept Unix path separator on non-Unix systems */ Replaceall(filename, "/", SWIG_FILE_DELIMITER); #endif diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h index bf1ca33d5..b27e26330 100644 --- a/Source/Swig/swig.h +++ b/Source/Swig/swig.h @@ -14,9 +14,7 @@ #ifndef SWIG_SWIG_H #define SWIG_SWIG_H -#ifndef MACSWIG #include "swigconfig.h" -#endif #include #include diff --git a/Source/Swig/swigfile.h b/Source/Swig/swigfile.h index 0583b3792..653ada2f7 100644 --- a/Source/Swig/swigfile.h +++ b/Source/Swig/swigfile.h @@ -34,9 +34,7 @@ extern void Swig_file_debug_set(void); /* Delimiter used in accessing files and directories */ -#if defined(MACSWIG) -# define SWIG_FILE_DELIMITER ":" -#elif defined(_WIN32) +#if defined(_WIN32) # define SWIG_FILE_DELIMITER "\\" #else # define SWIG_FILE_DELIMITER "/"