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.20 2001/10/18 20:20:28 hobbs Exp $
*/
#include "tclInt.h"
#include "tclPort.h"
#if defined(MAC_TCL) && !defined(TCL_MAC_USE_MSL_EPOCH)
# 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: @(#)
*/
#include "tclInt.h"
#include "tclPort.h"
#if defined(MAC_TCL) && !defined(TCL_MAC_USE_MSL_EPOCH)
# define EPOCH 1904
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
static int RelativeDay _ANSI_ARGS_((time_t Start, time_t RelDay,
time_t *TimePtr));
static int LookupWord _ANSI_ARGS_((char *buff));
static int TclDatelex _ANSI_ARGS_((void));
int
TclDateparse _ANSI_ARGS_((void));
typedef union
#ifdef __cplusplus
YYSTYPE
#endif
{
time_t Number;
enum _MERIDIAN Meridian;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
static int RelativeDay _ANSI_ARGS_((time_t Start, time_t RelDay,
time_t *TimePtr));
static int LookupWord _ANSI_ARGS_((char *buff));
static int TclDatelex _ANSI_ARGS_((void));
int
TclDateparse _ANSI_ARGS_((void));
/*
*----------------------------------------------------------------------
*
* TclDateCleanup --
*
* Clean up allocated memory on process exit.
*
* Results:
* None.
*
* Side effects:
* Frees the block of memory passed in as client data.
*
*----------------------------------------------------------------------
*/
static void
TclDateCleanup( ClientData clientData )
{
ckfree( (char*) clientData );
}
/*
*----------------------------------------------------------------------
*
* TclDateAlloc --
*
* Special purpose allocator for the two YACC stacks.
*
* Results:
* Returns a pointer to a block of memory.
*
* Side effects:
* Allocates the requested number of bytes, and
* sets up to delete the allocated memory on process exit.
*
* The YACC system is set up to free memory in its stacks only by
* abandonment. This procedure sets up to free it explicitly on exit
* from Tcl, as when unloading.
*
*----------------------------------------------------------------------
*/
static char*
TclDateAlloc( size_t n )
{
char* pointer = ckalloc( n );
Tcl_CreateExitHandler( TclDateCleanup, (ClientData) pointer );
return pointer;
}
/*
*----------------------------------------------------------------------
*
* TclDateRealloc --
*
* Special purpose allocator for the two YACC stacks.
*
* Results:
* Returns a pointer to a block of memory.
*
* Side effects:
* Allocates the requested number of bytes, and
* sets up to delete the allocated memory on process exit.
*
* The YACC system is set up to free memory in its stacks only by
* abandonment. This procedure sets up to free it explicitly on exit
* from Tcl, as when unloading.
*
*----------------------------------------------------------------------
*/
static char*
TclDateRealloc( char* oldPointer, size_t n )
{
char* newPointer;
Tcl_DeleteExitHandler( TclDateCleanup, (ClientData) oldPointer );
newPointer = ckrealloc( oldPointer, n );
Tcl_CreateExitHandler( TclDateCleanup, (ClientData) newPointer );
return newPointer;
}
typedef union
#ifdef __cplusplus
YYSTYPE
#endif
{
time_t Number;
enum _MERIDIAN Meridian;
|
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
|
}\
TclDatechar = newtoken;\
TclDatestate = *TclDateps;\
TclDatelval = newvalue;\
goto TclDatenewstate;\
}
#define YYRECOVERING() (!!TclDateerrflag)
#define YYNEW(type) malloc(sizeof(type) * TclDatenewmax)
#define YYCOPY(to, from, type) \
(type *) memcpy(to, (char *) from, TclDatemaxdepth * sizeof (type))
#define YYENLARGE( from, type) \
(type *) realloc((char *) from, TclDatenewmax * sizeof(type))
#ifndef YYDEBUG
# define YYDEBUG 1 /* make debugging available */
#endif
/*
** user known globals
*/
|
|
|
|
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
|
}\
TclDatechar = newtoken;\
TclDatestate = *TclDateps;\
TclDatelval = newvalue;\
goto TclDatenewstate;\
}
#define YYRECOVERING() (!!TclDateerrflag)
#define YYNEW(type) TclDateAlloc(sizeof(type) * TclDatenewmax)
#define YYCOPY(to, from, type) \
(type *) memcpy(to, (char *) from, TclDatemaxdepth * sizeof (type))
#define YYENLARGE( from, type) \
(type *) TclDateRealloc((char *) from, TclDatenewmax * sizeof(type))
#ifndef YYDEBUG
# define YYDEBUG 1 /* make debugging available */
#endif
/*
** user known globals
*/
|