[llvm-commits] CVS: llvm/lib/System/Makefile Path.cpp

Reid Spencer reid at x10sys.com
Tue Aug 24 23:19:11 PDT 2004



Changes in directory llvm/lib/System:

Makefile updated: 1.2 -> 1.3
Path.cpp updated: 1.2 -> 1.3
---
Log message:

Initial implementation of the Path operating system concept.


---
Diffs of the changes:  (+73 -0)

Index: llvm/lib/System/Makefile
diff -u /dev/null llvm/lib/System/Makefile:1.3
--- /dev/null	Wed Aug 25 01:19:11 2004
+++ llvm/lib/System/Makefile	Wed Aug 25 01:19:01 2004
@@ -0,0 +1,13 @@
+##===- lib/Bytecode/Reader/Makefile ------------------------*- Makefile -*-===##
+# 
+#                     The LLVM Compiler Infrastructure
+#
+# This file was developed by the LLVM research group and is distributed under
+# the University of Illinois Open Source License. See LICENSE.TXT for details.
+# 
+##===----------------------------------------------------------------------===##
+LEVEL = ../..
+LIBRARYNAME = system
+BUILD_ARCHIVE = 1
+
+include $(LEVEL)/Makefile.common


Index: llvm/lib/System/Path.cpp
diff -u /dev/null llvm/lib/System/Path.cpp:1.3
--- /dev/null	Wed Aug 25 01:19:11 2004
+++ llvm/lib/System/Path.cpp	Wed Aug 25 01:19:01 2004
@@ -0,0 +1,60 @@
+//===-- Path.cpp - Implement OS Path Concept --------------------*- C++ -*-===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Reid Spencer and is distributed under the 
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
+//
+//  This header file implements the operating system Path concept.
+//
+//===----------------------------------------------------------------------===//
+#include "llvm/System/Path.h"
+
+namespace llvm {
+namespace sys {
+
+//===----------------------------------------------------------------------===//
+//=== WARNING: Implementation here must contain only TRULY operating system
+//===          independent code. 
+//===----------------------------------------------------------------------===//
+
+bool
+Path::is_valid() const {
+  if ( empty() ) return false;
+  return true;
+}
+
+void 
+Path::fill( char* buffer, unsigned bufflen ) const {
+  unsigned pathlen = length();
+  assert( bufflen > pathlen && "Insufficient buffer size" );
+  unsigned copylen = pathlen <? (bufflen - 1);
+  this->copy(buffer, copylen, 0 );
+  buffer[ copylen ] = 0;
+}
+
+void
+Path::make_directory() {
+  char end[2];
+  end[0] = '/';
+  end[1] = 0;
+  if ( empty() )
+    this->assign( end );
+  else if ( (*this)[length()-1] != '/')
+    this->append( end );
+}
+
+void
+Path::make_file() {
+  if ( (*this)[length()-1] == '/')
+    this->erase( this->length()-1, 1 );
+}
+
+// Include the truly platform-specific parts of this class.
+#include "platform/Path.cpp"
+}
+}
+
+// vim: sw=2






More information about the llvm-commits mailing list