summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/tclMacOSXBundle.c4
-rw-r--r--macosx/tclMacOSXFCmd.c68
-rw-r--r--macosx/tclMacOSXNotify.c48
-rw-r--r--tools/man2tcl.c214
-rw-r--r--win/cat.c7
-rw-r--r--win/nmakehlp.c266
-rw-r--r--win/stub16.c67
-rw-r--r--win/tclWin32Dll.c237
-rw-r--r--win/tclWinChan.c144
-rw-r--r--win/tclWinConsole.c153
-rw-r--r--win/tclWinDde.c174
-rw-r--r--win/tclWinError.c23
-rw-r--r--win/tclWinFCmd.c38
-rw-r--r--win/tclWinFile.c6
-rw-r--r--win/tclWinInit.c52
-rw-r--r--win/tclWinLoad.c44
-rw-r--r--win/tclWinNotify.c20
-rw-r--r--win/tclWinPipe.c58
-rw-r--r--win/tclWinReg.c16
-rw-r--r--win/tclWinSock.c235
-rw-r--r--win/tclWinTest.c218
-rw-r--r--win/tclWinThrd.c91
-rw-r--r--win/tclWinTime.c116
23 files changed, 1188 insertions, 1111 deletions
diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c
index 4b735b7..59cead9 100644
--- a/macosx/tclMacOSXBundle.c
+++ b/macosx/tclMacOSXBundle.c
@@ -169,7 +169,7 @@ Tcl_MacOSXOpenVersionedBundleResources(
bundleRef = versionedBundleRef;
}
- if (bundleRef) {
+ if (bundleRef) {
if (hasResourceFile) {
/*
* Dynamically acquire address for CFBundleOpenBundleResourceMap
@@ -214,7 +214,7 @@ Tcl_MacOSXOpenVersionedBundleResources(
CFRelease(libURL);
}
}
-
+
if (libraryPath[0]) {
return TCL_OK;
} else {
diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c
index 738839d..aab5b44 100644
--- a/macosx/tclMacOSXFCmd.c
+++ b/macosx/tclMacOSXFCmd.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: tclMacOSXFCmd.c,v 1.4 2005/07/25 20:48:34 dkf Exp $
+ * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.5 2005/11/04 00:06:49 dkf Exp $
*/
#include "tclInt.h"
@@ -82,11 +82,11 @@ typedef struct fileinfobuf {
*/
int
-TclMacOSXGetFileAttribute(interp, objIndex, fileName, attributePtrPtr)
- Tcl_Interp *interp; /* The interp we are using for errors. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */
+TclMacOSXGetFileAttribute(
+ Tcl_Interp *interp, /* The interp we are using for errors. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
{
#ifdef HAVE_GETATTRLIST
int result;
@@ -99,8 +99,7 @@ TclMacOSXGetFileAttribute(interp, objIndex, fileName, attributePtrPtr)
if (result != 0) {
Tcl_AppendResult(interp, "could not read \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ", Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
@@ -111,7 +110,7 @@ TclMacOSXGetFileAttribute(interp, objIndex, fileName, attributePtrPtr)
errno = EISDIR;
Tcl_AppendResult(interp, "invalid attribute: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
@@ -127,8 +126,7 @@ TclMacOSXGetFileAttribute(interp, objIndex, fileName, attributePtrPtr)
if (result != 0) {
Tcl_AppendResult(interp, "could not read attributes of \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ", Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
@@ -149,8 +147,7 @@ TclMacOSXGetFileAttribute(interp, objIndex, fileName, attributePtrPtr)
}
return TCL_OK;
#else
- Tcl_AppendResult(interp, "Mac OS X file attributes not supported",
- (char *) NULL);
+ Tcl_AppendResult(interp, "Mac OS X file attributes not supported", NULL);
return TCL_ERROR;
#endif
}
@@ -173,11 +170,11 @@ TclMacOSXGetFileAttribute(interp, objIndex, fileName, attributePtrPtr)
*/
int
-TclMacOSXSetFileAttribute(interp, objIndex, fileName, attributePtr)
- Tcl_Interp *interp; /* The interp for error reporting. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj *attributePtr; /* New owner for file. */
+TclMacOSXSetFileAttribute(
+ Tcl_Interp *interp, /* The interp for error reporting. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj *attributePtr) /* New owner for file. */
{
#ifdef HAVE_GETATTRLIST
int result;
@@ -190,8 +187,7 @@ TclMacOSXSetFileAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
Tcl_AppendResult(interp, "could not read \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ", Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
@@ -202,7 +198,7 @@ TclMacOSXSetFileAttribute(interp, objIndex, fileName, attributePtr)
errno = EISDIR;
Tcl_AppendResult(interp, "invalid attribute: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
@@ -218,8 +214,7 @@ TclMacOSXSetFileAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
Tcl_AppendResult(interp, "could not read attributes of \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ", Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
@@ -257,8 +252,8 @@ TclMacOSXSetFileAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
Tcl_AppendResult(interp, "could not set attributes of \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ",
+ Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
} else {
@@ -279,8 +274,7 @@ TclMacOSXSetFileAttribute(interp, objIndex, fileName, attributePtr)
if(newRsrcForkSize != 0) {
Tcl_AppendResult(interp,
- "setting nonzero rsrclength not supported",
- (char *) NULL);
+ "setting nonzero rsrclength not supported", NULL);
return TCL_ERROR;
}
@@ -299,16 +293,15 @@ TclMacOSXSetFileAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
Tcl_AppendResult(interp,
"could not truncate resource fork of \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ",
+ Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
}
}
return TCL_OK;
#else
- Tcl_AppendResult(interp, "Mac OS X file attributes not supported",
- (char *) NULL);
+ Tcl_AppendResult(interp, "Mac OS X file attributes not supported", NULL);
return TCL_ERROR;
#endif
}
@@ -332,10 +325,10 @@ TclMacOSXSetFileAttribute(interp, objIndex, fileName, attributePtr)
*/
int
-TclMacOSXCopyFileAttributes(src, dst, statBufPtr)
- CONST char *src; /* Path name of source file (native). */
- CONST char *dst; /* Path name of target file (native). */
- CONST Tcl_StatBuf *statBufPtr;
+TclMacOSXCopyFileAttributes(
+ CONST char *src, /* Path name of source file (native). */
+ CONST char *dst, /* Path name of target file (native). */
+ CONST Tcl_StatBuf *statBufPtr)
/* Stat info for source file */
{
#ifdef HAVE_GETATTRLIST
@@ -430,9 +423,8 @@ Tcl_GetOSTypeFromObj(
Tcl_UtfToExternalDString(encoding, string, length, &ds);
if (Tcl_DStringLength(&ds) > sizeof(OSType)) {
- Tcl_AppendResult(interp,
- "expected Macintosh OS type but got \"",
- string, "\": ", (char *) NULL);
+ Tcl_AppendResult(interp, "expected Macintosh OS type but got \"",
+ string, "\": ", NULL);
result = TCL_ERROR;
} else {
memset(osTypePtr, 0, sizeof(OSType));
diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c
index 6c46562..67a1a78 100644
--- a/macosx/tclMacOSXNotify.c
+++ b/macosx/tclMacOSXNotify.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.4 2005/07/25 20:48:34 dkf Exp $
+ * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.5 2005/11/04 00:06:49 dkf Exp $
*/
#ifdef HAVE_COREFOUNDATION /* Traditional unix select-based notifier is
@@ -233,7 +233,7 @@ static int FileHandlerEventProc(Tcl_Event *evPtr, int flags);
*/
ClientData
-Tcl_InitNotifier()
+Tcl_InitNotifier(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -322,8 +322,8 @@ Tcl_InitNotifier()
*/
void
-Tcl_FinalizeNotifier(clientData)
- ClientData clientData; /* Not used. */
+Tcl_FinalizeNotifier(
+ ClientData clientData) /* Not used. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -401,8 +401,8 @@ Tcl_FinalizeNotifier(clientData)
*/
void
-Tcl_AlertNotifier(clientData)
- ClientData clientData;
+Tcl_AlertNotifier(
+ ClientData clientData)
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
@@ -434,8 +434,8 @@ Tcl_AlertNotifier(clientData)
*/
void
-Tcl_SetTimer(timePtr)
- Tcl_Time *timePtr; /* Timeout value, may be NULL. */
+Tcl_SetTimer(
+ Tcl_Time *timePtr) /* Timeout value, may be NULL. */
{
/*
* The interval timer doesn't do anything in this implementation, because
@@ -465,8 +465,8 @@ Tcl_SetTimer(timePtr)
*/
void
-Tcl_ServiceModeHook(mode)
- int mode; /* Either TCL_SERVICE_ALL, or
+Tcl_ServiceModeHook(
+ int mode) /* Either TCL_SERVICE_ALL, or
* TCL_SERVICE_NONE. */
{
}
@@ -488,15 +488,15 @@ Tcl_ServiceModeHook(mode)
*/
void
-Tcl_CreateFileHandler(fd, mask, proc, clientData)
- int fd; /* Handle of stream to watch. */
- int mask; /* OR'ed combination of TCL_READABLE,
+Tcl_CreateFileHandler(
+ int fd, /* Handle of stream to watch. */
+ int mask, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
* conditions under which proc should be
* called. */
- Tcl_FileProc *proc; /* Function to call for each
+ Tcl_FileProc *proc, /* Function to call for each
* selected event. */
- ClientData clientData; /* Arbitrary data to pass to proc. */
+ ClientData clientData) /* Arbitrary data to pass to proc. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
FileHandler *filePtr;
@@ -565,8 +565,8 @@ Tcl_CreateFileHandler(fd, mask, proc, clientData)
*/
void
-Tcl_DeleteFileHandler(fd)
- int fd; /* Stream id for which to remove callback
+Tcl_DeleteFileHandler(
+ int fd) /* Stream id for which to remove callback
* function. */
{
FileHandler *filePtr, *prevPtr;
@@ -658,9 +658,9 @@ Tcl_DeleteFileHandler(fd)
*/
static int
-FileHandlerEventProc(evPtr, flags)
- Tcl_Event *evPtr; /* Event to service. */
- int flags; /* Flags that indicate what events to handle,
+FileHandlerEventProc(
+ Tcl_Event *evPtr, /* Event to service. */
+ int flags) /* Flags that indicate what events to handle,
* such as TCL_FILE_EVENTS. */
{
int mask;
@@ -727,8 +727,8 @@ FileHandlerEventProc(evPtr, flags)
*/
int
-Tcl_WaitForEvent(timePtr)
- Tcl_Time *timePtr; /* Maximum block time, or NULL. */
+Tcl_WaitForEvent(
+ Tcl_Time *timePtr) /* Maximum block time, or NULL. */
{
FileHandler *filePtr;
FileHandlerEvent *fileEvPtr;
@@ -906,8 +906,8 @@ Tcl_WaitForEvent(timePtr)
*/
static void
-NotifierThreadProc(clientData)
- ClientData clientData; /* Not used. */
+NotifierThreadProc(
+ ClientData clientData) /* Not used. */
{
ThreadSpecificData *tsdPtr;
fd_set readableMask;
diff --git a/tools/man2tcl.c b/tools/man2tcl.c
index b2de3fe..aa8dfbc 100644
--- a/tools/man2tcl.c
+++ b/tools/man2tcl.c
@@ -1,11 +1,10 @@
-/*
+/*
* man2tcl.c --
*
- * This file contains a program that turns a man page of the
- * form used for Tcl and Tk into a Tcl script that invokes
- * a Tcl command for each construct in the man page. The
- * script can then be eval'ed to translate the manual entry
- * into some other format such as MIF or HTML.
+ * This file contains a program that turns a man page of the form used
+ * for Tcl and Tk into a Tcl script that invokes a Tcl command for each
+ * construct in the man page. The script can then be eval'ed to translate
+ * the manual entry into some other format such as MIF or HTML.
*
* Usage:
*
@@ -13,10 +12,10 @@
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: man2tcl.c,v 1.9 2005/10/13 18:30:09 dgp Exp $
+ * RCS: @(#) $Id: man2tcl.c,v 1.10 2005/11/04 00:06:49 dkf Exp $
*/
static char sccsid[] = "@(#) man2tcl.c 1.3 95/08/12 17:34:08";
@@ -31,10 +30,10 @@ static char sccsid[] = "@(#) man2tcl.c 1.3 95/08/12 17:34:08";
*/
/*
- * Some <errno.h> define errno to be something complex and
- * thread-aware; in that case we definitely do not want to declare
- * errno ourselves!
+ * Some <errno.h> define errno to be something complex and thread-aware; in
+ * that case we definitely do not want to declare errno ourselves!
*/
+
#ifndef errno
extern int errno;
#endif
@@ -46,22 +45,25 @@ extern int errno;
static int lineNumber;
/*
- * The variable below is set to 1 if an error occurs anywhere
- * while reading in the file.
+ * The variable below is set to 1 if an error occurs anywhere while reading in
+ * the file.
*/
static int status;
/*
- * The variable below is set to 1 if output should be generated.
- * If it's 0, it means we're doing a pre-pass to make sure that
- * the file can be properly parsed.
+ * The variable below is set to 1 if output should be generated. If it's 0, it
+ * means we're doing a pre-pass to make sure that the file can be properly
+ * parsed.
*/
static int writeOutput;
+#define PRINT(args) if (writeOutput) { printf args; }
+#define PRINTC(chr) if (writeOutput) { putc((chr), stdout); }
+
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
static void DoMacro(char *line);
@@ -73,24 +75,24 @@ static void QuoteText(char *string, int count);
*
* main --
*
- * This procedure is the main program, which does all of the work
- * of the program.
+ * This function is the main program, which does all of the work of the
+ * program.
*
* Results:
- * None: exits with a 0 return status to indicate success, or
- * 1 to indicate that there were problems in the translation.
+ * None: exits with a 0 return status to indicate success, or 1 to
+ * indicate that there were problems in the translation.
*
* Side effects:
- * A Tcl script is output to standard output. Error messages may
- * be output on standard error.
+ * A Tcl script is output to standard output. Error messages may be
+ * output on standard error.
*
*----------------------------------------------------------------------
*/
int
-main(argc, argv)
- int argc; /* Number of command-line arguments. */
- char **argv; /* Values of command-line arguments. */
+main(
+ int argc, /* Number of command-line arguments. */
+ char **argv) /* Values of command-line arguments. */
{
FILE *f;
#define MAX_LINE_SIZE 1000
@@ -115,10 +117,10 @@ main(argc, argv)
}
/*
- * Make two passes over the file. In the first pass, just check
- * to make sure we can handle everything. If there are problems,
- * generate output and stop. If everything is OK, make a second
- * pass to actually generate output.
+ * Make two passes over the file. In the first pass, just check to make
+ * sure we can handle everything. If there are problems, generate output
+ * and stop. If everything is OK, make a second pass to actually generate
+ * output.
*/
for (writeOutput = 0; writeOutput < 2; writeOutput++) {
@@ -132,15 +134,15 @@ main(argc, argv)
}
}
lineNumber++;
-
+
if ((line[0] == '\'') && (line[1] == '\\') && (line[2] == '\"')) {
- /*
- * This line is a comment. Ignore it.
+ /*
+ * This line is a comment. Ignore it.
*/
-
+
continue;
}
-
+
if (strlen(line) >= MAX_LINE_SIZE -1) {
fprintf(stderr, "Too long line. Max is %d chars.\n",
MAX_LINE_SIZE - 1);
@@ -151,14 +153,14 @@ main(argc, argv)
/*
* This line is a macro invocation.
*/
-
+
DoMacro(line);
} else {
/*
* This line is text, possibly with formatting characters
* embedded in it.
*/
-
+
DoText(line);
}
}
@@ -175,9 +177,9 @@ main(argc, argv)
*
* DoMacro --
*
- * This procedure is called to handle a macro invocation.
- * It parses the arguments to the macro and generates a
- * Tcl command to handle the invocation.
+ * This function is called to handle a macro invocation. It parses the
+ * arguments to the macro and generates a Tcl command to handle the
+ * invocation.
*
* Results:
* None.
@@ -189,9 +191,9 @@ main(argc, argv)
*/
static void
-DoMacro(line)
- char *line; /* The line of text that contains the
- * macro invocation. */
+DoMacro(
+ char *line) /* The line of text that contains the macro
+ * invocation. */
{
char *p, *end;
@@ -203,13 +205,9 @@ DoMacro(line)
return;
}
- if (writeOutput) {
- printf("macro");
- }
+ PRINT(("macro"));
if (*line != '.') {
- if (writeOutput) {
- printf("2");
- }
+ PRINT(("2"));
}
/*
@@ -218,10 +216,8 @@ DoMacro(line)
p = line+1;
while (1) {
- if (writeOutput) {
- putc(' ', stdout);
- }
- if (*p == '"') {
+ PRINTC(' ');
+ if (*p == '"') {
/*
* The argument is delimited by quotes.
*/
@@ -229,15 +225,15 @@ DoMacro(line)
for (end = p+1; *end != '"'; end++) {
if (*end == 0) {
fprintf(stderr,
- "Unclosed quote in macro call on line %d.\n",
- lineNumber);
+ "Unclosed quote in macro call on line %d.\n",
+ lineNumber);
status = 1;
break;
}
}
QuoteText(p+1, (end-(p+1)));
} else {
- for (end = p+1; (*end != 0) && !isspace(*end); end++) {
+ for (end = p+1; (*end != 0) && !isspace(*end); end++) {
/* Empty loop body. */
}
QuoteText(p, end-p);
@@ -257,9 +253,7 @@ DoMacro(line)
break;
}
}
- if (writeOutput) {
- putc('\n', stdout);
- }
+ PRINTC('\n');
}
/*
@@ -267,9 +261,9 @@ DoMacro(line)
*
* DoText --
*
- * This procedure is called to handle a line of troff text.
- * It parses the text, generating Tcl commands for text and
- * for formatting stuff such as font changes.
+ * This function is called to handle a line of troff text. It parses the
+ * text, generating Tcl commands for text and for formatting stuff such
+ * as font changes.
*
* Results:
* None.
@@ -281,22 +275,20 @@ DoMacro(line)
*/
static void
-DoText(line)
- char *line; /* The line of text. */
+DoText(
+ char *line) /* The line of text. */
{
char *p, *end;
/*
- * Divide the line up into pieces consisting of backslash sequences,
- * tabs, and other text.
+ * Divide the line up into pieces consisting of backslash sequences, tabs,
+ * and other text.
*/
p = line;
while (*p != 0) {
if (*p == '\t') {
- if (writeOutput) {
- printf("tab\n");
- }
+ PRINT(("tab\n"));
p++;
} else if (*p != '\\') {
/*
@@ -306,19 +298,15 @@ DoText(line)
for (end = p+1; (*end != '\\') && (*end != 0); end++) {
/* Empty loop body. */
}
- if (writeOutput) {
- printf("text ");
- }
+ PRINT(("text "));
QuoteText(p, end-p);
- if (writeOutput) {
- putc('\n', stdout);
- }
+ PRINTC('\n');
p = end;
} else {
/*
- * A backslash sequence. There are particular ones
- * that we understand; output an error message for
- * anything else and just ignore the backslash.
+ * A backslash sequence. There are particular ones that we
+ * understand; output an error message for anything else and just
+ * ignore the backslash.
*/
p++;
@@ -327,24 +315,16 @@ DoText(line)
* Font change.
*/
- if (writeOutput) {
- printf("font %c\n", p[1]);
- }
+ PRINT(("font %c\n", p[1]));
p += 2;
} else if (*p == '-') {
- if (writeOutput) {
- printf("dash\n");
- }
+ PRINT(("dash\n"));
p++;
} else if (*p == 'e') {
- if (writeOutput) {
- printf("text \\\\\n");
- }
+ PRINT(("text \\\\\n"));
p++;
} else if (*p == '.') {
- if (writeOutput) {
- printf("text .\n");
- }
+ PRINT(("text .\n"));
p++;
} else if (*p == '&') {
p++;
@@ -354,22 +334,16 @@ DoText(line)
lineNumber);
status = 1;
} else {
- if (writeOutput) {
- printf("char {\\(%c%c}\n", p[1], p[2]);
- }
+ PRINT(("char {\\(%c%c}\n", p[1], p[2]));
p += 3;
}
} else if (*p != 0) {
- if (writeOutput) {
- printf("char {\\%c}\n", *p);
- }
+ PRINT(("char {\\%c}\n", *p));
p++;
}
}
}
- if (writeOutput) {
- printf("newline\n");
- }
+ PRINT(("newline\n"));
}
/*
@@ -377,9 +351,9 @@ DoText(line)
*
* QuoteText --
*
- * Copy the "string" argument to stdout, adding quote characters
- * around any special Tcl characters so that they'll just be treated
- * as ordinary text.
+ * Copy the "string" argument to stdout, adding quote characters around
+ * any special Tcl characters so that they'll just be treated as ordinary
+ * text.
*
* Results:
* None.
@@ -391,26 +365,30 @@ DoText(line)
*/
static void
-QuoteText(string, count)
- char *string; /* The line of text. */
- int count; /* Number of characters to write from string. */
+QuoteText(
+ char *string, /* The line of text. */
+ int count) /* Number of characters to write from
+ * string. */
{
if (count == 0) {
- if (writeOutput) {
- printf("{}");
- }
+ PRINT(("{}"));
return;
}
for ( ; count > 0; string++, count--) {
- if ((*string == '$') || (*string == '[') || (*string == '{')
- || (*string == ' ') || (*string == ';') || (*string == '\\')
- || (*string == '"') || (*string == '\t')) {
- if (writeOutput) {
- putc('\\', stdout);
- }
- }
- if (writeOutput) {
- putc(*string, stdout);
+ switch (*string) {
+ case '$': case '[': case '{': case ' ': case ';': case '\\':
+ case '"': case '\t':
+ PRINTC('\\');
+ default:
+ PRINTC(*string);
}
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/cat.c b/win/cat.c
index cdd83a5..91c38f4 100644
--- a/win/cat.c
+++ b/win/cat.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: cat.c,v 1.2 1998/09/14 18:40:19 stanton Exp $
+ * RCS: @(#) $Id: cat.c,v 1.3 2005/11/04 00:06:49 dkf Exp $
*/
#include <stdio.h>
@@ -16,8 +16,8 @@
#include <string.h>
int
-main()
-{
+main(void)
+{
char buf[1024];
int n;
char *err;
@@ -34,4 +34,3 @@ main()
return 0;
}
-
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index d1fb6b4..5b7a3b4 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -1,4 +1,5 @@
-/* ----------------------------------------------------------------------------
+/*
+ * ----------------------------------------------------------------------------
* nmakehlp.c --
*
* This is used to fix limitations within nmake and the environment.
@@ -9,9 +10,10 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* ----------------------------------------------------------------------------
- * RCS: @(#) $Id: nmakehlp.c,v 1.8 2005/11/03 00:17:31 patthoyts Exp $
+ * RCS: @(#) $Id: nmakehlp.c,v 1.9 2005/11/04 00:06:49 dkf Exp $
* ----------------------------------------------------------------------------
*/
+
#include <windows.h>
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "kernel32.lib")
@@ -19,13 +21,15 @@
#include <math.h>
/* protos */
-int CheckForCompilerFeature (const char *option);
-int CheckForLinkerFeature (const char *option);
-int IsIn (const char *string, const char *substring);
-int GrepForDefine (const char *file, const char *string);
-DWORD WINAPI ReadFromPipe (LPVOID args);
+
+int CheckForCompilerFeature(const char *option);
+int CheckForLinkerFeature(const char *option);
+int IsIn(const char *string, const char *substring);
+int GrepForDefine(const char *file, const char *string);
+DWORD WINAPI ReadFromPipe(LPVOID args);
/* globals */
+
#define CHUNK 25
#define STATICBUFFERSIZE 1000
typedef struct {
@@ -35,21 +39,30 @@ typedef struct {
pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'};
pipeinfo Err = {INVALID_HANDLE_VALUE, '\0'};
+
+/*
+ * exitcodes: 0 == no, 1 == yes, 2 == error
+ */
-
-
-/* exitcodes: 0 == no, 1 == yes, 2 == error */
int
-main (int argc, char *argv[])
+main(
+ int argc,
+ char *argv[])
{
char msg[300];
DWORD dwWritten;
int chars;
- /* make sure children (cl.exe and link.exe) are kept quiet. */
+ /*
+ * Make sure children (cl.exe and link.exe) are kept quiet.
+ */
+
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
- /* Make sure the compiler and linker aren't effected by the outside world. */
+ /*
+ * Make sure the compiler and linker aren't effected by the outside world.
+ */
+
SetEnvironmentVariable("CL", "");
SetEnvironmentVariable("LINK", "");
@@ -60,7 +73,8 @@ main (int argc, char *argv[])
chars = wsprintf(msg, "usage: %s -c <compiler option>\n"
"Tests for whether cl.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
+ &dwWritten, NULL);
return 2;
}
return CheckForCompilerFeature(argv[2]);
@@ -69,19 +83,24 @@ main (int argc, char *argv[])
chars = wsprintf(msg, "usage: %s -l <linker option>\n"
"Tests for whether link.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
+ &dwWritten, NULL);
return 2;
}
return CheckForLinkerFeature(argv[2]);
case 'f':
if (argc == 2) {
chars = wsprintf(msg, "usage: %s -f <string> <substring>\n"
- "Find a substring within another\n"
- "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
+ "Find a substring within another\n"
+ "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
+ &dwWritten, NULL);
return 2;
} else if (argc == 3) {
- /* if the string is blank, there is no match */
+ /*
+ * If the string is blank, there is no match.
+ */
+
return 0;
} else {
return IsIn(argv[2], argv[3]);
@@ -89,9 +108,11 @@ main (int argc, char *argv[])
case 'g':
if (argc == 2) {
chars = wsprintf(msg, "usage: %s -g <file> <string>\n"
- "grep for a #define\n"
- "exitcodes: integer of the found string (no decimals)\n", argv[0]);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
+ "grep for a #define\n"
+ "exitcodes: integer of the found string (no decimals)\n",
+ argv[0]);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
+ &dwWritten, NULL);
return 2;
}
return GrepForDefine(argv[2], argv[3]);
@@ -104,9 +125,10 @@ main (int argc, char *argv[])
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
return 2;
}
-
+
int
-CheckForCompilerFeature (const char *option)
+CheckForCompilerFeature(
+ const char *option)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
@@ -130,23 +152,43 @@ CheckForCompilerFeature (const char *option)
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = FALSE;
- /* create a non-inheritible pipe. */
+ /*
+ * Create a non-inheritible pipe.
+ */
+
CreatePipe(&Out.pipe, &h, &sa, 0);
- /* dupe the write side, make it inheritible, and close the original. */
- DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput,
- 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+ /*
+ * Dupe the write side, make it inheritible, and close the original.
+ */
+
+ DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
+ DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+
+ /*
+ * Same as above, but for the error side.
+ */
- /* Same as above, but for the error side. */
CreatePipe(&Err.pipe, &h, &sa, 0);
- DuplicateHandle(hProcess, h, hProcess, &si.hStdError,
- 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+ DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
+ DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+
+ /*
+ * Base command line.
+ */
- /* base command line */
strcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X ");
- /* append our option for testing */
+
+ /*
+ * Append our option for testing
+ */
+
strcat(cmdline, option);
- /* filename to compile, which exists, but is nothing and empty. */
+
+ /*
+ * Filename to compile, which exists, but is nothing and empty.
+ */
+
strcat(cmdline, " .\\nul");
ok = CreateProcess(
@@ -163,46 +205,62 @@ CheckForCompilerFeature (const char *option)
if (!ok) {
DWORD err = GetLastError();
- int chars = wsprintf(msg, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
+ int chars = wsprintf(msg,
+ "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
- FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID) &msg[chars],
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
+ FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err, NULL);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err,NULL);
return 2;
}
- /* close our references to the write handles that have now been inherited. */
+ /*
+ * Close our references to the write handles that have now been inherited.
+ */
+
CloseHandle(si.hStdOutput);
CloseHandle(si.hStdError);
WaitForInputIdle(pi.hProcess, 5000);
CloseHandle(pi.hThread);
- /* start the pipe reader threads. */
+ /*
+ * Start the pipe reader threads.
+ */
+
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
- /* block waiting for the process to end. */
+ /*
+ * Block waiting for the process to end.
+ */
+
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
- /* wait for our pipe to get done reading, should it be a little slow. */
+ /*
+ * Wait for our pipe to get done reading, should it be a little slow.
+ */
+
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
CloseHandle(pipeThreads[0]);
CloseHandle(pipeThreads[1]);
- /* look for the commandline warning code in both streams.
+ /*
+ * Look for the commandline warning code in both streams.
* - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002.
*/
- return !(strstr(Out.buffer, "D4002") != NULL
+
+ return !(strstr(Out.buffer, "D4002") != NULL
|| strstr(Err.buffer, "D4002") != NULL
|| strstr(Out.buffer, "D9002") != NULL
|| strstr(Err.buffer, "D9002") != NULL);
}
-
+
int
-CheckForLinkerFeature (const char *option)
+CheckForLinkerFeature(
+ const char *option)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
@@ -226,21 +284,37 @@ CheckForLinkerFeature (const char *option)
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
- /* create a non-inheritible pipe. */
+ /*
+ * Create a non-inheritible pipe.
+ */
+
CreatePipe(&Out.pipe, &h, &sa, 0);
- /* dupe the write side, make it inheritible, and close the original. */
- DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput,
- 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+ /*
+ * Dupe the write side, make it inheritible, and close the original.
+ */
+
+ DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
+ DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+
+ /*
+ * Same as above, but for the error side.
+ */
- /* Same as above, but for the error side. */
CreatePipe(&Err.pipe, &h, &sa, 0);
- DuplicateHandle(hProcess, h, hProcess, &si.hStdError,
- 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+ DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
+ DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+
+ /*
+ * Base command line.
+ */
- /* base command line */
strcpy(cmdline, "link.exe -nologo ");
- /* append our option for testing */
+
+ /*
+ * Append our option for testing.
+ */
+
strcat(cmdline, option);
ok = CreateProcess(
@@ -257,48 +331,66 @@ CheckForLinkerFeature (const char *option)
if (!ok) {
DWORD err = GetLastError();
- int chars = wsprintf(msg, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
+ int chars = wsprintf(msg,
+ "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
- FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID) &msg[chars],
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
+ FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err, NULL);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err,NULL);
return 2;
}
- /* close our references to the write handles that have now been inherited. */
+ /*
+ * Close our references to the write handles that have now been inherited.
+ */
+
CloseHandle(si.hStdOutput);
CloseHandle(si.hStdError);
WaitForInputIdle(pi.hProcess, 5000);
CloseHandle(pi.hThread);
- /* start the pipe reader threads. */
+ /*
+ * Start the pipe reader threads.
+ */
+
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
- /* block waiting for the process to end. */
+ /*
+ * Block waiting for the process to end.
+ */
+
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
- /* wait for our pipe to get done reading, should it be a little slow. */
+ /*
+ * Wait for our pipe to get done reading, should it be a little slow.
+ */
+
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
CloseHandle(pipeThreads[0]);
CloseHandle(pipeThreads[1]);
- /* look for the commandline warning code in the stderr stream. */
- return !(strstr(Out.buffer, "LNK1117") != NULL || strstr(Err.buffer, "LNK1117") != NULL);
-}
+ /*
+ * Look for the commandline warning code in the stderr stream.
+ */
+ return !(strstr(Out.buffer, "LNK1117") != NULL ||
+ strstr(Err.buffer, "LNK1117") != NULL);
+}
+
DWORD WINAPI
-ReadFromPipe (LPVOID args)
+ReadFromPipe(
+ LPVOID args)
{
pipeinfo *pi = (pipeinfo *) args;
char *lastBuf = pi->buffer;
DWORD dwRead;
BOOL ok;
-again:
+ again:
if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) {
CloseHandle(pi->pipe);
return -1;
@@ -313,22 +405,25 @@ again:
return 0; /* makes the compiler happy */
}
-
+
int
-IsIn (const char *string, const char *substring)
+IsIn(
+ const char *string,
+ const char *substring)
{
return (strstr(string, substring) != NULL);
}
-
+
/*
- * Find a specified #define by name.
+ * Find a specified #define by name.
*
- * If the line is '#define TCL_VERSION "8.5"', it returns
- * 85 as the result.
+ * If the line is '#define TCL_VERSION "8.5"', it returns 85 as the result.
*/
int
-GrepForDefine (const char *file, const char *string)
+GrepForDefine(
+ const char *file,
+ const char *string)
{
FILE *f;
char s1[51], s2[51], s3[51];
@@ -343,13 +438,26 @@ GrepForDefine (const char *file, const char *string)
do {
r = fscanf(f, "%50s", s1);
if (r == 1 && !strcmp(s1, "#define")) {
- /* get next two words */
+ /*
+ * Get next two words.
+ */
+
r = fscanf(f, "%50s %50s", s2, s3);
- if (r != 2) continue;
- /* is the first word what we're looking for? */
+ if (r != 2) {
+ continue;
+ }
+
+ /*
+ * Is the first word what we're looking for?
+ */
+
if (!strcmp(s2, string)) {
fclose(f);
- /* add 1 past first double quote char. "8.5" */
+
+ /*
+ * Add 1 past first double quote char. "8.5"
+ */
+
d1 = atof(s3 + 1); /* 8.5 */
while (floor(d1) != d1) {
d1 *= 10.0;
diff --git a/win/stub16.c b/win/stub16.c
index 7114d4e..737a53e 100644
--- a/win/stub16.c
+++ b/win/stub16.c
@@ -1,15 +1,15 @@
-/*
- * stub16.c
+/*
+ * stub16.c
*
* A helper program used for running 16-bit DOS applications under
* Windows 95.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: stub16.c,v 1.4 1999/04/21 21:50:34 rjohnson Exp $
+ * RCS: @(#) $Id: stub16.c,v 1.5 2005/11/04 00:06:50 dkf Exp $
*/
#define STRICT
@@ -18,32 +18,31 @@
#include <stdio.h>
static HANDLE CreateTempFile(void);
-
+
/*
*---------------------------------------------------------------------------
*
* main
*
- * Entry point for the 32-bit console mode app used by Windows 95 to
- * help run the 16-bit program specified on the command line.
+ * Entry point for the 32-bit console mode app used by Windows 95 to help
+ * run the 16-bit program specified on the command line.
+ *
+ * 1. EOF on a pipe that connects a detached 16-bit process and a 32-bit
+ * process is never seen. So, this process runs the 16-bit process
+ * _attached_, and then it is run detached from the calling 32-bit
+ * process.
*
- * 1. EOF on a pipe that connects a detached 16-bit process and a
- * 32-bit process is never seen. So, this process runs the 16-bit
- * process _attached_, and then it is run detached from the calling
- * 32-bit process.
- *
- * 2. If a 16-bit process blocks reading from or writing to a pipe,
- * it never wakes up, and eventually brings the whole system down
- * with it if you try to kill the process. This app simulates
- * pipes. If any of the stdio handles is a pipe, this program
- * accumulates information into temp files and forwards it to or
- * from the DOS application as appropriate. This means that this
- * program must receive EOF from a stdin pipe before it will actually
- * start the DOS app, and the DOS app must finish generating stdout
- * or stderr before the data will be sent to the next stage of the
- * pipe. If the stdio handles are not pipes, no accumulation occurs
- * and the data is passed straight through to and from the DOS
- * application.
+ * 2. If a 16-bit process blocks reading from or writing to a pipe, it
+ * never wakes up, and eventually brings the whole system down with it if
+ * you try to kill the process. This app simulates pipes. If any of the
+ * stdio handles is a pipe, this program accumulates information into
+ * temp files and forwards it to or from the DOS application as
+ * appropriate. This means that this program must receive EOF from a
+ * stdin pipe before it will actually start the DOS app, and the DOS app
+ * must finish generating stdout or stderr before the data will be sent
+ * to the next stage of the pipe. If the stdio handles are not pipes, no
+ * accumulation occurs and the data is passed straight through to and
+ * from the DOS application.
*
* Results:
* None.
@@ -56,7 +55,7 @@ static HANDLE CreateTempFile(void);
*/
int
-main()
+main(void)
{
DWORD dwRead, dwWrite;
char *cmdLine;
@@ -74,10 +73,10 @@ main()
/*
* Don't get command line from argc, argv, because the command line
- * tokenizer will have stripped off all the escape sequences needed
- * for quotes and backslashes, and then we'd have to put them all
- * back in again. Get the raw command line and parse off what we
- * want ourselves. The command line should be of the form:
+ * tokenizer will have stripped off all the escape sequences needed for
+ * quotes and backslashes, and then we'd have to put them all back in
+ * again. Get the raw command line and parse off what we want ourselves.
+ * The command line should be of the form:
*
* stub16.exe program arg1 arg2 ...
*/
@@ -125,7 +124,7 @@ main()
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
- if (CreateProcess(NULL, cmdLine, NULL, NULL, TRUE, 0, NULL, NULL, &si,
+ if (CreateProcess(NULL, cmdLine, NULL, NULL, TRUE, 0, NULL, NULL, &si,
&pi) == FALSE) {
goto cleanup;
}
@@ -159,7 +158,7 @@ main()
}
}
-cleanup:
+ cleanup:
if (hFileInput != INVALID_HANDLE_VALUE) {
CloseHandle(hFileInput);
}
@@ -177,7 +176,7 @@ cleanup:
}
static HANDLE
-CreateTempFile()
+CreateTempFile(void)
{
char name[MAX_PATH];
SECURITY_ATTRIBUTES sa;
@@ -192,7 +191,7 @@ CreateTempFile()
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
- return CreateFile(name, GENERIC_READ | GENERIC_WRITE, 0, &sa,
+ return CreateFile(name, GENERIC_READ | GENERIC_WRITE, 0, &sa,
CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE,
NULL);
}
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index ae8de51..c196705 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclWin32Dll.c --
*
* This file contains the DLL entry point and other low-level bit bashing
@@ -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: tclWin32Dll.c,v 1.47 2005/11/03 01:16:07 patthoyts Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.48 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclWinInt.h"
@@ -29,7 +29,7 @@ typedef BOOL (WINAPI UTREGISTER)(HANDLE hModule, LPCSTR SixteenBitDLL,
typedef VOID (WINAPI UTUNREGISTER)(HANDLE hModule);
-/*
+/*
* The following variables keep track of information about this DLL on a
* per-instance basis. Each time this DLL is loaded, it gets its own new data
* segment with its own copy of all static and global information.
@@ -76,10 +76,10 @@ static TclWinProcs asciiProcs = {
(TCHAR *(WINAPI *)(TCHAR *)) CharLowerA,
(BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *, BOOL)) CopyFileA,
(BOOL (WINAPI *)(CONST TCHAR *, LPSECURITY_ATTRIBUTES)) CreateDirectoryA,
- (HANDLE (WINAPI *)(CONST TCHAR *, DWORD, DWORD, SECURITY_ATTRIBUTES *,
+ (HANDLE (WINAPI *)(CONST TCHAR *, DWORD, DWORD, SECURITY_ATTRIBUTES *,
DWORD, DWORD, HANDLE)) CreateFileA,
- (BOOL (WINAPI *)(CONST TCHAR *, TCHAR *, LPSECURITY_ATTRIBUTES,
- LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, CONST TCHAR *,
+ (BOOL (WINAPI *)(CONST TCHAR *, TCHAR *, LPSECURITY_ATTRIBUTES,
+ LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, CONST TCHAR *,
LPSTARTUPINFOA, LPPROCESS_INFORMATION)) CreateProcessA,
(BOOL (WINAPI *)(CONST TCHAR *)) DeleteFileA,
(HANDLE (WINAPI *)(CONST TCHAR *, WIN32_FIND_DATAT *)) FindFirstFileA,
@@ -87,11 +87,11 @@ static TclWinProcs asciiProcs = {
(BOOL (WINAPI *)(WCHAR *, LPDWORD)) GetComputerNameA,
(DWORD (WINAPI *)(DWORD, WCHAR *)) GetCurrentDirectoryA,
(DWORD (WINAPI *)(CONST TCHAR *)) GetFileAttributesA,
- (DWORD (WINAPI *)(CONST TCHAR *, DWORD nBufferLength, WCHAR *,
+ (DWORD (WINAPI *)(CONST TCHAR *, DWORD nBufferLength, WCHAR *,
TCHAR **)) GetFullPathNameA,
(DWORD (WINAPI *)(HMODULE, WCHAR *, int)) GetModuleFileNameA,
(DWORD (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD)) GetShortPathNameA,
- (UINT (WINAPI *)(CONST TCHAR *, CONST TCHAR *, UINT uUnique,
+ (UINT (WINAPI *)(CONST TCHAR *, CONST TCHAR *, UINT uUnique,
WCHAR *)) GetTempFileNameA,
(DWORD (WINAPI *)(DWORD, WCHAR *)) GetTempPathA,
(BOOL (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD,
@@ -100,12 +100,12 @@ static TclWinProcs asciiProcs = {
(TCHAR (WINAPI *)(WCHAR *, CONST TCHAR *)) lstrcpyA,
(BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *)) MoveFileA,
(BOOL (WINAPI *)(CONST TCHAR *)) RemoveDirectoryA,
- (DWORD (WINAPI *)(CONST TCHAR *, CONST TCHAR *, CONST TCHAR *, DWORD,
+ (DWORD (WINAPI *)(CONST TCHAR *, CONST TCHAR *, CONST TCHAR *, DWORD,
WCHAR *, TCHAR **)) SearchPathA,
(BOOL (WINAPI *)(CONST TCHAR *)) SetCurrentDirectoryA,
(BOOL (WINAPI *)(CONST TCHAR *, DWORD)) SetFileAttributesA,
- /*
+ /*
* The three NULL function pointers will only be set when
* Tcl_FindExecutable is called. If you don't ever call that function, the
* application will crash whenever WinTcl tries to call functions through
@@ -118,7 +118,7 @@ static TclWinProcs asciiProcs = {
/* deleted (int (__cdecl*)(CONST TCHAR *, struct _utimbuf *)) _utime, */
NULL,
NULL,
- /* getLongPathNameProc */
+ /* getLongPathNameProc */
NULL,
/* Security SDK - not available on 95,98,ME */
NULL, NULL, NULL, NULL, NULL, NULL,
@@ -134,10 +134,10 @@ static TclWinProcs unicodeProcs = {
(TCHAR *(WINAPI *)(TCHAR *)) CharLowerW,
(BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *, BOOL)) CopyFileW,
(BOOL (WINAPI *)(CONST TCHAR *, LPSECURITY_ATTRIBUTES)) CreateDirectoryW,
- (HANDLE (WINAPI *)(CONST TCHAR *, DWORD, DWORD, SECURITY_ATTRIBUTES *,
+ (HANDLE (WINAPI *)(CONST TCHAR *, DWORD, DWORD, SECURITY_ATTRIBUTES *,
DWORD, DWORD, HANDLE)) CreateFileW,
- (BOOL (WINAPI *)(CONST TCHAR *, TCHAR *, LPSECURITY_ATTRIBUTES,
- LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, CONST TCHAR *,
+ (BOOL (WINAPI *)(CONST TCHAR *, TCHAR *, LPSECURITY_ATTRIBUTES,
+ LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, CONST TCHAR *,
LPSTARTUPINFOA, LPPROCESS_INFORMATION)) CreateProcessW,
(BOOL (WINAPI *)(CONST TCHAR *)) DeleteFileW,
(HANDLE (WINAPI *)(CONST TCHAR *, WIN32_FIND_DATAT *)) FindFirstFileW,
@@ -145,25 +145,25 @@ static TclWinProcs unicodeProcs = {
(BOOL (WINAPI *)(WCHAR *, LPDWORD)) GetComputerNameW,
(DWORD (WINAPI *)(DWORD, WCHAR *)) GetCurrentDirectoryW,
(DWORD (WINAPI *)(CONST TCHAR *)) GetFileAttributesW,
- (DWORD (WINAPI *)(CONST TCHAR *, DWORD nBufferLength, WCHAR *,
+ (DWORD (WINAPI *)(CONST TCHAR *, DWORD nBufferLength, WCHAR *,
TCHAR **)) GetFullPathNameW,
(DWORD (WINAPI *)(HMODULE, WCHAR *, int)) GetModuleFileNameW,
(DWORD (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD)) GetShortPathNameW,
- (UINT (WINAPI *)(CONST TCHAR *, CONST TCHAR *, UINT uUnique,
+ (UINT (WINAPI *)(CONST TCHAR *, CONST TCHAR *, UINT uUnique,
WCHAR *)) GetTempFileNameW,
(DWORD (WINAPI *)(DWORD, WCHAR *)) GetTempPathW,
- (BOOL (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD,
+ (BOOL (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD,
WCHAR *, DWORD)) GetVolumeInformationW,
(HINSTANCE (WINAPI *)(CONST TCHAR *)) LoadLibraryW,
(TCHAR (WINAPI *)(WCHAR *, CONST TCHAR *)) lstrcpyW,
(BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *)) MoveFileW,
(BOOL (WINAPI *)(CONST TCHAR *)) RemoveDirectoryW,
- (DWORD (WINAPI *)(CONST TCHAR *, CONST TCHAR *, CONST TCHAR *, DWORD,
+ (DWORD (WINAPI *)(CONST TCHAR *, CONST TCHAR *, CONST TCHAR *, DWORD,
WCHAR *, TCHAR **)) SearchPathW,
(BOOL (WINAPI *)(CONST TCHAR *)) SetCurrentDirectoryW,
(BOOL (WINAPI *)(CONST TCHAR *, DWORD)) SetFileAttributesW,
- /*
+ /*
* The three NULL function pointers will only be set when
* Tcl_FindExecutable is called. If you don't ever call that function, the
* application will crash whenever WinTcl tries to call functions through
@@ -177,7 +177,7 @@ static TclWinProcs unicodeProcs = {
NULL,
NULL,
/* getLongPathNameProc */
- NULL,
+ NULL,
/* Security SDK - will be filled in on NT,XP,2000,2003 */
NULL, NULL, NULL, NULL, NULL, NULL,
/* ReadConsole and WriteConsole */
@@ -195,14 +195,14 @@ static Tcl_Encoding tclWinTCharEncoding;
* of redefined local labels.
*/
-BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason,
+BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason,
LPVOID reserved) __attribute__ ((noinline));
#else
/*
* The following declaration is for the VC++ DLL entry point.
*/
-BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason,
+BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason,
LPVOID reserved);
#endif /* HAVE_NO_SEH */
@@ -221,7 +221,7 @@ typedef struct MountPointMap {
* NULL. */
} MountPointMap;
-/*
+/*
* This is the head of the linked list, which is protected by the mutex which
* follows, for thread-enabled builds.
*/
@@ -256,10 +256,10 @@ extern Tcl_FSDupInternalRepProc TclNativeDupInternalRep;
*/
BOOL APIENTRY
-DllEntryPoint(hInst, reason, reserved)
- HINSTANCE hInst; /* Library instance handle. */
- DWORD reason; /* Reason this function is being called. */
- LPVOID reserved; /* Not used. */
+DllEntryPoint(
+ HINSTANCE hInst, /* Library instance handle. */
+ DWORD reason, /* Reason this function is being called. */
+ LPVOID reserved) /* Not used. */
{
return DllMain(hInst, reason, reserved);
}
@@ -286,10 +286,10 @@ DllEntryPoint(hInst, reason, reserved)
*/
BOOL APIENTRY
-DllMain(hInst, reason, reserved)
- HINSTANCE hInst; /* Library instance handle. */
- DWORD reason; /* Reason this function is being called. */
- LPVOID reserved; /* Not used. */
+DllMain(
+ HINSTANCE hInst, /* Library instance handle. */
+ DWORD reason, /* Reason this function is being called. */
+ LPVOID reserved) /* Not used. */
{
#ifdef HAVE_NO_SEH
EXCEPTION_REGISTRATION registration;
@@ -356,7 +356,7 @@ DllMain(hInst, reason, reserved)
"movl 0x8(%%edx), %%edx" "\n"
- /*
+ /*
* Come here however we exited. Restore context from the
* EXCEPTION_REGISTRATION in case the stack is unbalanced.
*/
@@ -388,7 +388,7 @@ DllMain(hInst, reason, reserved)
break;
}
- return TRUE;
+ return TRUE;
}
#endif /* !STATIC_BUILD */
#endif /* __WIN32__ */
@@ -410,7 +410,7 @@ DllMain(hInst, reason, reserved)
*/
HINSTANCE
-TclWinGetTclInstance()
+TclWinGetTclInstance(void)
{
return hInstance;
}
@@ -432,8 +432,8 @@ TclWinGetTclInstance()
*/
void
-TclWinInit(hInst)
- HINSTANCE hInst; /* Library instance handle. */
+TclWinInit(
+ HINSTANCE hInst) /* Library instance handle. */
{
OSVERSIONINFO os;
@@ -448,7 +448,7 @@ TclWinInit(hInst)
*/
if (platformId == VER_PLATFORM_WIN32s) {
- Tcl_Panic("Win32s is not a supported platform");
+ Tcl_Panic("Win32s is not a supported platform");
}
tclWinProcs = &asciiProcs;
@@ -474,8 +474,8 @@ TclWinInit(hInst)
*----------------------------------------------------------------------
*/
-int
-TclWinGetPlatformId()
+int
+TclWinGetPlatformId(void)
{
return platformId;
}
@@ -529,7 +529,7 @@ TclWinNoBackslash(
*/
int
-TclpCheckStackSpace()
+TclpCheckStackSpace(void)
{
#ifdef HAVE_NO_SEH
@@ -559,7 +559,7 @@ TclpCheckStackSpace()
"movl %%ebp, 0x8(%%edx)" "\n\t" /* ebp */
"movl %%esp, 0xc(%%edx)" "\n\t" /* esp */
"movl %[error], 0x10(%%edx)" "\n\t" /* status */
-
+
/*
* Link the EXCEPTION_REGISTRATION on the chain
*/
@@ -593,18 +593,18 @@ TclpCheckStackSpace()
"1:" "\t"
"movl %%fs:0, %%edx" "\n\t"
"movl 0x8(%%edx), %%edx" "\n\t"
-
- /*
+
+ /*
* Come here however we exited. Restore context from the
* EXCEPTION_REGISTRATION in case the stack is unbalanced.
*/
-
+
"2:" "\t"
"movl 0xc(%%edx), %%esp" "\n\t"
"movl 0x8(%%edx), %%ebp" "\n\t"
"movl 0x0(%%edx), %%eax" "\n\t"
"movl %%eax, %%fs:0" "\n\t"
-
+
:
/* No outputs */
:
@@ -632,7 +632,7 @@ TclpCheckStackSpace()
retval = 1;
} __except (EXCEPTION_EXECUTE_HANDLER) {}
#endif /* HAVE_NO_SEH */
-
+
return retval;
}
@@ -645,7 +645,7 @@ TclpCheckStackSpace()
* structure to dispatch to either the wide-character or multi-byte
* versions of the operating system calls, depending on whether Unicode
* is the system encoding.
- *
+ *
* As well as this, we can also try to load in some additional procs
* which may/may not be present depending on the current Windows version
* (e.g. Win95 will not have the procs below).
@@ -672,54 +672,54 @@ TclWinSetInterfaces(
if (tclWinProcs->getFileAttributesExProc == NULL) {
HINSTANCE hInstance = LoadLibraryA("kernel32");
if (hInstance != NULL) {
- tclWinProcs->getFileAttributesExProc =
+ tclWinProcs->getFileAttributesExProc =
(BOOL (WINAPI *)(CONST TCHAR *, GET_FILEEX_INFO_LEVELS,
LPVOID)) GetProcAddress(hInstance,
"GetFileAttributesExW");
- tclWinProcs->createHardLinkProc =
- (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR*,
- LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance,
+ tclWinProcs->createHardLinkProc =
+ (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR*,
+ LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance,
"CreateHardLinkW");
- tclWinProcs->findFirstFileExProc =
+ tclWinProcs->findFirstFileExProc =
(HANDLE (WINAPI *)(CONST TCHAR*, UINT, LPVOID, UINT,
- LPVOID, DWORD)) GetProcAddress(hInstance,
+ LPVOID, DWORD)) GetProcAddress(hInstance,
"FindFirstFileExW");
- tclWinProcs->getVolumeNameForVMPProc =
- (BOOL (WINAPI *)(CONST TCHAR*, TCHAR*,
- DWORD)) GetProcAddress(hInstance,
+ tclWinProcs->getVolumeNameForVMPProc =
+ (BOOL (WINAPI *)(CONST TCHAR*, TCHAR*,
+ DWORD)) GetProcAddress(hInstance,
"GetVolumeNameForVolumeMountPointW");
- tclWinProcs->getLongPathNameProc =
- (DWORD (WINAPI *)(CONST TCHAR*, TCHAR*,
+ tclWinProcs->getLongPathNameProc =
+ (DWORD (WINAPI *)(CONST TCHAR*, TCHAR*,
DWORD)) GetProcAddress(hInstance, "GetLongPathNameW");
FreeLibrary(hInstance);
}
hInstance = LoadLibraryA("advapi32");
if (hInstance != NULL) {
tclWinProcs->getFileSecurityProc = (BOOL (WINAPI *)(
- LPCTSTR lpFileName,
+ LPCTSTR lpFileName,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD nLength, LPDWORD lpnLengthNeeded))
- GetProcAddress(hInstance, "GetFileSecurityW");
+ GetProcAddress(hInstance, "GetFileSecurityW");
tclWinProcs->impersonateSelfProc = (BOOL (WINAPI *) (
- SECURITY_IMPERSONATION_LEVEL ImpersonationLevel))
+ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel))
GetProcAddress(hInstance, "ImpersonateSelf");
tclWinProcs->openThreadTokenProc = (BOOL (WINAPI *) (
HANDLE ThreadHandle, DWORD DesiredAccess,
BOOL OpenAsSelf, PHANDLE TokenHandle))
GetProcAddress(hInstance, "OpenThreadToken");
- tclWinProcs->revertToSelfProc = (BOOL (WINAPI *) (void))
+ tclWinProcs->revertToSelfProc = (BOOL (WINAPI *) (void))
GetProcAddress(hInstance, "RevertToSelf");
tclWinProcs->mapGenericMaskProc = (VOID (WINAPI *) (
- PDWORD AccessMask, PGENERIC_MAPPING GenericMapping))
+ PDWORD AccessMask, PGENERIC_MAPPING GenericMapping))
GetProcAddress(hInstance, "MapGenericMask");
tclWinProcs->accessCheckProc = (BOOL (WINAPI *)(
- PSECURITY_DESCRIPTOR pSecurityDescriptor,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor,
HANDLE ClientToken, DWORD DesiredAccess,
PGENERIC_MAPPING GenericMapping,
PPRIVILEGE_SET PrivilegeSet,
LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess,
- LPBOOL AccessStatus)) GetProcAddress(hInstance,
+ LPBOOL AccessStatus)) GetProcAddress(hInstance,
"AccessCheck");
FreeLibrary(hInstance);
}
@@ -730,13 +730,13 @@ TclWinSetInterfaces(
if (tclWinProcs->getFileAttributesExProc == NULL) {
HINSTANCE hInstance = LoadLibraryA("kernel32");
if (hInstance != NULL) {
- tclWinProcs->getFileAttributesExProc =
+ tclWinProcs->getFileAttributesExProc =
(BOOL (WINAPI *)(CONST TCHAR *, GET_FILEEX_INFO_LEVELS,
LPVOID)) GetProcAddress(hInstance,
"GetFileAttributesExA");
- tclWinProcs->createHardLinkProc =
- (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR*,
- LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance,
+ tclWinProcs->createHardLinkProc =
+ (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR*,
+ LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance,
"CreateHardLinkA");
tclWinProcs->findFirstFileExProc = NULL;
tclWinProcs->getLongPathNameProc = NULL;
@@ -746,14 +746,14 @@ TclWinSetInterfaces(
* Therefore we don't set this function pointer. The relevant
* code will fall back on a slower approach using the normal
* findFirstFileProc.
- *
+ *
* (HANDLE (WINAPI *)(CONST TCHAR*, UINT,
- * LPVOID, UINT, LPVOID, DWORD)) GetProcAddress(hInstance,
+ * LPVOID, UINT, LPVOID, DWORD)) GetProcAddress(hInstance,
* "FindFirstFileExA");
*/
- tclWinProcs->getVolumeNameForVMPProc =
- (BOOL (WINAPI *)(CONST TCHAR*, TCHAR*,
- DWORD)) GetProcAddress(hInstance,
+ tclWinProcs->getVolumeNameForVMPProc =
+ (BOOL (WINAPI *)(CONST TCHAR*, TCHAR*,
+ DWORD)) GetProcAddress(hInstance,
"GetVolumeNameForVolumeMountPointA");
FreeLibrary(hInstance);
}
@@ -773,7 +773,7 @@ TclWinSetInterfaces(
* We also clean up any memory allocated in our mount point map which is
* used to follow certain kinds of symlinks. That code should never be
* used once encodings are taken down.
- *
+ *
* Results:
* None.
*
@@ -784,7 +784,7 @@ TclWinSetInterfaces(
*/
void
-TclWinResetInterfaceEncodings()
+TclWinResetInterfaceEncodings(void)
{
MountPointMap *dlIter, *dlIter2;
if (tclWinTCharEncoding != NULL) {
@@ -797,7 +797,7 @@ TclWinResetInterfaceEncodings()
*/
Tcl_MutexLock(&mountPointMap);
- dlIter = driveLetterLookup;
+ dlIter = driveLetterLookup;
while (dlIter != NULL) {
dlIter2 = dlIter->nextPtr;
ckfree((char*)dlIter->volumeName);
@@ -825,7 +825,7 @@ TclWinResetInterfaceEncodings()
*---------------------------------------------------------------------------
*/
void
-TclWinResetInterfaces()
+TclWinResetInterfaces(void)
{
tclWinProcs = &asciiProcs;
}
@@ -840,36 +840,37 @@ TclWinResetInterfaces()
* understand paths correctly. So, we have to build an associated array
* to find these correctly, and allow quick and easy lookup from volume
* mount points to drive letters.
- *
+ *
* We assume here that we are running on a system for which the wide
* character interfaces are used, which is valid for Win 2000 and WinXP
* which are the only systems on which this function will ever be called.
- *
+ *
* Result:
* The drive letter, or -1 if no drive letter corresponds to the given
* mount point.
- *
+ *
*--------------------------------------------------------------------
*/
-char
-TclWinDriveLetterForVolMountPoint(CONST WCHAR *mountPoint)
+char
+TclWinDriveLetterForVolMountPoint(
+ CONST WCHAR *mountPoint)
{
MountPointMap *dlIter, *dlPtr2;
WCHAR Target[55]; /* Target of mount at mount point */
WCHAR drive[4] = { L'A', L':', L'\\', L'\0' };
-
- /*
+
+ /*
* Detect the volume mounted there. Unfortunately, there is no simple way
* to map a unique volume name to a DOS drive letter. So, we have to build
* an associative array.
*/
-
+
Tcl_MutexLock(&mountPointMap);
- dlIter = driveLetterLookup;
+ dlIter = driveLetterLookup;
while (dlIter != NULL) {
if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
- /*
+ /*
* We need to check whether this information is still valid, since
* either the user or various programs could have adjusted the
* mount points on the fly.
@@ -881,7 +882,7 @@ TclWinDriveLetterForVolMountPoint(CONST WCHAR *mountPoint)
* Try to read the volume mount point and see where it points.
*/
- if ((*tclWinProcs->getVolumeNameForVMPProc)((TCHAR*)drive,
+ if ((*tclWinProcs->getVolumeNameForVMPProc)((TCHAR*)drive,
(TCHAR*)Target, 55) != 0) {
if (wcscmp((WCHAR*)dlIter->volumeName, Target) == 0) {
/*
@@ -893,7 +894,7 @@ TclWinDriveLetterForVolMountPoint(CONST WCHAR *mountPoint)
}
}
- /*
+ /*
* If we reach here, unfortunately, this mount point is no longer
* valid at all.
*/
@@ -902,7 +903,7 @@ TclWinDriveLetterForVolMountPoint(CONST WCHAR *mountPoint)
dlPtr2 = dlIter;
driveLetterLookup = dlIter->nextPtr;
} else {
- for (dlPtr2 = driveLetterLookup;
+ for (dlPtr2 = driveLetterLookup;
dlPtr2 != NULL; dlPtr2 = dlPtr2->nextPtr) {
if (dlPtr2->nextPtr == dlIter) {
dlPtr2->nextPtr = dlIter->nextPtr;
@@ -919,7 +920,7 @@ TclWinDriveLetterForVolMountPoint(CONST WCHAR *mountPoint)
ckfree((char*)dlPtr2->volumeName);
ckfree((char*)dlPtr2);
- /*
+ /*
* Restart the loop - we could try to be clever and continue half
* way through, but the logic is a bit messy, so it's cleanest
* just to restart.
@@ -930,21 +931,21 @@ TclWinDriveLetterForVolMountPoint(CONST WCHAR *mountPoint)
}
dlIter = dlIter->nextPtr;
}
-
+
/*
* We couldn't find it, so we must iterate over the letters.
*/
-
+
for (drive[0] = L'A'; drive[0] <= L'Z'; drive[0]++) {
/*
* Try to read the volume mount point and see where it points.
*/
- if ((*tclWinProcs->getVolumeNameForVMPProc)((TCHAR*)drive,
+ if ((*tclWinProcs->getVolumeNameForVMPProc)((TCHAR*)drive,
(TCHAR*)Target, 55) != 0) {
int alreadyStored = 0;
- for (dlIter = driveLetterLookup; dlIter != NULL;
+ for (dlIter = driveLetterLookup; dlIter != NULL;
dlIter = dlIter->nextPtr) {
if (wcscmp((WCHAR*)dlIter->volumeName, Target) == 0) {
alreadyStored = 1;
@@ -965,7 +966,7 @@ TclWinDriveLetterForVolMountPoint(CONST WCHAR *mountPoint)
* Try again.
*/
- for (dlIter = driveLetterLookup; dlIter != NULL;
+ for (dlIter = driveLetterLookup; dlIter != NULL;
dlIter = dlIter->nextPtr) {
if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
Tcl_MutexUnlock(&mountPointMap);
@@ -973,7 +974,7 @@ TclWinDriveLetterForVolMountPoint(CONST WCHAR *mountPoint)
}
}
- /*
+ /*
* The volume doesn't appear to correspond to a drive letter - we remember
* that fact and store '-1' so we don't have to look it up each time.
*/
@@ -1038,27 +1039,27 @@ TclWinDriveLetterForVolMountPoint(CONST WCHAR *mountPoint)
*/
TCHAR *
-Tcl_WinUtfToTChar(string, len, dsPtr)
- CONST char *string; /* Source string in UTF-8. */
- int len; /* Source string length in bytes, or < 0 for
+Tcl_WinUtfToTChar(
+ CONST char *string, /* Source string in UTF-8. */
+ int len, /* Source string length in bytes, or < 0 for
* strlen(). */
- Tcl_DString *dsPtr; /* Uninitialized or free DString in which the
+ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
{
- return (TCHAR *) Tcl_UtfToExternalDString(tclWinTCharEncoding,
+ return (TCHAR *) Tcl_UtfToExternalDString(tclWinTCharEncoding,
string, len, dsPtr);
}
char *
-Tcl_WinTCharToUtf(string, len, dsPtr)
- CONST TCHAR *string; /* Source string in Unicode when running NT,
+Tcl_WinTCharToUtf(
+ CONST TCHAR *string, /* Source string in Unicode when running NT,
* ANSI when running 95. */
- int len; /* Source string length in bytes, or < 0 for
+ int len, /* Source string length in bytes, or < 0 for
* platform-specific string length. */
- Tcl_DString *dsPtr; /* Uninitialized or free DString in which the
+ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
{
- return Tcl_ExternalToUtfDString(tclWinTCharEncoding,
+ return Tcl_ExternalToUtfDString(tclWinTCharEncoding,
(CONST char *) string, len, dsPtr);
}
@@ -1091,11 +1092,11 @@ TclWinCPUID(
int status = TCL_ERROR;
#if defined(__GNUC__) && !defined(_WIN64)
- /*
+ /*
* Execute the CPUID instruction with the given index, and store results
* off 'regPtr'.
*/
-
+
__asm__ __volatile__(
/*
* Construct an EXCEPTION_REGISTRATION to protect the CPUID
@@ -1110,7 +1111,7 @@ TclWinCPUID(
"movl %%ebp, 0x8(%%edx)" "\n\t" /* ebp */
"movl %%esp, 0xc(%%edx)" "\n\t" /* esp */
"movl %[error], 0x10(%%edx)" "\n\t" /* status */
-
+
/*
* Link the EXCEPTION_REGISTRATION on the chain
*/
@@ -1148,21 +1149,21 @@ TclWinCPUID(
"1:" "\t"
"movl %%fs:0, %%edx" "\n\t"
"movl 0x8(%%edx), %%edx" "\n\t"
-
- /*
+
+ /*
* Come here however we exited. Restore context from the
* EXCEPTION_REGISTRATION in case the stack is unbalanced.
*/
-
+
"2:" "\t"
"movl 0xc(%%edx), %%esp" "\n\t"
"movl 0x8(%%edx), %%ebp" "\n\t"
"movl 0x0(%%edx), %%eax" "\n\t"
"movl %%eax, %%fs:0" "\n\t"
- :
+ :
/* No outputs */
- :
+ :
[index] "m" (index),
[rptr] "m" (regsPtr),
[registration] "m" (registration),
@@ -1184,7 +1185,7 @@ TclWinCPUID(
DWORD dw3;
} regs;
regs.dw0 = index;
-
+
/*
* Execute the CPUID instruction and save regs in the stack frame.
*/
@@ -1204,7 +1205,7 @@ TclWinCPUID(
pop ecx
pop ebx
}
-
+
/*
* Copy regs back out to the caller.
*/
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 66b332d..bf5301a 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.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: tclWinChan.c,v 1.44 2005/07/24 22:56:46 dkf Exp $
+ * RCS: @(#) $Id: tclWinChan.c,v 1.45 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclWinInt.h"
@@ -155,7 +155,7 @@ typedef struct EXCEPTION_REGISTRATION {
*/
static ThreadSpecificData *
-FileInit()
+FileInit(void)
{
ThreadSpecificData *tsdPtr =
(ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
@@ -187,8 +187,8 @@ FileInit()
*/
static void
-FileChannelExitHandler(clientData)
- ClientData clientData; /* Old window proc */
+FileChannelExitHandler(
+ ClientData clientData) /* Old window proc */
{
Tcl_DeleteEventSource(FileSetupProc, FileCheckProc, NULL);
}
@@ -211,9 +211,9 @@ FileChannelExitHandler(clientData)
*/
void
-FileSetupProc(data, flags)
- ClientData data; /* Not used. */
- int flags; /* Event flags as passed to Tcl_DoOneEvent. */
+FileSetupProc(
+ ClientData data, /* Not used. */
+ int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
FileInfo *infoPtr;
Tcl_Time blockTime = { 0, 0 };
@@ -254,9 +254,9 @@ FileSetupProc(data, flags)
*/
static void
-FileCheckProc(data, flags)
- ClientData data; /* Not used. */
- int flags; /* Event flags as passed to Tcl_DoOneEvent. */
+FileCheckProc(
+ ClientData data, /* Not used. */
+ int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
FileEvent *evPtr;
FileInfo *infoPtr;
@@ -305,9 +305,9 @@ FileCheckProc(data, flags)
*/
static int
-FileEventProc(evPtr, flags)
- Tcl_Event *evPtr; /* Event to service. */
- int flags; /* Flags that indicate what events to handle,
+FileEventProc(
+ Tcl_Event *evPtr, /* Event to service. */
+ int flags) /* Flags that indicate what events to handle,
* such as TCL_FILE_EVENTS. */
{
FileEvent *fileEvPtr = (FileEvent *)evPtr;
@@ -353,9 +353,9 @@ FileEventProc(evPtr, flags)
*/
static int
-FileBlockProc(instanceData, mode)
- ClientData instanceData; /* Instance data for channel. */
- int mode; /* TCL_MODE_BLOCKING or
+FileBlockProc(
+ ClientData instanceData, /* Instance data for channel. */
+ int mode) /* TCL_MODE_BLOCKING or
* TCL_MODE_NONBLOCKING. */
{
FileInfo *infoPtr = (FileInfo *) instanceData;
@@ -392,9 +392,9 @@ FileBlockProc(instanceData, mode)
*/
static int
-FileCloseProc(instanceData, interp)
- ClientData instanceData; /* Pointer to FileInfo structure. */
- Tcl_Interp *interp; /* Not used. */
+FileCloseProc(
+ ClientData instanceData, /* Pointer to FileInfo structure. */
+ Tcl_Interp *interp) /* Not used. */
{
FileInfo *fileInfoPtr = (FileInfo *) instanceData;
FileInfo *infoPtr;
@@ -465,11 +465,11 @@ FileCloseProc(instanceData, interp)
*/
static int
-FileSeekProc(instanceData, offset, mode, errorCodePtr)
- ClientData instanceData; /* File state. */
- long offset; /* Offset to seek to. */
- int mode; /* Relative to where should we seek? */
- int *errorCodePtr; /* To store error code. */
+FileSeekProc(
+ ClientData instanceData, /* File state. */
+ long offset, /* Offset to seek to. */
+ int mode, /* Relative to where should we seek? */
+ int *errorCodePtr) /* To store error code. */
{
FileInfo *infoPtr = (FileInfo *) instanceData;
LONG newPos, newPosHigh, oldPos, oldPosHigh;
@@ -543,11 +543,11 @@ FileSeekProc(instanceData, offset, mode, errorCodePtr)
*/
static Tcl_WideInt
-FileWideSeekProc(instanceData, offset, mode, errorCodePtr)
- ClientData instanceData; /* File state. */
- Tcl_WideInt offset; /* Offset to seek to. */
- int mode; /* Relative to where should we seek? */
- int *errorCodePtr; /* To store error code. */
+FileWideSeekProc(
+ ClientData instanceData, /* File state. */
+ Tcl_WideInt offset, /* Offset to seek to. */
+ int mode, /* Relative to where should we seek? */
+ int *errorCodePtr) /* To store error code. */
{
FileInfo *infoPtr = (FileInfo *) instanceData;
DWORD moveMethod;
@@ -594,9 +594,9 @@ FileWideSeekProc(instanceData, offset, mode, errorCodePtr)
*/
static int
-FileTruncateProc(instanceData, length)
- ClientData instanceData; /* File state. */
- Tcl_WideInt length; /* Length to truncate at. */
+FileTruncateProc(
+ ClientData instanceData, /* File state. */
+ Tcl_WideInt length) /* Length to truncate at. */
{
FileInfo *infoPtr = (FileInfo *) instanceData;
LONG newPos, newPosHigh, oldPos, oldPosHigh;
@@ -668,11 +668,11 @@ FileTruncateProc(instanceData, length)
*/
static int
-FileInputProc(instanceData, buf, bufSize, errorCode)
- ClientData instanceData; /* File state. */
- char *buf; /* Where to store data read. */
- int bufSize; /* Num bytes available in buffer. */
- int *errorCode; /* Where to store error code. */
+FileInputProc(
+ ClientData instanceData, /* File state. */
+ char *buf, /* Where to store data read. */
+ int bufSize, /* Num bytes available in buffer. */
+ int *errorCode) /* Where to store error code. */
{
FileInfo *infoPtr;
DWORD bytesRead;
@@ -720,11 +720,11 @@ FileInputProc(instanceData, buf, bufSize, errorCode)
*/
static int
-FileOutputProc(instanceData, buf, toWrite, errorCode)
- ClientData instanceData; /* File state. */
- CONST char *buf; /* The data buffer. */
- int toWrite; /* How many bytes to write? */
- int *errorCode; /* Where to store error code. */
+FileOutputProc(
+ ClientData instanceData, /* File state. */
+ CONST char *buf, /* The data buffer. */
+ int toWrite, /* How many bytes to write? */
+ int *errorCode) /* Where to store error code. */
{
FileInfo *infoPtr = (FileInfo *) instanceData;
DWORD bytesWritten;
@@ -767,9 +767,9 @@ FileOutputProc(instanceData, buf, toWrite, errorCode)
*/
static void
-FileWatchProc(instanceData, mask)
- ClientData instanceData; /* File state. */
- int mask; /* What events to watch for; OR-ed combination
+FileWatchProc(
+ ClientData instanceData, /* File state. */
+ int mask) /* What events to watch for; OR-ed combination
* of TCL_READABLE, TCL_WRITABLE and
* TCL_EXCEPTION. */
{
@@ -806,10 +806,10 @@ FileWatchProc(instanceData, mask)
*/
static int
-FileGetHandleProc(instanceData, direction, handlePtr)
- ClientData instanceData; /* The file state. */
- int direction; /* TCL_READABLE or TCL_WRITABLE */
- ClientData *handlePtr; /* Where to store the handle. */
+FileGetHandleProc(
+ ClientData instanceData, /* The file state. */
+ int direction, /* TCL_READABLE or TCL_WRITABLE */
+ ClientData *handlePtr) /* Where to store the handle. */
{
FileInfo *infoPtr = (FileInfo *) instanceData;
@@ -840,12 +840,12 @@ FileGetHandleProc(instanceData, direction, handlePtr)
*/
Tcl_Channel
-TclpOpenFileChannel(interp, pathPtr, mode, permissions)
- Tcl_Interp *interp; /* Interpreter for error reporting; can be
+TclpOpenFileChannel(
+ Tcl_Interp *interp, /* Interpreter for error reporting; can be
* NULL. */
- Tcl_Obj *pathPtr; /* Name of file to open. */
- int mode; /* POSIX mode. */
- int permissions; /* If the open involves creating a file, with
+ Tcl_Obj *pathPtr, /* Name of file to open. */
+ int mode, /* POSIX mode. */
+ int permissions) /* If the open involves creating a file, with
* what modes to create it? */
{
Tcl_Channel channel = 0;
@@ -943,7 +943,7 @@ TclpOpenFileChannel(interp, pathPtr, mode, permissions)
TclWinConvertError(err);
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "couldn't open \"", TclGetString(pathPtr),
- "\": ", Tcl_PosixError(interp), (char *) NULL);
+ "\": ", Tcl_PosixError(interp), NULL);
}
return NULL;
}
@@ -984,7 +984,7 @@ TclpOpenFileChannel(interp, pathPtr, mode, permissions)
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "couldn't reopen serial \"",
TclGetString(pathPtr), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
}
return NULL;
}
@@ -1019,7 +1019,7 @@ TclpOpenFileChannel(interp, pathPtr, mode, permissions)
channel = NULL;
Tcl_AppendResult(interp, "couldn't open \"", TclGetString(pathPtr),
- "\": bad file type", (char *) NULL);
+ "\": bad file type", NULL);
break;
}
@@ -1043,9 +1043,9 @@ TclpOpenFileChannel(interp, pathPtr, mode, permissions)
*/
Tcl_Channel
-Tcl_MakeFileChannel(rawHandle, mode)
- ClientData rawHandle; /* OS level handle */
- int mode; /* ORed combination of TCL_READABLE and
+Tcl_MakeFileChannel(
+ ClientData rawHandle, /* OS level handle */
+ int mode) /* ORed combination of TCL_READABLE and
* TCL_WRITABLE to indicate file mode. */
{
#ifdef HAVE_NO_SEH
@@ -1261,8 +1261,8 @@ Tcl_MakeFileChannel(rawHandle, mode)
*/
Tcl_Channel
-TclpGetDefaultStdChannel(type)
- int type; /* One of TCL_STDIN, TCL_STDOUT, or
+TclpGetDefaultStdChannel(
+ int type) /* One of TCL_STDIN, TCL_STDOUT, or
* TCL_STDERR. */
{
Tcl_Channel channel;
@@ -1317,7 +1317,7 @@ TclpGetDefaultStdChannel(type)
if (Tcl_SetChannelOption(NULL,channel,"-translation","auto")!=TCL_OK ||
Tcl_SetChannelOption(NULL,channel,"-eofchar","\032 {}")!=TCL_OK ||
Tcl_SetChannelOption(NULL,channel,"-buffering",bufMode)!=TCL_OK) {
- Tcl_Close((Tcl_Interp *) NULL, channel);
+ Tcl_Close(NULL, channel);
return (Tcl_Channel) NULL;
}
return channel;
@@ -1343,13 +1343,13 @@ TclpGetDefaultStdChannel(type)
*/
Tcl_Channel
-TclWinOpenFileChannel(handle, channelName, permissions, appendMode)
- HANDLE handle; /* Win32 HANDLE to swallow */
- char *channelName; /* Buffer to receive channel name */
- int permissions; /* OR'ed combination of TCL_READABLE,
+TclWinOpenFileChannel(
+ HANDLE handle, /* Win32 HANDLE to swallow */
+ char *channelName, /* Buffer to receive channel name */
+ int permissions, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, or TCL_EXCEPTION, indicating
* which operations are valid on the file. */
- int appendMode; /* OR'ed combination of bits indicating what
+ int appendMode) /* OR'ed combination of bits indicating what
* additional configuration of the channel is
* present. */
{
@@ -1417,7 +1417,7 @@ TclWinOpenFileChannel(handle, channelName, permissions, appendMode)
*/
void
-TclWinFlushDirtyChannels()
+TclWinFlushDirtyChannels(void)
{
FileInfo *infoPtr;
ThreadSpecificData *tsdPtr = FileInit();
@@ -1453,9 +1453,9 @@ TclWinFlushDirtyChannels()
*/
static void
-FileThreadActionProc(instanceData, action)
- ClientData instanceData;
- int action;
+FileThreadActionProc(
+ ClientData instanceData,
+ int action)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
FileInfo *infoPtr = (FileInfo *) instanceData;
diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c
index c59bc6f..615e87d 100644
--- a/win/tclWinConsole.c
+++ b/win/tclWinConsole.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclWinConsole.c --
*
* This file implements the Windows-specific console functions, and the
@@ -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: tclWinConsole.c,v 1.16 2005/11/03 01:16:07 patthoyts Exp $
+ * RCS: @(#) $Id: tclWinConsole.c,v 1.17 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclWinInt.h"
@@ -54,7 +54,6 @@ TCL_DECLARE_MUTEX(consoleMutex)
* This structure describes per-instance data for a console based channel.
*/
-
typedef struct ConsoleInfo {
HANDLE handle;
int type;
@@ -82,20 +81,17 @@ typedef struct ConsoleInfo {
* signal when the writer thread should
* attempt to write to the console. */
HANDLE stopWriter; /* Auto-reset event used by the main thread to
- * signal when the writer thread should exit.
- */
+ * signal when the writer thread should exit */
HANDLE startReader; /* Auto-reset event used by the main thread to
* signal when the reader thread should
* attempt to read from the console. */
HANDLE stopReader; /* Auto-reset event used by the main thread to
- * signal when the reader thread should exit.
- */
+ * signal when the reader thread should exit */
DWORD writeError; /* An error caused by the last background
* write. Set to 0 if no error has been
* detected. This word is shared with the
* writer thread so access must be
- * synchronized with the writable object.
- */
+ * synchronized with the writable object. */
char *writeBuf; /* Current background output buffer. Access is
* synchronized with the writable object. */
int writeBufLen; /* Size of write buffer. Access is
@@ -116,7 +112,7 @@ typedef struct ThreadSpecificData {
* The following pointer refers to the head of the list of consoles that
* are being watched for file events.
*/
-
+
ConsoleInfo *firstConsolePtr;
} ThreadSpecificData;
@@ -140,7 +136,7 @@ typedef struct ConsoleEvent {
* Declarations for functions used only in this file.
*/
-static int ConsoleBlockModeProc(ClientData instanceData, int mode);
+static int ConsoleBlockModeProc(ClientData instanceData,int mode);
static void ConsoleCheckProc(ClientData clientData, int flags);
static int ConsoleCloseProc(ClientData instanceData,
Tcl_Interp *interp);
@@ -188,15 +184,17 @@ static Tcl_ChannelType consoleChannelType = {
/*
*----------------------------------------------------------------------
- *
+ *
* readConsoleBytes, writeConsoleBytes --
* Wrapper for ReadConsole{A,W}, that takes and returns number of bytes
* instead of number of TCHARS
*/
-static BOOL readConsoleBytes(HANDLE hConsole,
- LPVOID lpBuffer,
- DWORD nbytes,
- LPDWORD nbytesread)
+static BOOL
+readConsoleBytes(
+ HANDLE hConsole,
+ LPVOID lpBuffer,
+ DWORD nbytes,
+ LPDWORD nbytesread)
{
DWORD ntchars;
BOOL result;
@@ -204,15 +202,17 @@ static BOOL readConsoleBytes(HANDLE hConsole,
tcharsize = tclWinProcs->useWide? 2 : 1;
result = tclWinProcs->readConsoleProc(
hConsole, lpBuffer, nbytes / tcharsize, &ntchars, NULL);
- if (nbytesread)
+ if (nbytesread)
*nbytesread = (ntchars*tcharsize);
return result;
}
-static BOOL writeConsoleBytes(HANDLE hConsole,
- const VOID *lpBuffer,
- DWORD nbytes,
- LPDWORD nbyteswritten)
+static BOOL
+writeConsoleBytes(
+ HANDLE hConsole,
+ const VOID *lpBuffer,
+ DWORD nbytes,
+ LPDWORD nbyteswritten)
{
DWORD ntchars;
BOOL result;
@@ -220,7 +220,7 @@ static BOOL writeConsoleBytes(HANDLE hConsole,
tcharsize = tclWinProcs->useWide? 2 : 1;
result = tclWinProcs->writeConsoleProc(
hConsole, lpBuffer, nbytes / tcharsize, &ntchars, NULL);
- if (nbyteswritten)
+ if (nbyteswritten)
*nbyteswritten = (ntchars*tcharsize);
return result;
}
@@ -242,7 +242,7 @@ static BOOL writeConsoleBytes(HANDLE hConsole,
*/
static void
-ConsoleInit()
+ConsoleInit(void)
{
ThreadSpecificData *tsdPtr;
@@ -349,12 +349,12 @@ ConsoleSetupProc(
if (!(flags & TCL_FILE_EVENTS)) {
return;
}
-
+
/*
* Look to see if any events are already pending. If they are, poll.
*/
- for (infoPtr = tsdPtr->firstConsolePtr; infoPtr != NULL;
+ for (infoPtr = tsdPtr->firstConsolePtr; infoPtr != NULL;
infoPtr = infoPtr->nextPtr) {
if (infoPtr->watchMask & TCL_WRITABLE) {
if (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT) {
@@ -402,18 +402,18 @@ ConsoleCheckProc(
if (!(flags & TCL_FILE_EVENTS)) {
return;
}
-
+
/*
* Queue events for any ready consoles that don't already have events
* queued.
*/
- for (infoPtr = tsdPtr->firstConsolePtr; infoPtr != NULL;
+ for (infoPtr = tsdPtr->firstConsolePtr; infoPtr != NULL;
infoPtr = infoPtr->nextPtr) {
if (infoPtr->flags & CONSOLE_PENDING) {
continue;
}
-
+
/*
* Queue an event if the console is signaled for reading or writing.
*/
@@ -424,7 +424,7 @@ ConsoleCheckProc(
needEvent = 1;
}
}
-
+
if (infoPtr->watchMask & TCL_READABLE) {
if (WaitForRead(infoPtr, 0) >= 0) {
needEvent = 1;
@@ -465,7 +465,7 @@ ConsoleBlockModeProc(
* TCL_MODE_NONBLOCKING. */
{
ConsoleInfo *infoPtr = (ConsoleInfo *) instanceData;
-
+
/*
* Consoles on Windows can not be switched between blocking and
* nonblocking, hence we have to emulate the behavior. This is done in the
@@ -510,13 +510,13 @@ ConsoleCloseProc(
DWORD exitCode;
errorCode = 0;
-
+
/*
* Clean up the background thread if necessary. Note that this must be
* done before we can close the file, since the thread may be blocking
* trying to read from the console.
*/
-
+
if (consolePtr->readThread) {
/*
* The thread may already have closed on it's own. Check it's exit
@@ -568,7 +568,7 @@ ConsoleCloseProc(
* the thread and close the handles. If the channel is nonblocking, there
* should be no pending write operations.
*/
-
+
if (consolePtr->writeThread) {
if (consolePtr->toWrite) {
/*
@@ -631,7 +631,7 @@ ConsoleCloseProc(
* another.
*/
- if (!TclInThreadExit()
+ if (!TclInThreadExit()
|| ((GetStdHandle(STD_INPUT_HANDLE) != consolePtr->handle)
&& (GetStdHandle(STD_OUTPUT_HANDLE) != consolePtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != consolePtr->handle))) {
@@ -640,7 +640,7 @@ ConsoleCloseProc(
errorCode = errno;
}
}
-
+
consolePtr->watchMask &= consolePtr->validMask;
/*
@@ -699,13 +699,13 @@ ConsoleInputProc(
/*
* Synchronize with the reader thread.
*/
-
+
result = WaitForRead(infoPtr, (infoPtr->flags & CONSOLE_ASYNC) ? 0 : 1);
-
+
/*
* If an error occurred, return immediately.
*/
-
+
if (result == -1) {
*errorCode = errno;
return -1;
@@ -727,21 +727,21 @@ ConsoleInputProc(
/*
* Reset the buffer
*/
-
+
infoPtr->readFlags &= ~CONSOLE_BUFFERED;
infoPtr->offset = 0;
}
return bytesRead;
}
-
+
/*
* Attempt to read bufSize bytes. The read will return immediately if
* there is any data available. Otherwise it will block until at least one
* byte is available or an EOF occurs.
*/
- if (readConsoleBytes(infoPtr->handle, (LPVOID) buf, (DWORD) bufSize, &count)
+ if (readConsoleBytes(infoPtr->handle, (LPVOID) buf, (DWORD) bufSize, &count)
== TRUE) {
buf[count] = '\0';
return count;
@@ -770,10 +770,10 @@ ConsoleInputProc(
static int
ConsoleOutputProc(
- ClientData instanceData, /* Console state. */
- CONST char *buf, /* The data buffer. */
- int toWrite, /* How many bytes to write? */
- int *errorCode) /* Where to store error code. */
+ ClientData instanceData, /* Console state. */
+ CONST char *buf, /* The data buffer. */
+ int toWrite, /* How many bytes to write? */
+ int *errorCode) /* Where to store error code. */
{
ConsoleInfo *infoPtr = (ConsoleInfo *) instanceData;
DWORD bytesWritten, timeout;
@@ -920,7 +920,7 @@ ConsoleEventProc(
} else {
mask |= TCL_READABLE;
}
- }
+ }
}
/*
@@ -1042,18 +1042,18 @@ ConsoleGetHandleProc(
static int
WaitForRead(
ConsoleInfo *infoPtr, /* Console state. */
- int blocking) /* Indicates whether call should be
- * blocking or not. */
+ int blocking) /* Indicates whether call should be blocking
+ * or not. */
{
DWORD timeout, count;
HANDLE *handle = infoPtr->handle;
INPUT_RECORD input;
-
+
while (1) {
/*
* Synchronize with the reader thread.
*/
-
+
timeout = blocking ? INFINITE : 0;
if (WaitForSingleObject(infoPtr->readable, timeout) == WAIT_TIMEOUT) {
/*
@@ -1064,27 +1064,27 @@ WaitForRead(
errno = EAGAIN;
return -1;
}
-
+
/*
* At this point, the two threads are synchronized, so it is safe to
* access shared state.
*/
-
+
/*
* If the console has hit EOF, it is always readable.
*/
-
+
if (infoPtr->readFlags & CONSOLE_EOF) {
return 1;
}
-
+
if (PeekConsoleInput(handle, &input, 1, &count) == FALSE) {
/*
* Check to see if the peek failed because of EOF.
*/
-
+
TclWinConvertError(GetLastError());
-
+
if (errno == EOF) {
infoPtr->readFlags |= CONSOLE_EOF;
return 1;
@@ -1093,7 +1093,7 @@ WaitForRead(
/*
* Ignore errors if there is data in the buffer.
*/
-
+
if (infoPtr->readFlags & CONSOLE_BUFFERED) {
return 0;
} else {
@@ -1113,7 +1113,7 @@ WaitForRead(
/*
* There wasn't any data available, so reset the thread and try again.
*/
-
+
ResetEvent(infoPtr->readable);
SetEvent(infoPtr->startReader);
}
@@ -1139,7 +1139,8 @@ WaitForRead(
*/
static DWORD WINAPI
-ConsoleReaderThread(LPVOID arg)
+ConsoleReaderThread(
+ LPVOID arg)
{
ConsoleInfo *infoPtr = (ConsoleInfo *)arg;
HANDLE *handle = infoPtr->handle;
@@ -1168,7 +1169,7 @@ ConsoleReaderThread(LPVOID arg)
count = 0;
- /*
+ /*
* Look for data on the console, but first ignore any events that are
* not KEY_EVENTs.
*/
@@ -1178,12 +1179,12 @@ ConsoleReaderThread(LPVOID arg)
/*
* Data was stored in the buffer.
*/
-
+
infoPtr->readFlags |= CONSOLE_BUFFERED;
} else {
DWORD err;
err = GetLastError();
-
+
if (err == EOF) {
infoPtr->readFlags = CONSOLE_EOF;
}
@@ -1236,7 +1237,8 @@ ConsoleReaderThread(LPVOID arg)
*/
static DWORD WINAPI
-ConsoleWriterThread(LPVOID arg)
+ConsoleWriterThread(
+ LPVOID arg)
{
ConsoleInfo *infoPtr = (ConsoleInfo *)arg;
@@ -1286,7 +1288,7 @@ ConsoleWriterThread(LPVOID arg)
* Signal the main thread by signalling the writable event and then
* waking up the notifier thread.
*/
-
+
SetEvent(infoPtr->writable);
/*
@@ -1301,6 +1303,7 @@ ConsoleWriterThread(LPVOID arg)
* TIP #218. When in flight ignore the event, no one will receive
* it anyway.
*/
+
Tcl_ThreadAlert(infoPtr->threadId);
}
Tcl_MutexUnlock(&consoleMutex);
@@ -1308,8 +1311,6 @@ ConsoleWriterThread(LPVOID arg)
return 0;
}
-
-
/*
*----------------------------------------------------------------------
@@ -1330,10 +1331,10 @@ ConsoleWriterThread(LPVOID arg)
*/
Tcl_Channel
-TclWinOpenConsoleChannel(handle, channelName, permissions)
- HANDLE handle;
- char *channelName;
- int permissions;
+TclWinOpenConsoleChannel(
+ HANDLE handle,
+ char *channelName,
+ int permissions)
{
char encoding[4 + TCL_INTEGER_SPACE];
ConsoleInfo *infoPtr;
@@ -1344,7 +1345,7 @@ TclWinOpenConsoleChannel(handle, channelName, permissions)
/*
* See if a channel with this handle already exists.
*/
-
+
infoPtr = (ConsoleInfo *) ckalloc((unsigned) sizeof(ConsoleInfo));
memset(infoPtr, 0, sizeof(ConsoleInfo));
@@ -1363,7 +1364,7 @@ TclWinOpenConsoleChannel(handle, channelName, permissions)
*/
wsprintfA(channelName, "file%lx", (int) infoPtr);
-
+
infoPtr->channel = Tcl_CreateChannel(&consoleChannelType, channelName,
(ClientData) infoPtr, permissions);
@@ -1400,7 +1401,7 @@ TclWinOpenConsoleChannel(handle, channelName, permissions)
* Files have default translation of AUTO and ^Z eof char, which means
* that a ^Z will be accepted as EOF when reading.
*/
-
+
Tcl_SetChannelOption(NULL, infoPtr->channel, "-translation", "auto");
Tcl_SetChannelOption(NULL, infoPtr->channel, "-eofchar", "\032 {}");
if (tclWinProcs->useWide)
@@ -1428,9 +1429,9 @@ TclWinOpenConsoleChannel(handle, channelName, permissions)
*/
static void
-ConsoleThreadActionProc (instanceData, action)
- ClientData instanceData;
- int action;
+ConsoleThreadActionProc(
+ ClientData instanceData,
+ int action)
{
ConsoleInfo *infoPtr = (ConsoleInfo *) instanceData;
diff --git a/win/tclWinDde.c b/win/tclWinDde.c
index 57a7d62..913a361 100644
--- a/win/tclWinDde.c
+++ b/win/tclWinDde.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: tclWinDde.c,v 1.27 2005/07/24 22:56:47 dkf Exp $
+ * RCS: @(#) $Id: tclWinDde.c,v 1.28 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclInt.h"
@@ -92,35 +92,31 @@ TCL_DECLARE_MUTEX(ddeMutex)
* Forward declarations for functions defined later in this file.
*/
-static LRESULT CALLBACK DdeClientWindowProc _ANSI_ARGS_((
- HWND hwnd, UINT uMsg, WPARAM wParam,
- LPARAM lParam));
-static int DdeCreateClient _ANSI_ARGS_((
- struct DdeEnumServices *es));
-static BOOL CALLBACK DdeEnumWindowsCallback _ANSI_ARGS_((
- HWND hwndTarget, LPARAM lParam));
-static void DdeExitProc _ANSI_ARGS_((ClientData clientData));
-static int DdeGetServicesList _ANSI_ARGS_((Tcl_Interp *interp,
- char *serviceName, char *topicName));
-static HDDEDATA CALLBACK DdeServerProc _ANSI_ARGS_((UINT uType,
- UINT uFmt, HCONV hConv, HSZ ddeTopic,
- HSZ ddeItem, HDDEDATA hData, DWORD dwData1,
- DWORD dwData2));
-static LRESULT DdeServicesOnAck _ANSI_ARGS_((HWND hwnd,
- WPARAM wParam, LPARAM lParam));
-static void DeleteProc _ANSI_ARGS_((ClientData clientData));
-static Tcl_Obj * ExecuteRemoteObject _ANSI_ARGS_((
- RegisteredInterp *riPtr,
- Tcl_Obj *ddeObjectPtr));
-static int MakeDdeConnection _ANSI_ARGS_((Tcl_Interp *interp,
- char *name, HCONV *ddeConvPtr));
-static void SetDdeError _ANSI_ARGS_((Tcl_Interp *interp));
-int Tcl_DdeObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-
-EXTERN int Dde_Init _ANSI_ARGS_((Tcl_Interp *interp));
-EXTERN int Dde_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
+static LRESULT CALLBACK DdeClientWindowProc(HWND hwnd, UINT uMsg,
+ WPARAM wParam, LPARAM lParam);
+static int DdeCreateClient(struct DdeEnumServices *es);
+static BOOL CALLBACK DdeEnumWindowsCallback(HWND hwndTarget, LPARAM lParam);
+static void DdeExitProc(ClientData clientData);
+static int DdeGetServicesList(Tcl_Interp *interp,
+ char *serviceName, char *topicName);
+static HDDEDATA CALLBACK DdeServerProc(UINT uType, UINT uFmt, HCONV hConv,
+ HSZ ddeTopic, HSZ ddeItem, HDDEDATA hData,
+ DWORD dwData1, DWORD dwData2);
+static LRESULT DdeServicesOnAck(HWND hwnd, WPARAM wParam,
+ LPARAM lParam);
+static void DeleteProc(ClientData clientData);
+static Tcl_Obj * ExecuteRemoteObject(RegisteredInterp *riPtr,
+ Tcl_Obj *ddeObjectPtr);
+static int MakeDdeConnection(Tcl_Interp *interp, char *name,
+ HCONV *ddeConvPtr);
+static void SetDdeError(Tcl_Interp *interp);
+
+int Tcl_DdeObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+
+EXTERN int Dde_Init(Tcl_Interp *interp);
+EXTERN int Dde_SafeInit(Tcl_Interp *interp);
/*
*----------------------------------------------------------------------
@@ -139,8 +135,8 @@ EXTERN int Dde_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
*/
int
-Dde_Init(interp)
- Tcl_Interp *interp;
+Dde_Init(
+ Tcl_Interp *interp)
{
ThreadSpecificData *tsdPtr;
@@ -171,8 +167,8 @@ Dde_Init(interp)
*/
int
-Dde_SafeInit(interp)
- Tcl_Interp *interp;
+Dde_SafeInit(
+ Tcl_Interp *interp)
{
int result = Dde_Init(interp);
if (result == TCL_OK) {
@@ -270,13 +266,13 @@ Initialize(void)
*/
static char *
-DdeSetServerName(interp, name, exactName, handlerPtr)
- Tcl_Interp *interp;
- char *name; /* The name that will be used to refer to the
+DdeSetServerName(
+ Tcl_Interp *interp,
+ char *name, /* The name that will be used to refer to the
* interpreter in later "send" commands. Must
* be globally unique. */
- int exactName; /* Should we make a unique name? 0 = unique */
- Tcl_Obj *handlerPtr; /* Name of the optional proc/command to handle
+ int exactName, /* Should we make a unique name? 0 = unique */
+ Tcl_Obj *handlerPtr) /* Name of the optional proc/command to handle
* incoming Dde eval's */
{
int suffix, offset;
@@ -435,8 +431,8 @@ DdeSetServerName(interp, name, exactName, handlerPtr)
*/
static RegisteredInterp *
-DdeGetRegistrationPtr(interp)
- Tcl_Interp *interp;
+DdeGetRegistrationPtr(
+ Tcl_Interp *interp)
{
RegisteredInterp *riPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -467,8 +463,8 @@ DdeGetRegistrationPtr(interp)
*/
static void
-DeleteProc(clientData)
- ClientData clientData; /* The interp we are deleting passed as
+DeleteProc(
+ ClientData clientData) /* The interp we are deleting passed as
* ClientData. */
{
RegisteredInterp *riPtr = (RegisteredInterp *) clientData;
@@ -521,9 +517,9 @@ DeleteProc(clientData)
*/
static Tcl_Obj *
-ExecuteRemoteObject(riPtr, ddeObjectPtr)
- RegisteredInterp *riPtr; /* Info about this server. */
- Tcl_Obj *ddeObjectPtr; /* The object to execute. */
+ExecuteRemoteObject(
+ RegisteredInterp *riPtr, /* Info about this server. */
+ Tcl_Obj *ddeObjectPtr) /* The object to execute. */
{
Tcl_Obj *returnPackagePtr;
int result = TCL_OK;
@@ -552,7 +548,7 @@ ExecuteRemoteObject(riPtr, ddeObjectPtr)
result = Tcl_EvalObjEx(riPtr->interp, ddeObjectPtr, TCL_EVAL_GLOBAL);
}
- returnPackagePtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
+ returnPackagePtr = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(NULL, returnPackagePtr, Tcl_NewIntObj(result));
Tcl_ListObjAppendElement(NULL, returnPackagePtr,
@@ -594,16 +590,17 @@ ExecuteRemoteObject(riPtr, ddeObjectPtr)
*/
static HDDEDATA CALLBACK
-DdeServerProc(uType, uFmt, hConv, ddeTopic, ddeItem, hData, dwData1, dwData2)
- UINT uType; /* The type of DDE transaction we are
+DdeServerProc(
+ UINT uType, /* The type of DDE transaction we are
* performing. */
- UINT uFmt; /* The format that data is sent or received. */
- HCONV hConv; /* The conversation associated with the
+ UINT uFmt, /* The format that data is sent or received. */
+ HCONV hConv, /* The conversation associated with the
* current transaction. */
- HSZ ddeTopic, ddeItem; /* String handles. Transaction-type
+ HSZ ddeTopic, HSZ ddeItem, /* String handles. Transaction-type
* dependent. */
- HDDEDATA hData; /* DDE data. Transaction-type dependent. */
- DWORD dwData1, dwData2; /* Transaction-dependent data. */
+ HDDEDATA hData, /* DDE data. Transaction-type dependent. */
+ DWORD dwData1, DWORD dwData2)
+ /* Transaction-dependent data. */
{
Tcl_DString dString;
int len;
@@ -852,8 +849,8 @@ DdeServerProc(uType, uFmt, hConv, ddeTopic, ddeItem, hData, dwData1, dwData2)
*/
static void
-DdeExitProc(clientData)
- ClientData clientData; /* Not used in this handler. */
+DdeExitProc(
+ ClientData clientData) /* Not used in this handler. */
{
DdeNameService(ddeInstance, NULL, 0, DNS_UNREGISTER);
DdeUninitialize(ddeInstance);
@@ -878,10 +875,10 @@ DdeExitProc(clientData)
*/
static int
-MakeDdeConnection(interp, name, ddeConvPtr)
- Tcl_Interp *interp; /* Used to report errors. */
- char *name; /* The connection to use. */
- HCONV *ddeConvPtr;
+MakeDdeConnection(
+ Tcl_Interp *interp, /* Used to report errors. */
+ char *name, /* The connection to use. */
+ HCONV *ddeConvPtr)
{
HSZ ddeTopic, ddeService;
HCONV ddeConv;
@@ -896,7 +893,7 @@ MakeDdeConnection(interp, name, ddeConvPtr)
if (ddeConv == (HCONV) NULL) {
if (interp != NULL) {
Tcl_AppendResult(interp, "no registered server named \"",
- name, "\"", (char *) NULL);
+ name, "\"", NULL);
}
return TCL_ERROR;
}
@@ -926,8 +923,8 @@ MakeDdeConnection(interp, name, ddeConvPtr)
*/
static int
-DdeCreateClient(es)
- struct DdeEnumServices *es;
+DdeCreateClient(
+ struct DdeEnumServices *es)
{
WNDCLASSEX wc;
static const char *szDdeClientClassName = "TclEval client class";
@@ -950,11 +947,11 @@ DdeCreateClient(es)
}
static LRESULT CALLBACK
-DdeClientWindowProc(hwnd, uMsg, wParam, lParam)
- HWND hwnd; /* What window is the message for */
- UINT uMsg; /* The type of message received */
- WPARAM wParam;
- LPARAM lParam; /* (Potentially) our local handle */
+DdeClientWindowProc(
+ HWND hwnd, /* What window is the message for */
+ UINT uMsg, /* The type of message received */
+ WPARAM wParam,
+ LPARAM lParam) /* (Potentially) our local handle */
{
LRESULT lr = 0L;
@@ -980,10 +977,10 @@ DdeClientWindowProc(hwnd, uMsg, wParam, lParam)
}
static LRESULT
-DdeServicesOnAck(hwnd, wParam, lParam)
- HWND hwnd;
- WPARAM wParam;
- LPARAM lParam;
+DdeServicesOnAck(
+ HWND hwnd,
+ WPARAM wParam,
+ LPARAM lParam)
{
HWND hwndRemote = (HWND)wParam;
ATOM service = (ATOM)LOWORD(lParam);
@@ -1036,9 +1033,9 @@ DdeServicesOnAck(hwnd, wParam, lParam)
}
static BOOL CALLBACK
-DdeEnumWindowsCallback(hwndTarget, lParam)
- HWND hwndTarget;
- LPARAM lParam;
+DdeEnumWindowsCallback(
+ HWND hwndTarget,
+ LPARAM lParam)
{
LRESULT dwResult = 0;
struct DdeEnumServices *es = (struct DdeEnumServices *) lParam;
@@ -1050,9 +1047,10 @@ DdeEnumWindowsCallback(hwndTarget, lParam)
}
static int
-DdeGetServicesList(interp, serviceName, topicName)
- Tcl_Interp *interp;
- char *serviceName, *topicName;
+DdeGetServicesList(
+ Tcl_Interp *interp,
+ char *serviceName,
+ char *topicName)
{
struct DdeEnumServices es;
@@ -1096,8 +1094,8 @@ DdeGetServicesList(interp, serviceName, topicName)
*/
static void
-SetDdeError(interp)
- Tcl_Interp *interp; /* The interp to put the message in. */
+SetDdeError(
+ Tcl_Interp *interp) /* The interp to put the message in. */
{
char *errorMessage;
@@ -1138,11 +1136,11 @@ SetDdeError(interp)
*/
int
-Tcl_DdeObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Used only for deletion */
- Tcl_Interp *interp; /* The interp we are sending from */
- int objc; /* Number of arguments */
- Tcl_Obj *CONST objv[]; /* The arguments */
+Tcl_DdeObjCmd(
+ ClientData clientData, /* Used only for deletion */
+ Tcl_Interp *interp, /* The interp we are sending from */
+ int objc, /* Number of arguments */
+ Tcl_Obj *CONST objv[]) /* The arguments */
{
static CONST char *ddeCommands[] = {
"servername", "execute", "poke", "request", "services", "eval",
@@ -1153,16 +1151,16 @@ Tcl_DdeObjCmd(clientData, interp, objc, objv)
DDE_EVAL
};
static CONST char *ddeSrvOptions[] = {
- "-force", "-handler", "--", (char *) NULL
+ "-force", "-handler", "--", NULL
};
enum DdeSrvOptions {
DDE_SERVERNAME_EXACT, DDE_SERVERNAME_HANDLER, DDE_SERVERNAME_LAST,
};
static CONST char *ddeExecOptions[] = {
- "-async", (char *) NULL
+ "-async", NULL
};
static CONST char *ddeReqOptions[] = {
- "-binary", (char *) NULL
+ "-binary", NULL
};
int index, i, length;
diff --git a/win/tclWinError.c b/win/tclWinError.c
index 9a504d2..05661a2 100644
--- a/win/tclWinError.c
+++ b/win/tclWinError.c
@@ -1,22 +1,21 @@
-/*
+/*
* tclWinError.c --
*
- * This file contains code for converting from Win32 errors to
- * errno errors.
+ * This file contains code for converting from Win32 errors to errno
+ * errors.
*
* Copyright (c) 1995-1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinError.c,v 1.6 2004/04/06 22:25:58 dgp Exp $
+ * RCS: @(#) $Id: tclWinError.c,v 1.7 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclInt.h"
/*
- * The following table contains the mapping from Win32 errors to
- * errno errors.
+ * The following table contains the mapping from Win32 errors to errno errors.
*/
static char errorTable[] = {
@@ -354,8 +353,8 @@ static int wsaErrorTable[] = {
*/
void
-TclWinConvertError(errCode)
- DWORD errCode; /* Win32 error code. */
+TclWinConvertError(
+ DWORD errCode) /* Win32 error code. */
{
if (errCode >= tableLen) {
Tcl_SetErrno(EINVAL);
@@ -381,8 +380,8 @@ TclWinConvertError(errCode)
*/
void
-TclWinConvertWSAError(errCode)
- DWORD errCode; /* Win32 error code. */
+TclWinConvertWSAError(
+ DWORD errCode) /* Win32 error code. */
{
if ((errCode >= WSAEWOULDBLOCK) && (errCode <= WSAEREMOTE)) {
Tcl_SetErrno(wsaErrorTable[errCode - WSAEWOULDBLOCK]);
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index c55e4df..2aa5f0c 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.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: tclWinFCmd.c,v 1.49 2005/08/05 23:00:41 dkf Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.50 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclWinInt.h"
@@ -162,9 +162,9 @@ static int TraverseWinTree(TraversalProc *traverseProc,
*/
int
-TclpObjRenameFile(srcPathPtr, destPathPtr)
- Tcl_Obj *srcPathPtr;
- Tcl_Obj *destPathPtr;
+TclpObjRenameFile(
+ Tcl_Obj *srcPathPtr,
+ Tcl_Obj *destPathPtr)
{
return DoRenameFile(Tcl_FSGetNativePath(srcPathPtr),
Tcl_FSGetNativePath(destPathPtr));
@@ -553,9 +553,9 @@ DoRenameFile(
*/
int
-TclpObjCopyFile(srcPathPtr, destPathPtr)
- Tcl_Obj *srcPathPtr;
- Tcl_Obj *destPathPtr;
+TclpObjCopyFile(
+ Tcl_Obj *srcPathPtr,
+ Tcl_Obj *destPathPtr)
{
return DoCopyFile(Tcl_FSGetNativePath(srcPathPtr),
Tcl_FSGetNativePath(destPathPtr));
@@ -758,8 +758,8 @@ DoCopyFile(
*/
int
-TclpObjDeleteFile(pathPtr)
- Tcl_Obj *pathPtr;
+TclpObjDeleteFile(
+ Tcl_Obj *pathPtr)
{
return TclpDeleteFile(Tcl_FSGetNativePath(pathPtr));
}
@@ -870,8 +870,8 @@ TclpDeleteFile(
*/
int
-TclpObjCreateDirectory(pathPtr)
- Tcl_Obj *pathPtr;
+TclpObjCreateDirectory(
+ Tcl_Obj *pathPtr)
{
return DoCreateDirectory(Tcl_FSGetNativePath(pathPtr));
}
@@ -914,10 +914,10 @@ DoCreateDirectory(
*/
int
-TclpObjCopyDirectory(srcPathPtr, destPathPtr, errorPtr)
- Tcl_Obj *srcPathPtr;
- Tcl_Obj *destPathPtr;
- Tcl_Obj **errorPtr;
+TclpObjCopyDirectory(
+ Tcl_Obj *srcPathPtr,
+ Tcl_Obj *destPathPtr,
+ Tcl_Obj **errorPtr)
{
Tcl_DString ds;
Tcl_DString srcString, dstString;
@@ -978,10 +978,10 @@ TclpObjCopyDirectory(srcPathPtr, destPathPtr, errorPtr)
*/
int
-TclpObjRemoveDirectory(pathPtr, recursive, errorPtr)
- Tcl_Obj *pathPtr;
- int recursive;
- Tcl_Obj **errorPtr;
+TclpObjRemoveDirectory(
+ Tcl_Obj *pathPtr,
+ int recursive,
+ Tcl_Obj **errorPtr)
{
Tcl_DString ds;
Tcl_Obj *normPtr = NULL;
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 10d242a..eb88bb1 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.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: tclWinFile.c,v 1.79 2005/10/31 15:59:41 dkf Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.80 2005/11/04 00:06:50 dkf Exp $
*/
/* #define _WIN32_WINNT 0x0500 */
@@ -1024,7 +1024,7 @@ TclpMatchInDirectory(
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "couldn't read directory \"",
Tcl_DStringValue(&dsOrig), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
}
Tcl_DStringFree(&dsOrig);
return TCL_ERROR;
@@ -1916,7 +1916,7 @@ TclpGetCwd(
TclWinConvertError(GetLastError());
if (interp != NULL) {
Tcl_AppendResult(interp, "error getting working directory name: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
}
return NULL;
}
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index a46fc80..4e87090 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclWinInit.c --
*
* Contains the Windows-specific interpreter initialization functions.
@@ -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: tclWinInit.c,v 1.67 2005/07/24 22:56:48 dkf Exp $
+ * RCS: @(#) $Id: tclWinInit.c,v 1.68 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclWinInt.h"
@@ -126,7 +126,7 @@ static int ToUtf(CONST WCHAR *wSrc, char *dst);
*/
void
-TclpInitPlatform()
+TclpInitPlatform(void)
{
tclPlatform = TCL_PLATFORM_WINDOWS;
@@ -166,16 +166,16 @@ TclpInitPlatform()
* None.
*
* Side effects:
- * Sets the library path to an initial value.
+ * Sets the library path to an initial value.
*
*-------------------------------------------------------------------------
- */
+ */
void
-TclpInitLibraryPath(valuePtr, lengthPtr, encodingPtr)
- char **valuePtr;
- int *lengthPtr;
- Tcl_Encoding *encodingPtr;
+TclpInitLibraryPath(
+ char **valuePtr,
+ int *lengthPtr,
+ Tcl_Encoding *encodingPtr)
{
#define LIBRARY_SIZE 32
Tcl_Obj *pathPtr;
@@ -284,7 +284,7 @@ AppendEnvironment(
TclWinNoBackslash(buf);
Tcl_SplitPath(buf, &pathc, &pathv);
- /*
+ /*
* The lstrcmpi() will work even if pathv[pathc-1] is random UTF-8
* chars because I know shortlib is ascii.
*/
@@ -330,10 +330,10 @@ AppendEnvironment(
*/
static void
-InitializeDefaultLibraryDir(valuePtr, lengthPtr, encodingPtr)
- char **valuePtr;
- int *lengthPtr;
- Tcl_Encoding *encodingPtr;
+InitializeDefaultLibraryDir(
+ char **valuePtr,
+ int *lengthPtr,
+ Tcl_Encoding *encodingPtr)
{
HMODULE hModule = TclWinGetTclInstance();
WCHAR wName[MAX_PATH + LIBRARY_SIZE];
@@ -367,7 +367,7 @@ InitializeDefaultLibraryDir(valuePtr, lengthPtr, encodingPtr)
*
* ToUtf --
*
- * Convert a char string to a UTF string.
+ * Convert a char string to a UTF string.
*
* Results:
* None.
@@ -414,7 +414,7 @@ ToUtf(
*/
void
-TclWinEncodingsCleanup()
+TclWinEncodingsCleanup(void)
{
TclWinResetInterfaceEncodings();
}
@@ -444,10 +444,10 @@ TclWinEncodingsCleanup()
*/
void
-TclpSetInitialEncodings()
+TclpSetInitialEncodings(void)
{
Tcl_DString encodingName;
-
+
TclpSetInterfaces();
Tcl_SetSystemEncoding(NULL,
TclpGetEncodingNameFromEnvironment(&encodingName));
@@ -455,7 +455,7 @@ TclpSetInitialEncodings()
}
void
-TclpSetInterfaces()
+TclpSetInterfaces(void)
{
int platformId, useWide;
@@ -466,8 +466,8 @@ TclpSetInterfaces()
}
CONST char *
-TclpGetEncodingNameFromEnvironment(bufPtr)
- Tcl_DString *bufPtr;
+TclpGetEncodingNameFromEnvironment(
+ Tcl_DString *bufPtr)
{
Tcl_DStringInit(bufPtr);
wsprintfA(Tcl_DStringValue(bufPtr), "cp%d", GetACP());
@@ -492,8 +492,8 @@ TclpGetEncodingNameFromEnvironment(bufPtr)
*/
void
-TclpSetVariables(interp)
- Tcl_Interp *interp; /* Interp to initialize. */
+TclpSetVariables(
+ Tcl_Interp *interp) /* Interp to initialize. */
{
CONST char *ptr;
char buffer[TCL_INTEGER_SPACE * 2];
@@ -605,10 +605,10 @@ TclpSetVariables(interp)
*/
int
-TclpFindVariable(name, lengthPtr)
- CONST char *name; /* Name of desired environment variable
+TclpFindVariable(
+ CONST char *name, /* Name of desired environment variable
* (UTF-8). */
- int *lengthPtr; /* Used to return length of name (for
+ int *lengthPtr) /* Used to return length of name (for
* successful searches) or number of non-NULL
* entries in environ (for unsuccessful
* searches). */
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c
index 34d98e3..7079571 100644
--- a/win/tclWinLoad.c
+++ b/win/tclWinLoad.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: tclWinLoad.c,v 1.18 2005/07/24 22:56:49 dkf Exp $
+ * RCS: @(#) $Id: tclWinLoad.c,v 1.19 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclWinInt.h"
@@ -35,14 +35,14 @@
*/
int
-TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *pathPtr; /* Name of the file containing the desired
+TclpDlopen(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code (UTF-8). */
- Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
+ Tcl_LoadHandle *loadHandle, /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
- Tcl_FSUnloadFileProc **unloadProcPtr;
+ Tcl_FSUnloadFileProc **unloadProcPtr)
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for this
* file. */
@@ -96,7 +96,7 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
#endif
Tcl_AppendResult(interp, "couldn't load library \"",
- Tcl_GetString(pathPtr), "\": ", (char *) NULL);
+ Tcl_GetString(pathPtr), "\": ", NULL);
/*
* Check for possible DLL errors. This doesn't work quite right,
@@ -109,24 +109,24 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
case ERROR_MOD_NOT_FOUND:
case ERROR_DLL_NOT_FOUND:
Tcl_AppendResult(interp, "this library or a dependent library",
- " could not be found in library path", (char *) NULL);
+ " could not be found in library path", NULL);
break;
case ERROR_PROC_NOT_FOUND:
Tcl_AppendResult(interp, "A function specified in the import",
" table could not be resolved by the system. Windows",
- " is not telling which one, I'm sorry.", (char *) NULL);
+ " is not telling which one, I'm sorry.", NULL);
break;
case ERROR_INVALID_DLL:
Tcl_AppendResult(interp, "this library or a dependent library",
- " is damaged", (char *) NULL);
+ " is damaged", NULL);
break;
case ERROR_DLL_INIT_FAILED:
Tcl_AppendResult(interp, "the library initialization",
- " routine failed", (char *) NULL);
+ " routine failed", NULL);
break;
default:
TclWinConvertError(lastError);
- Tcl_AppendResult(interp, Tcl_PosixError(interp), (char *) NULL);
+ Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL);
}
return TCL_ERROR;
} else {
@@ -151,11 +151,11 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
*----------------------------------------------------------------------
*/
-Tcl_PackageInitProc*
-TclpFindSymbol(interp, loadHandle, symbol)
- Tcl_Interp *interp;
- Tcl_LoadHandle loadHandle;
- CONST char *symbol;
+Tcl_PackageInitProc *
+TclpFindSymbol(
+ Tcl_Interp *interp,
+ Tcl_LoadHandle loadHandle,
+ CONST char *symbol)
{
Tcl_PackageInitProc *proc = NULL;
HINSTANCE handle = (HINSTANCE)loadHandle;
@@ -197,8 +197,8 @@ TclpFindSymbol(interp, loadHandle, symbol)
*/
void
-TclpUnloadFile(loadHandle)
- Tcl_LoadHandle loadHandle; /* loadHandle returned by a previous call to
+TclpUnloadFile(
+ Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to
* TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
@@ -229,10 +229,10 @@ TclpUnloadFile(loadHandle)
*/
int
-TclGuessPackageName(fileName, bufPtr)
- CONST char *fileName; /* Name of file containing package (already
+TclGuessPackageName(
+ CONST char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
- Tcl_DString *bufPtr; /* Initialized empty dstring. Append package
+ Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c
index dc8a683..d1cbf74 100644
--- a/win/tclWinNotify.c
+++ b/win/tclWinNotify.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: tclWinNotify.c,v 1.20 2005/07/24 22:56:49 dkf Exp $
+ * RCS: @(#) $Id: tclWinNotify.c,v 1.21 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclInt.h"
@@ -81,7 +81,7 @@ static LRESULT CALLBACK NotifierProc(HWND hwnd, UINT message,
*/
ClientData
-Tcl_InitNotifier()
+Tcl_InitNotifier(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
WNDCLASS class;
@@ -142,8 +142,8 @@ Tcl_InitNotifier()
*/
void
-Tcl_FinalizeNotifier(clientData)
- ClientData clientData; /* Pointer to notifier data. */
+Tcl_FinalizeNotifier(
+ ClientData clientData) /* Pointer to notifier data. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
@@ -210,8 +210,8 @@ Tcl_FinalizeNotifier(clientData)
*/
void
-Tcl_AlertNotifier(clientData)
- ClientData clientData; /* Pointer to thread data. */
+Tcl_AlertNotifier(
+ ClientData clientData) /* Pointer to thread data. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
@@ -324,8 +324,8 @@ Tcl_SetTimer(
*/
void
-Tcl_ServiceModeHook(mode)
- int mode; /* Either TCL_SERVICE_ALL, or
+Tcl_ServiceModeHook(
+ int mode) /* Either TCL_SERVICE_ALL, or
* TCL_SERVICE_NONE. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -538,8 +538,8 @@ Tcl_WaitForEvent(
*/
void
-Tcl_Sleep(ms)
- int ms; /* Number of milliseconds to sleep. */
+Tcl_Sleep(
+ int ms) /* Number of milliseconds to sleep. */
{
/*
* Simply calling 'Sleep' for the requisite number of milliseconds can
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index d91b873..93e9655 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.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: tclWinPipe.c,v 1.59 2005/07/28 10:55:37 dkf Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.60 2005/11/04 00:06:50 dkf Exp $
*/
#include "tclWinInt.h"
@@ -245,7 +245,7 @@ static Tcl_ChannelType pipeChannelType = {
*/
static void
-PipeInit()
+PipeInit(void)
{
ThreadSpecificData *tsdPtr;
@@ -314,7 +314,7 @@ PipeExitHandler(
*/
void
-TclpFinalizePipes()
+TclpFinalizePipes(void)
{
Tcl_MutexLock(&pipeMutex);
initialized = 0;
@@ -497,8 +497,8 @@ TclWinMakeFile(
*/
static int
-TempFileName(name)
- WCHAR name[MAX_PATH]; /* Buffer in which name for temporary file
+TempFileName(
+ WCHAR name[MAX_PATH]) /* Buffer in which name for temporary file
* gets stored. */
{
TCHAR *prefix;
@@ -538,9 +538,9 @@ TempFileName(name)
*/
TclFile
-TclpMakeFile(channel, direction)
- Tcl_Channel channel; /* Channel to get file from. */
- int direction; /* Either TCL_READABLE or TCL_WRITABLE. */
+TclpMakeFile(
+ Tcl_Channel channel, /* Channel to get file from. */
+ int direction) /* Either TCL_READABLE or TCL_WRITABLE. */
{
HANDLE handle;
@@ -570,9 +570,9 @@ TclpMakeFile(channel, direction)
*/
TclFile
-TclpOpenFile(path, mode)
- CONST char *path; /* The name of the file to open. */
- int mode; /* In what mode to open the file? */
+TclpOpenFile(
+ CONST char *path, /* The name of the file to open. */
+ int mode) /* In what mode to open the file? */
{
HANDLE handle;
DWORD accessMode, createMode, shareMode, flags;
@@ -691,8 +691,8 @@ TclpOpenFile(path, mode)
*/
TclFile
-TclpCreateTempFile(contents)
- CONST char *contents; /* String to write into temp file, or NULL. */
+TclpCreateTempFile(
+ CONST char *contents) /* String to write into temp file, or NULL. */
{
WCHAR name[MAX_PATH];
CONST char *native;
@@ -783,8 +783,8 @@ TclpCreateTempFile(contents)
*----------------------------------------------------------------------
*/
-Tcl_Obj*
-TclpTempFileName()
+Tcl_Obj *
+TclpTempFileName(void)
{
WCHAR fileName[MAX_PATH];
@@ -1327,7 +1327,7 @@ TclpCreateProcess(
*/
static BOOL
-HasConsole()
+HasConsole(void)
{
HANDLE handle;
@@ -1378,10 +1378,10 @@ HasConsole()
*/
static int
-ApplicationType(interp, originalName, fullName)
- Tcl_Interp *interp; /* Interp, for error message. */
- const char *originalName; /* Name of the application to find. */
- char fullName[]; /* Filled with complete path to
+ApplicationType(
+ Tcl_Interp *interp, /* Interp, for error message. */
+ const char *originalName, /* Name of the application to find. */
+ char fullName[]) /* Filled with complete path to
* application. */
{
int applType, i, nameLen, found;
@@ -2661,9 +2661,9 @@ Tcl_WaitPid(
*/
void
-TclWinAddProcess(hProcess, id)
- HANDLE hProcess; /* Handle to process */
- DWORD id; /* Global process identifier */
+TclWinAddProcess(
+ HANDLE hProcess, /* Handle to process */
+ DWORD id) /* Global process identifier */
{
ProcInfo *procPtr = (ProcInfo *) ckalloc(sizeof(ProcInfo));
@@ -2874,7 +2874,8 @@ WaitForRead(
*/
static DWORD WINAPI
-PipeReaderThread(LPVOID arg)
+PipeReaderThread(
+ LPVOID arg)
{
PipeInfo *infoPtr = (PipeInfo *)arg;
HANDLE *handle = ((WinFile *) infoPtr->readFile)->handle;
@@ -2996,7 +2997,8 @@ PipeReaderThread(LPVOID arg)
*/
static DWORD WINAPI
-PipeWriterThread(LPVOID arg)
+PipeWriterThread(
+ LPVOID arg)
{
PipeInfo *infoPtr = (PipeInfo *)arg;
HANDLE *handle = ((WinFile *) infoPtr->writeFile)->handle;
@@ -3088,9 +3090,9 @@ PipeWriterThread(LPVOID arg)
*/
static void
-PipeThreadActionProc(instanceData, action)
- ClientData instanceData;
- int action;
+PipeThreadActionProc(
+ ClientData instanceData,
+ int action)
{
PipeInfo *infoPtr = (PipeInfo *) instanceData;
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 902237d..cebb97c 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.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: tclWinReg.c,v 1.33 2005/07/24 22:56:49 dkf Exp $
+ * RCS: @(#) $Id: tclWinReg.c,v 1.34 2005/11/04 00:06:51 dkf Exp $
*/
#include "tclInt.h"
@@ -195,8 +195,8 @@ static int SetValue(Tcl_Interp *interp, Tcl_Obj *keyNameObj,
Tcl_Obj *valueNameObj, Tcl_Obj *dataObj,
Tcl_Obj *typeObj);
-EXTERN int Registry_Init(Tcl_Interp *interp);
-EXTERN int Registry_Unload(Tcl_Interp *interp, int flags);
+EXTERN int Registry_Init(Tcl_Interp *interp);
+EXTERN int Registry_Unload(Tcl_Interp *interp, int flags);
/*
*----------------------------------------------------------------------
@@ -304,7 +304,8 @@ Registry_Unload(
*/
static void
-DeleteCmd(ClientData clientData)
+DeleteCmd(
+ ClientData clientData)
{
Tcl_Interp *interp = clientData;
Tcl_SetAssocData(interp, REGISTRY_ASSOC_KEY, NULL, (ClientData)NULL);
@@ -337,8 +338,7 @@ RegistryObjCmd(
char *errString = NULL;
static CONST char *subcommands[] = {
- "broadcast", "delete", "get", "keys", "set", "type", "values",
- (char *) NULL
+ "broadcast", "delete", "get", "keys", "set", "type", "values", NULL
};
enum SubCmdIdx {
BroadcastIdx, DeleteIdx, GetIdx, KeysIdx, SetIdx, TypeIdx, ValuesIdx
@@ -1390,7 +1390,7 @@ static int
BroadcastValue(
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj * CONST objv[]) /* Argument values. */
+ Tcl_Obj *CONST objv[]) /* Argument values. */
{
LRESULT result, sendResult;
UINT timeout = 3000;
@@ -1516,7 +1516,7 @@ AppendSystemError(
}
sprintf(id, "%ld", error);
- Tcl_SetErrorCode(interp, "WINDOWS", id, msg, (char *) NULL);
+ Tcl_SetErrorCode(interp, "WINDOWS", id, msg, NULL);
Tcl_AppendToObj(resultPtr, msg, length);
Tcl_SetObjResult(interp, resultPtr);
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 030518a..cd26f98 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinSock.c,v 1.49 2005/11/03 00:17:31 patthoyts Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.50 2005/11/04 00:06:51 dkf Exp $
*/
#include "tclWinInt.h"
@@ -282,7 +282,6 @@ static Tcl_ChannelType tcpChannelType = {
NULL, /* wide seek proc */
TcpThreadActionProc, /* thread action proc */
};
-
/*
*----------------------------------------------------------------------
@@ -306,7 +305,7 @@ static Tcl_ChannelType tcpChannelType = {
*/
static void
-InitSockets()
+InitSockets(void)
{
DWORD id;
WSADATA wsaData;
@@ -538,7 +537,7 @@ InitSockets()
/* ARGSUSED */
static int
-SocketsEnabled()
+SocketsEnabled(void)
{
int enabled;
Tcl_MutexLock(&socketMutex);
@@ -567,8 +566,8 @@ SocketsEnabled()
/* ARGSUSED */
static void
-SocketExitHandler(clientData)
- ClientData clientData; /* Not used. */
+SocketExitHandler(
+ ClientData clientData) /* Not used. */
{
Tcl_MutexLock(&socketMutex);
if (winSock.hModule) {
@@ -606,8 +605,8 @@ SocketExitHandler(clientData)
/* ARGSUSED */
static void
-SocketThreadExitHandler(clientData)
- ClientData clientData; /* Not used. */
+SocketThreadExitHandler(
+ ClientData clientData) /* Not used. */
{
ThreadSpecificData *tsdPtr =
(ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
@@ -660,8 +659,8 @@ SocketThreadExitHandler(clientData)
*/
int
-TclpHasSockets(interp)
- Tcl_Interp *interp;
+TclpHasSockets(
+ Tcl_Interp *interp)
{
Tcl_MutexLock(&socketMutex);
InitSockets();
@@ -695,9 +694,9 @@ TclpHasSockets(interp)
*/
void
-SocketSetupProc(data, flags)
- ClientData data; /* Not used. */
- int flags; /* Event flags as passed to Tcl_DoOneEvent. */
+SocketSetupProc(
+ ClientData data, /* Not used. */
+ int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
SocketInfo *infoPtr;
Tcl_Time blockTime = { 0, 0 };
@@ -740,9 +739,9 @@ SocketSetupProc(data, flags)
*/
static void
-SocketCheckProc(data, flags)
- ClientData data; /* Not used. */
- int flags; /* Event flags as passed to Tcl_DoOneEvent. */
+SocketCheckProc(
+ ClientData data, /* Not used. */
+ int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
SocketInfo *infoPtr;
SocketEvent *evPtr;
@@ -795,9 +794,9 @@ SocketCheckProc(data, flags)
*/
static int
-SocketEventProc(evPtr, flags)
- Tcl_Event *evPtr; /* Event to service. */
- int flags; /* Flags that indicate what events to handle,
+SocketEventProc(
+ Tcl_Event *evPtr, /* Event to service. */
+ int flags) /* Flags that indicate what events to handle,
* such as TCL_FILE_EVENTS. */
{
SocketInfo *infoPtr;
@@ -925,9 +924,9 @@ SocketEventProc(evPtr, flags)
*/
static int
-TcpBlockProc(instanceData, mode)
- ClientData instanceData; /* The socket to block/un-block. */
- int mode; /* TCL_MODE_BLOCKING or
+TcpBlockProc(
+ ClientData instanceData, /* The socket to block/un-block. */
+ int mode) /* TCL_MODE_BLOCKING or
* TCL_MODE_NONBLOCKING. */
{
SocketInfo *infoPtr = (SocketInfo *) instanceData;
@@ -960,9 +959,9 @@ TcpBlockProc(instanceData, mode)
/* ARGSUSED */
static int
-TcpCloseProc(instanceData, interp)
- ClientData instanceData; /* The socket to close. */
- Tcl_Interp *interp; /* Unused. */
+TcpCloseProc(
+ ClientData instanceData, /* The socket to close. */
+ Tcl_Interp *interp) /* Unused. */
{
SocketInfo *infoPtr = (SocketInfo *) instanceData;
/* TIP #218 */
@@ -1016,8 +1015,8 @@ TcpCloseProc(instanceData, interp)
*/
static SocketInfo *
-NewSocketInfo(socket)
- SOCKET socket;
+NewSocketInfo(
+ SOCKET socket)
{
SocketInfo *infoPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -1063,15 +1062,15 @@ NewSocketInfo(socket)
*/
static SocketInfo *
-CreateSocket(interp, port, host, server, myaddr, myport, async)
- Tcl_Interp *interp; /* For error reporting; can be NULL. */
- int port; /* Port number to open. */
- CONST char *host; /* Name of host on which to open port. */
- int server; /* 1 if socket should be a server socket, else
+CreateSocket(
+ Tcl_Interp *interp, /* For error reporting; can be NULL. */
+ int port, /* Port number to open. */
+ CONST char *host, /* Name of host on which to open port. */
+ int server, /* 1 if socket should be a server socket, else
* 0 for a client socket. */
- CONST char *myaddr; /* Optional client-side address */
- int myport; /* Optional client-side port */
- int async; /* If nonzero, connect client socket
+ CONST char *myaddr, /* Optional client-side address */
+ int myport, /* Optional client-side port */
+ int async) /* If nonzero, connect client socket
* asynchronously. */
{
u_long flag = 1; /* Indicates nonblocking mode. */
@@ -1234,7 +1233,7 @@ CreateSocket(interp, port, host, server, myaddr, myport, async)
TclWinConvertWSAError((DWORD) winSock.WSAGetLastError());
if (interp != NULL) {
Tcl_AppendResult(interp, "couldn't open socket: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
}
if (sock != INVALID_SOCKET) {
winSock.closesocket(sock);
@@ -1260,10 +1259,10 @@ CreateSocket(interp, port, host, server, myaddr, myport, async)
*/
static int
-CreateSocketAddress(sockaddrPtr, host, port)
- LPSOCKADDR_IN sockaddrPtr; /* Socket address */
- CONST char *host; /* Host. NULL implies INADDR_ANY */
- int port; /* Port number */
+CreateSocketAddress(
+ LPSOCKADDR_IN sockaddrPtr, /* Socket address */
+ CONST char *host, /* Host. NULL implies INADDR_ANY */
+ int port) /* Port number */
{
struct hostent *hostent; /* Host database entry */
struct in_addr addr; /* For 64/32 bit madness */
@@ -1332,10 +1331,10 @@ CreateSocketAddress(sockaddrPtr, host, port)
*/
static int
-WaitForSocketEvent(infoPtr, events, errorCodePtr)
- SocketInfo *infoPtr; /* Information about this socket. */
- int events; /* Events to look for. */
- int *errorCodePtr; /* Where to store errors? */
+WaitForSocketEvent(
+ SocketInfo *infoPtr, /* Information about this socket. */
+ int events, /* Events to look for. */
+ int *errorCodePtr) /* Where to store errors? */
{
int result = 1;
int oldMode;
@@ -1400,13 +1399,13 @@ WaitForSocketEvent(infoPtr, events, errorCodePtr)
*/
Tcl_Channel
-Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async)
- Tcl_Interp *interp; /* For error reporting; can be NULL. */
- int port; /* Port number to open. */
- CONST char *host; /* Host on which to open port. */
- CONST char *myaddr; /* Client-side address */
- int myport; /* Client-side port */
- int async; /* If nonzero, should connect client socket
+Tcl_OpenTcpClient(
+ Tcl_Interp *interp, /* For error reporting; can be NULL. */
+ int port, /* Port number to open. */
+ CONST char *host, /* Host on which to open port. */
+ CONST char *myaddr, /* Client-side address */
+ int myport, /* Client-side port */
+ int async) /* If nonzero, should connect client socket
* asynchronously. */
{
SocketInfo *infoPtr;
@@ -1461,8 +1460,8 @@ Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async)
*/
Tcl_Channel
-Tcl_MakeTcpClientChannel(sock)
- ClientData sock; /* The socket to wrap up into a channel. */
+Tcl_MakeTcpClientChannel(
+ ClientData sock) /* The socket to wrap up into a channel. */
{
SocketInfo *infoPtr;
char channelName[16 + TCL_INTEGER_SPACE];
@@ -1515,14 +1514,14 @@ Tcl_MakeTcpClientChannel(sock)
*/
Tcl_Channel
-Tcl_OpenTcpServer(interp, port, host, acceptProc, acceptProcData)
- Tcl_Interp *interp; /* For error reporting - may be NULL. */
- int port; /* Port number to open. */
- CONST char *host; /* Name of local host. */
- Tcl_TcpAcceptProc *acceptProc;
+Tcl_OpenTcpServer(
+ Tcl_Interp *interp, /* For error reporting - may be NULL. */
+ int port, /* Port number to open. */
+ CONST char *host, /* Name of local host. */
+ Tcl_TcpAcceptProc *acceptProc,
/* Callback for accepting connections from new
* clients. */
- ClientData acceptProcData; /* Data for the callback. */
+ ClientData acceptProcData) /* Data for the callback. */
{
SocketInfo *infoPtr;
char channelName[16 + TCL_INTEGER_SPACE];
@@ -1574,8 +1573,8 @@ Tcl_OpenTcpServer(interp, port, host, acceptProc, acceptProcData)
*/
static void
-TcpAccept(infoPtr)
- SocketInfo *infoPtr; /* Socket to accept. */
+TcpAccept(
+ SocketInfo *infoPtr) /* Socket to accept. */
{
SOCKET newSocket;
SocketInfo *newInfoPtr;
@@ -1682,11 +1681,11 @@ TcpAccept(infoPtr)
*/
static int
-TcpInputProc(instanceData, buf, toRead, errorCodePtr)
- ClientData instanceData; /* The socket state. */
- char *buf; /* Where to store data. */
- int toRead; /* Maximum number of bytes to read. */
- int *errorCodePtr; /* Where to store error codes. */
+TcpInputProc(
+ ClientData instanceData, /* The socket state. */
+ char *buf, /* Where to store data. */
+ int toRead, /* Maximum number of bytes to read. */
+ int *errorCodePtr) /* Where to store error codes. */
{
SocketInfo *infoPtr = (SocketInfo *) instanceData;
int bytesRead;
@@ -1808,11 +1807,11 @@ TcpInputProc(instanceData, buf, toRead, errorCodePtr)
*/
static int
-TcpOutputProc(instanceData, buf, toWrite, errorCodePtr)
- ClientData instanceData; /* The socket state. */
- CONST char *buf; /* Where to get data. */
- int toWrite; /* Maximum number of bytes to write. */
- int *errorCodePtr; /* Where to store error codes. */
+TcpOutputProc(
+ ClientData instanceData, /* The socket state. */
+ CONST char *buf, /* Where to get data. */
+ int toWrite, /* Maximum number of bytes to write. */
+ int *errorCodePtr) /* Where to store error codes. */
{
SocketInfo *infoPtr = (SocketInfo *) instanceData;
int bytesWritten;
@@ -1917,7 +1916,7 @@ TcpOutputProc(instanceData, buf, toWrite, errorCodePtr)
*/
static int
-TcpSetOptionProc (
+TcpSetOptionProc(
ClientData instanceData, /* Socket state. */
Tcl_Interp *interp, /* For error reporting - can be NULL. */
CONST char *optionName, /* Name of the option to set. */
@@ -2007,13 +2006,13 @@ TcpSetOptionProc (
*/
static int
-TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
- ClientData instanceData; /* Socket state. */
- Tcl_Interp *interp; /* For error reporting - can be NULL */
- CONST char *optionName; /* Name of the option to retrieve the value
+TcpGetOptionProc(
+ ClientData instanceData, /* Socket state. */
+ Tcl_Interp *interp, /* For error reporting - can be NULL */
+ CONST char *optionName, /* Name of the option to retrieve the value
* for, or NULL to get all options and their
* values. */
- Tcl_DString *dsPtr; /* Where to store the computed value;
+ Tcl_DString *dsPtr) /* Where to store the computed value;
* initialized by caller. */
{
SocketInfo *infoPtr;
@@ -2040,7 +2039,7 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
infoPtr = (SocketInfo *) instanceData;
sock = (int) infoPtr->socket;
- if (optionName != (char *) NULL) {
+ if (optionName != NULL) {
len = strlen(optionName);
}
@@ -2074,13 +2073,13 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
winSock.inet_ntoa(peername.sin_addr));
if (peername.sin_addr.s_addr == 0) {
- hostEntPtr = (struct hostent *) NULL;
+ hostEntPtr = NULL;
} else {
hostEntPtr = winSock.gethostbyaddr(
(char *) &(peername.sin_addr),
sizeof(peername.sin_addr), AF_INET);
}
- if (hostEntPtr != (struct hostent *) NULL) {
+ if (hostEntPtr != NULL) {
Tcl_DStringAppendElement(dsPtr, hostEntPtr->h_name);
} else {
Tcl_DStringAppendElement(dsPtr,
@@ -2105,7 +2104,7 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
TclWinConvertWSAError((DWORD) winSock.WSAGetLastError());
if (interp) {
Tcl_AppendResult(interp, "can't get peername: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
}
return TCL_ERROR;
}
@@ -2122,13 +2121,13 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
Tcl_DStringAppendElement(dsPtr,
winSock.inet_ntoa(sockname.sin_addr));
if (sockname.sin_addr.s_addr == 0) {
- hostEntPtr = (struct hostent *) NULL;
+ hostEntPtr = NULL;
} else {
hostEntPtr = winSock.gethostbyaddr(
(char *) &(sockname.sin_addr),
sizeof(peername.sin_addr), AF_INET);
}
- if (hostEntPtr != (struct hostent *) NULL) {
+ if (hostEntPtr != NULL) {
Tcl_DStringAppendElement(dsPtr, hostEntPtr->h_name);
} else {
Tcl_DStringAppendElement(dsPtr,
@@ -2145,7 +2144,7 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
if (interp) {
TclWinConvertWSAError((DWORD) winSock.WSAGetLastError());
Tcl_AppendResult(interp, "can't get sockname: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
}
return TCL_ERROR;
}
@@ -2220,9 +2219,9 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
*/
static void
-TcpWatchProc(instanceData, mask)
- ClientData instanceData; /* The socket state. */
- int mask; /* Events of interest; an OR-ed combination of
+TcpWatchProc(
+ ClientData instanceData, /* The socket state. */
+ int mask) /* Events of interest; an OR-ed combination of
* TCL_READABLE, TCL_WRITABLE and
* TCL_EXCEPTION. */
{
@@ -2272,10 +2271,10 @@ TcpWatchProc(instanceData, mask)
*/
static int
-TcpGetHandleProc(instanceData, direction, handlePtr)
- ClientData instanceData; /* The socket state. */
- int direction; /* Not used. */
- ClientData *handlePtr; /* Where to store the handle. */
+TcpGetHandleProc(
+ ClientData instanceData, /* The socket state. */
+ int direction, /* Not used. */
+ ClientData *handlePtr) /* Where to store the handle. */
{
SocketInfo *statePtr = (SocketInfo *) instanceData;
@@ -2300,7 +2299,8 @@ TcpGetHandleProc(instanceData, direction, handlePtr)
*/
static DWORD WINAPI
-SocketThread(LPVOID arg)
+SocketThread(
+ LPVOID arg)
{
MSG msg;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)(arg);
@@ -2350,11 +2350,11 @@ SocketThread(LPVOID arg)
*/
static LRESULT CALLBACK
-SocketProc(hwnd, message, wParam, lParam)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
+SocketProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
int event, error;
SOCKET socket;
@@ -2501,7 +2501,7 @@ SocketProc(hwnd, message, wParam, lParam)
*/
CONST char *
-Tcl_GetHostName()
+Tcl_GetHostName(void)
{
return Tcl_GetString(TclGetProcessGlobalValue(&hostName));
}
@@ -2521,10 +2521,10 @@ Tcl_GetHostName()
*/
void
-InitializeHostName(valuePtr, lengthPtr, encodingPtr)
- char **valuePtr;
- int *lengthPtr;
- Tcl_Encoding *encodingPtr;
+InitializeHostName(
+ char **valuePtr,
+ int *lengthPtr,
+ Tcl_Encoding *encodingPtr)
{
WCHAR wbuf[MAX_COMPUTERNAME_LENGTH + 1];
DWORD length = sizeof(wbuf) / sizeof(WCHAR);
@@ -2581,8 +2581,12 @@ InitializeHostName(valuePtr, lengthPtr, encodingPtr)
*/
int
-TclWinGetSockOpt(SOCKET s, int level, int optname, char * optval,
- int FAR *optlen)
+TclWinGetSockOpt(
+ SOCKET s,
+ int level,
+ int optname,
+ char * optval,
+ int FAR *optlen)
{
/*
* Check that WinSock is initialized; do not call it if not, to prevent
@@ -2598,8 +2602,12 @@ TclWinGetSockOpt(SOCKET s, int level, int optname, char * optval,
}
int
-TclWinSetSockOpt(SOCKET s, int level, int optname, const char * optval,
- int optlen)
+TclWinSetSockOpt(
+ SOCKET s,
+ int level,
+ int optname,
+ const char * optval,
+ int optlen)
{
/*
* Check that WinSock is initialized; do not call it if not, to prevent
@@ -2615,7 +2623,8 @@ TclWinSetSockOpt(SOCKET s, int level, int optname, const char * optval,
}
u_short
-TclWinNToHS(u_short netshort)
+TclWinNToHS(
+ u_short netshort)
{
/*
* Check that WinSock is initialized; do not call it if not, to prevent
@@ -2631,7 +2640,9 @@ TclWinNToHS(u_short netshort)
}
struct servent *
-TclWinGetServByName(const char * name, const char * proto)
+TclWinGetServByName(
+ const char *name,
+ const char *proto)
{
/*
* Check that WinSock is initialized; do not call it if not, to prevent
@@ -2640,7 +2651,7 @@ TclWinGetServByName(const char * name, const char * proto)
*/
if (!SocketsEnabled()) {
- return (struct servent *) NULL;
+ return NULL;
}
return winSock.getservbyname(name, proto);
@@ -2663,9 +2674,9 @@ TclWinGetServByName(const char * name, const char * proto)
*/
static void
-TcpThreadActionProc (instanceData, action)
- ClientData instanceData;
- int action;
+TcpThreadActionProc(
+ ClientData instanceData,
+ int action)
{
ThreadSpecificData *tsdPtr;
SocketInfo *infoPtr = (SocketInfo *) instanceData;
diff --git a/win/tclWinTest.c b/win/tclWinTest.c
index a5af926..71d76e6 100644
--- a/win/tclWinTest.c
+++ b/win/tclWinTest.c
@@ -1,50 +1,44 @@
-/*
+/*
* tclWinTest.c --
*
* Contains commands for platform specific tests on Windows.
*
* Copyright (c) 1996 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinTest.c,v 1.11 2004/06/05 17:31:08 kennykb Exp $
+ * RCS: @(#) $Id: tclWinTest.c,v 1.12 2005/11/04 00:06:51 dkf Exp $
*/
#define USE_COMPAT_CONST
#include "tclInt.h"
/*
- * Forward declarations of procedures defined later in this file:
+ * Forward declarations of functions defined later in this file:
*/
-int TclplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
-static int TesteventloopCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, char **argv));
-static int TestvolumetypeCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int TestwinclockCmd _ANSI_ARGS_(( ClientData dummy,
- Tcl_Interp* interp,
- int objc,
- Tcl_Obj *CONST objv[] ));
-static int TestwinsleepCmd _ANSI_ARGS_(( ClientData dummy,
- Tcl_Interp* interp,
- int objc,
- Tcl_Obj *CONST objv[] ));
-static Tcl_ObjCmdProc TestExceptionCmd;
-static int TestwincpuidCmd _ANSI_ARGS_(( ClientData dummy,
- Tcl_Interp* interp,
- int objc,
- Tcl_Obj *CONST objv[] ));
+int TclplatformtestInit(Tcl_Interp *interp);
+static int TesteventloopCmd(ClientData dummy, Tcl_Interp *interp,
+ int argc, char **argv);
+static int TestvolumetypeCmd(ClientData dummy,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int TestwinclockCmd(ClientData dummy, Tcl_Interp* interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int TestwinsleepCmd(ClientData dummy, Tcl_Interp* interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static Tcl_ObjCmdProc TestExceptionCmd;
+static int TestwincpuidCmd(ClientData dummy, Tcl_Interp* interp,
+ int objc, Tcl_Obj *CONST objv[]);
/*
*----------------------------------------------------------------------
*
* TclplatformtestInit --
*
- * Defines commands that test platform specific functionality for
- * Windows platforms.
+ * Defines commands that test platform specific functionality for Windows
+ * platforms.
*
* Results:
* A standard Tcl result.
@@ -56,26 +50,23 @@ static int TestwincpuidCmd _ANSI_ARGS_(( ClientData dummy,
*/
int
-TclplatformtestInit(interp)
- Tcl_Interp *interp; /* Interpreter to add commands to. */
+TclplatformtestInit(
+ Tcl_Interp *interp) /* Interpreter to add commands to. */
{
/*
* Add commands for platform specific tests for Windows here.
*/
Tcl_CreateCommand(interp, "testeventloop", TesteventloopCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateObjCommand(interp, "testvolumetype", TestvolumetypeCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateObjCommand(interp, "testwinclock", TestwinclockCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateObjCommand(interp, "testwincpuid", TestwincpuidCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc*) NULL );
- Tcl_CreateObjCommand( interp,
- "testwinsleep",
- TestwinsleepCmd,
- (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL );
+ (ClientData) 0, NULL);
+ Tcl_CreateObjCommand(interp, "testwinsleep", TestwinsleepCmd,
+ (ClientData) 0, NULL);
Tcl_CreateObjCommand(interp, "testexcept", TestExceptionCmd, NULL, NULL);
return TCL_OK;
}
@@ -85,9 +76,9 @@ TclplatformtestInit(interp)
*
* TesteventloopCmd --
*
- * This procedure implements the "testeventloop" command. It is
- * used to test the Tcl notifier from an "external" event loop
- * (i.e. not Tcl_DoOneEvent()).
+ * This function implements the "testeventloop" command. It is used to
+ * test the Tcl notifier from an "external" event loop (i.e. not
+ * Tcl_DoOneEvent()).
*
* Results:
* A standard Tcl result.
@@ -99,19 +90,19 @@ TclplatformtestInit(interp)
*/
static int
-TesteventloopCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+TesteventloopCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ char **argv) /* Argument strings. */
{
- static int *framePtr = NULL; /* Pointer to integer on stack frame of
- * innermost invocation of the "wait"
- * subcommand. */
+ static int *framePtr = NULL;/* Pointer to integer on stack frame of
+ * innermost invocation of the "wait"
+ * subcommand. */
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0],
- " option ... \"", (char *) NULL);
+ " option ... \"", NULL);
return TCL_ERROR;
}
if (strcmp(argv[1], "done") == 0) {
@@ -152,7 +143,7 @@ TesteventloopCmd(clientData, interp, argc, argv)
framePtr = oldFramePtr;
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be done or wait", (char *) NULL);
+ "\": must be done or wait", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -163,8 +154,8 @@ TesteventloopCmd(clientData, interp, argc, argv)
*
* Testvolumetype --
*
- * This procedure implements the "testvolumetype" command. It is
- * used to check the volume type (FAT, NTFS) of a volume.
+ * This function implements the "testvolumetype" command. It is used to
+ * check the volume type (FAT, NTFS) of a volume.
*
* Results:
* A standard Tcl result.
@@ -176,11 +167,11 @@ TesteventloopCmd(clientData, interp, argc, argv)
*/
static int
-TestvolumetypeCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+TestvolumetypeCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
#define VOL_BUF_SIZE 32
int found;
@@ -200,12 +191,12 @@ TestvolumetypeCmd(clientData, interp, objc, objv)
} else {
path = NULL;
}
- found = GetVolumeInformationA(path, NULL, 0, NULL, NULL,
+ found = GetVolumeInformationA(path, NULL, 0, NULL, NULL,
NULL, volType, VOL_BUF_SIZE);
if (found == 0) {
Tcl_AppendResult(interp, "could not get volume type for \"",
- (path?path:""), "\"", (char *) NULL);
+ (path?path:""), "\"", NULL);
TclWinConvertError(GetLastError());
return TCL_ERROR;
}
@@ -241,54 +232,50 @@ TestvolumetypeCmd(clientData, interp, objc, objv)
*/
static int
-TestwinclockCmd( ClientData dummy,
- /* Unused */
- Tcl_Interp* interp,
- /* Tcl interpreter */
- int objc,
- /* Argument count */
- Tcl_Obj *CONST objv[] )
- /* Argument vector */
+TestwinclockCmd(
+ ClientData dummy, /* Unused */
+ Tcl_Interp* interp, /* Tcl interpreter */
+ int objc, /* Argument count */
+ Tcl_Obj *CONST objv[]) /* Argument vector */
{
CONST static FILETIME posixEpoch = { 0xD53E8000, 0x019DB1DE };
- /* The Posix epoch, expressed as a
- * Windows FILETIME */
+ /* The Posix epoch, expressed as a Windows
+ * FILETIME */
Tcl_Time tclTime; /* Tcl clock */
FILETIME sysTime; /* System clock */
Tcl_Obj* result; /* Result of the command */
LARGE_INTEGER t1, t2;
LARGE_INTEGER p1, p2;
- if ( objc != 1 ) {
- Tcl_WrongNumArgs( interp, 1, objv, "" );
+ if (objc != 1) {
+ Tcl_WrongNumArgs(interp, 1, objv, "");
return TCL_ERROR;
}
- QueryPerformanceCounter( &p1 );
+ QueryPerformanceCounter(&p1);
- Tcl_GetTime( &tclTime );
- GetSystemTimeAsFileTime( &sysTime );
+ Tcl_GetTime(&tclTime);
+ GetSystemTimeAsFileTime(&sysTime);
t1.LowPart = posixEpoch.dwLowDateTime;
t1.HighPart = posixEpoch.dwHighDateTime;
t2.LowPart = sysTime.dwLowDateTime;
t2.HighPart = sysTime.dwHighDateTime;
t2.QuadPart -= t1.QuadPart;
- QueryPerformanceCounter( &p2 );
+ QueryPerformanceCounter(&p2);
result = Tcl_NewObj();
- Tcl_ListObjAppendElement
- ( interp, result, Tcl_NewIntObj( (int) (t2.QuadPart / 10000000 ) ) );
- Tcl_ListObjAppendElement
- ( interp, result,
- Tcl_NewIntObj( (int) ( (t2.QuadPart / 10 ) % 1000000 ) ) );
- Tcl_ListObjAppendElement( interp, result, Tcl_NewIntObj( tclTime.sec ) );
- Tcl_ListObjAppendElement( interp, result, Tcl_NewIntObj( tclTime.usec ) );
+ Tcl_ListObjAppendElement(interp, result,
+ Tcl_NewIntObj((int) (t2.QuadPart / 10000000)));
+ Tcl_ListObjAppendElement(interp, result,
+ Tcl_NewIntObj((int) ((t2.QuadPart / 10) % 1000000)));
+ Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(tclTime.sec));
+ Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(tclTime.usec));
- Tcl_ListObjAppendElement( interp, result, Tcl_NewWideIntObj( p1.QuadPart ) );
- Tcl_ListObjAppendElement( interp, result, Tcl_NewWideIntObj( p2.QuadPart ) );
+ Tcl_ListObjAppendElement(interp, result, Tcl_NewWideIntObj(p1.QuadPart));
+ Tcl_ListObjAppendElement(interp, result, Tcl_NewWideIntObj(p2.QuadPart));
- Tcl_SetObjResult( interp, result );
+ Tcl_SetObjResult(interp, result);
return TCL_OK;
}
@@ -317,10 +304,11 @@ TestwinclockCmd( ClientData dummy,
*/
static int
-TestwincpuidCmd( ClientData dummy,
- Tcl_Interp* interp, /* Tcl interpreter */
- int objc, /* Parameter count */
- Tcl_Obj *CONST * objv ) /* Parameter vector */
+TestwincpuidCmd(
+ ClientData dummy,
+ Tcl_Interp* interp, /* Tcl interpreter */
+ int objc, /* Parameter count */
+ Tcl_Obj *CONST * objv) /* Parameter vector */
{
int status;
int index;
@@ -328,25 +316,24 @@ TestwincpuidCmd( ClientData dummy,
Tcl_Obj * regsObjs[4];
int i;
- if ( objc != 2 ) {
- Tcl_WrongNumArgs( interp, 1, objv, "eax" );
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "eax");
return TCL_ERROR;
}
- if ( Tcl_GetIntFromObj( interp, objv[1], &index ) != TCL_OK ) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &index) != TCL_OK) {
return TCL_ERROR;
}
- status = TclWinCPUID( (unsigned int) index, regs );
- if ( status != TCL_OK ) {
- Tcl_SetObjResult( interp, Tcl_NewStringObj( "operation not available",
- -1 ) );
+ status = TclWinCPUID((unsigned int) index, regs);
+ if (status != TCL_OK) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj("operation not available", -1));
return status;
}
- for ( i = 0; i < 4; ++i ) {
- regsObjs[i] = Tcl_NewIntObj( (int) regs[i] );
+ for (i=0 ; i<4 ; ++i) {
+ regsObjs[i] = Tcl_NewIntObj((int) regs[i]);
}
- Tcl_SetObjResult( interp, Tcl_NewListObj( 4, regsObjs ) );
+ Tcl_SetObjResult(interp, Tcl_NewListObj(4, regsObjs));
return TCL_OK;
-
}
/*
@@ -354,8 +341,8 @@ TestwincpuidCmd( ClientData dummy,
*
* TestwinsleepCmd --
*
- * Causes this process to wait for the given number of milliseconds
- * by means of a direct call to Sleep.
+ * Causes this process to wait for the given number of milliseconds by
+ * means of a direct call to Sleep.
*
* Usage:
* testwinsleep <n>
@@ -373,24 +360,21 @@ TestwincpuidCmd( ClientData dummy,
*/
static int
-TestwinsleepCmd( ClientData clientData,
- /* Unused */
- Tcl_Interp* interp,
- /* Tcl interpreter */
- int objc,
- /* Parameter count */
- Tcl_Obj * CONST * objv )
- /* Parameter vector */
+TestwinsleepCmd(
+ ClientData clientData, /* Unused */
+ Tcl_Interp* interp, /* Tcl interpreter */
+ int objc, /* Parameter count */
+ Tcl_Obj * CONST * objv) /* Parameter vector */
{
int ms;
- if ( objc != 2 ) {
- Tcl_WrongNumArgs( interp, 1, objv, "ms" );
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "ms");
return TCL_ERROR;
}
- if ( Tcl_GetIntFromObj( interp, objv[1], &ms ) != TCL_OK ) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &ms) != TCL_OK) {
return TCL_ERROR;
}
- Sleep( (DWORD) ms );
+ Sleep((DWORD) ms);
return TCL_OK;
}
@@ -399,8 +383,8 @@ TestwinsleepCmd( ClientData clientData,
*
* TestExceptionCmd --
*
- * Causes this process to end with the named exception. Used for
- * testing Tcl_WaitPid().
+ * Causes this process to end with the named exception. Used for testing
+ * Tcl_WaitPid().
*
* Usage:
* testexcept <type>
@@ -473,7 +457,7 @@ TestExceptionCmd(
};
int cmd;
- if ( objc != 2 ) {
+ if (objc != 2) {
Tcl_WrongNumArgs(interp, 0, objv, "<type-of-exception>");
return TCL_ERROR;
}
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index a54ff36..66a685c 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.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: tclWinThrd.c,v 1.40 2005/08/11 22:06:47 kennykb Exp $
+ * RCS: @(#) $Id: tclWinThrd.c,v 1.41 2005/11/04 00:06:51 dkf Exp $
*/
#include "tclWinInt.h"
@@ -144,13 +144,13 @@ typedef struct allocMutex {
*/
int
-TclpThreadCreate(idPtr, proc, clientData, stackSize, flags)
- Tcl_ThreadId *idPtr; /* Return, the ID of the thread. */
- Tcl_ThreadCreateProc proc; /* Main() function of the thread. */
- ClientData clientData; /* The one argument to Main(). */
- int stackSize; /* Size of stack for the new thread. */
- int flags; /* Flags controlling behaviour of the
- * new thread. */
+TclpThreadCreate(
+ Tcl_ThreadId *idPtr, /* Return, the ID of the thread. */
+ Tcl_ThreadCreateProc proc, /* Main() function of the thread. */
+ ClientData clientData, /* The one argument to Main(). */
+ int stackSize, /* Size of stack for the new thread. */
+ int flags) /* Flags controlling behaviour of the new
+ * thread. */
{
HANDLE tHandle;
@@ -202,9 +202,9 @@ TclpThreadCreate(idPtr, proc, clientData, stackSize, flags)
*/
int
-Tcl_JoinThread(threadId, result)
- Tcl_ThreadId threadId; /* Id of the thread to wait upon */
- int *result; /* Reference to the storage the result of the
+Tcl_JoinThread(
+ Tcl_ThreadId threadId, /* Id of the thread to wait upon */
+ int *result) /* Reference to the storage the result of the
* thread we wait upon will be written into. */
{
return TclJoinThread(threadId, result);
@@ -227,8 +227,8 @@ Tcl_JoinThread(threadId, result)
*/
void
-TclpThreadExit(status)
- int status;
+TclpThreadExit(
+ int status)
{
EnterCriticalSection(&joinLock);
TclSignalExitThread(Tcl_GetCurrentThread(), status);
@@ -258,7 +258,7 @@ TclpThreadExit(status)
*/
Tcl_ThreadId
-Tcl_GetCurrentThread()
+Tcl_GetCurrentThread(void)
{
return (Tcl_ThreadId) GetCurrentThreadId();
}
@@ -283,7 +283,7 @@ Tcl_GetCurrentThread()
*/
void
-TclpInitLock()
+TclpInitLock(void)
{
if (!init) {
/*
@@ -319,7 +319,7 @@ TclpInitLock()
*/
void
-TclpInitUnlock()
+TclpInitUnlock(void)
{
LeaveCriticalSection(&initLock);
}
@@ -345,7 +345,7 @@ TclpInitUnlock()
*/
void
-TclpMasterLock()
+TclpMasterLock(void)
{
if (!init) {
/*
@@ -381,7 +381,7 @@ TclpMasterLock()
*/
void
-TclpMasterUnlock()
+TclpMasterUnlock(void)
{
LeaveCriticalSection(&masterLock);
}
@@ -406,7 +406,7 @@ TclpMasterUnlock()
*/
Tcl_Mutex *
-Tcl_GetAllocMutex()
+Tcl_GetAllocMutex(void)
{
#ifdef TCL_THREADS
if (!allocOnce) {
@@ -438,7 +438,7 @@ Tcl_GetAllocMutex()
*/
void
-TclFinalizeLock()
+TclFinalizeLock(void)
{
MASTER_LOCK;
DeleteCriticalSection(&joinLock);
@@ -469,7 +469,7 @@ TclFinalizeLock()
#ifdef TCL_THREADS
/* locally used prototype */
-static void FinalizeConditionEvent(ClientData data);
+static void FinalizeConditionEvent(ClientData data);
/*
*----------------------------------------------------------------------
@@ -489,8 +489,8 @@ static void FinalizeConditionEvent(ClientData data);
*/
void
-Tcl_MutexLock(mutexPtr)
- Tcl_Mutex *mutexPtr; /* The lock */
+Tcl_MutexLock(
+ Tcl_Mutex *mutexPtr) /* The lock */
{
CRITICAL_SECTION *csPtr;
if (*mutexPtr == NULL) {
@@ -529,8 +529,8 @@ Tcl_MutexLock(mutexPtr)
*/
void
-Tcl_MutexUnlock(mutexPtr)
- Tcl_Mutex *mutexPtr; /* The lock */
+Tcl_MutexUnlock(
+ Tcl_Mutex *mutexPtr) /* The lock */
{
CRITICAL_SECTION *csPtr = *((CRITICAL_SECTION **)mutexPtr);
LeaveCriticalSection(csPtr);
@@ -554,13 +554,13 @@ Tcl_MutexUnlock(mutexPtr)
*/
void
-TclpFinalizeMutex(mutexPtr)
- Tcl_Mutex *mutexPtr;
+TclpFinalizeMutex(
+ Tcl_Mutex *mutexPtr)
{
CRITICAL_SECTION *csPtr = *(CRITICAL_SECTION **)mutexPtr;
if (csPtr != NULL) {
DeleteCriticalSection(csPtr);
- ckfree((char *)csPtr);
+ ckfree((char *) csPtr);
*mutexPtr = NULL;
}
}
@@ -588,10 +588,10 @@ TclpFinalizeMutex(mutexPtr)
*/
void
-Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
- Tcl_Condition *condPtr; /* Really (WinCondition **) */
- Tcl_Mutex *mutexPtr; /* Really (CRITICAL_SECTION **) */
- Tcl_Time *timePtr; /* Timeout on waiting period */
+Tcl_ConditionWait(
+ Tcl_Condition *condPtr, /* Really (WinCondition **) */
+ Tcl_Mutex *mutexPtr, /* Really (CRITICAL_SECTION **) */
+ Tcl_Time *timePtr) /* Timeout on waiting period */
{
WinCondition *winCondPtr; /* Per-condition queue head */
CRITICAL_SECTION *csPtr; /* Caller's Mutex, after casting */
@@ -760,8 +760,8 @@ Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
*/
void
-Tcl_ConditionNotify(condPtr)
- Tcl_Condition *condPtr;
+Tcl_ConditionNotify(
+ Tcl_Condition *condPtr)
{
WinCondition *winCondPtr;
ThreadSpecificData *tsdPtr;
@@ -813,8 +813,8 @@ Tcl_ConditionNotify(condPtr)
*/
static void
-FinalizeConditionEvent(data)
- ClientData data;
+FinalizeConditionEvent(
+ ClientData data)
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) data;
tsdPtr->flags = WIN_THREAD_DEAD;
@@ -841,8 +841,8 @@ FinalizeConditionEvent(data)
*/
void
-TclpFinalizeCondition(condPtr)
- Tcl_Condition *condPtr;
+TclpFinalizeCondition(
+ Tcl_Condition *condPtr)
{
WinCondition *winCondPtr = *(WinCondition **)condPtr;
@@ -855,7 +855,7 @@ TclpFinalizeCondition(condPtr)
if (winCondPtr != NULL) {
DeleteCriticalSection(&winCondPtr->condLock);
- ckfree((char *)winCondPtr);
+ ckfree((char *) winCondPtr);
*condPtr = NULL;
}
}
@@ -880,8 +880,8 @@ TclpNewAllocMutex(void)
}
void
-TclpFreeAllocMutex(mutex)
- Tcl_Mutex *mutex; /* The alloc mutex to free. */
+TclpFreeAllocMutex(
+ Tcl_Mutex *mutex) /* The alloc mutex to free. */
{
allocMutex *lockPtr = (allocMutex *) mutex;
@@ -918,7 +918,8 @@ TclpGetAllocCache(void)
}
void
-TclpSetAllocCache(void *ptr)
+TclpSetAllocCache(
+ void *ptr)
{
BOOL success;
success = TlsSetValue(tlsKey, ptr);
@@ -928,7 +929,8 @@ TclpSetAllocCache(void *ptr)
}
void
-TclpFreeAllocCache(void *ptr)
+TclpFreeAllocCache(
+ void *ptr)
{
BOOL success;
@@ -941,7 +943,7 @@ TclpFreeAllocCache(void *ptr)
TclFreeAllocCache(ptr);
success = TlsSetValue(tlsKey, NULL);
if (!success) {
- panic("TlsSetValue failed from TclpFreeAllocCache!");
+ Tcl_Panic("TlsSetValue failed from TclpFreeAllocCache!");
}
} else if (once) {
/*
@@ -957,7 +959,6 @@ TclpFreeAllocCache(void *ptr)
}
}
-
#endif /* USE_THREAD_ALLOC */
#endif /* TCL_THREADS */
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index 0b8ebfa..c1e2b6e 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclWinTime.c --
*
* Contains Windows specific versions of Tcl functions that obtain time
@@ -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: tclWinTime.c,v 1.32 2005/11/03 00:17:31 patthoyts Exp $
+ * RCS: @(#) $Id: tclWinTime.c,v 1.33 2005/11/04 00:06:51 dkf Exp $
*/
#include "tclInt.h"
@@ -67,7 +67,7 @@ typedef struct TimeInfo {
/*
* The following values are used for calculating virtual time. Virtual
* time is always equal to:
- * lastFileTime + (current perf counter - lastCounter)
+ * lastFileTime + (current perf counter - lastCounter)
* * 10000000 / curCounterFreq
* and lastFileTime and lastCounter are updated any time that virtual time
* is returned to a caller.
@@ -119,7 +119,7 @@ static struct tm * ComputeGMT(const time_t *tp);
static void StopCalibration(ClientData clientData);
static DWORD WINAPI CalibrationThread(LPVOID arg);
static void UpdateTimeEachSecond(void);
-static void ResetCounterSamples(Tcl_WideUInt fileTime,
+static void ResetCounterSamples(Tcl_WideUInt fileTime,
Tcl_WideInt perfCounter, Tcl_WideInt perfFreq);
static Tcl_WideInt AccumulateSample(Tcl_WideInt perfCounter,
Tcl_WideUInt fileTime);
@@ -154,7 +154,7 @@ ClientData tclTimeClientData = NULL;
*/
unsigned long
-TclpGetSeconds()
+TclpGetSeconds(void)
{
Tcl_Time t;
@@ -182,7 +182,7 @@ TclpGetSeconds()
*/
unsigned long
-TclpGetClicks()
+TclpGetClicks(void)
{
/*
* Use the Tcl_GetTime abstraction to get the time in microseconds, as
@@ -217,8 +217,8 @@ TclpGetClicks()
*/
int
-TclpGetTimeZone(currentTime)
- unsigned long currentTime;
+TclpGetTimeZone(
+ unsigned long currentTime)
{
int timeZone;
@@ -251,8 +251,8 @@ TclpGetTimeZone(currentTime)
*/
void
-Tcl_GetTime(timePtr)
- Tcl_Time *timePtr; /* Location to store time information. */
+Tcl_GetTime(
+ Tcl_Time *timePtr) /* Location to store time information. */
{
(*tclGetTimeProcPtr) (timePtr, tclTimeClientData);
}
@@ -275,9 +275,9 @@ Tcl_GetTime(timePtr)
*/
static void
-NativeScaleTime(timePtr, clientData)
- Tcl_Time *timePtr;
- ClientData clientData;
+NativeScaleTime(
+ Tcl_Time *timePtr,
+ ClientData clientData)
{
/*
* Native scale is 1:1. Nothing is done.
@@ -307,9 +307,9 @@ NativeScaleTime(timePtr, clientData)
*/
static void
-NativeGetTime(timePtr, clientData)
- Tcl_Time *timePtr;
- ClientData clientData;
+NativeGetTime(
+ Tcl_Time *timePtr,
+ ClientData clientData)
{
struct timeb t;
int useFtime = 1; /* Flag == TRUE if we need to fall back on
@@ -322,7 +322,7 @@ NativeGetTime(timePtr, clientData)
* avoids an extra mutex lock in the common case.
*/
- if (!timeInfo.initialized) {
+ if (!timeInfo.initialized) {
TclpInitLock();
if (!timeInfo.initialized) {
timeInfo.perfCounterAvailable =
@@ -379,7 +379,7 @@ NativeGetTime(timePtr, clientData)
&& regs[1] == 0x756e6547 /* "Genu" */
&& regs[3] == 0x49656e69 /* "ineI" */
&& regs[2] == 0x6c65746e /* "ntel" */
- && TclWinCPUID(1, regs) == TCL_OK
+ && TclWinCPUID(1, regs) == TCL_OK
&& ((regs[0]&0x00000F00) == 0x00000F00 /* Pentium 4 */
|| ((regs[0] & 0x00F00000) /* Extended family */
&& (regs[3] & 0x10000000))) /* Hyperthread */
@@ -446,7 +446,7 @@ NativeGetTime(timePtr, clientData)
QueryPerformanceCounter(&curCounter);
- /*
+ /*
* If it appears to be more than 1.1 seconds since the last trip
* through the calibration loop, the performance counter may have
* jumped forward. (See MSDN Knowledge Base article Q274323 for a
@@ -471,7 +471,7 @@ NativeGetTime(timePtr, clientData)
LeaveCriticalSection(&timeInfo.cs);
}
-
+
if (useFtime) {
/*
* High resolution timer is not available. Just use ftime.
@@ -502,8 +502,8 @@ NativeGetTime(timePtr, clientData)
*/
static void
-StopCalibration(ClientData unused)
- /* Client data is unused */
+StopCalibration(
+ ClientData unused) /* Client data is unused */
{
SetEvent(timeInfo.exitEvent);
@@ -534,7 +534,8 @@ StopCalibration(ClientData unused)
*/
char *
-TclpGetTZName(int dst)
+TclpGetTZName(
+ int dst)
{
int len;
char *zone, *p;
@@ -595,11 +596,11 @@ TclpGetTZName(int dst)
dst = 0;
}
encoding = Tcl_GetEncoding(NULL, "unicode");
- Tcl_ExternalToUtf(NULL, encoding,
- (char *) ((dst) ? tz.DaylightName : tz.StandardName), -1,
+ Tcl_ExternalToUtf(NULL, encoding,
+ (char *) ((dst) ? tz.DaylightName : tz.StandardName), -1,
0, NULL, name, sizeof(tsdPtr->tzName), NULL, NULL, NULL);
Tcl_FreeEncoding(encoding);
- }
+ }
return name;
}
@@ -622,9 +623,9 @@ TclpGetTZName(int dst)
*/
struct tm *
-TclpGetDate(t, useGMT)
- CONST time_t *t;
- int useGMT;
+TclpGetDate(
+ CONST time_t *t,
+ int useGMT)
{
struct tm *tmPtr;
time_t time;
@@ -660,7 +661,7 @@ TclpGetDate(t, useGMT)
}
time = *t - timezone;
-
+
/*
* If we aren't near to overflowing the long, just add the bias and
* use the normal calculation. Otherwise we will need to adjust the
@@ -685,7 +686,7 @@ TclpGetDate(t, useGMT)
tmPtr->tm_sec += 60;
time -= 60;
}
-
+
time = tmPtr->tm_min + time/60;
tmPtr->tm_min = (int)(time % 60);
if (tmPtr->tm_min < 0) {
@@ -729,8 +730,8 @@ TclpGetDate(t, useGMT)
*/
static struct tm *
-ComputeGMT(tp)
- const time_t *tp;
+ComputeGMT(
+ const time_t *tp)
{
struct tm *tmPtr;
long tmp, rem;
@@ -787,7 +788,7 @@ ComputeGMT(tp)
tmPtr->tm_yday = rem / SECSPERDAY;
rem %= SECSPERDAY;
-
+
/*
* Compute the time of day.
*/
@@ -851,7 +852,8 @@ ComputeGMT(tp)
*/
static DWORD WINAPI
-CalibrationThread(LPVOID arg)
+CalibrationThread(
+ LPVOID arg)
{
FILETIME curFileTime;
DWORD waitResult;
@@ -918,7 +920,7 @@ CalibrationThread(LPVOID arg)
*/
static void
-UpdateTimeEachSecond()
+UpdateTimeEachSecond(void)
{
LARGE_INTEGER curPerfCounter;
/* Current value returned from
@@ -989,11 +991,11 @@ UpdateTimeEachSecond()
* sec, so that virtual time 2 sec from now will be
*
* vt1 = 20000000 + curFileTime
- *
+ *
* The frequency that we need to use to drift the counter back into place
* is estFreq * 20000000 / (vt1 - vt0)
*/
-
+
vt0 = 10000000 * (curPerfCounter.QuadPart
- timeInfo.perfCounterLastCall.QuadPart)
/ timeInfo.curCounterFreq.QuadPart
@@ -1090,7 +1092,9 @@ ResetCounterSamples(
*/
static Tcl_WideInt
-AccumulateSample(Tcl_WideInt perfCounter, Tcl_WideUInt fileTime)
+AccumulateSample(
+ Tcl_WideInt perfCounter,
+ Tcl_WideUInt fileTime)
{
Tcl_WideUInt workFTSample; /* File time sample being removed from or
* added to the circular buffer. */
@@ -1128,22 +1132,22 @@ AccumulateSample(Tcl_WideInt perfCounter, Tcl_WideUInt fileTime)
/*
* Estimate the frequency.
*/
-
+
workPCSample = timeInfo.perfCounterSample[timeInfo.sampleNo];
workFTSample = timeInfo.fileTimeSample[timeInfo.sampleNo];
estFreq = 10000000 * (perfCounter - workPCSample)
/ (fileTime - workFTSample);
timeInfo.perfCounterSample[timeInfo.sampleNo] = perfCounter;
timeInfo.fileTimeSample[timeInfo.sampleNo] = (Tcl_WideInt) fileTime;
-
+
/*
* Advance the sample number.
*/
-
+
if (++timeInfo.sampleNo >= SAMPLES) {
timeInfo.sampleNo = 0;
- }
-
+ }
+
return estFreq;
}
}
@@ -1165,8 +1169,8 @@ AccumulateSample(Tcl_WideInt perfCounter, Tcl_WideUInt fileTime)
*/
struct tm *
-TclpGmtime(timePtr)
- CONST time_t *timePtr; /* Pointer to the number of seconds since the
+TclpGmtime(
+ CONST time_t *timePtr) /* Pointer to the number of seconds since the
* local system's epoch */
{
/*
@@ -1196,8 +1200,8 @@ TclpGmtime(timePtr)
*/
struct tm *
-TclpLocaltime(timePtr)
- CONST time_t *timePtr; /* Pointer to the number of seconds since the
+TclpLocaltime(
+ CONST time_t *timePtr) /* Pointer to the number of seconds since the
* local system's epoch */
{
@@ -1228,10 +1232,10 @@ TclpLocaltime(timePtr)
*/
void
-Tcl_SetTimeProc(getProc, scaleProc, clientData)
- Tcl_GetTimeProc *getProc;
- Tcl_ScaleTimeProc *scaleProc;
- ClientData clientData;
+Tcl_SetTimeProc(
+ Tcl_GetTimeProc *getProc,
+ Tcl_ScaleTimeProc *scaleProc,
+ ClientData clientData)
{
tclGetTimeProcPtr = getProc;
tclScaleTimeProcPtr = scaleProc;
@@ -1255,10 +1259,10 @@ Tcl_SetTimeProc(getProc, scaleProc, clientData)
*/
void
-Tcl_QueryTimeProc(getProc, scaleProc, clientData)
- Tcl_GetTimeProc ** getProc;
- Tcl_ScaleTimeProc **scaleProc;
- ClientData *clientData;
+Tcl_QueryTimeProc(
+ Tcl_GetTimeProc **getProc,
+ Tcl_ScaleTimeProc **scaleProc,
+ ClientData *clientData)
{
if (getProc) {
*getProc = tclGetTimeProcPtr;