[llvm-commits] [hlvm] r38017 - in /hlvm/trunk/hlvm/Reader: Makefile Reader.h XML/Makefile XML/XMLReader.cpp XML/XMLReader.h

Reid Spencer reid at x10sys.com
Sat Jul 7 16:59:00 PDT 2007


Author: reid
Date: Sat Jul  7 18:58:59 2007
New Revision: 38017

URL: http://llvm.org/viewvc/llvm-project?rev=38017&view=rev
Log:
Create an initial implementation of an XML Reader. No functionality yet.

Added:
    hlvm/trunk/hlvm/Reader/Reader.h
    hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp
    hlvm/trunk/hlvm/Reader/XML/XMLReader.h
Modified:
    hlvm/trunk/hlvm/Reader/Makefile
    hlvm/trunk/hlvm/Reader/XML/Makefile

Modified: hlvm/trunk/hlvm/Reader/Makefile
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/Makefile?rev=38017&r1=38016&r2=38017&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Reader/Makefile (original)
+++ hlvm/trunk/hlvm/Reader/Makefile Sat Jul  7 18:58:59 2007
@@ -7,6 +7,6 @@
 #
 # List all of the subdirectories that we will compile.
 #
-DIRS=XML Yaml
+DIRS=XML
 
 include $(LEVEL)/Makefile.hlvm

Added: hlvm/trunk/hlvm/Reader/Reader.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/Reader.h?rev=38017&view=auto

==============================================================================
--- hlvm/trunk/hlvm/Reader/Reader.h (added)
+++ hlvm/trunk/hlvm/Reader/Reader.h Sat Jul  7 18:58:59 2007
@@ -0,0 +1,49 @@
+//===-- hlvm/Reader/Reader.h - AST Abstract Reader Class --------*- C++ -*-===//
+//
+//                      High Level Virtual Machine (HLVM)
+//
+// Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+//
+// This software is free software; you can redistribute it and/or modify it 
+// under the terms of the GNU Lesser General Public License as published by 
+// the Free Software Foundation; either version 2.1 of the License, or (at 
+// your option) any later version.
+//
+// This software 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 Lesser General Public License for 
+// more details.
+//
+// You should have received a copy of the GNU Lesser General Public License 
+// along with this library in the file named LICENSE.txt; if not, write to the 
+// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+// MA 02110-1301 USA
+//
+//===----------------------------------------------------------------------===//
+/// @file hlvm/Reader/Reader.h
+/// @author Reid Spencer <rspencer at x10sys.com>
+/// @date 2006/05/12
+/// @since 0.1.0
+/// @brief Provides the interface to hlvm::Reader
+//===----------------------------------------------------------------------===//
+
+#ifndef XPS_READER_READER_H
+#define XPS_READER_READER_H
+
+#include <llvm/System/Path.h>
+
+namespace hlvm {
+namespace AST { class AST; }
+
+  class Reader
+  {
+  public:
+    /// This method reads the entire content of the reader's source.
+    virtual void read() = 0;
+
+    /// This method retrieves the construct AST that resulted from reading.
+    /// @returns 0 if nothing has been read yet
+    virtual AST::AST* get() = 0;
+  };
+}
+#endif

Modified: hlvm/trunk/hlvm/Reader/XML/Makefile
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/XML/Makefile?rev=38017&r1=38016&r2=38017&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Reader/XML/Makefile (original)
+++ hlvm/trunk/hlvm/Reader/XML/Makefile Sat Jul  7 18:58:59 2007
@@ -1,12 +1,13 @@
-##===- hlvm/Reader/XML/Makefile ----------------------------*- Makefile -*-===##
+#-------------------------------------------------------------------------------
+# 
+# Copyright (C) 2006 HLVM Group. All Rights Reserved
 #
-# Relative path to the top of the source tree.
-#
-LEVEL=../../..
+#-------------------------------------------------------------------------------
 
-#
-# List all of the subdirectories that we will compile.
-#
-DIRS=
+LEVEL = ../../..
+LIBRARYNAME = HLVMXMLReader
+DONT_BUILD_RELINKED := 1
+BUILD_ARCHIVE := 1
+INSTALL_INCLUDES := XMLReader.h
 
 include $(LEVEL)/Makefile.hlvm

Added: hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp?rev=38017&view=auto

==============================================================================
--- hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp (added)
+++ hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp Sat Jul  7 18:58:59 2007
@@ -0,0 +1,69 @@
+//===-- hlvm/Reader/XML/XMLReader.cpp - AST XML Reader Class ----*- C++ -*-===//
+//
+//                      High Level Virtual Machine (HLVM)
+//
+// Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+//
+// This software is free software; you can redistribute it and/or modify it 
+// under the terms of the GNU Lesser General Public License as published by 
+// the Free Software Foundation; either version 2.1 of the License, or (at 
+// your option) any later version.
+//
+// This software 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 Lesser General Public License for 
+// more details.
+//
+// You should have received a copy of the GNU Lesser General Public License 
+// along with this library in the file named LICENSE.txt; if not, write to the 
+// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+// MA 02110-1301 USA
+//
+//===----------------------------------------------------------------------===//
+/// @file hlvm/Reader/XML/XMLReader.cpp
+/// @author Reid Spencer <rspencer at x10sys.com>
+/// @date 2006/05/12
+/// @since 0.1.0
+/// @brief Provides the interface to hlvm::XMLReader
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/Reader/XML/XMLReader.h>
+#include <hlvm/AST/AST.h>
+
+using namespace hlvm;
+
+namespace {
+
+class XMLReaderImpl : public XMLReader {
+public:
+  XMLReaderImpl(const llvm::sys::Path& path) :
+    path_(path), ast_(0) {}
+
+  virtual ~XMLReaderImpl() { if (ast_) delete ast_; }
+
+  virtual void read();
+  virtual AST::AST* get();
+
+private: 
+  llvm::sys::Path path_;
+  AST::AST* ast_;
+};
+
+AST::AST*
+XMLReaderImpl::get()
+{
+  return ast_;
+}
+
+void
+XMLReaderImpl::read() {
+  ast_ = new AST::AST();
+}
+
+}
+
+XMLReader* 
+XMLReader::create(const llvm::sys::Path& path)
+{
+  return new XMLReaderImpl(path);
+}

Added: hlvm/trunk/hlvm/Reader/XML/XMLReader.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/XML/XMLReader.h?rev=38017&view=auto

==============================================================================
--- hlvm/trunk/hlvm/Reader/XML/XMLReader.h (added)
+++ hlvm/trunk/hlvm/Reader/XML/XMLReader.h Sat Jul  7 18:58:59 2007
@@ -0,0 +1,51 @@
+//===-- hlvm/Reader/XML/XMLReader.h - AST XML Reader Class ------*- C++ -*-===//
+//
+//                      High Level Virtual Machine (HLVM)
+//
+// Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+//
+// This software is free software; you can redistribute it and/or modify it 
+// under the terms of the GNU Lesser General Public License as published by 
+// the Free Software Foundation; either version 2.1 of the License, or (at 
+// your option) any later version.
+//
+// This software 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 Lesser General Public License for 
+// more details.
+//
+// You should have received a copy of the GNU Lesser General Public License 
+// along with this library in the file named LICENSE.txt; if not, write to the 
+// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+// MA 02110-1301 USA
+//
+//===----------------------------------------------------------------------===//
+/// @file hlvm/Reader/XML/XMLReader.h
+/// @author Reid Spencer <rspencer at x10sys.com>
+/// @date 2006/05/12
+/// @since 0.1.0
+/// @brief Provides the interface to hlvm::XMLReader
+//===----------------------------------------------------------------------===//
+
+#ifndef XPS_READER_XML_XMLREADER_H
+#define XPS_READER_XML_XMLREADER_H
+
+#include <hlvm/Reader/Reader.h>
+#include <llvm/System/Path.h>
+
+namespace hlvm {
+
+  class AST::AST;
+
+  class XMLReader : public Reader
+  {
+  public:
+    /// This method instantiates an XMLReader that is prepared to read from
+    /// the path provided.
+    /// @brief Create a new XmlReader
+    static XMLReader* create(const llvm::sys::Path& path);
+
+    virtual ~XMLReader() {}
+  };
+}
+#endif





More information about the llvm-commits mailing list