Tue, 16 Mar 2004 21:35:13 +0100
trunk: changeset 1408
Changed include directives to reflect change in locations of headers.
| 0 | 1 | /* |
| 2 | * libtu/tester.c | |
| 3 | * | |
| 36 | 4 | * Copyright (c) Tuomo Valkonen 1999-2002. |
| 53 | 5 | * |
| 6 | * You may distribute and modify this library under the terms of either | |
| 7 | * the Clarified Artistic License or the GNU LGPL, version 2.1 or later. | |
| 0 | 8 | */ |
| 9 | ||
| 10 | #include <stdio.h> | |
| 5 | 11 | |
| 70 | 12 | #include "misc.h" |
| 13 | #include "tokenizer.h" | |
| 14 | #include "util.h" | |
| 0 | 15 | |
| 12 | 16 | int main(int argc, char *argv[]) |
| 0 | 17 | { |
| 62 | 18 | Tokenizer*tokz; |
| 19 | Token tok=TOK_INIT; | |
| 20 | ||
| 21 | libtu_init(argv[0]); | |
| 22 | ||
| 23 | if(!(tokz=tokz_open_file(stdin, "stdin"))) | |
| 24 | return EXIT_FAILURE; | |
| 0 | 25 | |
| 62 | 26 | while(tokz_get_token(tokz, &tok)){ |
| 27 | switch(tok.type){ | |
| 28 | case TOK_LONG: | |
| 29 | printf("long - %ld\n", TOK_LONG_VAL(&tok)); | |
| 30 | break; | |
| 31 | case TOK_DOUBLE: | |
| 32 | printf("double - %g\n", TOK_DOUBLE_VAL(&tok)); | |
| 33 | break; | |
| 34 | case TOK_CHAR: | |
| 35 | printf("char - '%c'\n", TOK_CHAR_VAL(&tok)); | |
| 36 | break; | |
| 37 | case TOK_STRING: | |
| 38 | printf("string - \"%s\"\n", TOK_STRING_VAL(&tok)); | |
| 39 | break; | |
| 40 | case TOK_IDENT: | |
| 41 | printf("ident - %s\n", TOK_IDENT_VAL(&tok)); | |
| 42 | break; | |
| 43 | case TOK_COMMENT: | |
| 44 | printf("comment - %s\n", TOK_COMMENT_VAL(&tok)); | |
| 45 | break; | |
| 46 | case TOK_OP: | |
| 47 | printf("operator - %03x\n", TOK_OP_VAL(&tok)); | |
| 48 | break; | |
| 49 | } | |
| 50 | } | |
| 51 | ||
| 52 | return EXIT_SUCCESS; | |
| 0 | 53 | } |
| 54 |