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

File: [Pegasus] / pegasus / src / Pegasus / Compiler / cimmofParser.h (download)
Revision: 1.33, 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-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-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.32: +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: Carol Ann Krug Graves, Hewlett-Packard Company
//                (carolann_graves@hp.com)
//              Gerarda Marquez (gmarquez@us.ibm.com)
//              -- PEP 43 changes
//              Terry Martin, Hewlett-Packard Company (terry.martin@hp.com)
//
//%/////////////////////////////////////////////////////////////////////////////


//
//
// This header describes the cimmofParser class.  
// It is a singleton, and can only be accessed via the pointer
// returned by its static Intance() method.
// //
// The instance of this
// class hold enough state information that there should be no need for
// the underlying YACC parser to be written reentrant.
//
// The YACCer (and LExer) communicate with the instance of this class
// via the ointer returned by the Instance() method.
//
// This specialization contains a reference to the containing program's
// mofComplerCmdLine object, which holds the command line arguments
// including the list of directories to search to find included mof files
//

#ifndef _CIMMOFPARSER_H_
#define _CIMMOFPARSER_H_


#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/InternalException.h>
#include <Pegasus/Compiler/compilerCommonDefs.h>
#include <Pegasus/Compiler/Linkage.h>
#include "parser.h"
#include "mofCompilerOptions.h"
#include "cimmofRepositoryInterface.h"
#include "cimmofMessages.h"
#include "memobjs.h"
#include "objname.h"

// Diagnostics that can be used to display flow.
// This is manually turned on be selecting the proper define
// below.  
#define YACCTRACE(X)
//#define YACCTRACE(X) {if (yydebug) cerr << X << endl;}
// The following is used for the moment to set the trace because
// there is a bug when YYDEBUG set and yydebug needs to be connected
// to the commof compile flags.
//#define YACCTRACE(X) {cerr << X << endl;}


extern int cimmof_parse(); // the yacc parser entry point

//class cimmofRepository;

// This class extends class parser (see parser.h)
class PEGASUS_COMPILER_LINKAGE cimmofParser : public parser {
 private:
  // This is meant to be a singleton, so we hide the constructor
  // and the destructor
  static cimmofParser *_instance;
  cimmofParser();
  ~cimmofParser();
  void trace(const String &head, const String &tail) const;
  //either throw us out or retry depending on user preference
  void maybeThrowParseError(const String &msg) const;
  void maybeThrowLexerError(const String &msg) const;

  //Processing to determine if class should be updated
  Boolean updateClass(const CIMClass &classdecl, cimmofMessages::MsgCode &updateMessage, Boolean &classExist);
  Boolean verifyVersion(const String &version, int &iM, int &iN, int &iU);

  // Here are the members added by this specialization
  const mofCompilerOptions *_cmdline;
  String _includefile;  // temp storage for included file to be entered
  cimmofRepositoryInterface _repository; // the repository interface object
  String _defaultNamespacePath;  // The path we'll use if none is given
  String _currentNamespacePath;  // a namespace set from a #pragma
  compilerCommonDefs::operationType _ot;
 public:
  // Provide a way for the singleton to be constructed, or a
  // pointer to be returned:
  static cimmofParser *Instance();
  void elog(const String &msg) const; // handle logging of errors
  void wlog(const String &msg) const; // handle logging of warnings

  //------------------------------------------------------------------
  // Methods for manipulating the members added in this specialization
  //------------------------------------------------------------------
  // compiler options.  This may be set from command line data,
  // or by an embedding application
  void setCompilerOptions(const mofCompilerOptions *co);
  const mofCompilerOptions *getCompilerOptions() const;
  // for all, or nearly all, operations, a repository object is needed
  Boolean setRepository(void);
  const cimmofRepositoryInterface *getRepository() const;
  // Whether you need a repository or not depends on the operationsType
  void setOperationType(compilerCommonDefs::operationType);
  compilerCommonDefs::operationType getOperationType() const;
  // Set a default root namespace path to pass to  the repository
  void setDefaultNamespacePath(const String &path); // default value
  void setCurrentNamespacePath(const String &path); // current override
  const String &getDefaultNamespacePath() const;
  const String &getCurrentNamespacePath() const;
  // Get the effective namespace path -- the override, if there is one.
  const String &getNamespacePath() const;
  //------------------------------------------------------------------
  // Methods that implement or override base class methods
  //------------------------------------------------------------------
  // establish an input buffer given an input file stream
  int setInputBuffer(const FILE *f, Boolean closeCurrent);
  // establish an input buffer given an existing context (YY_BUFFERSTATE)
  int setInputBuffer(void *buffstate, Boolean closeCurrent);
  // Dig into an include file given its name
  int enterInlineInclude(const String &filename);
  // Dig into an include file given an input file stream
  int enterInlineInclude(const FILE *f);
  // Handle end-of-file 
  int wrapCurrentBuffer();
  // Parse an input file
  int parse();
  // Log a parser error
  void log_parse_error(char *token, const char *errmsg) const;

  //------------------------------------------------------------------
  // Do various representation transformations.
  // These are in this class simply because there wasn't another
  // conventient place for them.  They could just as well be static
  // methods of some convenience class.
  //------------------------------------------------------------------
  //    Octal character input to decimal character output
  char *oct_to_dec(const String &octrep) const;
  //    Hex character input to decimal character output
  char *hex_to_dec(const String &hexrep) const;
  //    Binary character input to decimal character output
  char *binary_to_dec(const String &binrep) const;

  //------------------------------------------------------------------
  // Handle the processing of CIM-specific constructs
  //------------------------------------------------------------------
  // This is called after a completed #pragma production is formed
  void processPragma(const String &pragmaName, const String &pragmaString);
  // This is called when a completed class declaration production is formed
  int addClass(CIMClass *classdecl);
  // This is called when a new class declaration heading is discovered
  CIMClass *newClassDecl(const CIMName &name, const CIMName &superclass);
  // Called when a completed instanace declaration production is formed
  int addInstance(CIMInstance *instance);
  // Called when a new qualifier declaration heading is discovered
  CIMQualifierDecl *newQualifierDecl(const String &name, const CIMValue *value,
      const CIMScope & scope, const CIMFlavor & flavor);
  // Called when a completed qualifier declaration production is formed
  int addQualifier(CIMQualifierDecl *qualifier);
  // Called when a new qualifier declaration heading is discovered
  CIMQualifier *newQualifier(const String &name, const CIMValue &val,
			     const CIMFlavor & flav);
  // Called when a new instance declaration heading is discovered
  CIMInstance *newInstance(const CIMName &name);
  // Called when a new property is discovered
  CIMProperty *newProperty(const CIMName &name, const CIMValue &val,
                           const Boolean isArray,
                           const Uint32 arraySize,
			   const CIMName &referencedObj = CIMName()) const;
  // Called when a property production inside a class is complete
  int applyProperty(CIMClass &c, CIMProperty &p);
  // Called when a property production inside an instance is complete
  int applyProperty(CIMInstance &instance, CIMProperty &p);
  // Called when a new method is discovered
  CIMMethod   *newMethod(const CIMName &name, const CIMType type);
  // Called when a method production inside a class is complete
  int applyMethod(CIMClass &c, CIMMethod &m);
  // Called when a method parameter is discovered
  CIMParameter *newParameter(const CIMName &name, const CIMType type,
			     Boolean isArray=false, Uint32 array=0, 
			     const CIMName &objName=CIMName());
  // Called when a method parameter production is complete
  int applyParameter(CIMMethod &method, CIMParameter &parm);
  // Called when a qualifier value production is complete
  CIMValue *QualifierValue(const CIMName &qualifierName, 
                           Boolean isNull, const String &valstr);
  // Called to retrieve the value object for an existing parameter
  CIMProperty *PropertyFromInstance(CIMInstance &instance,
				    const CIMName &propertyName) const;
  CIMValue *ValueFromProperty(const CIMProperty &prop) const;
  CIMValue *PropertyValueFromInstance(CIMInstance &instance, 
				      const CIMName &propertyName) const; 
  // Called when a class alias is found
  void addClassAlias(const String &alias, const CIMClass *cd, 
		Boolean isInstance);
  // Called when an instance alias is found
  Uint32 addInstanceAlias(const String &alias, const CIMInstance *cd, 
		Boolean isInstance);
  // Called when an instance alias reference is found
  Uint32 getInstanceAlias(const String &alias, CIMObjectPath &ObjPath);
  // Called when a reference declaration is found
  CIMObjectPath *newReference(const objectName &oname);
  // Make a clone of a property object, inserting a new value object
  CIMProperty *copyPropertyWithNewValue(const CIMProperty &p,
					const CIMValue &v) const;
};

// Exceptions

class PEGASUS_COMPILER_LINKAGE LexerError : public Exception {
 public:
  static const char MSG[];
  LexerError(const String &lexerr) : Exception(MSG + lexerr) {}
};

#endif
  



No CVS admin address has been configured
Powered by
ViewCVS 0.9.2