From rspencer at reidspencer.com Tue May 16 01:59:53 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 02:59:53 -0400 Subject: [hlvm-commits] r59 - hlvm/AST Message-ID: <200605160659.k4G6xri6008902@sneezy.swagora.com> Author: reid Date: 2006-05-16 02:59:51 -0400 (Tue, 16 May 2006) New Revision: 59 Log: Add features needed for XML Reading/Writing Modified: hlvm/AST/AST.h hlvm/AST/Bundle.cpp hlvm/AST/Makefile hlvm/AST/Node.cpp hlvm/AST/Node.h Modified: hlvm/AST/AST.h =================================================================== --- hlvm/AST/AST.h 2006-05-14 17:42:27 UTC (rev 58) +++ hlvm/AST/AST.h 2006-05-16 06:59:51 UTC (rev 59) @@ -30,8 +30,6 @@ #ifndef HLVM_AST_AST_H #define HLVM_AST_AST_H -#include - /// This namespace is for all HLVM software. It ensures that HLVM software does /// not collide with any other software. Hopefully HLVM is not a namespace used /// elsewhere. @@ -41,6 +39,8 @@ /// node types of the AST are declared in this namespace. namespace AST { + class Bundle; + /// This class is used to hold or contain an Abstract Syntax Tree. It provides /// those aspects of the tree that are not part of the tree itself. /// @brief AST Container Class @@ -55,12 +55,13 @@ /// @name Accessors /// @{ public: + Bundle* getBundle() { return tree_; } /// @} /// @name Data /// @{ protected: - Node* tree_; + Bundle* tree_; /// @} }; } // AST Modified: hlvm/AST/Bundle.cpp =================================================================== --- hlvm/AST/Bundle.cpp 2006-05-14 17:42:27 UTC (rev 58) +++ hlvm/AST/Bundle.cpp 2006-05-16 06:59:51 UTC (rev 59) @@ -32,4 +32,8 @@ namespace hlvm { namespace AST { +Bundle::~Bundle() +{ +} + }} Modified: hlvm/AST/Makefile =================================================================== --- hlvm/AST/Makefile 2006-05-14 17:42:27 UTC (rev 58) +++ hlvm/AST/Makefile 2006-05-16 06:59:51 UTC (rev 59) @@ -4,11 +4,11 @@ # #------------------------------------------------------------------------------- -LEVEL = ../.. -LIBRARYNAME = HLVMAST +LEVEL := ../.. +LIBRARYNAME := HLVMAST DONT_BUILD_RELINKED := 1 -BUILD_ARCHIVE := 1 -INSTALL_INCLUDES := Bundle.h Conditionable.h ContainerType.h Function.h \ - LinkageItem.h Node.h SymbolTable.h Type.h Variable.h +BUILD_ARCHIVE := 1 +INSTALL_INCLUDES := Bundle.h Conditionable.h ContainerType.h Function.h \ + LinkageItem.h Node.h SymbolTable.h Type.h Variable.h include $(LEVEL)/Makefile.hlvm Modified: hlvm/AST/Node.cpp =================================================================== --- hlvm/AST/Node.cpp 2006-05-14 17:42:27 UTC (rev 58) +++ hlvm/AST/Node.cpp 2006-05-16 06:59:51 UTC (rev 59) @@ -31,9 +31,18 @@ #include #include -namespace hlvm { -namespace AST { +namespace hlvm { namespace AST { +Node::~Node() +{ + removeFromTree(); +} + +void +Node::removeFromTree() +{ +} + #ifndef _NDEBUG void Node::dump() const { Modified: hlvm/AST/Node.h =================================================================== --- hlvm/AST/Node.h 2006-05-14 17:42:27 UTC (rev 58) +++ hlvm/AST/Node.h 2006-05-16 06:59:51 UTC (rev 59) @@ -208,20 +208,41 @@ /// @name Accessors /// @{ public: + /// Get the type of node + inline bool getID() const { return id_; } + + /// Get the name of the node + inline const std::string& getName() { return name_; } + + /// Determine if the node is a Type inline bool isType() const { return id_ >= FirstPrimitiveTypeID && id_ <= LastContainerTypeID; } + /// Determine if the node is any of the Operators inline bool isOperator() const { return id_ >= FirstOperatorID && id_ <= LastOperatorID; } + /// Determine if the node is a Block inline bool isBlock() const { return id_ == BlockID; } + /// Determine if the node is a Bundle inline bool isBundle() const { return id_ == BundleID; } + /// Determine if the node is a Function inline bool isFunction() const { return id_ == FunctionID; } + /// Determine if the node is a Program inline bool isProgram() const { return id_ == ProgramID; } + /// Determine if the node is a Variable inline bool isVariable() const { return id_ == VariableID; } + /// Provide support for isa and friends static inline bool classof(const Node*) { return true; } /// @} + /// @name Mutators + /// @{ + protected: + void removeFromTree(); + + + /// @} /// @name Data /// @{ protected: _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 16 03:40:31 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 04:40:31 -0400 Subject: [hlvm-commits] r60 - / autoconf Message-ID: <200605160840.k4G8eVKl009020@sneezy.swagora.com> Author: reid Date: 2006-05-16 04:40:30 -0400 (Tue, 16 May 2006) New Revision: 60 Log: Don't include the install directory as a library source for linking. That means you'll link against something old that you previously installed, not against what you just built. This wasted 4 hours tonight. *sigh*. Modified: autoconf/configure.ac configure Modified: autoconf/configure.ac =================================================================== --- autoconf/configure.ac 2006-05-16 06:59:51 UTC (rev 59) +++ autoconf/configure.ac 2006-05-16 08:40:30 UTC (rev 60) @@ -308,7 +308,7 @@ HLVM_FIND_LIBRARY([syck],[syck.h],[syck],[syck_parse],[Syck Yaml Handler]) dnl -- Check for specific libraries we depend on. -LDFLAGS="-L${HLVM_WITH_LLVM_OBJ}/lib/Debug -L${prefix}/lib -L/usr/local/lib ${LDFLAGS}" +LDFLAGS="-L${HLVM_WITH_LLVM_OBJ}/lib/Debug ${LDFLAGS}" if test "$HLVM_EFENCE" = true ; then AC_CHECK_LIB(efence,malloc,, AC_MSG_ERROR(Electric Fence library is required: -lefence) ) Modified: configure =================================================================== --- configure 2006-05-16 06:59:51 UTC (rev 59) +++ configure 2006-05-16 08:40:30 UTC (rev 60) @@ -5806,7 +5806,7 @@ fi -LDFLAGS="-L${HLVM_WITH_LLVM_OBJ}/lib/Debug -L${prefix}/lib -L/usr/local/lib ${LDFLAGS}" +LDFLAGS="-L${HLVM_WITH_LLVM_OBJ}/lib/Debug ${LDFLAGS}" if test "$HLVM_EFENCE" = true ; then echo "$as_me:$LINENO: checking for malloc in -lefence" >&5 _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 16 03:51:21 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 04:51:21 -0400 Subject: [hlvm-commits] r61 - / autoconf Message-ID: <200605160851.k4G8pLNm009051@sneezy.swagora.com> Author: reid Date: 2006-05-16 04:51:20 -0400 (Tue, 16 May 2006) New Revision: 61 Log: Just don't mess with LDFLAGS at all! Modified: autoconf/configure.ac configure Modified: autoconf/configure.ac =================================================================== --- autoconf/configure.ac 2006-05-16 08:40:30 UTC (rev 60) +++ autoconf/configure.ac 2006-05-16 08:51:20 UTC (rev 61) @@ -308,7 +308,6 @@ HLVM_FIND_LIBRARY([syck],[syck.h],[syck],[syck_parse],[Syck Yaml Handler]) dnl -- Check for specific libraries we depend on. -LDFLAGS="-L${HLVM_WITH_LLVM_OBJ}/lib/Debug ${LDFLAGS}" if test "$HLVM_EFENCE" = true ; then AC_CHECK_LIB(efence,malloc,, AC_MSG_ERROR(Electric Fence library is required: -lefence) ) Modified: configure =================================================================== --- configure 2006-05-16 08:40:30 UTC (rev 60) +++ configure 2006-05-16 08:51:20 UTC (rev 61) @@ -5806,7 +5806,6 @@ fi -LDFLAGS="-L${HLVM_WITH_LLVM_OBJ}/lib/Debug ${LDFLAGS}" if test "$HLVM_EFENCE" = true ; then echo "$as_me:$LINENO: checking for malloc in -lefence" >&5 _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 16 03:56:13 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 04:56:13 -0400 Subject: [hlvm-commits] r62 - / Message-ID: <200605160856.k4G8uDKW009069@sneezy.swagora.com> Author: reid Date: 2006-05-16 04:56:12 -0400 (Tue, 16 May 2006) New Revision: 62 Log: Fix C++ compiler options (remove redundancies with LLVM) and get rid of cruft. Modified: Makefile.hlvm Modified: Makefile.hlvm =================================================================== --- Makefile.hlvm 2006-05-16 08:51:20 UTC (rev 61) +++ Makefile.hlvm 2006-05-16 08:56:12 UTC (rev 62) @@ -17,22 +17,20 @@ # CPPFLAGS += -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS \ - -I$(HLVM_top_srcdir) \ - -I$(HLVM_top_objdir) \ + -I$(HLVM_top_srcdir) -I$(HLVM_top_objdir) ifeq ($(HLVM_ASSERT),true) CPPFLAGS += -DHLVM_ASSERT=1 endif -HLVM_COMMONFLAGS := -pipe -Wall -W -Wwrite-strings -Wno-unused -Wcast-align \ - -Wpointer-arith +HLVM_COMMONFLAGS := -pipe -Wcast-align -Wpointer-arith CXXFLAGS += $(HLVM_COMMONFLAGS) -Wno-deprecated -Wold-style-cast \ - -Woverloaded-virtual -ffor-scope -foperator-names + -Woverloaded-virtual -ffor-scope -fno-operator-names CFLAGS += $(HLVM_COMMONFLAGS) ifeq ($(HLVM_DEBUG),true) -CXXFLAGS += -ggdb -CFLAGS += -ggdb +#CXXFLAGS += -ggdb +#CFLAGS += -ggdb endif ifeq ($(HLVM_OPTIMIZE),true) @@ -56,16 +54,6 @@ CFLAGS += -pg endif -# -# Define the ICU Resource stuff -# -SUFFIXES = .E -ICU_DATA_FILE = $(ICU_NAME).dat -ICU_MSGS_FILES = $(ICU_RESOURCES:%=%.msgs) -ICU_RES_FILES = $(ICU_RESOURCES:%=$(ICU_NAME)_%.res) -ICU_FILE_LIST = $(ICU_NAME).files -ALL_MSGS_FILES = $(HLVM_ALL_LANGUAGES:%=%.msgs) - # LLVM Requirements for makefile system PROJECT_NAME := $(HLVM_name) PROJECT_VERSION := $(HLVM_version) @@ -85,7 +73,6 @@ EchoCmd := $(ECHO) hlvm [$(MAKELEVEL)]: Echo := @$(EchoCmd) - $(PROJ_OBJ_ROOT)/Makefile.hlvm: $(PROJ_SRC_ROOT)/Makefile.hlvm $(Echo) "Updating Makefile.hlvm" $(Verb) $(MKDIR) $(@D) _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 16 03:57:26 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 04:57:26 -0400 Subject: [hlvm-commits] r63 - hlvm/AST hlvm/Reader/XML hlvm/Writer hlvm/Writer/XML tools/hlvm-xml2xml Message-ID: <200605160857.k4G8vQ0f009082@sneezy.swagora.com> Author: reid Date: 2006-05-16 04:57:25 -0400 (Tue, 16 May 2006) New Revision: 63 Log: Initial cut at implementing a skeletal framework for writing XML AST files. Modified: hlvm/AST/Block.cpp hlvm/AST/Function.cpp hlvm/AST/Node.cpp hlvm/AST/Node.h hlvm/AST/Operator.cpp hlvm/AST/Program.cpp hlvm/AST/Type.cpp hlvm/AST/Variable.cpp hlvm/Reader/XML/XMLReader.cpp hlvm/Writer/Writer.h hlvm/Writer/XML/XMLWriter.cpp hlvm/Writer/XML/XMLWriter.h tools/hlvm-xml2xml/Makefile Modified: hlvm/AST/Block.cpp =================================================================== --- hlvm/AST/Block.cpp 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/AST/Block.cpp 2006-05-16 08:57:25 UTC (rev 63) @@ -32,4 +32,7 @@ namespace hlvm { namespace AST { +Block::~Block() +{ +} }} Modified: hlvm/AST/Function.cpp =================================================================== --- hlvm/AST/Function.cpp 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/AST/Function.cpp 2006-05-16 08:57:25 UTC (rev 63) @@ -32,4 +32,7 @@ namespace hlvm { namespace AST { +Function::~Function() +{ +} }} Modified: hlvm/AST/Node.cpp =================================================================== --- hlvm/AST/Node.cpp 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/AST/Node.cpp 2006-05-16 08:57:25 UTC (rev 63) @@ -28,11 +28,14 @@ //===----------------------------------------------------------------------===// #include -#include -#include namespace hlvm { namespace AST { +Node::Node(NodeIDs id, Node* parent, const std::string& name) + : id_(id), parent_(parent), kids_(), name_(name) +{ +} + Node::~Node() { removeFromTree(); @@ -45,7 +48,8 @@ #ifndef _NDEBUG void -Node::dump() const { +hlvm::AST::Node::dump() const +{ } #endif Modified: hlvm/AST/Node.h =================================================================== --- hlvm/AST/Node.h 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/AST/Node.h 2006-05-16 08:57:25 UTC (rev 63) @@ -197,12 +197,12 @@ /// @name Constructors /// @{ public: - Node(NodeIDs id, Node* parent = 0, const std::string& name = "") - : id_(id), parent_(parent), kids_(), name_(name) {} - virtual ~Node(); + Node(NodeIDs id, Node* parent = 0, const std::string& name = ""); + #ifndef _NDEBUG virtual void dump() const; #endif + virtual ~Node(); /// @} /// @name Accessors Modified: hlvm/AST/Operator.cpp =================================================================== --- hlvm/AST/Operator.cpp 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/AST/Operator.cpp 2006-05-16 08:57:25 UTC (rev 63) @@ -32,4 +32,8 @@ namespace hlvm { namespace AST { +Operator::~Operator() +{ +} + }} Modified: hlvm/AST/Program.cpp =================================================================== --- hlvm/AST/Program.cpp 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/AST/Program.cpp 2006-05-16 08:57:25 UTC (rev 63) @@ -39,4 +39,8 @@ } SignatureType* Program::SignatureTy = Program::initSignature(); +Program::~Program() +{ +} + }} Modified: hlvm/AST/Type.cpp =================================================================== --- hlvm/AST/Type.cpp 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/AST/Type.cpp 2006-05-16 08:57:25 UTC (rev 63) @@ -32,4 +32,8 @@ namespace hlvm { namespace AST { +Type::~Type() +{ +} + }} Modified: hlvm/AST/Variable.cpp =================================================================== --- hlvm/AST/Variable.cpp 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/AST/Variable.cpp 2006-05-16 08:57:25 UTC (rev 63) @@ -32,4 +32,8 @@ namespace hlvm { namespace AST { +Variable::~Variable() +{ +} + }} Modified: hlvm/Reader/XML/XMLReader.cpp =================================================================== --- hlvm/Reader/XML/XMLReader.cpp 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/Reader/XML/XMLReader.cpp 2006-05-16 08:57:25 UTC (rev 63) @@ -360,7 +360,6 @@ return 1; } -/// @} }; AST::AST* @@ -415,7 +414,8 @@ const std::string* pubid = 0; elem.find_attrs(TKN_pubid,pubid); if (pubid) { - elem.node = new AST::Bundle(static_cast(0),*pubid); + elem.node = + new hlvm::AST::Bundle(static_cast(0),*pubid); } break; } @@ -508,7 +508,7 @@ } XMLReader* -XMLReader::create(const llvm::sys::Path& path) +hlvm::XMLReader::create(const llvm::sys::Path& path) { return new XMLReaderImpl(path); } Modified: hlvm/Writer/Writer.h =================================================================== --- hlvm/Writer/Writer.h 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/Writer/Writer.h 2006-05-16 08:57:25 UTC (rev 63) @@ -30,17 +30,15 @@ #ifndef XPS_WRITER_WRITER_H #define XPS_WRITER_WRITER_H -#include - namespace hlvm { -namespace AST { class AST; } +namespace AST { class Node; } class Writer { public: /// This method writes the entire content of the AST to the writer's /// destination - virtual void write(AST::AST* source) = 0; + virtual void write(AST::Node* source) = 0; }; } #endif Modified: hlvm/Writer/XML/XMLWriter.cpp =================================================================== --- hlvm/Writer/XML/XMLWriter.cpp 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/Writer/XML/XMLWriter.cpp 2006-05-16 08:57:25 UTC (rev 63) @@ -28,46 +28,257 @@ //===----------------------------------------------------------------------===// #include -#include +#include #include #include -#include +#include using namespace hlvm; namespace { -class XMLWriterImpl : public XMLWriter { - llvm::sys::Path path_; - std::fstream* out_; - AST::AST* ast_; +// An ostream that automatically indents and provides methods to control it. +class ostream_indent +{ + uint32_t indent_; public: - XMLWriterImpl(const llvm::sys::Path& path) : - path_(path), out_(0), ast_(0) + std::ostream& strm_; + ostream_indent(std::ostream& os) : indent_(0), strm_(os) {} + + inline void nl() { + strm_ << '\n'; + strm_.width(indent_); + strm_ << ' '; } + inline void in( bool with_newline = false) + { + indent_++; + if (with_newline) + nl(); + } + + inline void out( bool with_newline = false) + { + indent_--; + if (with_newline) + nl(); + } +}; + +class XMLWriterImpl : public XMLWriter { + ostream_indent ind_; + std::ostream& out_; + AST::Node* node_; +public: + XMLWriterImpl(std::ostream& out) + : ind_(out), out_(out), node_(0) + { } + virtual ~XMLWriterImpl() { - if (out_) { - out_->flush(); - out_->close(); - delete out_; - } + out_.flush(); } - virtual void write(AST::AST* ast); + virtual void write(AST::Node* node); + +private: + inline void putHeader(); + inline void putFooter(); + inline void put(AST::Node* node); + inline void put(AST::Bundle* node); }; +std::string +sanitize(const std::string* input) +{ + // Replace all the & in the name with & and simliarly for < and > + // because XML doesn't like 'em + std::string output(*input); + std::string::size_type pos = 0; + while (std::string::npos != (pos = output.find('&',pos))) + { + output.replace(pos,1,"&"); + pos += 5; + } + pos = 0; + while (std::string::npos != (pos = output.find('<',pos))) + { + output.replace(pos,1,"<"); + pos += 4; + } + pos = 0; + while (std::string::npos != (pos = output.find('>',pos))) + { + output.replace(pos,1,">"); + pos += 4; + } + return output; +} + +std::string +sanitize(const std::string& input) +{ + return sanitize(&input); +} + void -XMLWriterImpl::write(AST::AST* ast) { - ast_ = ast; +XMLWriterImpl::putHeader() +{ + out_ << "\n"; + out_ << "\n"; + out_ << "\n"; + ind_.in(); } +void +XMLWriterImpl::putFooter() +{ + ind_.out(); + out_ << "\n"; } +inline void +XMLWriterImpl::put(AST::Bundle* b) +{ + out_ << "getName() << "\">\n"; + ind_.in(); +} + +void +XMLWriterImpl::put(AST::Node* node) +{ + switch (node->getID()) + { + case hlvm::AST::VoidTypeID: break; + case hlvm::AST::AnyTypeID: break; + case hlvm::AST::BooleanTypeID: break; + case hlvm::AST::CharacterTypeID: break; + case hlvm::AST::OctetTypeID: break; + case hlvm::AST::IntegerTypeID: break; + case hlvm::AST::RangeTypeID: break; + case hlvm::AST::RealTypeID: break; + case hlvm::AST::RationalTypeID: break; + case hlvm::AST::StringTypeID: break; + case hlvm::AST::PointerTypeID: break; + case hlvm::AST::ArrayTypeID: break; + case hlvm::AST::VectorTypeID: break; + case hlvm::AST::StructureTypeID: break; + case hlvm::AST::FieldID: break; + case hlvm::AST::SignatureTypeID: break; + case hlvm::AST::ArgumentID: break; + case hlvm::AST::ContinuationTypeID: break; + case hlvm::AST::InterfaceID: break; + case hlvm::AST::ClassID: break; + case hlvm::AST::MethodID: break; + case hlvm::AST::ImplementsID: break; + case hlvm::AST::VariableID: break; + case hlvm::AST::FunctionID: break; + case hlvm::AST::ProgramID: break; + case hlvm::AST::BundleID: + put(llvm::cast(node)); + break; + case hlvm::AST::BlockID: break; + case hlvm::AST::CallOpID: break; + case hlvm::AST::InvokeOpID: break; + case hlvm::AST::DispatchOpID: break; + case hlvm::AST::CreateContOpID: break; + case hlvm::AST::CallWithContOpID: break; + case hlvm::AST::ReturnOpID: break; + case hlvm::AST::ThrowOpID: break; + case hlvm::AST::JumpToOpID: break; + case hlvm::AST::BreakOpID: break; + case hlvm::AST::IfOpID: break; + case hlvm::AST::LoopOpID: break; + case hlvm::AST::SelectOpID: break; + case hlvm::AST::WithOpID: break; + case hlvm::AST::LoadOpID: break; + case hlvm::AST::StoreOpID: break; + case hlvm::AST::AllocateOpID: break; + case hlvm::AST::FreeOpID: break; + case hlvm::AST::ReallocateOpID: break; + case hlvm::AST::StackAllocOpID: break; + case hlvm::AST::ReferenceOpID: break; + case hlvm::AST::DereferenceOpID: break; + case hlvm::AST::NegateOpID: break; + case hlvm::AST::ComplementOpID: break; + case hlvm::AST::PreIncrOpID: break; + case hlvm::AST::PostIncrOpID: break; + case hlvm::AST::PreDecrOpID: break; + case hlvm::AST::PostDecrOpID: break; + case hlvm::AST::AddOpID: break; + case hlvm::AST::SubtractOpID: break; + case hlvm::AST::MultiplyOpID: break; + case hlvm::AST::DivideOpID: break; + case hlvm::AST::ModulusOpID: break; + case hlvm::AST::BAndOpID: break; + case hlvm::AST::BOrOpID: break; + case hlvm::AST::BXOrOpID: break; + case hlvm::AST::AndOpID: break; + case hlvm::AST::OrOpID: break; + case hlvm::AST::NorOpID: break; + case hlvm::AST::XorOpID: break; + case hlvm::AST::NotOpID: break; + case hlvm::AST::LTOpID: break; + case hlvm::AST::GTOpID: break; + case hlvm::AST::LEOpID: break; + case hlvm::AST::GEOpID: break; + case hlvm::AST::EQOpID: break; + case hlvm::AST::NEOpID: break; + case hlvm::AST::IsPInfOpID: break; + case hlvm::AST::IsNInfOpID: break; + case hlvm::AST::IsNaNOpID: break; + case hlvm::AST::TruncOpID: break; + case hlvm::AST::RoundOpID: break; + case hlvm::AST::FloorOpID: break; + case hlvm::AST::CeilingOpID: break; + case hlvm::AST::PowerOpID: break; + case hlvm::AST::LogEOpID: break; + case hlvm::AST::Log2OpID: break; + case hlvm::AST::Log10OpID: break; + case hlvm::AST::SqRootOpID: break; + case hlvm::AST::RootOpID: break; + case hlvm::AST::FactorialOpID: break; + case hlvm::AST::GCDOpID: break; + case hlvm::AST::LCMOpID: break; + case hlvm::AST::MungeOpID: break; + case hlvm::AST::LengthOpID: break; + case hlvm::AST::IntOpID: break; + case hlvm::AST::RealOpID: break; + case hlvm::AST::PInfOpID: break; + case hlvm::AST::NInfOpID: break; + case hlvm::AST::NaNOpID: break; + case hlvm::AST::StringOpID: break; + case hlvm::AST::ArrayOpID: break; + case hlvm::AST::VectorOpID: break; + case hlvm::AST::StructureOpID: break; + case hlvm::AST::MapFileOpID: break; + case hlvm::AST::OpenOpID: break; + case hlvm::AST::CloseOpID: break; + case hlvm::AST::ReadOpID: break; + case hlvm::AST::WriteOpID: break; + case hlvm::AST::PositionOpID: break; + default: + assert(!"Invalid Node ID"); + break; + } +} + +void +XMLWriterImpl::write(AST::Node* node) +{ + node_ = node; + putHeader(); + put(node); + putFooter(); +} + +} + XMLWriter* -XMLWriter::create(const llvm::sys::Path& path) +hlvm::XMLWriter::create(std::ostream& out) { - return new XMLWriterImpl(path); + return new XMLWriterImpl(out); } Modified: hlvm/Writer/XML/XMLWriter.h =================================================================== --- hlvm/Writer/XML/XMLWriter.h 2006-05-16 08:56:12 UTC (rev 62) +++ hlvm/Writer/XML/XMLWriter.h 2006-05-16 08:57:25 UTC (rev 63) @@ -31,19 +31,17 @@ #define XPS_WRITER_XML_XMLWRITER_H #include -#include +#include namespace hlvm { - class AST::AST; - class XMLWriter: public Writer { public: /// This method instantiates an XMLReader that is prepared to read from /// the path provided. /// @brief Create a new XmlReader - static XMLWriter* create(const llvm::sys::Path& path); + static XMLWriter* create(std::ostream& out); virtual ~XMLWriter() {} }; Modified: tools/hlvm-xml2xml/Makefile =================================================================== --- tools/hlvm-xml2xml/Makefile 2006-05-16 08:56:12 UTC (rev 62) +++ tools/hlvm-xml2xml/Makefile 2006-05-16 08:57:25 UTC (rev 63) @@ -2,7 +2,7 @@ LEVEL = ../.. TOOLNAME = hlvm-xml2xml -USEDLIBS = HLVMXMLReader.a HLVMAST.a +USEDLIBS = HLVMXMLWriter.a HLVMXMLReader.a HLVMAST.a LLVMLIBS = LLVMSupport.a LLVMSystem.a include $(LEVEL)/Makefile.hlvm _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 16 04:15:01 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 05:15:01 -0400 Subject: [hlvm-commits] r64 - hlvm/Reader hlvm/Reader/XML tools/hlvm-xml2xml Message-ID: <200605160915.k4G9F1s5009106@sneezy.swagora.com> Author: reid Date: 2006-05-16 05:15:00 -0400 (Tue, 16 May 2006) New Revision: 64 Log: Incorporate the writing side of hlvm-xml2xml into the program. The skeleton is now complete. Modified: hlvm/Reader/Reader.h hlvm/Reader/XML/XMLReader.cpp tools/hlvm-xml2xml/hlvm-xml2xml.cpp Modified: hlvm/Reader/Reader.h =================================================================== --- hlvm/Reader/Reader.h 2006-05-16 08:57:25 UTC (rev 63) +++ hlvm/Reader/Reader.h 2006-05-16 09:15:00 UTC (rev 64) @@ -33,7 +33,7 @@ #include namespace hlvm { -namespace AST { class AST; } +namespace AST { class Node; } class Reader { @@ -43,7 +43,7 @@ /// This method retrieves the construct AST that resulted from reading. /// @returns 0 if nothing has been read yet - virtual AST::AST* get() = 0; + virtual AST::Node* get() = 0; }; } #endif Modified: hlvm/Reader/XML/XMLReader.cpp =================================================================== --- hlvm/Reader/XML/XMLReader.cpp 2006-05-16 08:57:25 UTC (rev 63) +++ hlvm/Reader/XML/XMLReader.cpp 2006-05-16 09:15:00 UTC (rev 64) @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -110,13 +109,13 @@ class XMLReaderImpl : public XMLReader { llvm::sys::Path path_; - AST::AST* ast_; + AST::Node* node_; XML_Parser xp_; std::vector elems_; ///< The element stack ElementInfo* etop_; ///< A pointer to the top of the element stack public: XMLReaderImpl(const llvm::sys::Path& path) : - path_(path), ast_(0), xp_(0), elems_(), etop_(0) + path_(path), node_(0), xp_(0), elems_(), etop_(0) { xp_ = XML_ParserCreate( "UTF-8"); // Reserve some space on the elements and attributes list so we aren't @@ -129,12 +128,12 @@ virtual ~XMLReaderImpl() { - if (ast_) delete ast_; + if (node_) delete node_; XML_ParserFree( xp_ ); } virtual void read(); - virtual AST::AST* get(); + virtual AST::Node* get(); void CDataSectionStart(void ); void CDataSectionEnd(); @@ -362,18 +361,16 @@ }; -AST::AST* +AST::Node* XMLReaderImpl::get() { - return ast_; + return node_; } static const XML_Char Namespace_Separator = 4; void XMLReaderImpl::read() { - ast_ = new AST::AST(); - // Set up the parser for parsing a document. XML_ParserReset(xp_,"UTF-8"); XML_SetUserData(xp_, this ); @@ -416,6 +413,7 @@ if (pubid) { elem.node = new hlvm::AST::Bundle(static_cast(0),*pubid); + node_ = elem.node; } break; } Modified: tools/hlvm-xml2xml/hlvm-xml2xml.cpp =================================================================== --- tools/hlvm-xml2xml/hlvm-xml2xml.cpp 2006-05-16 08:57:25 UTC (rev 63) +++ tools/hlvm-xml2xml/hlvm-xml2xml.cpp 2006-05-16 09:15:00 UTC (rev 64) @@ -28,6 +28,7 @@ //===----------------------------------------------------------------------===// #include +#include #include #include #include @@ -75,7 +76,14 @@ } XMLReader* rdr = XMLReader::create(llvm::sys::Path(InputFilename)); + XMLWriter* wrtr = XMLWriter::create(*Out); rdr->read(); + AST::Node* node = rdr->get(); + if (node) { + wrtr->write(node); + } + delete rdr; + delete wrtr; if (Out != &std::cout) { static_cast(Out)->close(); _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 16 12:27:24 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 13:27:24 -0400 Subject: [hlvm-commits] r65 - / autoconf docs hlvm/Base hlvm/Reader hlvm/Reader/XML tools/hlvm-xml2xml Message-ID: <200605161727.k4GHROV7010234@sneezy.swagora.com> Author: reid Date: 2006-05-16 13:27:22 -0400 (Tue, 16 May 2006) New Revision: 65 Log: Get hlvm-xml2xml to actually do something. It can now do a little bit of parsing and geneate a skeletal XML file. This patch also solves several build and configuration problems and documents those in the GettingStarted.html doc. Added: hlvm/Base/Memory.cpp hlvm/Base/Memory.h hlvm/Base/Source.cpp hlvm/Base/Source.h hlvm/Base/URI.cpp hlvm/Base/URI.h Modified: autoconf/configure.ac build.sh configure docs/GettingStarted.html hlvm/Reader/Reader.h hlvm/Reader/XML/XMLReader.cpp hlvm/Reader/XML/XMLReader.h tools/hlvm-xml2xml/Makefile tools/hlvm-xml2xml/hlvm-xml2xml.cpp Modified: autoconf/configure.ac =================================================================== --- autoconf/configure.ac 2006-05-16 09:15:00 UTC (rev 64) +++ autoconf/configure.ac 2006-05-16 17:27:22 UTC (rev 65) @@ -211,18 +211,6 @@ AC_MSG_RESULT($HLVM_WITH_WORKSPACE) AC_SUBST(HLVM_WITH_WORKSPACE) -dnl -- with-expat: specifies the location of the expat library -AC_MSG_CHECKING(location of expat library) -AC_ARG_WITH(expat, - AS_HELP_STRING([--with-expat=], - [Specify where the expat lbrary is located (default=/usr/local)]), - [case "${withval}" in - /*) HLVM_WITH_EXPAT=$withval ;; - *) AC_MSG_ERROR(bad value ${withval} for --with-expat) ;; - esac],[HLVM_WITH_EXPAT=/usr]) -AC_MSG_RESULT($HLVM_WITH_EXPAT) -AC_SUBST(HLVM_WITH_EXPAT) - dnl -- with-includes: specifies the location of additional header file dirs AC_MSG_CHECKING(location of additional header files) AC_ARG_WITH(includes, Modified: build.sh =================================================================== --- build.sh 2006-05-16 09:15:00 UTC (rev 64) +++ build.sh 2006-05-16 17:27:22 UTC (rev 65) @@ -86,9 +86,12 @@ getDirectory "Enter path to LLVM object root" "/proj/llvm/build" LLVM_OBJ="$DIR" - getDirectory "Enter path to expat libraries" "/proj/install/lib" + getDirectory "Enter path to expat libraries" "/proj/install" EXPAT_OBJ="$DIR" + getDirectory "Enter path to apr libraries" "/proj/install" + APR_OBJ="$DIR" + getDirectory "Enter path for additional header files" "/proj/install/include" HEADERS="$DIR" @@ -124,6 +127,7 @@ echo "LLVM_SRC=$LLVM_SRC" echo "LLVM_OBJ=$LLVM_OBJ" echo "EXPAT_OBJ=$EXPAT_OBJ" + echo "APR_OBJ=$APR_OBJ" echo "HEADERS=$HEADERS" echo "LIBRARIES=$LIBRARIES" echo "PROGRAMS=$PROGRAMS" @@ -149,6 +153,7 @@ echo "LLVM_SRC=$LLVM_SRC" >> config.opts echo "LLVM_OBJ=$LLVM_OBJ" >> config.opts echo "EXPAT_OBJ=$EXPAT_OBJ" >> config.opts + echo "APR_OBJ=$APR_OBJ" >> config.opts echo "HEADERS=$HEADERS" >> config.opts echo "LIBRARIES=$LIBRARIES" >> config.opts echo "PROGRAMS=$PROGRAMS" >> config.opts @@ -223,7 +228,9 @@ --enable-small=${enable_SMALL} \ --enable-efence=${enable_EFENCE} \ --enable-profiling=${enable_PROFILING} \ - --with-expat=${EXPAT_OBJ} \ + --with-EXPAT=${EXPAT_OBJ} \ + --with-APR=${APR_OBJ} \ + --with-APRU=${APR_OBJ} \ --with-llvm-src=${LLVM_SRC} \ --with-llvm-obj=${LLVM_OBJ} \ --with-workspace=${WORKSPACE} \ Modified: configure =================================================================== --- configure 2006-05-16 09:15:00 UTC (rev 64) +++ configure 2006-05-16 17:27:22 UTC (rev 65) @@ -315,7 +315,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS HLVM_COPYRIGHT HLVM_PACKAGE HLVM_VERSION HLVM_SO_VERSION HLVM_SO_CURRENT HLVM_SO_REVISION HLVM_SO_AGE HLVM_SHAREDPREFIX HLVM_DEBUG HLVM_OPTIMIZE HLVM_INLINE HLVM_ASSERT HLVM_TRACE HLVM_SMALL HLVM_EFENCE HLVM_PROFILING HLVM_WITH_WORKSPACE HLVM_WITH_EXPAT HLVM_WITH_INCLUDES HLVM_WITH_LLVM_SRC HLVM_WITH_LLVM_OBJ HLVM_WITH_LLVMGCC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX ifGNUmake apr_INC apr_LIB apru_INC apru_LIB expat_INC expat_LIB syck_INC syck_LIB EGREP HLVM_CFGNAME HLVM_CONFIGTIME HLVM_PREFIX LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS HLVM_COPYRIGHT HLVM_PACKAGE HLVM_VERSION HLVM_SO_VERSION HLVM_SO_CURRENT HLVM_SO_REVISION HLVM_SO_AGE HLVM_SHAREDPREFIX HLVM_DEBUG HLVM_OPTIMIZE HLVM_INLINE HLVM_ASSERT HLVM_TRACE HLVM_SMALL HLVM_EFENCE HLVM_PROFILING HLVM_WITH_WORKSPACE HLVM_WITH_INCLUDES HLVM_WITH_LLVM_SRC HLVM_WITH_LLVM_OBJ HLVM_WITH_LLVMGCC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX ifGNUmake apr_INC apr_LIB apru_INC apru_LIB expat_INC expat_LIB syck_INC syck_LIB EGREP HLVM_CFGNAME HLVM_CONFIGTIME HLVM_PREFIX LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -875,8 +875,6 @@ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-workspace= dir=location of the HLVM workspace storage (default=/opt/hlvm) - --with-expat= Specify where the expat lbrary is located - (default=/usr/local) --with-includes=-I... Specify additional header file directories (efault=none) @@ -1590,25 +1588,6 @@ echo "${ECHO_T}$HLVM_WITH_WORKSPACE" >&6 -echo "$as_me:$LINENO: checking location of expat library" >&5 -echo $ECHO_N "checking location of expat library... $ECHO_C" >&6 - -# Check whether --with-expat or --without-expat was given. -if test "${with_expat+set}" = set; then - withval="$with_expat" - case "${withval}" in - /*) HLVM_WITH_EXPAT=$withval ;; - *) { { echo "$as_me:$LINENO: error: bad value ${withval} for --with-expat" >&5 -echo "$as_me: error: bad value ${withval} for --with-expat" >&2;} - { (exit 1); exit 1; }; } ;; - esac -else - HLVM_WITH_EXPAT=/usr -fi; -echo "$as_me:$LINENO: result: $HLVM_WITH_EXPAT" >&5 -echo "${ECHO_T}$HLVM_WITH_EXPAT" >&6 - - echo "$as_me:$LINENO: checking location of additional header files" >&5 echo $ECHO_N "checking location of additional header files... $ECHO_C" >&6 @@ -7014,7 +6993,6 @@ s, at HLVM_EFENCE@,$HLVM_EFENCE,;t t s, at HLVM_PROFILING@,$HLVM_PROFILING,;t t s, at HLVM_WITH_WORKSPACE@,$HLVM_WITH_WORKSPACE,;t t -s, at HLVM_WITH_EXPAT@,$HLVM_WITH_EXPAT,;t t s, at HLVM_WITH_INCLUDES@,$HLVM_WITH_INCLUDES,;t t s, at HLVM_WITH_LLVM_SRC@,$HLVM_WITH_LLVM_SRC,;t t s, at HLVM_WITH_LLVM_OBJ@,$HLVM_WITH_LLVM_OBJ,;t t Modified: docs/GettingStarted.html =================================================================== --- docs/GettingStarted.html 2006-05-16 09:15:00 UTC (rev 64) +++ docs/GettingStarted.html 2006-05-16 17:27:22 UTC (rev 65) @@ -18,6 +18,7 @@
  • Software
  • +
  • Building Other Packages
  • @@ -284,5 +285,35 @@
  • zip* - zip command for distribution generation
  • + + + + +
    +

    Separate Install Area

    +

    It is suggested that you keep a separate installation area for building the + things that HLVM depends upon. This is the location in your file system where + you will install the built packages. It is used with the --prefix + option to the configure programs of the packages. By using a separate install + area, you ensure that the HLVM version of required packages doesn't interfere + with any of your system installed packages.

    +

    expat

    +
      +
    • Always build expat first. It doesn't depend on anything else
    • +
    • Use version 2.0 or later
    • +
    +

    apr

    +
      +
    • Optionally use the --enable-debug configure flag.
    • +
    • Required to use the --enable-threads configure flag.
    • +
    • Required to use the --enable-other-child configure flag.
    • +
    +

    apr-util

    +
      +
    • APR Utils depends on expat and so does HLVM. They must use the same + version or HLVM tools will not link properly. To ensure this, always provide + the apr-util configure script with --with-expat=/your/install
    • +
    +
    Added: hlvm/Base/Memory.cpp =================================================================== --- hlvm/Base/Memory.cpp 2006-05-16 09:15:00 UTC (rev 64) +++ hlvm/Base/Memory.cpp 2006-05-16 17:27:22 UTC (rev 65) @@ -0,0 +1,165 @@ +//===-- hlvm/Base/Memory.h - HLVM Memory Facilities -------------*- 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/Base/Memory.h +/// @author Reid Spencer (original author) +/// @date 2006/05/04 +/// @since 0.1.0 +/// @brief Declares the HLVM Memory Facilities +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include +#include +#include + +namespace hlvm { namespace Base { + +// The following provides a 64KByte emergency memory reserve for the program +// heap. Application writers are encouraged to use the memory facilities +// provided in this module but XPS itself can utilize the heap with +// malloc/free and new/delete. This memory reserve helps to avoid situations +// where new/delete might fail. + +static char * _memory_reserve = 0; + +static void +the_new_handler( void ) +{ + if ( _memory_reserve ) + { + delete [] _memory_reserve; + _memory_reserve = 0; + } + else + { + assert( _memory_reserve != 0 && "No memory!"); + } +} + +static void +the_unexpected_handler( void ) +{ + assert(!"Unexpected Handler."); +} + +static void +the_terminate_handler( void ) +{ + assert(!"Terminate Handler."); +} + +static void +ensure_emergency_reserve( void ) +{ + if ( _memory_reserve == 0 ) + { + _memory_reserve = ::new char [ 64 * 1024 ]; + } +} + +bool +memory_is_low( void ) +{ + return _memory_reserve == 0; +} + +apr_pool_t* POOL = 0; + +static bool initialized = false; +void +initialize(int& /*argc*/, char** /*argv*/) +{ + if ( ! initialized ) + { + try + { + // Reserve memory for emergencies + ensure_emergency_reserve(); + + // Specify the new_handler for C++ memory allocation + std::set_new_handler( the_new_handler ); + + // Specify the unexpected handler for unexpected C++ exceptions + std::set_unexpected( the_unexpected_handler ); + + // Specify the terminate handler for abnormal terminations + std::set_terminate( the_terminate_handler ); + + // Initialize APR + if (APR_SUCCESS != apr_initialize()) + assert(!"Can't initialize APR"); + + // Allocate the master pool + if (APR_SUCCESS != apr_pool_create(&POOL,0)) + assert(!"Can't allocate the master pool"); + +#ifdef XPS_DEBUG + // Make sure we print stack trace if we get bad signals + llvm::sys::PrintStackTraceOnErrorSignal(); +#endif + + } + catch ( ... ) + { + assert(!"Unexpected exception during initialization."); + } + + if (0 != atexit(terminate)) + assert(!"Can't register termination at exit"); + + // We've made it through initialization .. indicate that. + initialized = true; + } +} + +void +terminate( void ) +{ + if (initialized) + { + // Terminate APR + apr_terminate(); + + // Release the memory reserve + ::delete [] _memory_reserve; + + // Done. + initialized = false; + } +} + +}} + +void* +operator new(size_t size, apr_pool_t* pool) +{ + return apr_palloc(pool,size); +} + +void* +operator new[](size_t size, apr_pool_t* pool) +{ + return apr_palloc(pool,size); +} Added: hlvm/Base/Memory.h =================================================================== --- hlvm/Base/Memory.h 2006-05-16 09:15:00 UTC (rev 64) +++ hlvm/Base/Memory.h 2006-05-16 17:27:22 UTC (rev 65) @@ -0,0 +1,58 @@ +//===-- hlvm/Base/Memory.h - HLVM Memory Facilities -------------*- 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/Base/Memory.h +/// @author Reid Spencer (original author) +/// @date 2006/05/04 +/// @since 0.1.0 +/// @brief Declares memory facilities for HLVM +//===----------------------------------------------------------------------===// + +#ifndef HLVM_BASE_MEMORY_H +#define HLVM_BASE_MEMORY_H + +#include + +/// The BASE module implements fundamental utilities at the core of XPS. +/// @brief The most elemental module in XPS. +namespace hlvm { namespace Base { + +/// An APR pool to allocate memory into. This is the master pool of all XPS +/// allocated pools and generally the one used to allocate APRish stuff into. +/// Note that this doesn't exist until after the call to initialize() +/// @see initialize +/// @brief The main memory pool for XPS +extern apr_pool_t* POOL; + +/// Determine if emergency memory reserve has been exhausted. +/// @brief Detemine if heap memory is low. +extern bool memory_is_low( void ); + +void initialize(int& argc, char**argv ); +void terminate(); + +}} + +void* operator new(size_t size, apr_pool_t* pool); +void* operator new[](size_t size, apr_pool_t* pool); + +#endif Added: hlvm/Base/Source.cpp =================================================================== --- hlvm/Base/Source.cpp 2006-05-16 09:15:00 UTC (rev 64) +++ hlvm/Base/Source.cpp 2006-05-16 17:27:22 UTC (rev 65) @@ -0,0 +1,233 @@ +//===-- hlvm/Base/Source.cpp - AST Abstract Data Sourc 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/Base/Source.cpp +/// @author Reid Spencer (original author) +/// @date 2006/05/04 +/// @since 0.1.0 +/// @brief Defines the class hlvm::Source +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + +using namespace hlvm; + +namespace +{ + +class MappedFileSource : public Base::Source +{ +public: + MappedFileSource(llvm::sys::MappedFile& mf) + : mf_(mf), at_(0), end_(0), was_mapped_(false), read_len_(0) + { + } + + virtual void prepare(intptr_t block_len) + { + was_mapped_ = mf_.isMapped(); + if (!was_mapped_) + mf_.map(); + at_ = mf_.charBase(); + end_ = at_ + mf_.size(); + read_len_ = block_len; + } + + virtual bool more() + { + return at_ < end_; + } + + virtual const char* read(intptr_t& actual_len) + { + if (at_ >= end_) { + actual_len = 0; + return 0; + } + const char* result = at_; + if (read_len_ < end_ - at_) { + actual_len = read_len_; + at_ += read_len_; + } else { + actual_len = end_ - at_; + at_ = end_; + } + return result; + } + + virtual void finish() + { + if (!was_mapped_) + mf_.unmap(); + at_ = 0; + end_ = 0; + was_mapped_ = false; + read_len_ = 0; + } + + virtual std::string systemId() const + { + return mf_.path().toString(); + } + + virtual std::string publicId() const + { + return "file://" + systemId(); + } + +private: + llvm::sys::MappedFile& mf_; + const char* at_; + const char* end_; + bool was_mapped_; + intptr_t read_len_; +}; + +class StreamSource : public Base::Source +{ +public: + StreamSource(std::istream& strm, std::string sysId, size_t bsize) : s_(strm) + { + s_.seekg(0, std::ios::end); + len_ = s_.tellg(); + s_.seekg(0, std::ios::beg); + if (bsize > 1024*1024) + buffSize = 1024*1024; + else + buffSize = bsize; + buffer = new char[buffSize+1]; + } + + virtual ~StreamSource() + { + delete buffer; + } + + virtual void prepare(intptr_t block_len) + { + s_.seekg(0,std::ios::beg); + } + + virtual bool more() + { + return ! s_.bad() && !s_.eof(); + } + + virtual const char* read(intptr_t& actual_len) + { + if (more()) + { + size_t pos = s_.tellg(); + if (len_ - pos > buffSize) + actual_len = buffSize; + else + actual_len = len_ - pos; + s_.read(buffer, actual_len); + buffer[actual_len] = 0; + return buffer; + } + else + { + buffer[0] = 0; + actual_len = 0; + return buffer; + } + } + + virtual void finish() + { + } + + virtual std::string systemId() const + { + return sysId; + } + + virtual std::string publicId() const + { + return "file:///" + systemId(); + } + +private: + std::string sysId; + std::istream& s_; + size_t len_; + char* buffer; + size_t buffSize; +}; + +class URISource : public Base::Source +{ +private: + hlvm::Base::URI uri_; + llvm::sys::MappedFile* mf_; + MappedFileSource* mfs_; +public: + URISource(const Base::URI& uri ) + : uri_(uri) + , mf_(0) + , mfs_(0) + { + mf_ = new llvm::sys::MappedFile(llvm::sys::Path(uri_.resolveToFile())); + mfs_ = new MappedFileSource(*mf_); + } + virtual ~URISource() {} + virtual void prepare(intptr_t block_len) { mfs_->prepare(block_len); } + virtual bool more() { return mfs_->more(); } + virtual const char* read(intptr_t& actual_len) + { return mfs_->read(actual_len); } + virtual void finish() { mfs_->finish(); } + virtual std::string systemId() const { return mfs_->systemId(); } + virtual std::string publicId() const { return "file://" + mfs_->systemId(); } +}; + +} + +namespace hlvm { namespace Base { + +Source::~Source() +{ +} + +Source* +new_MappedFileSource(llvm::sys::MappedFile& mf) +{ + return new MappedFileSource(mf); +} + + +Source* +new_StreamSource(std::istream& strm, std::string sysId, size_t bSize) +{ + return new StreamSource(strm, sysId, bSize); +} + +Source* +new_URISource(const Base::URI& uri) +{ + return new URISource(uri); +} + +}} Added: hlvm/Base/Source.h =================================================================== --- hlvm/Base/Source.h 2006-05-16 09:15:00 UTC (rev 64) +++ hlvm/Base/Source.h 2006-05-16 17:27:22 UTC (rev 65) @@ -0,0 +1,79 @@ +//===-- hlvm/Base/Source.h - AST Abstract Input Source 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/Base/Source.h +/// @author Reid Spencer (original author) +/// @date 2006/05/04 +/// @since 0.1.0 +/// @brief Declares the class hlvm::Base::Source +//===----------------------------------------------------------------------===// + +#ifndef HLVM_BASE_SOURCE_H +#define HLVM_BASE_SOURCE_H + +#include +#include +#include + +namespace hlvm { namespace Base { + /// This class is the base class of a family of input source classes that can + /// be used to provide input to some parsing facility. This abstracts away + /// the details of how the input is acquired. Four functions must be + /// implemented by subclasses: prepare, more, read, and finish. + /// @brief Abstract Input Source Class + class Source + { + /// @name Methods + /// @{ + public: + /// @brief This destructor does nothing, but declared virtual for subclasses + virtual ~Source(); + + /// @brief Tells the source to prepare to be read + virtual void prepare(intptr_t block_len) = 0; + + /// @brief Requests a block of data. + virtual const char* read(intptr_t& actual_len) = 0; + + /// @brief Indicates if more data waits + virtual bool more() = 0; + + /// @brief Tells the source to finish up. + virtual void finish() = 0; + + /// @brief Get the system identifier of the source + virtual std::string systemId() const = 0; + + /// @brief Get the public identifier of the source + virtual std::string publicId() const = 0; + + /// @} + }; + + Source* new_MappedFileSource(llvm::sys::MappedFile& mf); + Source* new_StreamSource(std::istream&, std::string sysId = "", + size_t bSize = 65536); + Source* new_URISource(const URI& uri); + +}} + +#endif Added: hlvm/Base/URI.cpp =================================================================== --- hlvm/Base/URI.cpp 2006-05-16 09:15:00 UTC (rev 64) +++ hlvm/Base/URI.cpp 2006-05-16 17:27:22 UTC (rev 65) @@ -0,0 +1,78 @@ +//===-- hlvm/Base/URI.cpp - Uniform Resource Identifier ---------*- 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/Base/URI.cpp +/// @author Reid Spencer (original author) +/// @date 2006/05/04 +/// @since 0.1.0 +/// @brief Declares the class hlvm::Base::URI +//===----------------------------------------------------------------------===// + +#include +#include +#include + +namespace hlvm { namespace Base { + +URI::URI( const char * text) +{ + apr_uri_parse(POOL, text, &uri_); +} + +URI::URI( const std::string& str) +{ + apr_uri_parse(POOL, str.c_str(), &uri_); +} + +URI::~URI ( void ) +{ +} + +std::string +URI::as_string( void ) const +{ + const char* result = apr_uri_unparse(POOL, &uri_, 0); + return std::string( result ); +} + +/// @brief Clears the URI, releases memory. +void +URI::clear( void ) +{ + /// FIXME: how do we do this with the APR pools? +} + +std::string +URI::resolveToFile() const +{ + const char* scheme = this->scheme(); + if (scheme) + { + if (strncmp("file",this->scheme(),4) == 0) + { + return this->path(); + } + } + return ""; +} + +}} Added: hlvm/Base/URI.h =================================================================== --- hlvm/Base/URI.h 2006-05-16 09:15:00 UTC (rev 64) +++ hlvm/Base/URI.h 2006-05-16 17:27:22 UTC (rev 65) @@ -0,0 +1,257 @@ +//===-- hlvm/Base/URI.h - Uniform Resource Identifier -----------*- 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/Base/URI.h +/// @author Reid Spencer (original author) +/// @date 2006/05/04 +/// @since 0.1.0 +/// @brief Declares the class hlvm::Base::URI +//===----------------------------------------------------------------------===// + +#ifndef HLVM_BASE_URI_H +#define HLVM_BASE_URI_H + +#include +#include + +namespace hlvm { namespace Base { + +/// A class to represent Uniform Resource Identifiers (URIs). This class can +/// also support URLs and URNs. The implementation is based on the APR-UTIL +/// apr_uri set of functions and associated data types. +/// @see RFC 2396 states that hostnames take the form described in +/// @see RFC 1034 (Section 3) Hostname Syntax +/// @see RFC 1123 (Section 2.1). Hostnames +/// @see RFC 1609 Universal Resource Identifiers in WWW - Berners-Lee. +/// @see RFC 1738 Uniform Resource Locators - Berners-Lee. +/// @see RFC 1808 Relative Uniform Resource Locators - Fielding +/// @see RFC 2059 Uniform Resource Locators for z39.50 - Denenberg +/// @see RFC 2111 Content-ID and Message-ID Uniform Resource Locators-Levinson +/// @see RFC 2396 Uniform Resource Identifiers (URI) - Berners-Lee +/// @see RFC 3305 URI/URL/URN Clarifications and Recommendations - Mealling +/// @see RFC 3406 URN Namespace Definition Mechanisms - Daigle +/// @see RFC 3508 URL Schem Registration - Levin +/// @brief HLVM Uniform Resource Identifier Class +class URI +{ +/// @name Constructors +/// @{ +public: + /// @brief Default Constructor builds empty uri + URI ( void ); + + /// @brief Parsing constructor builds uri by parsing the string parameter + URI( const char * str ); + + /// @brief Parsing constructor builds uri by parsing the string parameter + URI( const std::string& xmlStr); + + /// @brief Copy Constructor. + URI ( const URI & that ); + + /// @brief Destructor. + ~URI ( void ); + +/// @} +/// @name Operators +/// @{ +public: + /// @brief Equality Operator. + bool operator == ( const URI & that ) const; + + /// @brief Assignment Operator. + URI & operator = ( const URI & that ); + +/// @} +/// @name Accessors +/// @{ +public: + + /// @brief Return the URI as a string (escaped). Caller must + /// free the returned string. + std::string as_string( void ) const; + + /// @brief Set a string to the value of the URI with escapes. + void get_string( std::string& str_to_fill ) const; + + /// @brief Return the scheme of the URI + const char* const scheme() const; + + /// @brief Return the password part of the URI + const char* const password() const; + + /// @breif Return the user part of the URI + const char* const user() const; + + /// @brief Return the host name from the URI + const char* const hostname() const; + + /// @brief Return the combined [user[:password]\@host:port/ part of the URI + const char* const hostinfo() const; + + /// @brief Return the port part of the URI + uint32_t port() const; + + /// @brief Return the path part of the URI + const char* const path() const; + + /// @brief Return the query part of the URI + const char* const query() const; + + /// @brief Return the fragment identifier part of the URI + const char* const fragment() const; + + /// @brief Determines if two URIs are equal + bool equals( const URI& that ) const; + + std::string resolveToFile() const; +/// @} +/// @name Mutators +/// @{ +public: + /// @brief Assignment of one URI to another + URI& assign( const URI& that ); + + /// @brief Assignment of an std::string to a URI. + void assign( const std::string& that ); + + /// @brief Clears the URI, releases memory. + void clear( void ); + + /// @brief Sets the scheme + //void scheme( const char* const scheme ); + + /// @brief Set the opaque part of the URI + //void opaque( const char* const opaque ); + + /// @brief Sets the authority. + //void authority( const char* const authority ); + + /// @brief Sets the user. + //void user( const char* const user ); + + /// @brief Sets the server. + //void server( const char* const server ); + + /// @brief Sets the port. + //void port( uint32_t portnum ); + +/// @} +/// @name Functions +/// @{ +public: + static uint32_t port_for_scheme( const char* scheme ); + +/// @} +/// @name Data +/// @{ +private: + apr_uri_t uri_; +/// @} +/// @name Unimplemented +/// @{ +private: +/// @} + +}; + +inline +URI::URI() +{ +} + +inline URI& +URI::assign( const URI& that ) +{ + this->uri_ = that.uri_; + return *this; +} + +inline +URI::URI ( const URI & that ) +{ + this->assign(that); +} + +inline URI & +URI::operator = ( const URI & that ) +{ + return this->assign(that); +} + +inline bool +URI::operator == ( const URI & that ) const +{ + return this->equals(that); +} + +inline const char* const +URI::scheme() const +{ + return uri_.scheme; +} + +inline const char* const +URI::password() const +{ + return uri_.password; +} + +inline const char* const +URI::user() const +{ + return uri_.user; +} + +inline const char* const +URI::hostname() const +{ + return uri_.hostname; +} + +inline uint32_t +URI::port() const +{ + return atoi(uri_.port_str); +} + +inline const char* const +URI::path() const +{ + return uri_.path; +} + +inline const char* const +URI::query() const +{ + return uri_.query; +} + +inline const char* const +URI::fragment() const +{ + return uri_.fragment; +} + +}} + +#endif Modified: hlvm/Reader/Reader.h =================================================================== --- hlvm/Reader/Reader.h 2006-05-16 09:15:00 UTC (rev 64) +++ hlvm/Reader/Reader.h 2006-05-16 17:27:22 UTC (rev 65) @@ -30,8 +30,6 @@ #ifndef XPS_READER_READER_H #define XPS_READER_READER_H -#include - namespace hlvm { namespace AST { class Node; } Modified: hlvm/Reader/XML/XMLReader.cpp =================================================================== --- hlvm/Reader/XML/XMLReader.cpp 2006-05-16 09:15:00 UTC (rev 64) +++ hlvm/Reader/XML/XMLReader.cpp 2006-05-16 17:27:22 UTC (rev 65) @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -108,14 +109,14 @@ }; class XMLReaderImpl : public XMLReader { - llvm::sys::Path path_; + hlvm::Base::Source* in_; AST::Node* node_; XML_Parser xp_; std::vector elems_; ///< The element stack ElementInfo* etop_; ///< A pointer to the top of the element stack public: - XMLReaderImpl(const llvm::sys::Path& path) : - path_(path), node_(0), xp_(0), elems_(), etop_(0) + XMLReaderImpl(Base::Source* input) + : in_(input), node_(0), xp_(0), elems_(), etop_(0) { xp_ = XML_ParserCreate( "UTF-8"); // Reserve some space on the elements and attributes list so we aren't @@ -206,9 +207,7 @@ // Fill in the element info ei.local = name; ei.token = HLVMTokenizer::recognize(name); - ei.set( - "", - p->path_.c_str(), + ei.set("", "{in}", uint32_t(XML_GetCurrentLineNumber(p->xp_)), uint32_t(XML_GetCurrentColumnNumber(p->xp_)) ); @@ -381,6 +380,41 @@ XML_SetCdataSectionHandler( xp_, StartCdataSectionHandler, EndCdataSectionHandler ); XML_SetUnknownEncodingHandler( xp_, UnknownEncodingHandler, this); + + try + { + int actual_len = 0; + in_->prepare(65536); + + // While there is more input to read + while ( in_->more() ) + { + // Read a chunk of data + const char* ptr = in_->read(actual_len); + + // Parse it. + int parse_result = XML_Parse( xp_, ptr, actual_len, in_->more() ) ; + + if ( XML_STATUS_ERROR == parse_result ) + { + std::cerr << "Parsing Error\n"; + + // Signal end of the parsing if we didn't already + if (in_->more()) + XML_Parse( xp_, 0, 0, 1 ); + in_->finish(); + return; + } + } + + // Signal the end of parsing + XML_StopParser( xp_, 0); + in_->finish(); + } catch (...) { + XML_StopParser(xp_,0); + in_->finish(); + throw; + } } void @@ -506,7 +540,7 @@ } XMLReader* -hlvm::XMLReader::create(const llvm::sys::Path& path) +hlvm::XMLReader::create(hlvm::Base::Source* src) { - return new XMLReaderImpl(path); + return new XMLReaderImpl(src); } Modified: hlvm/Reader/XML/XMLReader.h =================================================================== --- hlvm/Reader/XML/XMLReader.h 2006-05-16 09:15:00 UTC (rev 64) +++ hlvm/Reader/XML/XMLReader.h 2006-05-16 17:27:22 UTC (rev 65) @@ -31,7 +31,7 @@ #define XPS_READER_XML_XMLREADER_H #include -#include +#include namespace hlvm { @@ -43,7 +43,7 @@ /// 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); + static XMLReader* create(Base::Source* in); virtual ~XMLReader() {} }; Modified: tools/hlvm-xml2xml/Makefile =================================================================== --- tools/hlvm-xml2xml/Makefile 2006-05-16 09:15:00 UTC (rev 64) +++ tools/hlvm-xml2xml/Makefile 2006-05-16 17:27:22 UTC (rev 65) @@ -2,7 +2,7 @@ LEVEL = ../.. TOOLNAME = hlvm-xml2xml -USEDLIBS = HLVMXMLWriter.a HLVMXMLReader.a HLVMAST.a +USEDLIBS = HLVMXMLWriter.a HLVMXMLReader.a HLVMAST.a HLVMBase.a LLVMLIBS = LLVMSupport.a LLVMSystem.a include $(LEVEL)/Makefile.hlvm Modified: tools/hlvm-xml2xml/hlvm-xml2xml.cpp =================================================================== --- tools/hlvm-xml2xml/hlvm-xml2xml.cpp 2006-05-16 09:15:00 UTC (rev 64) +++ tools/hlvm-xml2xml/hlvm-xml2xml.cpp 2006-05-16 17:27:22 UTC (rev 65) @@ -27,6 +27,7 @@ /// @brief Implements the main program for the hlvm-xml2xml executable //===----------------------------------------------------------------------===// +#include #include #include #include @@ -46,9 +47,9 @@ int main(int argc, char**argv) { try { + Base::initialize(argc,argv); cl::ParseCommandLineOptions(argc, argv, "hlvm-xml2xml XML->AST->XML translator\n"); - sys::PrintStackTraceOnErrorSignal(); std::ostream *Out = &std::cout; // Default to printing to stdout. @@ -75,7 +76,23 @@ Out = &std::cout; } - XMLReader* rdr = XMLReader::create(llvm::sys::Path(InputFilename)); + Base::Source* src = 0; + llvm::sys::MappedFile* mf = 0; + if (InputFilename == "-" ) { + src = Base::new_StreamSource(std::cin); + } else { + llvm::sys::Path path(InputFilename); + if (path.canRead()) { + mf = new llvm::sys::MappedFile(path); + src = Base::new_MappedFileSource(*mf); + } else { + std::cerr << argv[0] << ": can't read input file: " << InputFilename + << "\n"; + exit(2); + } + } + + XMLReader* rdr = XMLReader::create(src); XMLWriter* wrtr = XMLWriter::create(*Out); rdr->read(); AST::Node* node = rdr->get(); @@ -84,6 +101,10 @@ } delete rdr; delete wrtr; + if (mf) { + mf->close(); + delete mf; + } if (Out != &std::cout) { static_cast(Out)->close(); _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 16 20:58:52 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 21:58:52 -0400 Subject: [hlvm-commits] r66 - docs Message-ID: <200605170158.k4H1wqMI010756@sneezy.swagora.com> Author: reid Date: 2006-05-16 21:58:51 -0400 (Tue, 16 May 2006) New Revision: 66 Log: Add an initial version of the release plans document. Added: docs/ReleasePlans.html Modified: docs/index.html Added: docs/ReleasePlans.html =================================================================== --- docs/ReleasePlans.html 2006-05-16 17:27:22 UTC (rev 65) +++ docs/ReleasePlans.html 2006-05-17 01:58:51 UTC (rev 66) @@ -0,0 +1,136 @@ + + + + + + HLVM Release Plans + + + +
    HLVM Release Plans
    +
    CAUTION: This document is always a work in progress.
    +
      +
    1. Introduction +
    2. Overview
    3. +
    4. Features
    5. +
    6. Status
    7. +
    8. Released Features +
    + +
    +

    Author:Reid Spencer.

    +
    + + + + + +
    +
    +

    WARNING

    +

    This document is ephemeral. We change it all the time. It gets updated + with our current plans for the definition of a release. As such, referring + to it often will help you understand where HLVM is going in upcoming + releases.

    +

    However, nothing within these plans should be relied upon or + taken as a committment from the developers. Open Source projects proceed + as time and talent permits and this one is no exception. We are simply + trying to provide you with information about what is likely to occur in + the next few releases.

    +
    +
    +
    +

    This document contains the Release plans for HLVM. Each release is broken + down into a set of high-level features that we are intending to implement in + that release. For each release, we describe the features and provide a + completion matrix to help you track the progress.

    +

    One of the reasons we publish this information is so that developers can + see where they might be able to help. If you have an interest in implementing + one of the features, please contact us.

    +
    + + + + +
    +

    The table below shows the releases we are thinking about.

    + + + + + + + + + + + + +
    ReleaseTitleLinks
    0.1AST ConstructionFeaturesStatus
    0.2Code GenerationFeaturesStatus
    +
    + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + +
    FeatureFeatureFeature
    Build Environment
    Mostly complete.
    Test Harness
    Just starting.
    AST Nodes
    A few nodes developed.
    XML Reader
    Infrastructure complete.
    XML Writer
    Infrastructure complete.
    hlvm_xml2xml
    Done.
    + AST Test Suite
    Just starting. +
    +
    + + + +
    +

    No status yet.

    +
    + + + + +
    +

    No releases yet.

    +
    + + Modified: docs/index.html =================================================================== --- docs/index.html 2006-05-16 17:27:22 UTC (rev 65) +++ docs/index.html 2006-05-17 01:58:51 UTC (rev 66) @@ -12,12 +12,17 @@ - - + + +
    UsersDevelopers
      +
    + + +
    _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 16 21:03:51 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 22:03:51 -0400 Subject: [hlvm-commits] r67 - docs Message-ID: <200605170203.k4H23pRT010773@sneezy.swagora.com> Author: reid Date: 2006-05-16 22:03:50 -0400 (Tue, 16 May 2006) New Revision: 67 Log: Fix some formatting issues. Modified: docs/ReleasePlans.html docs/hlvm.css Modified: docs/ReleasePlans.html =================================================================== --- docs/ReleasePlans.html 2006-05-17 01:58:51 UTC (rev 66) +++ docs/ReleasePlans.html 2006-05-17 02:03:50 UTC (rev 67) @@ -59,12 +59,12 @@ 0.1 AST Construction - FeaturesStatus + Features Status 0.2 Code Generation - FeaturesStatus + Features Status @@ -75,25 +75,25 @@ @@ -113,9 +113,8 @@ hlvm_xml2xml
    Done. - - AST Test Suite
    Just starting. - + AST Test Suite
    Just starting. +   Modified: docs/hlvm.css =================================================================== --- docs/hlvm.css 2006-05-17 01:58:51 UTC (rev 66) +++ docs/hlvm.css 2006-05-17 02:03:50 UTC (rev 67) @@ -150,7 +150,8 @@ color: #eeeeff; padding: 0.1em 0.1em 0.1em .1em; width: 100%; - margin-bottom: 0.3em; + margin-bottom: 0.2em; + margin-top: 0.3em; } .subsection { width: 75%; _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 16 21:06:06 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 16 May 2006 22:06:06 -0400 Subject: [hlvm-commits] r68 - docs Message-ID: <200605170206.k4H266JJ010787@sneezy.swagora.com> Author: reid Date: 2006-05-16 22:06:05 -0400 (Tue, 16 May 2006) New Revision: 68 Log: Adjust font sizes downward a bit. Modified: docs/hlvm.css Modified: docs/hlvm.css =================================================================== --- docs/hlvm.css 2006-05-17 02:03:50 UTC (rev 67) +++ docs/hlvm.css 2006-05-17 02:06:05 UTC (rev 68) @@ -62,7 +62,7 @@ border-bottom: 1px solid #CCEEFF; text-align: center; vertical-align: middle; - font-size: 150%; + font-size: 140%; font-weight: bold; padding: 0.1em 0.1em 0.1em 0.1em; width: 100%; @@ -74,7 +74,7 @@ background-color: #4444AA; color: #EEEEFF; text-align: left; - font-size: 125%; + font-size: 120%; font-weight: bold; } H3 { @@ -145,7 +145,8 @@ border-style: solid none solid none; text-align: center; vertical-align: middle; - font-weight: bold; font-size: 18pt; + font-weight: bold; + font-size: 16pt; background-color: #000088; color: #eeeeff; padding: 0.1em 0.1em 0.1em .1em; @@ -156,7 +157,7 @@ .subsection { width: 75%; text-align: left; - font-size: 12pt; + font-size: 13pt; } .subsubsection { margin: 1.0em 0.5em 0.5em 0.5em; _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 13:57:46 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Wed, 17 May 2006 14:57:46 -0400 Subject: [hlvm-commits] r69 - in test: . config lib xml2xml Message-ID: <200605171857.k4HIvkS9012543@sneezy.swagora.com> Author: reid Date: 2006-05-17 14:57:45 -0400 (Wed, 17 May 2006) New Revision: 69 Log: Provide an initial dejagnu testing framework for the identity tests. These tests, in xml2xml transform XML -> AST -> XML. We "diff" the input and output XML. If they are identical, the identity test passes. This approach can be used with any tool that can read its input and echo its output. Added: test/config/ test/config/unix.exp test/lib/ test/lib/identity.exp test/lib/xml2xml.exp test/xml2xml/ test/xml2xml/bundle.hlx test/xml2xml/dg.exp Modified: test/Makefile Modified: test/Makefile =================================================================== --- test/Makefile 2006-05-17 02:06:05 UTC (rev 68) +++ test/Makefile 2006-05-17 18:57:45 UTC (rev 69) @@ -1,13 +1,28 @@ -##===- test/Makefile ---------------------------------------*- Makefile -*-===## +LEVEL = .. +DIRS = +DISABLE_AUTO_DEPENDENCIES=1 -# -# Relative path to the top of the source tree. -# -LEVEL=.. +include ${LEVEL}/Makefile.hlvm -# -# List all of the subdirectories that we will compile. -# -DIRS= +all:: check-local -include $(LEVEL)/Makefile.hlvm +check-local:: site.exp + @DEJAGNU=./site.exp runtest --tool xml2xml + +site.exp: Makefile $(PROJ_OBJ_ROOT)/Makefile.config + @echo 'Making a new site.exp file...' + @echo '## these variables are automatically generated by make ##' >site.tmp + @echo '# Do not edit here. If you wish to override these values' >>site.tmp + @echo '# edit the last section' >>site.tmp + @echo 'set target_triplet "$(TARGET_TRIPLE)"' >> site.tmp + @echo 'set srcdir "$(PROJ_SRC_ROOT)/test"' >>site.tmp + @echo 'set objdir "$(PROJ_OBJ_ROOT)/test"' >>site.tmp + @echo 'set srcrootdir "$(PROJ_SRC_ROOT)"' >>site.tmp + @echo 'set objrootdir "$(PROJ_OBJ_ROOT)"' >>site.tmp + @echo 'set tmpdir "$$objdir/tmp"' >> site.tmp + @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp + @test ! -f site.exp || \ + sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp + @-rm -f site.bak + @test ! -f site.exp || mv site.exp site.bak + @mv site.tmp site.exp Added: test/config/unix.exp =================================================================== --- test/config/unix.exp 2006-05-17 02:06:05 UTC (rev 68) +++ test/config/unix.exp 2006-05-17 18:57:45 UTC (rev 69) @@ -0,0 +1,22 @@ +# Copyright (C) 1997 - 2001 Free Software Foundation, Inc. + +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu at gnu.org + +proc foo_load {} {} +proc foo_exit {} {} + Added: test/lib/identity.exp =================================================================== --- test/lib/identity.exp 2006-05-17 02:06:05 UTC (rev 68) +++ test/lib/identity.exp 2006-05-17 18:57:45 UTC (rev 69) @@ -0,0 +1,70 @@ +#===-test/lib/identity.exp - Script for identity tests ---------------------===# +# +# 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 +# +#===------------------------------------------------------------------------===# +proc hlvm-identity-tests { prog pat } { + global srcdir subdir objdir tmpdir objrootdir + set outdir [file join $objdir $subdir] + set tool [file join $objrootdir Debug bin $prog ] + set source [file join $srcdir $subdir ] + set files [lsort [ + glob -nocomplain -tails -types {f r} -directory $source $pat]] + set dirs [lsort [ + glob -nocomplain -tails -types {d r} -directory $source *]] + + if { [file isdirectory $outdir] } { + cd $outdir + } else { + if { [file exists $outdir] } { + fail "identity: $outdir exists and is not a directory. Remove it" + exit(2) + } else { + file mkdir $outdir + } + } + + foreach test $files { + set output [file join $outdir ${test}.out] + set testsrc [file join $source $test] + set retval [ catch {exec $tool $testsrc -o $output >>&$output } ] + if { $retval == 1 } { + #Get output + set outputFile [open $output {RDONLY}] + set result [read $outputFile] + close $outputFile + fail "$test: $tool returned $retval\n$result" + } else { + # Do the identity test + set diffout [file join ${output}.diff] + set retval [ catch {exec diff $testsrc $output >&$diffout } ] + if {$retval == 1} { + #Get output + set difffile [open $diffout {RDONLY}] + set result [read $difffile] + close $difffile + fail "$test: identity test failed:\n$result" + } else { + file delete $diffout + pass "$test" + } + } + } +} Added: test/lib/xml2xml.exp =================================================================== Added: test/xml2xml/bundle.hlx =================================================================== --- test/xml2xml/bundle.hlx 2006-05-17 02:06:05 UTC (rev 68) +++ test/xml2xml/bundle.hlx 2006-05-17 18:57:45 UTC (rev 69) @@ -0,0 +1,4 @@ + + + + Added: test/xml2xml/dg.exp =================================================================== --- test/xml2xml/dg.exp 2006-05-17 02:06:05 UTC (rev 68) +++ test/xml2xml/dg.exp 2006-05-17 18:57:45 UTC (rev 69) @@ -0,0 +1,3 @@ +load_lib identity.exp + +hlvm-identity-tests hlvm-xml2xml "*.hlx" _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 14:18:40 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Wed, 17 May 2006 15:18:40 -0400 Subject: [hlvm-commits] r70 - test/xml2xml Message-ID: <200605171918.k4HJIeS5012602@sneezy.swagora.com> Author: reid Date: 2006-05-17 15:18:39 -0400 (Wed, 17 May 2006) New Revision: 70 Log: Correct this to conform to the expected output for an identity test. Modified: test/xml2xml/bundle.hlx Modified: test/xml2xml/bundle.hlx =================================================================== --- test/xml2xml/bundle.hlx 2006-05-17 18:57:45 UTC (rev 69) +++ test/xml2xml/bundle.hlx 2006-05-17 19:18:39 UTC (rev 70) @@ -1,4 +1,6 @@ + + - + _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 15:10:30 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Wed, 17 May 2006 16:10:30 -0400 Subject: [hlvm-commits] r71 - test/lib Message-ID: <200605172010.k4HKAUCa012652@sneezy.swagora.com> Author: reid Date: 2006-05-17 16:10:29 -0400 (Wed, 17 May 2006) New Revision: 71 Log: Don't attempt to redirect the output to the same place as the program is putting its output. The output is gobbled by the exec command. Modified: test/lib/identity.exp Modified: test/lib/identity.exp =================================================================== --- test/lib/identity.exp 2006-05-17 19:18:39 UTC (rev 70) +++ test/lib/identity.exp 2006-05-17 20:10:29 UTC (rev 71) @@ -44,7 +44,7 @@ foreach test $files { set output [file join $outdir ${test}.out] set testsrc [file join $source $test] - set retval [ catch {exec $tool $testsrc -o $output >>&$output } ] + set retval [ catch {exec $tool $testsrc -o $output } ] if { $retval == 1 } { #Get output set outputFile [open $output {RDONLY}] _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 15:18:25 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Wed, 17 May 2006 16:18:25 -0400 Subject: [hlvm-commits] r72 - hlvm/AST Message-ID: <200605172018.k4HKIPZu012672@sneezy.swagora.com> Author: reid Date: 2006-05-17 16:18:25 -0400 (Wed, 17 May 2006) New Revision: 72 Log: Allow the node ID to be obtained. Modified: hlvm/AST/Node.h Modified: hlvm/AST/Node.h =================================================================== --- hlvm/AST/Node.h 2006-05-17 20:10:29 UTC (rev 71) +++ hlvm/AST/Node.h 2006-05-17 20:18:25 UTC (rev 72) @@ -209,7 +209,7 @@ /// @{ public: /// Get the type of node - inline bool getID() const { return id_; } + inline NodeIDs getID() const { return id_; } /// Get the name of the node inline const std::string& getName() { return name_; } _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 15:51:02 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Wed, 17 May 2006 16:51:02 -0400 Subject: [hlvm-commits] r73 - hlvm/Reader/XML Message-ID: <200605172051.k4HKp21U012706@sneezy.swagora.com> Author: reid Date: 2006-05-17 16:51:01 -0400 (Wed, 17 May 2006) New Revision: 73 Log: Get the RNG validation errors out of this schema so it can be used. Modified: hlvm/Reader/XML/HLVM.rng Modified: hlvm/Reader/XML/HLVM.rng =================================================================== --- hlvm/Reader/XML/HLVM.rng 2006-05-17 20:18:25 UTC (rev 72) +++ hlvm/Reader/XML/HLVM.rng 2006-05-17 20:51:01 UTC (rev 73) @@ -38,10 +38,10 @@ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns ="http://relaxng.org/ns/structure/1.0" xmlns:a="http://relaxng.org/ns/annotation/1.0" - ns="http://hlvm.org/src/hlvm/Reader/XML/HLVMAST.rng"> + ns="http://hlvm.org/src/hlvm/Reader/XML/HLVM.rng"> - + @@ -141,9 +141,16 @@ + + + + + + + - + @@ -155,18 +162,14 @@ - + - - - - - - - - + + + + - + @@ -193,27 +196,22 @@ - - + - - - - + - @@ -235,10 +233,8 @@ - - - + @@ -246,46 +242,34 @@ - - - - + - - - - + - - - - + - - - @@ -297,7 +281,7 @@ - + @@ -312,22 +296,17 @@ - - - + - - - - + @@ -347,7 +326,6 @@ - @@ -361,12 +339,10 @@ - - - + @@ -377,17 +353,11 @@ - - - - - - @@ -396,329 +366,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 15:52:10 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Wed, 17 May 2006 16:52:10 -0400 Subject: [hlvm-commits] r74 - test/xml2xml Message-ID: <200605172052.k4HKqAb2012731@sneezy.swagora.com> Author: reid Date: 2006-05-17 16:52:09 -0400 (Wed, 17 May 2006) New Revision: 74 Log: Get this to validate with RelaxNG: remove DTD declaration (RNG is not a DTD), and fix the attribute on the bundle element. This now validates. Modified: test/xml2xml/bundle.hlx Modified: test/xml2xml/bundle.hlx =================================================================== --- test/xml2xml/bundle.hlx 2006-05-17 20:51:01 UTC (rev 73) +++ test/xml2xml/bundle.hlx 2006-05-17 20:52:09 UTC (rev 74) @@ -1,6 +1,5 @@ - - - + + _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 19:16:02 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Wed, 17 May 2006 20:16:02 -0400 Subject: [hlvm-commits] r75 - in utils: bin tmplt Message-ID: <200605180016.k4I0G2RX012838@sneezy.swagora.com> Author: reid Date: 2006-05-17 20:16:01 -0400 (Wed, 17 May 2006) New Revision: 75 Log: Fix some bug-a-boos with handling the source directory. Modified: utils/bin/mkFuncs.pm utils/bin/mkTokenizer utils/tmplt/Tokenizer_Template.cpp Modified: utils/bin/mkFuncs.pm =================================================================== --- utils/bin/mkFuncs.pm 2006-05-17 20:52:09 UTC (rev 74) +++ utils/bin/mkFuncs.pm 2006-05-18 00:16:01 UTC (rev 75) @@ -1,14 +1,12 @@ #!/usr/bin/perl +use FindBin; + sub get_hlvm_dir { - chomp(my $cwd=`pwd`); - my $hlvmdir = $cwd; - $hlvmdir =~ s|(.*hlvm).*|$1|; - if (-d"$hlvmdir/AST") { - $hlvmdir =~ s|(.*)/hlvm|$1|; - } - return $hlvmdir; + my $hlvmdir = $FindBin::Bin; + my $index = rindex($hlvmdir, "/utils/bin"); + return substr($hlvmdir,0,$index); } sub process_file Modified: utils/bin/mkTokenizer =================================================================== --- utils/bin/mkTokenizer 2006-05-17 20:52:09 UTC (rev 74) +++ utils/bin/mkTokenizer 2006-05-18 00:16:01 UTC (rev 75) @@ -28,26 +28,30 @@ # Usage: # mkTokenizer -f # +use FindBin; +use lib $FindBin::Bin; +use mkFuncs; +use File::Copy; + $SchemaFile = shift; if ("$SchemaFile" eq "-f") { $Force = 1; $SchemaFile = shift; } die "USAGE: $0 \n" if -z "$SchemaFile"; -$HLVM_root = shift; +$HLVM_root = get_hlvm_dir(); die "USAGE: $0 \n" if -z "$HLVM_root"; -print "$HLVM_root\n"; $Schema = $SchemaFile; $Schema =~ s/\.rng//; $Schema = substr($Schema,rindex($Schema,'/')+1); -$PreambleFile = "$HLVM_root"."/utils/tmplt/Preamble_Code"; -$HeaderTemplate = "$HLVM_root"."/utils/tmplt/Tokenizer_Template.h"; -$HeaderFile = "$Schema"."Tokenizer.h"; -$SourceTemplate = "$HLVM_root"."/utils/tmplt/Tokenizer_Template.cpp"; -$SourceFile = "$Schema"."Tokenizer.cpp"; -$TokenHashClass = "$Schema" . "TokenHash"; -$TokenHashFile = "$TokenHashClass" . ".i"; +$PreambleFile = $HLVM_root . "/utils/tmplt/Preamble_Code"; +$HeaderTemplate = $HLVM_root . "/utils/tmplt/Tokenizer_Template.h"; +$HeaderFile = $Schema . "Tokenizer.h"; +$SourceTemplate = $HLVM_root . "/utils/tmplt/Tokenizer_Template.cpp"; +$SourceFile = $Schema . "Tokenizer.cpp"; +$TokenHashClass = $Schema . "TokenHash"; +$TokenHashFile = $TokenHashClass . ".i"; # Check the validity of the files we use/create die "Invalid schema file name" if ! -e "$SchemaFile"; @@ -60,11 +64,6 @@ # Get the plain old schema name from the file name -use FindBin; -use lib $FindBin::Bin; -use mkFuncs; -use File::Copy; - sub sortUnique { my @list = @_; Modified: utils/tmplt/Tokenizer_Template.cpp =================================================================== --- utils/tmplt/Tokenizer_Template.cpp 2006-05-17 20:52:09 UTC (rev 74) +++ utils/tmplt/Tokenizer_Template.cpp 2006-05-18 00:16:01 UTC (rev 75) @@ -5,8 +5,8 @@ /// @brief Implements the functions of class %SCHEMA_NAME%Tokenizer. /////////////////////////////////////////////////////////////////////////////// -#include -#include +#include <%MODULE_PATH%/%SCHEMA_NAME%Tokenizer.h> +#include <%MODULE_PATH%/%SCHEMA_NAME%TokenHash.i> namespace HLVM_%MODULE% { _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 20:31:11 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Wed, 17 May 2006 21:31:11 -0400 Subject: [hlvm-commits] r76 - in utils: bin tmplt Message-ID: <200605180131.k4I1VBwL012880@sneezy.swagora.com> Author: reid Date: 2006-05-17 21:31:10 -0400 (Wed, 17 May 2006) New Revision: 76 Log: Undo my brain fart. Modified: utils/bin/mkFuncs.pm utils/bin/mkTokenizer utils/tmplt/Tokenizer_Template.cpp Modified: utils/bin/mkFuncs.pm =================================================================== --- utils/bin/mkFuncs.pm 2006-05-18 00:16:01 UTC (rev 75) +++ utils/bin/mkFuncs.pm 2006-05-18 01:31:10 UTC (rev 76) @@ -18,7 +18,7 @@ my $hlvmdir = get_hlvm_dir(); chomp($MODULE_PATH = `pwd`); - $MODULE_PATH =~ s|$hlvmdir\/hlvm\/(.*)|$1|; + $MODULE_PATH = substr($MODULE_PATH,rindex($MODULE_PATH,"/hlvm/")+6); $MODULE = $MODULE_PATH; $MODULE =~ s|\/|_|g; @@ -50,7 +50,7 @@ } } - local $NAMESPACE = "HLVM_$MODULE"; + local $NAMESPACE = "HLVM_$MODULE"; local $module_header = ucfirst($MODULE); local $MODULE_INCLUDE = ""; local $CLASS_INCLUDE = ""; Modified: utils/bin/mkTokenizer =================================================================== --- utils/bin/mkTokenizer 2006-05-18 00:16:01 UTC (rev 75) +++ utils/bin/mkTokenizer 2006-05-18 01:31:10 UTC (rev 76) @@ -114,8 +114,9 @@ # Run the input through GPERF to create the perfect hash function $hlvmdir = get_hlvm_dir(); -chomp($Module = `pwd`); -$Module =~ s|$hlvmdir\/hlvm\/(.*)|$1|; +chomp($ModulePath = `pwd`); +$ModulePath = substr($ModulePath,rindex($ModulePath,"/hlvm/")+6); +$Module = $ModulePath; $Module =~ s|\/|_|g; print GPERF "struct TokenMap {\n"; print GPERF "const char *name; HLVM_$Module"."::".$Schema."Tokens token;\n" ; Modified: utils/tmplt/Tokenizer_Template.cpp =================================================================== --- utils/tmplt/Tokenizer_Template.cpp 2006-05-18 00:16:01 UTC (rev 75) +++ utils/tmplt/Tokenizer_Template.cpp 2006-05-18 01:31:10 UTC (rev 76) @@ -5,8 +5,8 @@ /// @brief Implements the functions of class %SCHEMA_NAME%Tokenizer. /////////////////////////////////////////////////////////////////////////////// -#include <%MODULE_PATH%/%SCHEMA_NAME%Tokenizer.h> -#include <%MODULE_PATH%/%SCHEMA_NAME%TokenHash.i> +#include +#include namespace HLVM_%MODULE% { _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 23:09:54 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Thu, 18 May 2006 00:09:54 -0400 Subject: [hlvm-commits] r77 - test/lib Message-ID: <200605180409.k4I49smj013039@sneezy.swagora.com> Author: reid Date: 2006-05-18 00:09:53 -0400 (Thu, 18 May 2006) New Revision: 77 Log: Gracefully handle cases where the test program didn't produce any output. Modified: test/lib/identity.exp Modified: test/lib/identity.exp =================================================================== --- test/lib/identity.exp 2006-05-18 01:31:10 UTC (rev 76) +++ test/lib/identity.exp 2006-05-18 04:09:53 UTC (rev 77) @@ -47,9 +47,13 @@ set retval [ catch {exec $tool $testsrc -o $output } ] if { $retval == 1 } { #Get output - set outputFile [open $output {RDONLY}] - set result [read $outputFile] - close $outputFile + if { [file exists $output] } { + set outputFile [open $output {RDONLY}] + set result [read $outputFile] + close $outputFile + } else { + set result "no output file" + } fail "$test: $tool returned $retval\n$result" } else { # Do the identity test @@ -57,9 +61,13 @@ set retval [ catch {exec diff $testsrc $output >&$diffout } ] if {$retval == 1} { #Get output - set difffile [open $diffout {RDONLY}] - set result [read $difffile] - close $difffile + if { [file exists $diffout] } { + set difffile [open $diffout {RDONLY}] + set result [read $difffile] + close $difffile + } else { + set result "no diff file" + } fail "$test: identity test failed:\n$result" } else { file delete $diffout _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 23:10:34 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Thu, 18 May 2006 00:10:34 -0400 Subject: [hlvm-commits] r78 - hlvm/Writer/XML Message-ID: <200605180410.k4I4AYUD013052@sneezy.swagora.com> Author: reid Date: 2006-05-18 00:10:33 -0400 (Thu, 18 May 2006) New Revision: 78 Log: Get the indentation right. Modified: hlvm/Writer/XML/XMLWriter.cpp Modified: hlvm/Writer/XML/XMLWriter.cpp =================================================================== --- hlvm/Writer/XML/XMLWriter.cpp 2006-05-18 04:09:53 UTC (rev 77) +++ hlvm/Writer/XML/XMLWriter.cpp 2006-05-18 04:10:33 UTC (rev 78) @@ -129,22 +129,24 @@ out_ << "\n"; out_ << "\n"; - out_ << "\n"; - ind_.in(); + out_ << ""; + ind_.in(true); } void XMLWriterImpl::putFooter() { - ind_.out(); + ind_.out(true); out_ << "\n"; } inline void XMLWriterImpl::put(AST::Bundle* b) { - out_ << "getName() << "\">\n"; - ind_.in(); + out_ << "getName() << "\">"; + ind_.in(true); + ind_.out(true); + out_ << ""; } void _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Wed May 17 23:11:50 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Thu, 18 May 2006 00:11:50 -0400 Subject: [hlvm-commits] r79 - / autoconf hlvm/Reader/XML tools/hlvm-xml2xml Message-ID: <200605180411.k4I4Bo1Z013065@sneezy.swagora.com> Author: reid Date: 2006-05-18 00:11:48 -0400 (Thu, 18 May 2006) New Revision: 79 Log: Convert to use libxml2 instead of expat. libxml2 understands how to parse and validate Relax/NG schema grammars and documents based on them. This is a big win in functionality and cuts down on the amount of code we have to write. Modified: autoconf/configure.ac configure hlvm/Reader/XML/Makefile hlvm/Reader/XML/XMLReader.cpp hlvm/Reader/XML/XMLReader.h tools/hlvm-xml2xml/hlvm-xml2xml.cpp Modified: autoconf/configure.ac =================================================================== --- autoconf/configure.ac 2006-05-18 04:10:33 UTC (rev 78) +++ autoconf/configure.ac 2006-05-18 04:11:48 UTC (rev 79) @@ -291,8 +291,8 @@ [Apache Portable Runtime]) HLVM_FIND_LIBRARY([apru],[apr-1/apu.h],[aprutil-1],[apu_version], [Apache Portable Runtime Utilities]) -HLVM_FIND_LIBRARY([expat],[expat.h],[expat],[XML_ParserCreate], - [expat XML Parser]) +HLVM_FIND_LIBRARY([xml2],[libxml/parser.h],[xml2], + [xmlCreateFileParserCtxt],[libxml2 XML C Parser]) HLVM_FIND_LIBRARY([syck],[syck.h],[syck],[syck_parse],[Syck Yaml Handler]) dnl -- Check for specific libraries we depend on. Modified: configure =================================================================== --- configure 2006-05-18 04:10:33 UTC (rev 78) +++ configure 2006-05-18 04:11:48 UTC (rev 79) @@ -315,7 +315,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS HLVM_COPYRIGHT HLVM_PACKAGE HLVM_VERSION HLVM_SO_VERSION HLVM_SO_CURRENT HLVM_SO_REVISION HLVM_SO_AGE HLVM_SHAREDPREFIX HLVM_DEBUG HLVM_OPTIMIZE HLVM_INLINE HLVM_ASSERT HLVM_TRACE HLVM_SMALL HLVM_EFENCE HLVM_PROFILING HLVM_WITH_WORKSPACE HLVM_WITH_INCLUDES HLVM_WITH_LLVM_SRC HLVM_WITH_LLVM_OBJ HLVM_WITH_LLVMGCC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX ifGNUmake apr_INC apr_LIB apru_INC apru_LIB expat_INC expat_LIB syck_INC syck_LIB EGREP HLVM_CFGNAME HLVM_CONFIGTIME HLVM_PREFIX LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS HLVM_COPYRIGHT HLVM_PACKAGE HLVM_VERSION HLVM_SO_VERSION HLVM_SO_CURRENT HLVM_SO_REVISION HLVM_SO_AGE HLVM_SHAREDPREFIX HLVM_DEBUG HLVM_OPTIMIZE HLVM_INLINE HLVM_ASSERT HLVM_TRACE HLVM_SMALL HLVM_EFENCE HLVM_PROFILING HLVM_WITH_WORKSPACE HLVM_WITH_INCLUDES HLVM_WITH_LLVM_SRC HLVM_WITH_LLVM_OBJ HLVM_WITH_LLVMGCC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX ifGNUmake apr_INC apr_LIB apru_INC apru_LIB xml2_INC xml2_LIB syck_INC syck_LIB EGREP HLVM_CFGNAME HLVM_CONFIGTIME HLVM_PREFIX LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -895,11 +895,12 @@ libraries are in DIR --with-APRU-inc=DIR Specify that the Apache Portable Runtime Utilities includes are in DIR - --with-EXPAT=DIR Specify that the expat XML Parser install prefix is + --with-XML2=DIR Specify that the libxml2 XML C Parser install prefix + is DIR + --with-XML2-lib=DIR Specify that libxml2 XML C Parser libraries are in DIR - --with-EXPAT-lib=DIR Specify that expat XML Parser libraries are in DIR - --with-EXPAT-inc=DIR Specify that the expat XML Parser includes are in - DIR + --with-XML2-inc=DIR Specify that the libxml2 XML C Parser includes are + in DIR --with-SYCK=DIR Specify that the Syck Yaml Handler install prefix is DIR --with-SYCK-lib=DIR Specify that Syck Yaml Handler libraries are in DIR @@ -4756,34 +4757,34 @@ -# Check whether --with-EXPAT or --without-EXPAT was given. -if test "${with_EXPAT+set}" = set; then - withval="$with_EXPAT" - expatpfxdir=$withval +# Check whether --with-XML2 or --without-XML2 was given. +if test "${with_XML2+set}" = set; then + withval="$with_XML2" + xml2pfxdir=$withval else - expatpfxdir=nada + xml2pfxdir=nada fi; -# Check whether --with-EXPAT-lib or --without-EXPAT-lib was given. -if test "${with_EXPAT_lib+set}" = set; then - withval="$with_EXPAT_lib" - expatlibdir=$withval +# Check whether --with-XML2-lib or --without-XML2-lib was given. +if test "${with_XML2_lib+set}" = set; then + withval="$with_XML2_lib" + xml2libdir=$withval else - expatlibdir=nada + xml2libdir=nada fi; -# Check whether --with-EXPAT-inc or --without-EXPAT-inc was given. -if test "${with_EXPAT_inc+set}" = set; then - withval="$with_EXPAT_inc" - expatincdir=$withval +# Check whether --with-XML2-inc or --without-XML2-inc was given. +if test "${with_XML2_inc+set}" = set; then + withval="$with_XML2_inc" + xml2incdir=$withval else - expatincdir=nada + xml2incdir=nada fi; -pfxval="${expatpfxdir}" -incval="${expatincdir}" -libval="${expatlibdir}" -echo "$as_me:$LINENO: checking for expat XML Parser library and header" >&5 -echo $ECHO_N "checking for expat XML Parser library and header... $ECHO_C" >&6 +pfxval="${xml2pfxdir}" +incval="${xml2incdir}" +libval="${xml2libdir}" +echo "$as_me:$LINENO: checking for libxml2 XML C Parser library and header" >&5 +echo $ECHO_N "checking for libxml2 XML C Parser library and header... $ECHO_C" >&6 hlvm_found_lib=0 hlvm_found_inc=0 if test "${pfxval}" != "nada" ; then @@ -4791,11 +4792,11 @@ hlvm_found_inc=0 if test -d "${pfxval}" ; then - if test -n "expat.h" ; then - for dir in "${pfxval}/include" "${pfxval}" "${pfxval}/include/expat" ; do + if test -n "libxml/parser.h" ; then + for dir in "${pfxval}/include" "${pfxval}" "${pfxval}/include/xml2" ; do if test -d "$dir" ; then - if test -f "$dir/expat.h" ; then - expat_INC="$dir" + if test -f "$dir/libxml/parser.h" ; then + xml2_INC="$dir" hlvm_found_inc=1 fi @@ -4807,19 +4808,19 @@ hlvm_found_lib=0 if test -d "${pfxval}" ; then - if test -n "expat" ; then + if test -n "xml2" ; then for dir in "${pfxval}" "${pfxval}/lib" ; do if test -d "$dir" ; then - if test -f "$dir/libexpat.so" ; then - expat_LIB=$dir + if test -f "$dir/libxml2.so" ; then + xml2_LIB=$dir hlvm_found_lib=1 - elif test -f "$dir/libexpat.a" ; then - expat_LIB=$dir + elif test -f "$dir/libxml2.a" ; then + xml2_LIB=$dir hlvm_found_lib=1 - elif test -f "$dir/libexpat.la" ; then - expat_LIB=$dir + elif test -f "$dir/libxml2.la" ; then + xml2_LIB=$dir hlvm_found_lib=1 fi @@ -4831,8 +4832,8 @@ else echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6; - { { echo "$as_me:$LINENO: error: The --with-expat value must be a directory" >&5 -echo "$as_me: error: The --with-expat value must be a directory" >&2;} + { { echo "$as_me:$LINENO: error: The --with-xml2 value must be a directory" >&5 +echo "$as_me: error: The --with-xml2 value must be a directory" >&2;} { (exit 1); exit 1; }; } fi else @@ -4840,19 +4841,19 @@ hlvm_found_lib=0 if test -d "${libval}" ; then - if test -n "expat" ; then + if test -n "xml2" ; then for dir in "${libval}" "${libval}/lib" ; do if test -d "$dir" ; then - if test -f "$dir/libexpat.so" ; then - expat_LIB=$dir + if test -f "$dir/libxml2.so" ; then + xml2_LIB=$dir hlvm_found_lib=1 - elif test -f "$dir/libexpat.a" ; then - expat_LIB=$dir + elif test -f "$dir/libxml2.a" ; then + xml2_LIB=$dir hlvm_found_lib=1 - elif test -f "$dir/libexpat.la" ; then - expat_LIB=$dir + elif test -f "$dir/libxml2.la" ; then + xml2_LIB=$dir hlvm_found_lib=1 fi @@ -4866,11 +4867,11 @@ hlvm_found_inc=0 if test -d "${incval}" ; then - if test -n "expat.h" ; then - for dir in "${incval}/include" "${incval}" "${incval}/include/expat" ; do + if test -n "libxml/parser.h" ; then + for dir in "${incval}/include" "${incval}" "${incval}/include/xml2" ; do if test -d "$dir" ; then - if test -f "$dir/expat.h" ; then - expat_INC="$dir" + if test -f "$dir/libxml/parser.h" ; then + xml2_INC="$dir" hlvm_found_inc=1 fi @@ -4885,19 +4886,19 @@ hlvm_found_lib=0 if test -d "/usr" ; then - if test -n "expat" ; then + if test -n "xml2" ; then for dir in "/usr" "/usr/lib" ; do if test -d "$dir" ; then - if test -f "$dir/libexpat.so" ; then - expat_LIB=$dir + if test -f "$dir/libxml2.so" ; then + xml2_LIB=$dir hlvm_found_lib=1 - elif test -f "$dir/libexpat.a" ; then - expat_LIB=$dir + elif test -f "$dir/libxml2.a" ; then + xml2_LIB=$dir hlvm_found_lib=1 - elif test -f "$dir/libexpat.la" ; then - expat_LIB=$dir + elif test -f "$dir/libxml2.la" ; then + xml2_LIB=$dir hlvm_found_lib=1 fi @@ -4911,19 +4912,19 @@ hlvm_found_lib=0 if test -d "/usr/local" ; then - if test -n "expat" ; then + if test -n "xml2" ; then for dir in "/usr/local" "/usr/local/lib" ; do if te