Diff
Not logged in

Differences From Artifact [bcc8e0fc7c]:

To Artifact [d9127a7d3b]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tclDate.c --
 *
 *	This file is generated from a yacc grammar defined in
 *	the file tclGetDate.y.  It should not be edited directly.
 *
 * Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans.
 * Copyright (c) 1995-1997 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: tclDate.c,v 1.3 1999/03/10 05:52:47 stanton Exp $ 
 */

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

#ifdef MAC_TCL
#   define EPOCH           1904












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tclDate.c --
 *
 *	This file is generated from a yacc grammar defined in
 *	the file tclGetDate.y.  It should not be edited directly.
 *
 * Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans.
 * Copyright (c) 1995-1997 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: tclDate.c,v 1.4 1999/04/16 00:46:45 stanton Exp $ 
 */

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

#ifdef MAC_TCL
#   define EPOCH           1904
533
534
535
536
537
538
539
540
541
542
543
544

545
546
547
548
549
550
551
    register TABLE *tp;
    int i;
    int abbrev;

    /*
     * Make it lowercase.
     */
    for (p = buff; *p; p++) {
        if (isupper(UCHAR(*p))) {
            *p = (char) tolower(UCHAR(*p));
	}
    }


    if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
        TclDatelval.Meridian = MERam;
        return tMERIDIAN;
    }
    if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
        TclDatelval.Meridian = MERpm;







<
<
<
|
<
>







533
534
535
536
537
538
539



540

541
542
543
544
545
546
547
548
    register TABLE *tp;
    int i;
    int abbrev;

    /*
     * Make it lowercase.
     */





    Tcl_UtfToLower(buff);

    if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
        TclDatelval.Meridian = MERam;
        return tMERIDIAN;
    }
    if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
        TclDatelval.Meridian = MERpm;
610
611
612
613
614
615
616
617

618
619
620
621
622
623
624
            return tp->type;
        }
    }

    /*
     * Military timezones.
     */
    if (buff[1] == '\0' && isalpha(UCHAR(*buff))) {

        for (tp = MilitaryTable; tp->name; tp++) {
            if (strcmp(buff, tp->name) == 0) {
                TclDatelval.Number = tp->value;
                return tp->type;
            }
	}
    }







|
>







607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
            return tp->type;
        }
    }

    /*
     * Military timezones.
     */
    if (buff[1] == '\0' && !(*buff & 0x80)
	    && isalpha(UCHAR(*buff))) {	/* INTL: ISO only */
        for (tp = MilitaryTable; tp->name; tp++) {
            if (strcmp(buff, tp->name) == 0) {
                TclDatelval.Number = tp->value;
                return tp->type;
            }
	}
    }
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675

676
677
678
679
680
681
682
683
684
685

686
687
688
689
690
691
692
    int                 sign;

    for ( ; ; ) {
        while (isspace((unsigned char) (*TclDateInput))) {
            TclDateInput++;
	}

        if (isdigit(c = *TclDateInput) || c == '-' || c == '+') {
            if (c == '-' || c == '+') {
                sign = c == '-' ? -1 : 1;
                if (!isdigit(*++TclDateInput)) {
                    /*
		     * skip the '-' sign
		     */
                    continue;
		}
            } else {
                sign = 0;
	    }
            for (TclDatelval.Number = 0; isdigit(c = *TclDateInput++); ) {

                TclDatelval.Number = 10 * TclDatelval.Number + c - '0';
	    }
            TclDateInput--;
            if (sign < 0) {
                TclDatelval.Number = -TclDatelval.Number;
	    }
            return sign ? tSNUMBER : tUNUMBER;
        }
        if (isalpha(UCHAR(c))) {
            for (p = buff; isalpha(c = *TclDateInput++) || c == '.'; ) {

                if (p < &buff[sizeof buff - 1]) {
                    *p++ = c;
		}
	    }
            *p = '\0';
            TclDateInput--;
            return LookupWord(buff);







|


|








|
>








|
|
>







654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
    int                 sign;

    for ( ; ; ) {
        while (isspace((unsigned char) (*TclDateInput))) {
            TclDateInput++;
	}

        if (isdigit(c = *TclDateInput) || c == '-' || c == '+') { /* INTL: digit */
            if (c == '-' || c == '+') {
                sign = c == '-' ? -1 : 1;
                if (!isdigit(*++TclDateInput)) { /* INTL: digit */
                    /*
		     * skip the '-' sign
		     */
                    continue;
		}
            } else {
                sign = 0;
	    }
            for (TclDatelval.Number = 0;
		    isdigit(c = *TclDateInput++); ) { /* INTL: digit */
                TclDatelval.Number = 10 * TclDatelval.Number + c - '0';
	    }
            TclDateInput--;
            if (sign < 0) {
                TclDatelval.Number = -TclDatelval.Number;
	    }
            return sign ? tSNUMBER : tUNUMBER;
        }
        if (!(c & 0x80) && isalpha(UCHAR(c))) {	/* INTL: ISO only. */
            for (p = buff; isalpha(c = *TclDateInput++) /* INTL: ISO only. */
		     || c == '.'; ) {
                if (p < &buff[sizeof buff - 1]) {
                    *p++ = c;
		}
	    }
            *p = '\0';
            TclDateInput--;
            return LookupWord(buff);