www.pudn.com > cppcc.rar > cw_iparser_spec.h


/*
 *  File:       cw_iparser_spec.h
 *              $Id: cw_iparser_spec.h,v 1.2 2002/06/13 11:36:26 alec Exp $
 *
 *  Author:     Alec Panovici (alecu@email.com)
 * 
 *  Comments:
 *
 *  Revision history:
 *
 *  $Log: cw_iparser_spec.h,v $
 *  Revision 1.2  2002/06/13 11:36:26  alec
 *  added #line stuff
 *
 *  Revision 1.1  2002/05/08 18:16:53  alec
 *  *** empty log message ***
 *
 */


/*
  Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 */

#ifndef __CW_IPARSER_SPEC_H__
#define __CW_IPARSER_SPEC_H__

#if defined __cplusplus

class IParserSpec;

/**
 * \ingroup cw_iparser_spec
 * This will point to the IParserSpec object whose methods should actually be
 * called by the wrapper functions. It is initialized by the LexYaccParser
 * before parsing starts.
 */
extern IParserSpec *cw_parserSpec;

#define CLINK extern "C"

#else

#define CLINK

#endif

#include "cw_misc.h"


/**
 * \defgroup cw_iparser_spec IParser C Wrapper
 *
 * these are te wrapper functions that get called from the C parser code. Each
 * of these functions will call the corresponding method of the IParserSpec
 * instance pointed to by cw_parserSpec.
 *
 * Eaach parameter is transformed into its C++ counterpart. The Position
 * argument required by the IParserSpec interface is created as
 * Position(yylineno, 0). The rest of the linNo arguments are the yylinno's
 * corresponding to each component of the production.
 *
 * @{
 */
CLINK void IParserSpec_addProduction (char *name,
                                      char *retTypeName, int lineTypeLine,
                                      char *formalArgs, int lineArgsLine,
                                      char *exceptList, int exceptListLine,
                                      char *preambleCode, int preambleCodeLine,
                                      void *expansion);

CLINK void IParserSpec_setPreambleCode (char *block);

CLINK void IParserSpec_setClassName (char *className);

CLINK void IParserSpec_setInheritance (char *inheritance);

CLINK void IParserSpec_addCodeBlock (char *block);

/* @} */

#endif /* #ifndef __CW_IPARSER_SPEC_H__ */