Tcl Source Code

Check-in [e1542205dd]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixed compiler errors/warnings on VC++ 5.0/6.0 and HP-UX native compiler without -Aa or -Ae
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-1-branch-old
Files: files | file ages | folders
SHA1: e1542205dd4859517b062ddac6f39b288d123984
User & Date: redman 1999-03-25 00:34:15
Context
1999-03-25
01:25
Fix socket code (typo) and test case after looking at it again. check-in: 2c4f496e6a user: redman tags: core-8-1-branch-old
00:34
fixed compiler errors/warnings on VC++ 5.0/6.0 and HP-UX native compiler without -Aa or -Ae check-in: e1542205dd user: redman tags: core-8-1-branch-old
00:31
Removed mention of Win32s. check-in: 248bb1b1f2 user: rjohnson tags: core-8-1-branch-old
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1
2








3
4
5
6
7
8
9
1999-03-24    <[email protected]>









	* win/tclWinSock.c: Make sockets thread-safe on Windows. The
	current implementation uses windows to handle events on the
	socket, one for each thread (thread local storage). Previously,
	there was only one window shared between threads, which didn't
	work. [Bug: 1326]

1999-03-23    <[email protected]>

>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
1999-03-24    <[email protected]>

	* generic/tclAlloc.c:
	* generic/tclEncoding.c:
	* generic/tclProc.c:
	* unix/tclUnixTime.c:
	* win/tclWinSerial.c: Fixed compilation warnings/errors for VC++
	5.0 and 6.0 and HP-UX native compiler without -Aa or -Ae. 
	[Bug: 1323 1518 1324 1583 1585 1586]

	* win/tclWinSock.c: Make sockets thread-safe on Windows. The
	current implementation uses windows to handle events on the
	socket, one for each thread (thread local storage). Previously,
	there was only one window shared between threads, which didn't
	work. [Bug: 1326]

1999-03-23    <[email protected]>

Changes to generic/tclAlloc.c.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
...
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
...
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
...
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
...
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
...
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
...
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
...
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * Portions contributed by Chris Kingsley, Jack Jansen and Ray Johnson.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclAlloc.c,v 1.1.2.6 1999/03/10 06:49:13 stanton Exp $
 */

#include "tclInt.h"
#include "tclPort.h"

#if USE_TCLALLOC

................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

char *
TclpAlloc(
    unsigned int nbytes)	/* Number of bytes to allocate. */
{
    register union overhead *op;
    register long bucket;
    register unsigned amt;
    struct block *bigBlockPtr;

    if (!allocInit) {
................................................................................
 * Side effects:
 *	Attempts to get more memory from the system.
 *
 *----------------------------------------------------------------------
 */

static void
MoreCore(
    int bucket)		/* What bucket to allocat to. */
{
    register union overhead *op;
    register long sz;		/* size of desired block */
    long amt;			/* amount to allocate */
    int nblks;			/* how many blocks we get */
    struct block *blockPtr;

................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

void
TclpFree(
    char *cp)		/* Pointer to memory to free. */
{   
    register long size;
    register union overhead *op;
    struct block *bigBlockPtr;

    if (cp == NULL) {
	return;
................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

char *
TclpRealloc(
    char *cp,			/* Pointer to alloced block. */
    unsigned int nbytes)	/* New size of memory. */
{   
    int i;
    union overhead *op;
    struct block *bigBlockPtr;
    int expensive;
    unsigned long maxsize;

................................................................................
 *	None.
 *
 *----------------------------------------------------------------------
 */

#ifdef MSTATS
void
mstats(
    char *s)	/* Where to write info. */
{
    register int i, j;
    register union overhead *p;
    int totfree = 0,
	totused = 0;

    TclpMutexLock(&allocMutex);
................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

char *
TclpAlloc(
    unsigned int nbytes)	/* Number of bytes to allocate. */
{
    return (char*) malloc(nbytes);
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

void
TclpFree(
    char *cp)		/* Pointer to memory to free. */
{   
    free(cp);
    return;
}
 
/*
 *----------------------------------------------------------------------
................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

char *
TclpRealloc(
    char *cp,			/* Pointer to alloced block. */
    unsigned int nbytes)	/* New size of memory. */
{   
    return (char*) realloc(cp, nbytes);
}

#endif /* !USE_TCLALLOC */






|







 







|
|







 







|
|







 







|
|







 







|
|
|







 







|
|







 







|
|







 







|
|







 







|
|
|





11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
...
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
...
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
...
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
...
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
...
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
...
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
...
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * Portions contributed by Chris Kingsley, Jack Jansen and Ray Johnson.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclAlloc.c,v 1.1.2.7 1999/03/25 00:34:15 redman Exp $
 */

#include "tclInt.h"
#include "tclPort.h"

#if USE_TCLALLOC

................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

char *
TclpAlloc(nbytes)
    unsigned int nbytes;	/* Number of bytes to allocate. */
{
    register union overhead *op;
    register long bucket;
    register unsigned amt;
    struct block *bigBlockPtr;

    if (!allocInit) {
................................................................................
 * Side effects:
 *	Attempts to get more memory from the system.
 *
 *----------------------------------------------------------------------
 */

static void
MoreCore(bucket)
    int bucket;		/* What bucket to allocat to. */
{
    register union overhead *op;
    register long sz;		/* size of desired block */
    long amt;			/* amount to allocate */
    int nblks;			/* how many blocks we get */
    struct block *blockPtr;

................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

void
TclpFree(cp)
    char *cp;		/* Pointer to memory to free. */
{   
    register long size;
    register union overhead *op;
    struct block *bigBlockPtr;

    if (cp == NULL) {
	return;
................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

char *
TclpRealloc(cp, nbytes)
    char *cp;			/* Pointer to alloced block. */
    unsigned int nbytes;	/* New size of memory. */
{   
    int i;
    union overhead *op;
    struct block *bigBlockPtr;
    int expensive;
    unsigned long maxsize;

................................................................................
 *	None.
 *
 *----------------------------------------------------------------------
 */

#ifdef MSTATS
void
mstats(s)
    char *s;	/* Where to write info. */
{
    register int i, j;
    register union overhead *p;
    int totfree = 0,
	totused = 0;

    TclpMutexLock(&allocMutex);
................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

char *
TclpAlloc(nbytes)
    unsigned int nbytes;	/* Number of bytes to allocate. */
{
    return (char*) malloc(nbytes);
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

void
TclpFree(cp)
    char *cp;		/* Pointer to memory to free. */
{   
    free(cp);
    return;
}
 
/*
 *----------------------------------------------------------------------
................................................................................
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

char *
TclpRealloc(cp, nbytes)
    char *cp;			/* Pointer to alloced block. */
    unsigned int nbytes;	/* New size of memory. */
{   
    return (char*) realloc(cp, nbytes);
}

#endif /* !USE_TCLALLOC */

Changes to generic/tclEncoding.c.

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
 *	Contains the implementation of the encoding conversion package.
 *
 * Copyright (c) 1996-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclEncoding.c,v 1.1.2.8 1999/03/12 23:47:49 surles Exp $
 */

#include "tclInt.h"
#include "tclPort.h"

typedef size_t (LengthProc)_ANSI_ARGS_((CONST char *src));

................................................................................
 *
 * Side effects:
 *
 *-------------------------------------------------------------------------
 */

char *
Tcl_GetDefaultEncodingDir(void)
{
    return tclDefaultEncodingDir;
}
 
/*
 *-------------------------------------------------------------------------
 *






|







 







|







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
 *	Contains the implementation of the encoding conversion package.
 *
 * Copyright (c) 1996-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclEncoding.c,v 1.1.2.9 1999/03/25 00:34:15 redman Exp $
 */

#include "tclInt.h"
#include "tclPort.h"

typedef size_t (LengthProc)_ANSI_ARGS_((CONST char *src));

................................................................................
 *
 * Side effects:
 *
 *-------------------------------------------------------------------------
 */

char *
Tcl_GetDefaultEncodingDir()
{
    return tclDefaultEncodingDir;
}
 
/*
 *-------------------------------------------------------------------------
 *

Changes to generic/tclProc.c.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
....
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
....
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
 *
 * Copyright (c) 1987-1993 The Regents of the University of California.
 * Copyright (c) 1994-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclProc.c,v 1.1.2.7 1999/02/10 23:31:18 stanton Exp $
 */

#include "tclInt.h"
#include "tclCompile.h"

/*
 * Prototypes for static functions in this file
................................................................................
 *
 *----------------------------------------------------------------------
 */

TclCmdProcType
TclGetInterpProc()
{
    return TclProcInterpProc;
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclGetObjInterpProc --
 *
................................................................................
 *
 *----------------------------------------------------------------------
 */

TclObjCmdProcType
TclGetObjInterpProc()
{
    return TclObjInterpProc;
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclNewProcBodyObj --
 *






|







 







|







 







|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
....
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
....
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
 *
 * Copyright (c) 1987-1993 The Regents of the University of California.
 * Copyright (c) 1994-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclProc.c,v 1.1.2.8 1999/03/25 00:34:16 redman Exp $
 */

#include "tclInt.h"
#include "tclCompile.h"

/*
 * Prototypes for static functions in this file
................................................................................
 *
 *----------------------------------------------------------------------
 */

TclCmdProcType
TclGetInterpProc()
{
    return (TclCmdProcType) TclProcInterpProc;
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclGetObjInterpProc --
 *
................................................................................
 *
 *----------------------------------------------------------------------
 */

TclObjCmdProcType
TclGetObjInterpProc()
{
    return (TclObjCmdProcType) TclObjInterpProc;
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclNewProcBodyObj --
 *

Changes to unix/tclUnixTime.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
...
288
289
290
291
292
293
294
295
296
297
298
299
 *	obtain time values from the operating system.
 *
 * 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.
 *
 * RCS: @(#) $Id: tclUnixTime.c,v 1.1.2.5 1999/03/10 06:49:29 stanton Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
 
/*
 *-----------------------------------------------------------------------------
................................................................................
 */

struct tm *
TclpGetDate(time, useGMT)
    TclpTime_t time;
    int useGMT;
{
    const time_t *tp = (const time_t *)time;

    if (useGMT) {
	return gmtime(tp);
    } else {
	return localtime(tp);
    }
}
................................................................................
 *----------------------------------------------------------------------
 */

size_t
TclpStrftime(s, maxsize, format, t)
    char *s;
    size_t maxsize;
    const char *format;
    const struct tm *t;
{
    return strftime(s, maxsize, format, t);
}






|







 







|







 







|
|



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
...
288
289
290
291
292
293
294
295
296
297
298
299
 *	obtain time values from the operating system.
 *
 * 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.
 *
 * RCS: @(#) $Id: tclUnixTime.c,v 1.1.2.6 1999/03/25 00:34:17 redman Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
 
/*
 *-----------------------------------------------------------------------------
................................................................................
 */

struct tm *
TclpGetDate(time, useGMT)
    TclpTime_t time;
    int useGMT;
{
    CONST time_t *tp = (CONST time_t *)time;

    if (useGMT) {
	return gmtime(tp);
    } else {
	return localtime(tp);
    }
}
................................................................................
 *----------------------------------------------------------------------
 */

size_t
TclpStrftime(s, maxsize, format, t)
    char *s;
    size_t maxsize;
    CONST char *format;
    CONST struct tm *t;
{
    return strftime(s, maxsize, format, t);
}

Changes to win/tclWinSerial.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
 *	and the "serial" channel driver.
 *
 * Copyright (c) 1999 by Scriptics Corp.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclWinSerial.c,v 1.1.2.3 1999/03/24 02:37:14 redman Exp $
 */

#include "tclWinInt.h"

#include <dos.h>
#include <fcntl.h>
#include <io.h>
................................................................................

static int
SerialCloseProc(
    ClientData instanceData,	/* Pointer to SerialInfo structure. */
    Tcl_Interp *interp)		/* For error reporting. */
{
    SerialInfo *serialPtr = (SerialInfo *) instanceData;
    int errorCode, result;
    SerialInfo *infoPtr, **nextPtrPtr;
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);

    errorCode = 0;
    if (serialPtr->readThread) {
	TerminateThread(serialPtr->readThread, 0);
	/*






|







 







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
 *	and the "serial" channel driver.
 *
 * Copyright (c) 1999 by Scriptics Corp.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclWinSerial.c,v 1.1.2.4 1999/03/25 00:34:17 redman Exp $
 */

#include "tclWinInt.h"

#include <dos.h>
#include <fcntl.h>
#include <io.h>
................................................................................

static int
SerialCloseProc(
    ClientData instanceData,	/* Pointer to SerialInfo structure. */
    Tcl_Interp *interp)		/* For error reporting. */
{
    SerialInfo *serialPtr = (SerialInfo *) instanceData;
    int errorCode, result = 0;
    SerialInfo *infoPtr, **nextPtrPtr;
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);

    errorCode = 0;
    if (serialPtr->readThread) {
	TerminateThread(serialPtr->readThread, 0);
	/*