130da1778Schristos/* 230da1778Schristos * This file is part of flex. 330da1778Schristos * 430da1778Schristos * Redistribution and use in source and binary forms, with or without 530da1778Schristos * modification, are permitted provided that the following conditions 630da1778Schristos * are met: 730da1778Schristos * 830da1778Schristos * 1. Redistributions of source code must retain the above copyright 930da1778Schristos * notice, this list of conditions and the following disclaimer. 1030da1778Schristos * 2. Redistributions in binary form must reproduce the above copyright 1130da1778Schristos * notice, this list of conditions and the following disclaimer in the 1230da1778Schristos * documentation and/or other materials provided with the distribution. 1330da1778Schristos * 1430da1778Schristos * Neither the name of the University nor the names of its contributors 1530da1778Schristos * may be used to endorse or promote products derived from this software 1630da1778Schristos * without specific prior written permission. 1730da1778Schristos * 1830da1778Schristos * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1930da1778Schristos * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 2030da1778Schristos * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2130da1778Schristos * PURPOSE. 2230da1778Schristos */ 2330da1778Schristos 2430da1778Schristos%{ 2530da1778Schristos#include <stdio.h> 2630da1778Schristos#include <stdlib.h> 2730da1778Schristos#include "config.h" 2830da1778Schristos 2930da1778Schristos%} 3030da1778Schristos 3130da1778Schristos%option 8bit prefix="test" 3230da1778Schristos%option nounput nomain noyywrap noinput 3330da1778Schristos%option warn reject 3430da1778Schristos 3530da1778Schristos 3630da1778Schristos%% 3730da1778Schristos 3830da1778Schristos. { REJECT; } 3930da1778Schristos.|\n ; 4030da1778Schristos 4130da1778Schristos%% 4230da1778Schristos 4330da1778Schristosint main ( int argc, char** argv ) 4430da1778Schristos{ 4530da1778Schristos FILE* fp = NULL; 4630da1778Schristos void *yyscanner=0; 4730da1778Schristos M4_YY_DECL_GUTS_VAR(); 4830da1778Schristos 4930da1778Schristos#ifdef TEST_IS_REENTRANT 50*56bd8546Schristos testlex_init(&yyscanner); 5130da1778Schristos#else 5230da1778Schristos (void)yyscanner; 5330da1778Schristos#endif 5430da1778Schristos 5530da1778Schristos#ifdef TEST_HAS_TABLES_EXTERNAL 56*56bd8546Schristos if((fp = fopen(argv[1],"rb"))== NULL) 5730da1778Schristos YY_FATAL_ERROR("could not open tables file for reading"); 5830da1778Schristos 5930da1778Schristos if(yytables_fload(fp M4_YY_CALL_LAST_ARG) < 0) 6030da1778Schristos YY_FATAL_ERROR("yytables_fload returned < 0"); 6130da1778Schristos if(M4_YY_TABLES_VERIFY) 6230da1778Schristos exit(0); 6330da1778Schristos#endif 6430da1778Schristos 6530da1778Schristos if(argc > 2){ 6630da1778Schristos if((fp = fopen(argv[2],"r"))== NULL) 6730da1778Schristos YY_FATAL_ERROR("could not open input file for reading"); 6830da1778Schristos yyin = fp; 6930da1778Schristos } 70*56bd8546Schristos while(testlex(M4_YY_CALL_ONLY_ARG) != 0) 7130da1778Schristos ; 7230da1778Schristos 7330da1778Schristos#ifdef TEST_HAS_TABLES_EXTERNAL 74*56bd8546Schristos testtables_destroy(M4_YY_CALL_ONLY_ARG); 7530da1778Schristos#endif 76*56bd8546Schristos testlex_destroy(M4_YY_CALL_ONLY_ARG); 7730da1778Schristos 7830da1778Schristos if(argc < 0) /* silence the compiler */ 7930da1778Schristos yyscanner = (void*)fp; 8030da1778Schristos 8130da1778Schristos return 0; 8230da1778Schristos} 83