From: <ai...@us...> - 2011-03-19 21:56:41
|
Revision: 11656 http://plplot.svn.sourceforge.net/plplot/?rev=11656&view=rev Author: airwin Date: 2011-03-19 21:56:35 +0000 (Sat, 19 Mar 2011) Log Message: ----------- Make PLplot parameters available to plserver. Without this fix, targets such as test_tk_standard_examples which use plserver do not run correctly. Modified Paths: -------------- trunk/bindings/tk/plserver.c trunk/bindings/tk/plserver.h Modified: trunk/bindings/tk/plserver.c =================================================================== --- trunk/bindings/tk/plserver.c 2011-03-19 21:33:53 UTC (rev 11655) +++ trunk/bindings/tk/plserver.c 2011-03-19 21:56:35 UTC (rev 11656) @@ -235,6 +235,10 @@ Tcl_CreateCommand( interp, "exit", (Tcl_CmdProc *) plExitCmd, (ClientData) mainWindow, (Tcl_CmdDeleteProc*) NULL ); +// Define the flags as variables in the PLPLOT namespace + + set_plplot_parameters( interp ); + return TCL_OK; } Modified: trunk/bindings/tk/plserver.h =================================================================== --- trunk/bindings/tk/plserver.h 2011-03-19 21:33:53 UTC (rev 11655) +++ trunk/bindings/tk/plserver.h 2011-03-19 21:56:35 UTC (rev 11656) @@ -12,6 +12,7 @@ #include "plDevs.h" #include "pltkd.h" #include "pltcl.h" +#include "plplot_parameters.h" // State info for the rendering code This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-11-12 06:03:22
|
Revision: 12681 http://sourceforge.net/p/plplot/code/12681 Author: airwin Date: 2013-11-12 06:03:11 +0000 (Tue, 12 Nov 2013) Log Message: ----------- Forgot to use the global attribute when necessary for new global variables pl_itcl_package_name and pl_iwidgets_package_name. For all PLplot Tk GUI's these fixes allow access to the "Itcl" version of the file chooser and also provides an "Itcl" "Palettes" menu item which appears to work perfectly. Modified Paths: -------------- trunk/bindings/tk/pltools.tcl trunk/bindings/tk/plwidget.tcl Modified: trunk/bindings/tk/pltools.tcl =================================================================== --- trunk/bindings/tk/pltools.tcl 2013-11-12 05:49:16 UTC (rev 12680) +++ trunk/bindings/tk/pltools.tcl 2013-11-12 06:03:11 UTC (rev 12681) @@ -256,6 +256,7 @@ #---------------------------------------------------------------------------- proc fileSelect {{filter {}}} { + global pl_iwidgets_package_name # Use the Iwidgets file selector if available if ![catch {eval package require $pl_iwidgets_package_name}] { Modified: trunk/bindings/tk/plwidget.tcl =================================================================== --- trunk/bindings/tk/plwidget.tcl 2013-11-12 05:49:16 UTC (rev 12680) +++ trunk/bindings/tk/plwidget.tcl 2013-11-12 06:03:11 UTC (rev 12681) @@ -556,7 +556,7 @@ proc plw::create_pmenu_palettes {w} { global pmenu; set m $pmenu($w).palettes - global plopt_static_redraw plopt_dynamic_redraw + global plopt_static_redraw plopt_dynamic_redraw pl_itcl_package_name # The palette tools require Itcl 3.0 or later. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2013-11-18 19:31:29
|
Revision: 12711 http://sourceforge.net/p/plplot/code/12711 Author: arjenmarkus Date: 2013-11-18 19:31:25 +0000 (Mon, 18 Nov 2013) Log Message: ----------- Add print statements to make it clear to the user what went wrong if parts of the initialization fail. Also use the lappend command to set the auto_path variable, to prevent directories containing spaces to cause difficult to trace problems. Finally distinguish between the tow forms of the "exit" command (with and without a return code). The original code may have been causing segfaults, though it has to be confirmed that that particular problem has been solved. Modified Paths: -------------- trunk/bindings/tk/plserver.c trunk/bindings/tk/tkMain.c Modified: trunk/bindings/tk/plserver.c =================================================================== --- trunk/bindings/tk/plserver.c 2013-11-17 00:49:08 UTC (rev 12710) +++ trunk/bindings/tk/plserver.c 2013-11-18 19:31:25 UTC (rev 12711) @@ -96,7 +96,7 @@ main( int argc, const char **argv ) { int i, myargc = argc; - const char *myargv[20]; + const char **myargv; Tcl_Interp *interp; const char *helpmsg = "Command-specific options:"; @@ -113,8 +113,9 @@ interp = Tcl_CreateInterp(); -// Save arglist to get around tk_ParseArgv limitations +// Save arglist to get around Tk_ParseArgv limitations + myargv = (const char **) malloc( argc * sizeof(char *) ); for ( i = 0; i < argc; i++ ) { myargv[i] = argv[i]; @@ -224,7 +225,7 @@ if ( auto_path != NULL ) { Tcl_SetVar( interp, "dir", auto_path, 0 ); - tcl_cmd( interp, "set auto_path [list $dir $auto_path]" ); + tcl_cmd( interp, "lappend auto_path $dir" ); } // Rename "exit" to "tkexit", and insert custom exit handler @@ -277,8 +278,17 @@ Tcl_VarEval( interp, "plserver_link_end", (char **) NULL ); // Now really exit +// (Note: this function is actually deprecated, but as it is only used here +// at the end of the program, let's leave it.) - return Tcl_VarEval( interp, "tkexit", argv[1], (char **) NULL ); + if ( argc == 1 ) + { + return Tcl_VarEval( interp, "tkexit", (char **) NULL ); + } + else + { + return Tcl_VarEval( interp, "tkexit", argv[1], (char **) NULL ); + } } //-------------------------------------------------------------------------- Modified: trunk/bindings/tk/tkMain.c =================================================================== --- trunk/bindings/tk/tkMain.c 2013-11-17 00:49:08 UTC (rev 12710) +++ trunk/bindings/tk/tkMain.c 2013-11-18 19:31:25 UTC (rev 12711) @@ -251,21 +251,25 @@ if ( Tcl_Init( interp ) == TCL_ERROR ) { + fprintf( stderr, "Tcl initialisation failed: %s\n", Tcl_GetStringResult( interp ) ); return TCL_ERROR; } if ( Tk_Init( interp ) == TCL_ERROR ) { + fprintf( stderr, "Tk initialisation failed: %s\n", Tcl_GetStringResult( interp ) ); return TCL_ERROR; } #ifdef HAVE_ITCL if ( Itcl_Init( interp ) == TCL_ERROR ) { + fprintf( stderr, "Itcl initialisation failed: %s\n", Tcl_GetStringResult( interp ) ); return TCL_ERROR; } #endif #ifdef HAVE_ITK if ( Itk_Init( interp ) == TCL_ERROR ) { + fprintf( stderr, "Itk initialisation failed: %s\n", Tcl_GetStringResult( interp ) ); return TCL_ERROR; } @@ -281,17 +285,20 @@ if ( Tcl_Import( interp, Tcl_GetGlobalNamespace( interp ), "::itk::*", /* allowOverwrite */ 1 ) != TCL_OK ) { + fprintf( stderr, "Itk initialisation failed: %s\n", Tcl_GetStringResult( interp ) ); return TCL_ERROR; } if ( Tcl_Import( interp, Tcl_GetGlobalNamespace( interp ), "::itcl::*", /* allowOverwrite */ 1 ) != TCL_OK ) { + fprintf( stderr, "Itk initialisation failed: %s\n", Tcl_GetStringResult( interp ) ); return TCL_ERROR; } if ( Tcl_Eval( interp, "auto_mkindex_parser::slavehook { _%@namespace import -force ::itcl::* ::itk::* }" ) != TCL_OK ) { + fprintf( stderr, "Itk initialisation failed: %s\n", Tcl_GetStringResult( interp ) ); return TCL_ERROR; } #endif @@ -333,6 +340,7 @@ if ( ( *AppInit )( interp ) != TCL_OK ) { fprintf( stderr, "(*AppInit) failed: %s\n", Tcl_GetStringResult( interp ) ); + return TCL_ERROR; } // @@ -412,7 +420,7 @@ Tcl_DStringFree( &buffer ); } // Exclude UNIX-only feature -#if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) && !defined ( __CYGWIN__ ) +#if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) Tk_CreateFileHandler( 0, TK_READABLE, StdinProc, (ClientData) 0 ); #endif if ( tty ) @@ -493,7 +501,7 @@ } else { -#if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) && !defined ( __CYGWIN__ ) +#if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) Tk_DeleteFileHandler( 0 ); #endif } @@ -527,11 +535,11 @@ // finished. Among other things, this will trash the text of the // command being evaluated. // -#if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) && !defined ( __CYGWIN__ ) +#if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) Tk_CreateFileHandler( 0, 0, StdinProc, (ClientData) 0 ); #endif code = Tcl_RecordAndEval( interp, cmd, 0 ); -#if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) && !defined ( __CYGWIN__ ) +#if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) Tk_CreateFileHandler( 0, TK_READABLE, StdinProc, (ClientData) 0 ); #endif Tcl_DStringFree( &command ); @@ -574,8 +582,8 @@ // static void -Prompt( intp, partial ) -Tcl_Interp * intp; // Interpreter to use for prompting. +Prompt( interp, partial ) +Tcl_Interp * interp; // Interpreter to use for prompting. int partial; // Non-zero means there already // exists a partial command, so use // the secondary prompt. @@ -583,7 +591,7 @@ const char *promptCmd; int code; - promptCmd = Tcl_GetVar( intp, + promptCmd = Tcl_GetVar( interp, partial ? "tcl_prompt2" : "tcl_prompt1", TCL_GLOBAL_ONLY ); if ( promptCmd == NULL ) { @@ -595,12 +603,12 @@ } else { - code = Tcl_Eval( intp, promptCmd ); + code = Tcl_Eval( interp, promptCmd ); if ( code != TCL_OK ) { - Tcl_AddErrorInfo( intp, + Tcl_AddErrorInfo( interp, "\n (script that generates prompt)" ); - fprintf( stderr, "%s\n", Tcl_GetStringResult( intp ) ); + fprintf( stderr, "%s\n", Tcl_GetStringResult( interp ) ); goto defaultPrompt; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2013-12-09 19:18:25
|
Revision: 12835 http://sourceforge.net/p/plplot/code/12835 Author: arjenmarkus Date: 2013-12-09 19:18:22 +0000 (Mon, 09 Dec 2013) Log Message: ----------- Changes to get the Tk bindings compilable on Windows for the ntk. Not all the code involved in this change set is actually used by the ntk device, but the compiler and linker complain otherwise. Modified Paths: -------------- trunk/bindings/tk/plframe.c trunk/bindings/tk/pltkd.h trunk/bindings/tk/tcpip.c trunk/bindings/tk/tkMain.c Modified: trunk/bindings/tk/plframe.c =================================================================== --- trunk/bindings/tk/plframe.c 2013-12-09 19:16:11 UTC (rev 12834) +++ trunk/bindings/tk/plframe.c 2013-12-09 19:18:22 UTC (rev 12835) @@ -1195,7 +1195,11 @@ dbug_enter( "PlFrameKeyEH" ); +#if !defined( __WIN32__ ) nchars = XLookupString( event, string, 10, &keysym, &cs ); +#else + nchars = 0; +#endif string[nchars] = '\0'; pldebug( "PlFrameKeyEH", "Keysym %x, translation: %s\n", keysym, string ); @@ -2544,7 +2548,11 @@ (char *) NULL ); return TCL_ERROR; } +#if !defined( __WIN32__ ) if ( ( iodev->fd = open( argv[1], O_RDONLY ) ) == -1 ) +#else + if ( 1 ) +#endif { Tcl_AppendResult( interp, "cannot open fifo ", argv[1], " for read", (char *) NULL ); @@ -2552,7 +2560,11 @@ } iodev->type = 0; iodev->typeName = "fifo"; +#if !defined( __WIN32__ ) iodev->file = fdopen( iodev->fd, "rb" ); +#else + iodev->file = NULL; +#endif } // Open socket @@ -2863,7 +2875,11 @@ if ( plFramePtr->plpr_cmd == NULL ) plFramePtr->plpr_cmd = plFindCommand( "plpr" ); +#if !defined( __WIN32__ ) if ( ( plFramePtr->plpr_cmd == NULL ) || ( pid = fork() ) < 0 ) +#else + if ( 1 ) +#endif { Tcl_AppendResult( interp, "Error -- cannot fork print process", @@ -2872,8 +2888,12 @@ } else if ( pid == 0 ) { +#if !defined( __WIN32__ ) if ( execl( plFramePtr->plpr_cmd, plFramePtr->plpr_cmd, sfnam, (char *) 0 ) ) +#else + if ( 1 ) +#endif { fprintf( stderr, "Unable to exec print command.\n" ); free( sfnam ); Modified: trunk/bindings/tk/pltkd.h =================================================================== --- trunk/bindings/tk/pltkd.h 2013-12-09 19:16:11 UTC (rev 12834) +++ trunk/bindings/tk/pltkd.h 2013-12-09 19:18:22 UTC (rev 12835) @@ -21,6 +21,11 @@ #include <dp.h> #endif +// Define the type pid_t - a dummy for the moment - for MS Windows +#if defined(__WIN32__) +typedef unsigned int pid_t; +#endif + // One of these holds the TK driver state information typedef struct Modified: trunk/bindings/tk/tcpip.c =================================================================== --- trunk/bindings/tk/tcpip.c 2013-12-09 19:16:11 UTC (rev 12834) +++ trunk/bindings/tk/tcpip.c 2013-12-09 19:18:22 UTC (rev 12835) @@ -105,9 +105,18 @@ #include <sys/types.h> #include <fcntl.h> #include <ctype.h> +#if !defined( __WIN32__ ) #include <sys/uio.h> +#endif #include <errno.h> +// Supply dummy macros for the low-level I/O functions - Windows +#if defined( __WIN32__ ) +#define read(a,b,c) 0 +#define close(a) +#define write(a,b,c) 0 +#endif + //extern int errno; #ifndef MIN Modified: trunk/bindings/tk/tkMain.c =================================================================== --- trunk/bindings/tk/tkMain.c 2013-12-09 19:16:11 UTC (rev 12834) +++ trunk/bindings/tk/tkMain.c 2013-12-09 19:18:22 UTC (rev 12835) @@ -108,7 +108,12 @@ // extern int isatty _ANSI_ARGS_((int fd)); // extern int read _ANSI_ARGS_((int fd, char *buf, size_t size)); // +#if !defined(__WIN32__) extern char * strrchr _ANSI_ARGS_( ( CONST char *string, int c ) ); +#else +// On Windows we do not have a convenient console to work with +#define isatty( a ) 0 +#endif // // Global variables used by the main program: @@ -199,6 +204,7 @@ // // Parse command-line arguments. // + fprintf( stderr, "Before Tk_ParseArgv\n"); if ( Tk_ParseArgv( interp, (Tk_Window) NULL, &argc, argv, argTable, 0 ) != TCL_OK ) @@ -206,6 +212,7 @@ fprintf( stderr, "%s\n", Tcl_GetStringResult( interp ) ); exit( 1 ); } + fprintf( stderr, "After Tk_ParseArgv\n"); if ( name == NULL ) { if ( fileName != NULL ) @@ -308,6 +315,7 @@ // and "argv". Also set the "geometry" variable from the geometry // specified on the command line. // + fprintf( stderr, "Before Tcl_Merge\n"); args = Tcl_Merge( argc - 1, ( CONST char * CONST * )argv + 1 ); Tcl_SetVar( interp, "argv", args, TCL_GLOBAL_ONLY ); @@ -315,6 +323,7 @@ sprintf( buf, "%d", argc - 1 ); Tcl_SetVar( interp, "argc", buf, TCL_GLOBAL_ONLY ); + fprintf( stderr, "After Tcl_Merge\n"); if ( geometry != NULL ) { Tcl_SetVar( interp, "geometry", geometry, TCL_GLOBAL_ONLY ); @@ -336,6 +345,7 @@ // // Invoke application-specific initialization. // + fprintf( stderr, "Before AppInit\n"); if ( ( *AppInit )( interp ) != TCL_OK ) { @@ -359,6 +369,7 @@ // // Process the startup script, if any. // + fprintf( stderr, "Before startup\n"); if ( script != NULL ) { @@ -373,6 +384,7 @@ // // Invoke the script specified on the command line, if any. // + fprintf( stderr, "Before source\n"); if ( fileName != NULL ) { @@ -436,6 +448,7 @@ // are no windows left, Tk_MainLoop returns and we exit. // + fprintf( stderr, "Before Tk_MainLoop\n"); Tk_MainLoop(); // @@ -489,7 +502,11 @@ int code, count; const char *res; +#if !defined(__WIN32__) count = (int) read( fileno( stdin ), input, BUFFER_SIZE ); +#else + count = fread( input, BUFFER_SIZE, sizeof( char ), stdin ); +#endif if ( count <= 0 ) { if ( !gotPartial ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2014-01-12 02:53:59
|
Revision: 12933 http://sourceforge.net/p/plplot/code/12933 Author: airwin Date: 2014-01-12 02:53:54 +0000 (Sun, 12 Jan 2014) Log Message: ----------- Fix build errors on MinGW. Modified Paths: -------------- trunk/bindings/tk/pltkd.h trunk/bindings/tk/tcpip.c Modified: trunk/bindings/tk/pltkd.h =================================================================== --- trunk/bindings/tk/pltkd.h 2014-01-12 02:18:40 UTC (rev 12932) +++ trunk/bindings/tk/pltkd.h 2014-01-12 02:53:54 UTC (rev 12933) @@ -21,8 +21,9 @@ #include <dp.h> #endif -// Define the type pid_t - a dummy for the moment - for MS Windows -#if defined ( __WIN32__ ) +// typedef the type pid_t - a dummy for the moment - for MS Windows +// platforms other than those (e.g., MinGW) that typedef it already. +#if defined ( __WIN32__ ) && !defined ( __MINGW32__ ) typedef unsigned int pid_t; #endif Modified: trunk/bindings/tk/tcpip.c =================================================================== --- trunk/bindings/tk/tcpip.c 2014-01-12 02:18:40 UTC (rev 12932) +++ trunk/bindings/tk/tcpip.c 2014-01-12 02:53:54 UTC (rev 12933) @@ -110,6 +110,19 @@ #endif #include <errno.h> +#if defined ( __WIN32__ ) +// This is the source of the WSAEWOULDBLOCK macro on Windows platforms. + #include <winerror.h> +#endif + +#if defined ( EWOULDBLOCK ) + #define PLPLOT_EWOULDBLOCK EWOULDBLOCK +#elif defined ( WSAEWOULDBLOCK ) + #define PLPLOT_EWOULDBLOCK WSAEWOULDBLOCK +#else + #error broken system where neither EWOULDBLOCK nor WSAEWOULDBLOCK macros are #defined +#endif + // Supply dummy macros for the low-level I/O functions - Windows #if defined ( __WIN32__ ) #define read( a, b, c ) 0 @@ -561,7 +574,7 @@ // return a null string. // - if ( errno == EWOULDBLOCK || errno == EAGAIN ) + if ( errno == PLPLOT_EWOULDBLOCK || errno == EAGAIN ) { Tcl_ResetResult( interp ); return TCL_OK; @@ -686,7 +699,7 @@ if ( (unsigned) numSent != packetLen ) { - if ( ( errno == 0 ) || ( errno == EWOULDBLOCK || errno == EAGAIN ) ) + if ( ( errno == 0 ) || ( errno == PLPLOT_EWOULDBLOCK || errno == EAGAIN ) ) { // // Non-blocking I/O: return number of bytes actually sent. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |