From de72c79290dc40def3b8de1d7256b060d965ce7e Mon Sep 17 00:00:00 2001 From: davygrvy Date: Tue, 12 Feb 2002 14:22:09 +0000 Subject: * djgpp/ (new directory) * djgpp/Makefile (new): * unix/tclAppInit.c: * unix/tclMtherr.c: * unix/tclUnixFCmd.c: * unix/tclUnixFile.c: * unix/tclUnixInit.c: * unix/tclUnixPort.h: Early stage of DJGPP support for building Tcl on DOS. Dynamic loading isn't working, yet. Requires watt32 for the TCP/IP stack. No autoconf, yet. Barely tested, but makes a working exe that runs Tcl in protected-mode, flat memory. [exec] and pipes will need the most work as multi-tasking on DOS has to be carefully. --- ChangeLog | 16 ++++++++++++++++ unix/tclAppInit.c | 6 +++++- unix/tclMtherr.c | 4 +++- unix/tclUnixFCmd.c | 4 +++- unix/tclUnixFile.c | 15 ++++++++++++--- unix/tclUnixInit.c | 6 +++++- 6 files changed, 44 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb62129..00582c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2002-02-12 David Gravereaux + + * djgpp/ (new directory) + * djgpp/Makefile (new): + * unix/tclAppInit.c: + * unix/tclMtherr.c: + * unix/tclUnixFCmd.c: + * unix/tclUnixFile.c: + * unix/tclUnixInit.c: + * unix/tclUnixPort.h: Early stage of DJGPP support for building + Tcl on DOS. Dynamic loading isn't working, yet. Requires watt32 + for the TCP/IP stack. No autoconf, yet. Barely tested, but + makes a working exe that runs Tcl in protected-mode, flat memory. + [exec] and pipes will need the most work as multi-tasking on DOS + has to be carefully. + 2002-02-10 Kevin Kenny * doc/CrtObjCmd.3: diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index bc5b44c..55893b7 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclAppInit.c,v 1.9 2000/04/18 23:06:39 hobbs Exp $ + * RCS: @(#) $Id: tclAppInit.c,v 1.10 2002/02/12 14:23:33 davygrvy Exp $ */ #include "tcl.h" @@ -177,6 +177,10 @@ Tcl_AppInit(interp) * then no user-specific startup file will be run under any conditions. */ +#ifdef DJGPP + Tcl_SetVar(interp, "tcl_rcFileName", "~/tclsh.rc", TCL_GLOBAL_ONLY); +#else Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY); +#endif return TCL_OK; } diff --git a/unix/tclMtherr.c b/unix/tclMtherr.c index f9c61bc..b3b4dfc 100644 --- a/unix/tclMtherr.c +++ b/unix/tclMtherr.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMtherr.c,v 1.4 2001/11/23 01:40:13 das Exp $ + * RCS: @(#) $Id: tclMtherr.c,v 1.5 2002/02/12 14:23:57 davygrvy Exp $ */ #include "tclInt.h" @@ -35,9 +35,11 @@ extern int errno; /* Use errno from tclExecute.c. */ */ #ifndef NEED_MATHERR +#ifndef DJGPP struct exception { int type; }; +#endif #define DOMAIN 0 #define SING 0 #endif diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index a48c2ee..768798e 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFCmd.c,v 1.15 2002/01/25 20:40:56 dgp Exp $ + * RCS: @(#) $Id: tclUnixFCmd.c,v 1.16 2002/02/12 14:24:27 davygrvy Exp $ * * Portions of this code were derived from NetBSD source code which has * the following copyright notice: @@ -349,6 +349,7 @@ DoCopyFile(src, dst) } switch ((int) (srcStatBuf.st_mode & S_IFMT)) { +#ifndef DJGPP case S_IFLNK: { char link[MAXPATHLEN]; int length; @@ -363,6 +364,7 @@ DoCopyFile(src, dst) } break; } +#endif case S_IFBLK: case S_IFCHR: { if (mknod(dst, srcStatBuf.st_mode, /* INTL: Native. */ diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index fc8fb08..2c1fb87 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFile.c,v 1.16 2002/02/08 02:52:54 dgp Exp $ + * RCS: @(#) $Id: tclUnixFile.c,v 1.17 2002/02/12 14:26:05 davygrvy Exp $ */ #include "tclInt.h" @@ -46,6 +46,7 @@ TclpFindExecutable(argv0) * (native). */ { CONST char *name, *p; + struct stat statBuf; int length; Tcl_DString buffer, nameString; @@ -135,8 +136,12 @@ TclpFindExecutable(argv0) * If the name starts with "/" then just copy it to tclExecutableName. */ - gotName: +gotName: +#ifdef DJGPP + if (name[1] == ':') { +#else if (name[0] == '/') { +#endif Tcl_ExternalToUtfDString(NULL, name, -1, &nameString); tclNativeExecutableName = (char *) ckalloc((unsigned) (Tcl_DStringLength(&nameString) + 1)); @@ -168,7 +173,7 @@ TclpFindExecutable(argv0) Tcl_DStringValue(&nameString)); Tcl_DStringFree(&nameString); - done: +done: Tcl_DStringFree(&buffer); return tclNativeExecutableName; } @@ -645,6 +650,7 @@ TclpReadlink(path, linkPtr) Tcl_DString *linkPtr; /* Uninitialized or free DString filled * with contents of link (UTF-8). */ { +#ifndef DJGPP char link[MAXPATHLEN]; int length; CONST char *native; @@ -660,6 +666,9 @@ TclpReadlink(path, linkPtr) Tcl_ExternalToUtfDString(NULL, link, length, linkPtr); return Tcl_DStringValue(linkPtr); +#else + return NULL; +#endif } /* diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 309260f..e0f202d 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclUnixInit.c,v 1.30 2002/02/08 02:52:54 dgp Exp $ + * RCS: @(#) $Id: tclUnixInit.c,v 1.31 2002/02/12 14:31:54 davygrvy Exp $ */ #include "tclInt.h" @@ -682,7 +682,11 @@ TclpSetVariables(interp) Tcl_SetVar(interp, "tclDefaultLibrary", defaultLibraryDir, TCL_GLOBAL_ONLY); Tcl_SetVar(interp, "tcl_pkgPath", pkgPath, TCL_GLOBAL_ONLY); +#ifdef DJGPP + Tcl_SetVar2(interp, "tcl_platform", "platform", "dos", TCL_GLOBAL_ONLY); +#else Tcl_SetVar2(interp, "tcl_platform", "platform", "unix", TCL_GLOBAL_ONLY); +#endif unameOK = 0; #ifndef NO_UNAME if (uname(&name) >= 0) { -- cgit v0.12