[1] | 1 | /* $Id: datetime_impl.h 2 2009-10-12 09:51:22Z mamonski $ */ |
---|
| 2 | /* |
---|
| 3 | * FedStage DRMAA utilities library |
---|
| 4 | * Copyright (C) 2006-2008 FedStage Systems |
---|
| 5 | * |
---|
| 6 | * This program is free software: you can redistribute it and/or modify |
---|
| 7 | * it under the terms of the GNU General Public License as published by |
---|
| 8 | * the Free Software Foundation, either version 3 of the License, or |
---|
| 9 | * (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License |
---|
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | /** |
---|
| 21 | * @file datetime_impl.h |
---|
| 22 | * DRMAA date/time parser - Bison interface functions. |
---|
| 23 | */ |
---|
| 24 | #ifndef __DRMAA_UTILS__DATETIME_IMPL_H |
---|
| 25 | #define __DRMAA_UTILS__DATETIME_IMPL_H |
---|
| 26 | |
---|
| 27 | #ifdef HAVE_CONFIG_H |
---|
| 28 | # include <config.h> |
---|
| 29 | #endif |
---|
| 30 | |
---|
| 31 | #include <drmaa_utils/datetime.h> |
---|
| 32 | |
---|
| 33 | /** @addtogroup datetime */ |
---|
| 34 | /* @{ */ |
---|
| 35 | |
---|
| 36 | typedef struct fsd_dt_parser_s fsd_dt_parser_t; |
---|
| 37 | typedef struct fsd_dt_lexer_s fsd_dt_lexer_t; |
---|
| 38 | union YYSTYPE; |
---|
| 39 | |
---|
| 40 | /** Date/time parser data. */ |
---|
| 41 | struct fsd_dt_parser_s { |
---|
| 42 | fsd_dt_lexer_t *lexer; /**< Lexical analyzer. */ |
---|
| 43 | fsd_datetime_t result; /**< Parsing result. */ |
---|
| 44 | int n_errors; /**< Number of parse errors. */ |
---|
| 45 | }; |
---|
| 46 | |
---|
| 47 | /** Date/time lexical analyzer. */ |
---|
| 48 | struct fsd_dt_lexer_s { |
---|
| 49 | fsd_dt_parser_t *parser; /**< Date/time parser. */ |
---|
| 50 | const unsigned char *begin; /**< Begin of parsed string. */ |
---|
| 51 | const unsigned char *end; /**< End of parsed string. */ |
---|
| 52 | const unsigned char *p; /**< Scanner position |
---|
| 53 | (points to first not parsed character). */ |
---|
| 54 | }; |
---|
| 55 | |
---|
| 56 | /** Parser interface function (Bison generated). */ |
---|
| 57 | int fsd_dt_parse( fsd_dt_parser_t *parser, fsd_dt_lexer_t *lexer ); |
---|
| 58 | |
---|
| 59 | /** |
---|
| 60 | * Error reporting function (hand written). |
---|
| 61 | */ |
---|
| 62 | void fsd_dt_error( |
---|
| 63 | fsd_dt_parser_t *parser, fsd_dt_lexer_t *lexer, |
---|
| 64 | const char *fmt, ... |
---|
| 65 | ); |
---|
| 66 | |
---|
| 67 | /** Lexer interface (hand written). */ |
---|
| 68 | int fsd_dt_lex( union YYSTYPE *lvalp, fsd_dt_lexer_t *lexer ); |
---|
| 69 | |
---|
| 70 | /* @} */ |
---|
| 71 | |
---|
| 72 | #endif /* __DRMAA_UTILS__DATETIME_IMPL_H */ |
---|
| 73 | |
---|