2000-08-08 01:06:24 -04:00
|
|
|
#if defined USE_TCL_STUBS && defined USE_TK_STUBS
|
|
|
|
#include <tcl.h>
|
|
|
|
#include <tk.h>
|
|
|
|
#include "ruby.h"
|
|
|
|
|
2001-05-28 12:07:34 -04:00
|
|
|
#if defined _WIN32 || defined __CYGWIN__
|
2002-11-09 03:05:27 -05:00
|
|
|
# include "util.h"
|
2000-08-08 01:06:24 -04:00
|
|
|
# include <windows.h>
|
|
|
|
typedef HINSTANCE DL_HANDLE;
|
|
|
|
# define DL_OPEN LoadLibrary
|
|
|
|
# define DL_SYM GetProcAddress
|
|
|
|
# define TCL_INDEX 4
|
|
|
|
# define TK_INDEX 3
|
|
|
|
# define TCL_NAME "tcl89%s"
|
|
|
|
# define TK_NAME "tk89%s"
|
|
|
|
# undef DLEXT
|
|
|
|
# define DLEXT ".dll"
|
|
|
|
#elif defined HAVE_DLOPEN
|
|
|
|
# include <dlfcn.h>
|
|
|
|
typedef void *DL_HANDLE;
|
|
|
|
# define DL_OPEN(file) dlopen(file, RTLD_LAZY|RTLD_GLOBAL)
|
|
|
|
# define DL_SYM dlsym
|
|
|
|
# define TCL_INDEX 8
|
|
|
|
# define TK_INDEX 7
|
|
|
|
# define TCL_NAME "libtcl8.9%s"
|
|
|
|
# define TK_NAME "libtk8.9%s"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int
|
|
|
|
ruby_tcltk_stubs()
|
|
|
|
{
|
|
|
|
DL_HANDLE tcl_dll;
|
|
|
|
DL_HANDLE tk_dll;
|
|
|
|
Tcl_Interp *(*p_Tcl_CreateInterp)();
|
|
|
|
int (*p_Tk_Init) _((Tcl_Interp *));
|
|
|
|
Tcl_Interp *tcl_ip;
|
|
|
|
int n;
|
2002-10-10 04:30:52 -04:00
|
|
|
char *ruby_tcl_dll = 0;
|
|
|
|
char *ruby_tk_dll = 0;
|
2000-08-08 01:06:24 -04:00
|
|
|
char tcl_name[20];
|
|
|
|
char tk_name[20];
|
|
|
|
|
|
|
|
ruby_tcl_dll = getenv("RUBY_TCL_DLL");
|
* configure.in, defines.h, dir.c, dir.h, dln.c, error.c,
eval.c, file.c, hash.c, io.c, main.c, missing.c,
process.c, ruby.c, rubysig.h, signal.c, st.c, util.c, util.h,
bcc/Makefile.sub, win32/Makefile.sub, win32/win32.h,
ext/Win32API/Win32API.c, ext/socket/getaddrinfo.c,
ext/socket/getnameinfo.c, ext/socket/socket.c,
ext/tcltklib/stubs.c
: replace "NT" with "_WIN32", add DOSISH_DRIVE_LETTER
* wince/exe.mak : delete \r at the end of lines.
* wince/mswince-ruby17.def : delete rb_obj_become
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-14 22:18:08 -05:00
|
|
|
#if defined _WIN32
|
2002-07-30 02:34:27 -04:00
|
|
|
if (ruby_tcl_dll) ruby_tcl_dll = ruby_strdup(ruby_tcl_dll);
|
|
|
|
#endif
|
2000-08-08 01:06:24 -04:00
|
|
|
ruby_tk_dll = getenv("RUBY_TK_DLL");
|
|
|
|
if (ruby_tcl_dll && ruby_tk_dll) {
|
|
|
|
tcl_dll = (DL_HANDLE)DL_OPEN(ruby_tcl_dll);
|
|
|
|
tk_dll = (DL_HANDLE)DL_OPEN(ruby_tk_dll);
|
|
|
|
} else {
|
|
|
|
snprintf(tcl_name, sizeof tcl_name, TCL_NAME, DLEXT);
|
|
|
|
snprintf(tk_name, sizeof tk_name, TK_NAME, DLEXT);
|
2001-06-24 21:52:59 -04:00
|
|
|
/* examine from 8.9 to 8.1 */
|
2000-08-08 01:06:24 -04:00
|
|
|
for (n = '9'; n > '0'; n--) {
|
|
|
|
tcl_name[TCL_INDEX] = n;
|
|
|
|
tk_name[TK_INDEX] = n;
|
|
|
|
tcl_dll = (DL_HANDLE)DL_OPEN(tcl_name);
|
|
|
|
tk_dll = (DL_HANDLE)DL_OPEN(tk_name);
|
|
|
|
if (tcl_dll && tk_dll)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
* configure.in, defines.h, dir.c, dir.h, dln.c, error.c,
eval.c, file.c, hash.c, io.c, main.c, missing.c,
process.c, ruby.c, rubysig.h, signal.c, st.c, util.c, util.h,
bcc/Makefile.sub, win32/Makefile.sub, win32/win32.h,
ext/Win32API/Win32API.c, ext/socket/getaddrinfo.c,
ext/socket/getnameinfo.c, ext/socket/socket.c,
ext/tcltklib/stubs.c
: replace "NT" with "_WIN32", add DOSISH_DRIVE_LETTER
* wince/exe.mak : delete \r at the end of lines.
* wince/mswince-ruby17.def : delete rb_obj_become
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-14 22:18:08 -05:00
|
|
|
#if defined _WIN32
|
2002-10-10 04:30:52 -04:00
|
|
|
if (ruby_tcl_dll) ruby_xfree(ruby_tcl_dll);
|
|
|
|
#endif
|
|
|
|
|
2000-08-08 01:06:24 -04:00
|
|
|
if (!tcl_dll || !tk_dll)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
p_Tcl_CreateInterp = (Tcl_Interp *(*)())DL_SYM(tcl_dll, "Tcl_CreateInterp");
|
|
|
|
if (!p_Tcl_CreateInterp)
|
|
|
|
return -2;
|
|
|
|
|
|
|
|
tcl_ip = (*p_Tcl_CreateInterp)();
|
|
|
|
if (!tcl_ip)
|
|
|
|
return -3;
|
|
|
|
|
|
|
|
p_Tk_Init = (int (*) _((Tcl_Interp *)))DL_SYM(tk_dll, "Tk_Init");
|
|
|
|
if (!p_Tk_Init)
|
|
|
|
return -4;
|
|
|
|
(*p_Tk_Init)(tcl_ip);
|
|
|
|
|
|
|
|
if (!Tcl_InitStubs(tcl_ip, "8.1", 0))
|
|
|
|
return -5;
|
|
|
|
if (!Tk_InitStubs(tcl_ip, "8.1", 0))
|
|
|
|
return -6;
|
|
|
|
|
|
|
|
Tcl_DeleteInterp(tcl_ip);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|