(file) Return to parser.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Compiler

File: [Pegasus] / pegasus / src / Pegasus / Compiler / parser.h (download)
Revision: 1.20, Mon Jan 30 16:17:33 2006 UTC (18 years, 5 months ago) by karl
Branch: MAIN
CVS Tags: TASK_PEP233_EmbeddedInstSupport-merge_out_trunk, TASK_BUG_5314_IPC_REFACTORING_ROOT, TASK_BUG_5314_IPC_REFACTORING_BRANCH, TASK_BUG_5314_IPC_REFACTORING-V1, TASK_BUG_5191_QUEUE_CONSOLIDATION_ROOT, TASK_BUG_5191_QUEUE_CONSOLIDATION_BRANCH, TASK-TASK-BUG4011_WinLocalConnect-branch-New-root, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_to_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_from_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_to_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_from_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-branch, TASK-PEP286_PRIVILEGE_SEPARATION-root, TASK-PEP286_PRIVILEGE_SEPARATION-branch, TASK-PEP274_dacim-root, TASK-PEP274_dacim-merged_out_to_branch, TASK-PEP274_dacim-merged_out_from_trunk, TASK-PEP274_dacim-merged_in_to_trunk, TASK-PEP274_dacim-merged_in_from_branch, TASK-PEP274_dacim-branch, TASK-PEP268_SSLClientCertificatePropagation-root, TASK-PEP268_SSLClientCertificatePropagation-merged_out_to_branch, TASK-PEP268_SSLClientCertificatePropagation-merged_out_from_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_to_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_from_branch, TASK-PEP268_SSLClientCertificatePropagation-branch, TASK-PEP267_SLPReregistrationSupport-root, TASK-PEP267_SLPReregistrationSupport-merging_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merging_out_from_trunk, TASK-PEP267_SLPReregistrationSupport-merged_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merged_out_from_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_to_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_from_branch, TASK-PEP267_SLPReregistrationSupport-branch, TASK-PEP250_RPMProvider-root, TASK-PEP250_RPMProvider-merged_out_to_branch, TASK-PEP250_RPMProvider-merged_out_from_trunk, TASK-PEP250_RPMProvider-merged_in_to_trunk, TASK-PEP250_RPMProvider-merged_in_from_branch, TASK-PEP250_RPMProvider-branch, TASK-PEP245_CimErrorInfrastructure-root, TASK-PEP245_CimErrorInfrastructure-merged_out_to_branch, TASK-PEP245_CimErrorInfrastructure-merged_out_from_trunk, TASK-PEP245_CimErrorInfrastructure-merged_in_to_trunk, TASK-PEP245_CimErrorInfrastructure-merged_in_from_branch, TASK-PEP245_CimErrorInfrastructure-branch, TASK-PEP241_OpenPegasusStressTests-root, TASK-PEP241_OpenPegasusStressTests-merged_out_to_branch, TASK-PEP241_OpenPegasusStressTests-merged_out_from_trunk, TASK-PEP241_OpenPegasusStressTests-merged_in_to_trunk, TASK-PEP241_OpenPegasusStressTests-merged_in_from_branch, TASK-PEP241_OpenPegasusStressTests-branch, TASK-Bugs5690_3913_RemoteCMPI-root, TASK-Bugs5690_3913_RemoteCMPI-merged_out_to_branch, TASK-Bugs5690_3913_RemoteCMPI-merged_out_from_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_to_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_from_branch, TASK-Bugs5690_3913_RemoteCMPI-branch, TASK-Bug2102_RCMPIWindows-root, TASK-Bug2102_RCMPIWindows-merged_out_to_branch, TASK-Bug2102_RCMPIWindows-merged_out_from_trunk, TASK-Bug2102_RCMPIWindows-merged_in_to_trunk, TASK-Bug2102_RCMPIWindows-merged_in_from_branch, TASK-Bug2102_RCMPIWindows-branch, TASK-Bug2102Final-root, TASK-Bug2102Final-merged_out_to_branch, TASK-Bug2102Final-merged_out_from_trunk, TASK-Bug2102Final-merged_in_to_trunk, TASK-Bug2102Final-merged_in_from_branch, TASK-Bug2102Final-branch, TASK-Bug2021_RemoteCMPIonWindows-root, TASK-Bug2021_RemoteCMPIonWindows-merged_out_to_branch, TASK-Bug2021_RemoteCMPIonWindows-merged_out_from_trunk, TASK-Bug2021_RemoteCMPIonWindows-merged_in_to_trunk, TASK-Bug2021_RemoteCMPIonWindows-merged_in_from_branch, TASK-Bug2021_RemoteCMPIonWindows-branch, TASK-Bug2021_RCMPIonWindows-root, TASK-Bug2021_RCMPIonWindows-merged_out_to_branch, TASK-Bug2021_RCMPIonWindows-merged_out_from_trunk, TASK-Bug2021_RCMPIonWindows-merged_in_to_trunk, TASK-Bug2021_RCMPIonWindows-merged_in_from_branch, TASK-Bug2021_RCMPIonWindows-branch, TASK-BUG7240-root, TASK-BUG7240-branch, TASK-BUG4011_WinLocalConnect-root, TASK-BUG4011_WinLocalConnect-merged_out_to_branch, TASK-BUG4011_WinLocalConnect-merged_out_from_trunk, TASK-BUG4011_WinLocalConnect-merged_in_to_trunk, TASK-BUG4011_WinLocalConnect-merged_in_from_branch, TASK-BUG4011_WinLocalConnect-branch-New, TASK-BUG4011_WinLocalConnect-branch, RELEASE_2_6_3-RC2, RELEASE_2_6_3-RC1, RELEASE_2_6_3, RELEASE_2_6_2-RC1, RELEASE_2_6_2, RELEASE_2_6_1-RC1, RELEASE_2_6_1, RELEASE_2_6_0-RC1, RELEASE_2_6_0-FC, RELEASE_2_6_0, RELEASE_2_6-root, RELEASE_2_6-branch-clean, RELEASE_2_6-branch, RELEASE_2_5_5-RC2, RELEASE_2_5_5-RC1, RELEASE_2_5_5, RELEASE_2_5_4-RC2, RELEASE_2_5_4-RC1, RELEASE_2_5_4, RELEASE_2_5_3-RC1, RELEASE_2_5_3, RELEASE_2_5_2-RC1, RELEASE_2_5_2, RELEASE_2_5_1-RC1, RELEASE_2_5_1, RELEASE_2_5-root, RELEASE_2_5-branch, PEP286_PRIVILEGE_SEPARATION_ROOT, PEP286_PRIVILEGE_SEPARATION_CODE_FREEZE, PEP286_PRIVILEGE_SEPARATION_BRANCH, PEP286_PRIVILEGE_SEPARATION_1
Changes since 1.19: +3 -1 lines
BUG#: 4691
TITLE: Update Licenses to 2006

DESCRIPTION: Updates most of the licenses to 2006. The slp_client directories are excluded for the moment pending discussion. This change has passed unit and system tests.  Note that this changes just about EVERY file in Pegasus.

//%2006////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation, The Open Group.
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; Symantec Corporation; The Open Group.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
// Author: Bob Blair (bblair@bmc.com)
//
// Modified By:
//              Jim Wunderlich (Jim_Wunderlich@prodigy.net)
//
//%/////////////////////////////////////////////////////////////////////////////


//
// Header for a class to generate CIMValue objects from String values
//
//
//
// This is a generic parser class from which controllers for particular
// yacc parsers can be derived.  It keeps enough state information that
// you should be able to get by without a reentrant parser.  You should
// compile both parser and lexer with a C++ compiler, although there
// is no need to generate a C++ lexer.
//
// The include file and compile-from-String techniques used here are
// supported only by bison and flex.
//

#ifndef _PARSER_H_
#define _PARSER_H_

#include <Pegasus/Common/Config.h>
#include <cstdio>
#include <Pegasus/Common/String.h>
#include <Pegasus/Common/Stack.h>
#include <Pegasus/Compiler/Linkage.h>
#include <Pegasus/Common/FileSystem.h>


PEGASUS_USING_STD;
PEGASUS_USING_PEGASUS;

#define CIMMOF_CONSTANT_VALUE  1
#define CIMMOF_ARRAY_VALUE     2
#define CIMMOF_REFERENCE_VALUE 3
#define CIMMOF_NULL_VALUE      4

// #define  DEBUG_INCLUDE // enables include file processing debug printout

typedef struct typedInitializerValue {
    Uint16 type;
    const String *value;
    } TYPED_INITIALIZER_VALUE;

struct bufstate {
	void *buffer_state; // the YY_BUFFER_STATE of the stacked context
	String filename;    // the name of the file open in the stacked context
	int    lineno;      // the line number of the file
	String filenamePath; //the path of the file open in the stacked context
};

class PEGASUS_COMPILER_LINKAGE  parser {
 private:
  unsigned int _buffer_size;   // the value of the YY_BUFFER_SIZE macro
  Stack<bufstate*> _include_stack;  // a stack of YY_BUFFER_STATEs
  String _current_filename; // name of the file being parsed
  unsigned int _lineno;     // current line number in the file 
  String _current_filenamePath; // path of the file being parsed
 protected:
  void push_statebuff(bufstate *statebuff) { _include_stack.push(statebuff); }
  bufstate *pop_statebuff();
 public:

  // Constructor, destructor
  parser() : _buffer_size(16384), _lineno(0) {;}
  virtual ~parser() {;}

  virtual int parse() = 0;    // call the parser main yy_parse()
  virtual int wrap();         // handle the end of the current stream

  int setInputBufferFromName(const String &filename); // start parsing this file
  virtual int setInputBuffer(const FILE *f, 
                       Boolean closeCurrent) = 0;  // start parsing this handle
  //  int setInputBuffer(const char *buf);   // start parsing this String
  virtual int setInputBuffer(void *buffstate,
                       Boolean closeCurrent) = 0; // start parsing this buffer

  // given a file stream, treat it as an include file
  virtual int enterInlineInclude(const FILE *f) = 0;
  virtual int wrapCurrentBuffer() = 0;

  unsigned int get_buffer_size() { return _buffer_size; }
  void set_buffer_size(unsigned int siz) { _buffer_size = siz; }

  // We keep track of the filename associated with the current input
  // buffer so we can report on it.
  void set_current_filename(const String &filename)
  	{ 
	  _current_filename = filename;

#ifdef DEBUG_INCLUDE
	  cout << "cimmof parser - setting path = " << get_current_filenamePath() << endl; // DEBUG
#endif // DEBUG_INCLUDE

	  String includePathTemp = FileSystem::extractFilePath(filename);
	  
	  // ************************************************************
	  // if the filename path consisted of just the file name 
	  // becasue it is in the current directory then extractFilePath
	  // returns just the filename rather than "dot". The following 
	  // test is to prevent adding file names to the include path.
	  // ****************************************************************
	  if (includePathTemp == filename)
	    {
	      includePathTemp = ".";
	    }

	    set_current_filenamePath(includePathTemp);	  

#ifdef DEBUG_INCLUDE
	    cout << "cimmof parser set filename = " << filename 
                 << " include path = " << get_current_filenamePath()
		 << endl; // DEBUG
#endif //  DEBUG_INCLUDE
	}

  const String &get_current_filename() const { return _current_filename; }

  // We keep track of the filename path associated with the current input
  // buffer so we can use it to search for include files in that same directory
  void set_current_filenamePath(const String &filenamePath)
  	{ _current_filenamePath = filenamePath; }

  const String &get_current_filenamePath() const { return _current_filenamePath; }

  // Ditto the line number
  void set_lineno(int n) { _lineno = n; }
  void increment_lineno() { ++_lineno; }
  unsigned int get_lineno() const { return _lineno; }

  // This is the main entry point for parser error logging
  virtual void log_parse_error(char *token, const char *errmsg) const;
};
#endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2