瀏覽代碼

Removing old files that are unneeded

Samuel Jaffe 9 年之前
父節點
當前提交
7c5e81575f
共有 4 個文件被更改,包括 0 次插入459 次删除
  1. 0 78
      Makefile
  2. 0 6
      vector.xcodeproj/project.pbxproj
  3. 0 290
      vector_old.hpp
  4. 0 85
      vector_type_generator.hpp

+ 0 - 78
Makefile

@@ -1,78 +0,0 @@
-WARNINGS := -Wall -pedantic  \
-  -pedantic-errors -Wextra -Wcast-align \
-  -Wcast-qual  -Wchar-subscripts  -Wcomment -Wconversion \
-  -Wdisabled-optimization \
-  -Werror -Wfloat-equal  -Wformat  -Wformat=2 \
-  -Wformat-nonliteral -Wformat-security  \
-  -Wformat-y2k \
-  -Wimport  -Winit-self  -Winline \
-  -Winvalid-pch   \
-  -Wunsafe-loop-optimizations  -Wno-long-long -Wmissing-braces \
-  -Wmissing-field-initializers -Wmissing-format-attribute   \
-  -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-declarations \
-  -Wpacked -Wparentheses  -Wpointer-arith \
-  -Wredundant-decls -Wreturn-type \
-  -Wsequence-point  -Wshadow -Wsign-compare  -Wstack-protector \
-  -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch  -Wswitch-default \
-  -Wswitch-enum -Wtrigraphs  -Wuninitialized \
-  -Wunknown-pragmas  -Wunreachable-code -Wunused \
-  -Wunused-function  -Wunused-label  -Wunused-parameter \
-  -Wunused-value  -Wunused-variable  -Wvariadic-macros \
-  -Wvolatile-register-var  -Wwrite-strings
-CWARNINGS := $(WARNINGS) -Wimplicit
-CPPWARNINGS := $(WARNINGS)
-
-CFLAGS   := $(CWARNINGS)
-CPPFLAGS := --std=c++11 $(CPPWARNINGS)
-LDFLAGS  :=
-
-HDRFILES := vector.hpp
-SRCFILES := 
-DEPFILES := $(patsubst %.cpp,.%.d,$(SRCFILES))
-OBJFILES := $(patsubst %.cpp,%.o,$(SRCFILES))
-TSTSUITE := vector.t.h
-TSTFILES := $(patsubst %.t.h,%.cpp,$(TSTSUITE))
-TSTDRIVR := $(patsubst %.cpp,%,$(TSTFILES))
-BINARY   :=
-
-ALLFILES := $(SRCFILES) $(HDRFILES) $(AUXFILES)
-
-.PHONY: all clean debug release check coverage
-
-all: $(BINARY) $(LNBINARY)
-
-debug: CFLAGS += -DDEBUG -g
-debug: CPPFLAGS += -DDEBUG -g
-debug: all
-
-release: CFLAGS += -O2
-release: CPPFLAGS += -O2
-release: all
-
-coverage: CFLAGS += -fprofile-arcs -ftest-coverage
-coverage: CPPFLAGS += -fprofile-arcs -ftest-coverage
-coverage: check
-
-clean: check-clean
-	@$(RM) $(BINARY) $(wildcard $(OBJFILES)) $(LNBINARY)
-
-check-clean:
-	@$(RM) $(TSTDRIVR) $(TSTFILES)
-
-check: check-clean $(TSTDRIVR)
-
-.h.cpp:
-	@cxxtestgen --error-printer $< -o $@
-
-.cpp.o: Makefile
-	$(CXX) $(CPPFLAGS) -MMD -MP -MF $(patsubst %.cpp,.%.d,$<) -c $< -o $@
-
-$(BINARY): $(OBJFILES) 
-	$(CXX) $(LDFLAGS) -o $@ $(OBJFILES)
-
-$(TSTDRIVR): $(TSTFILES)
-	@$(CXX) $(CPPFLAGS) -I$(CXXTEST) -w $@.cpp -o $@
-	@echo Running TestDriver: ./$@
-	@./$@
-
-

+ 0 - 6
vector.xcodeproj/project.pbxproj

@@ -23,12 +23,9 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
-		0E5DFDD71BB4D3360063976E /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
-		0E5DFDD81BB4D3360063976E /* vector_old.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = vector_old.hpp; sourceTree = "<group>"; };
 		0E5DFDDA1BB4D3360063976E /* vector_tc.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = vector_tc.cpp; sourceTree = "<group>"; };
 		0E5DFDDB1BB4D3360063976E /* vector.t.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vector.t.h; sourceTree = "<group>"; };
 		0E5DFDF31BB4D5040063976E /* vector_tc */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = vector_tc; sourceTree = BUILT_PRODUCTS_DIR; };
-		CD97B6211CA576B7007756C8 /* vector_type_generator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = vector_type_generator.hpp; sourceTree = "<group>"; };
 		CDFFC7A81D62296200E9528B /* vector.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = vector.hpp; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
@@ -46,10 +43,7 @@
 		0E5DFDD01BB4D3360063976E = {
 			isa = PBXGroup;
 			children = (
-				0E5DFDD71BB4D3360063976E /* Makefile */,
-				0E5DFDD81BB4D3360063976E /* vector_old.hpp */,
 				CDFFC7A81D62296200E9528B /* vector.hpp */,
-				CD97B6211CA576B7007756C8 /* vector_type_generator.hpp */,
 				0E5DFDDA1BB4D3360063976E /* vector_tc.cpp */,
 				0E5DFDDB1BB4D3360063976E /* vector.t.h */,
 				0E5DFDF41BB4D5040063976E /* Products */,

+ 0 - 290
vector_old.hpp

@@ -1,290 +0,0 @@
-//
-//  vector.h
-//  
-//
-//  Created by Sam Jaffe on 8/21/15.
-//
-//
-
-#pragma once
-
-namespace math { namespace vector {
-  template <size_t, typename> class raw_vector;
-} }
-
-template <size_t D, typename T>
-math::vector::raw_vector<D, T> operator +(T const&, math::vector::raw_vector<D, T> const&);
-template <size_t D, typename T>
-math::vector::raw_vector<D, T> operator -(T const&, math::vector::raw_vector<D, T> const&);
-template <size_t D, typename T>
-math::vector::raw_vector<D, T> operator *(T const&, math::vector::raw_vector<D, T> const&);
-template <size_t D, typename T>
-math::vector::raw_vector<D, T> operator /(T const&, math::vector::raw_vector<D, T> const&);
-
-namespace math { namespace vector {
-  struct fill_t {} fill;
-
-  template <size_t D, typename T>
-  class raw_vector {
-  public:
-    typedef T value_type;
-    typedef T& reference;
-    typedef const T& const_reference;
-    typedef raw_vector<D, T> this_type;
-    
-    typedef decltype(std::sqrt(std::declval<T>())) sqrt_type; // double or float
-    
-    T& operator [](size_t index) { return data[index]; }
-    
-    inline const T& operator [](size_t index) const { return data[index]; }
-    
-    T& at(size_t index) {
-      if (index >= D) throw std::out_of_range(std::to_string(index) + " is out of range [0, " + std::to_string(D) + ")");
-      return operator [](index);
-    }
-    
-    const T& at(size_t index) const {
-      if (index >= D) throw std::out_of_range(std::to_string(index) + " is out of range [0, " + std::to_string(D) + ")");
-      return operator [](index);
-    }
-    
-    template <std::size_t Idx, typename = typename std::enable_if<Idx < D>::type>
-    inline const_reference get() const { return data[Idx]; }
-    
-    template <std::size_t Idx, typename = typename std::enable_if<Idx < D>::type>
-    inline reference get() { return data[Idx]; }
-    
-    reference x() { return get<0>(); }
-    const_reference x() const { return get<0>(); }
-    reference y() { return get<1>(); }
-    const_reference y() const { return get<1>(); }
-    reference z() { return get<2>(); }
-    const_reference z() const { return get<2>(); }
-    reference w() { return get<3>(); }
-    const_reference w() const { return get<3>(); }
-    reference r() { return get<0>(); }
-    const_reference r() const { return get<0>(); }
-    reference g() { return get<1>(); }
-    const_reference g() const { return get<1>(); }
-    reference b() { return get<2>(); }
-    const_reference b() const { return get<2>(); }
-    reference a() { return get<3>(); }
-    const_reference a() const { return get<3>(); }
-    
-    this_type& operator+=(const this_type& other) {
-      for (size_t i = 0; i < D; ++i) at(i) += other.at(i);
-      return *this;
-    }
-    
-    this_type& operator-=(const this_type& other) {
-      for (size_t i = 0; i < D; ++i) at(i) -= other.at(i);
-      return *this;
-    }
-    
-    this_type& operator*=(const this_type& other) {
-      for (size_t i = 0; i < D; ++i) at(i) *= other.at(i);
-      return *this;
-    }
-    
-    this_type& operator/=(const this_type& other) {
-      for (size_t i = 0; i < D; ++i) at(i) /= other.at(i);
-      return *this;
-    }
-    
-    this_type& operator+=(const T& c) {
-      return operator +=(this_type{c, fill});
-    }
-    
-    this_type& operator -=(const T& c) {
-      return operator -=(this_type{c, fill});
-    }
-    
-    this_type& operator *=(const T& c)  {
-      return operator *=(this_type{c, fill});
-    }
-    
-    this_type& operator /=(const T& c) {
-      return operator /=(this_type{c, fill});
-    }
-    
-    this_type operator +(const this_type& other) const {
-      return this_type(*this) += other;
-    }
-    
-    this_type operator -(const this_type& other) const {
-      return this_type(*this) -= other;
-    }
-    
-    this_type operator *(const this_type& other) const {
-      return this_type(*this) *= other;
-    }
-    
-    this_type operator /(const this_type& other) const {
-      return this_type(*this) /= other;
-    }
-    
-    this_type operator +(const T& c) const {
-      return operator +(this_type{c, fill});
-    }
-    
-    this_type operator -(const T& c) const {
-      return operator -(this_type{c, fill});
-    }
-    
-    this_type operator *(const T& c) const {
-      return operator *(this_type{c, fill});
-    }
-    
-    this_type operator /(const T& c) const {
-      return operator /(this_type{c, fill});
-    }
-    
-    this_type operator -() const { return -1 * (*this); }
-    
-    bool operator ==(const this_type& other) const {
-      return !memcmp(data, other.data, D * sizeof(T));
-    } // technically wrong on float/double
-    
-    bool operator !=(const this_type& other) const {
-      return !operator==(other);
-    }
-    
-    bool operator <=(const this_type& other) const {
-      for (size_t i = 0; i < D; ++i) { if (at(i) > other.at(i)) return false; }
-      return true;
-    }
-    
-    bool operator <(const this_type& other) const {
-      for (size_t i = 0; i < D; ++i) { if (at(i) >= other.at(i)) return false; }
-      return true;
-    }
-    
-    bool operator >=(const this_type& other) const {
-      for (size_t i = 0; i < D; ++i) { if (at(i) < other.at(i)) return false; }
-      return true;
-    }
-    
-    bool operator >(const this_type& other) const {
-      for (size_t i = 0; i < D; ++i) { if (at(i) <= other.at(i)) return false; }
-      return true;
-    }
-    
-    template <size_t D2>
-    typename std::enable_if<(D == 2 || D == 3) && D == D2, raw_vector<3, T> >::type cross(const raw_vector<D2, T>& v) const {
-      return D == 2
-      ? raw_vector<3, T>{0, 0, at(0)*v.at(1) - at(1)*v.at(0)}
-      : raw_vector<3, T>{
-        at(1)*v.at(2) - at(2)*v.at(1),
-        at(2)*v.at(0) - at(0)*v.at(2),
-        at(0)*v.at(1) - at(1)*v.at(0)
-      };
-    }
-    
-    T dot(const this_type& v) const {
-      T accum{};
-      for (size_t i = 0; i < D; ++i) accum += data[i] * v[i];
-      return accum;
-    }
-    
-    T lengthSquared() const {
-      return dot(*this);
-    }
-    
-    sqrt_type length() const {
-      return std::sqrt(lengthSquared());
-    }
-    
-    T distanceSquared(const this_type& other) const {
-      return operator -(other).lengthSquared();
-    }
-    
-    sqrt_type distance(const this_type& other) const {
-      return std::sqrt(distanceSquared(other));
-    }
-    
-    raw_vector<D, sqrt_type> unit() const { return raw_vector<D, sqrt_type>(*this)/length(); }
-    
-    void swap(raw_vector& that) {
-      using std::swap;
-      for (size_t i = 0; i < D; ++i) swap(data[i], that.data[i]);
-    }
-    
-    constexpr raw_vector() = default;
-    
-    raw_vector(const this_type& that) {
-      for (size_t i = 0; i < D; ++i) data[i] = that.data[i];
-    }
-    
-    raw_vector(this_type&& that) {
-      for (size_t i = 0; i < D; ++i) data[i] = that.data[i];
-    }
-    
-    raw_vector& operator=(const this_type& other) {
-      for (size_t i = 0; i < D; ++i) data[i] = other.data[i];
-      return *this;
-    }
-    
-    raw_vector& operator=(this_type&& other) {
-      for (size_t i = 0; i < D; ++i) data[i] = other.data[i];
-      return *this;
-    }
-    
-    raw_vector(std::initializer_list<T> vals) {
-      const size_t D2 = vals.size();
-      const T* ptr = vals.begin();
-      for (size_t i = 0; i < std::min(D, D2); ++i) data[i] = *ptr++;
-      for (size_t j = std::min(D, D2); j < std::max(D, D2); ++j) data[j] = T();
-    }
-    
-    template <std::size_t D2, typename T2,
-    typename = typename std::enable_if<D2 != D || !std::is_same<T, T2>::value>::type>
-    explicit raw_vector(const raw_vector<D2, T2>& that) {
-      for (size_t i = 0; i < std::min(D, D2); ++i) data[i] = static_cast<T>(that[i]);
-      for (size_t j = std::min(D, D2); j < std::max(D, D2); ++j) data[j] = T();
-    }
-    
-    raw_vector(T const& t, fill_t) {
-      for (size_t i = 0; i < D; ++i) data[i] = t;
-    }
-    
-  private:
-    value_type data[D] = {0};
-  };
-} }
-
-template <size_t D, typename T>
-math::vector::raw_vector<D, T> operator +(T const& lhs, math::vector::raw_vector<D, T> const& rhs) {
-  return rhs + lhs;
-}
-
-template <size_t D, typename T>
-math::vector::raw_vector<D, T> operator -(T const& lhs, math::vector::raw_vector<D, T> const& rhs) {
-  return math::vector::raw_vector<D, T>(lhs, math::vector::fill) - rhs;
-}
-
-template <size_t D, typename T>
-math::vector::raw_vector<D, T> operator *(T const& lhs, math::vector::raw_vector<D, T> const& rhs) {
-  return rhs * lhs;
-}
-
-template <size_t D, typename T>
-math::vector::raw_vector<D, T> operator /(T const& lhs, math::vector::raw_vector<D, T> const& rhs) {
-  return math::vector::raw_vector<D, T>(lhs, math::vector::fill) / rhs;
-}
-
-template <typename CharT, typename Traits, size_t N, typename T>
-std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& out, const math::vector::raw_vector<N, T>& v) {
-  out << '(' << v[0];
-  for (size_t i = 1; i < N; ++i) { out << ',' << v[i]; }
-  out << ')';
-  return out;
-}
-
-namespace std {
-  template <size_t D, typename T>
-  math::vector::raw_vector<D, T> abs(math::vector::raw_vector<D, T> const& data) {
-    math::vector::raw_vector<D, T> rval;
-    for (size_t i = 0; i < D; ++i) rval[i] = std::abs(data[i]);
-    return rval;
-  }
-}

+ 0 - 85
vector_type_generator.hpp

@@ -1,85 +0,0 @@
-#include <boost/preprocessor/seq/for_each.hpp>
-
-#include <boost/preprocessor/tuple/elem.hpp>
-
-#include <boost/preprocessor/seq/size.hpp>
-#include <boost/preprocessor/seq/to_tuple.hpp>
-#include <boost/preprocessor/tuple/to_list.hpp>
-#include <boost/preprocessor/list/for_each.hpp>
-
-#define APPLY_BINARY_OPERATOR(z, op, field)\
-  field op rhs.field;
-
-#define DEFINE_BINARY_OPERATOR(left_t, right_t, op, fields)\
-  left_t& operator op##=(right_t const& rhs) {\
-    BOOST_PP_SEQ_FOR_EACH(APPLY_BINARY_OPERATOR, op##=, fields)\
-    return *this;\
-  }\
-  left_t operator op(right_t const& rhs) {\
-    return left_t{*this} op##= rhs;\
-  }
-
-#define DEFINE_SELF_BINARY_OPERATOR(type, op, fields)\
-  DEFINE_BINARY_OPERATOR(type, type, op, fields)
-
-#define DEFINE_VECTOR_MEMVAR(z, type, field)\
-  type field;
-
-#define DEFINE_VECTOR_OPERATOR2(type, op, fields)\
-DEFINE_SELF_BINARY_OPERATOR(type, op, fields)
-
-#define DEFINE_VECTOR_OPERATOR(z, tup, op)\
-  DEFINE_VECTOR_OPERATOR2(BOOST_PP_TUPLE_ELEM(2, 0, tup), op, BOOST_PP_TUPLE_ELEM(2, 1, tup))
-
-#define DEFINE_VECTOR_OPERATIONS(type, fields, operators)\
-  BOOST_PP_LIST_FOR_EACH(DEFINE_VECTOR_OPERATOR, (type, fields),BOOST_PP_TUPLE_TO_LIST(BOOST_PP_SEQ_SIZE(operators), BOOST_PP_SEQ_TO_TUPLE(operators)))\
-
-#define DEF_VEC_CTR_ARG_2(elem_t, field) elem_t _##field
-#define DEF_VEC_CTR_ARG_1(elem_t, field) DEF_VEC_CTR_ARG_2(elem_t, field)
-#define DEF_VEC_CTR_ARG(z, elem_t, field) ,DEF_VEC_CTR_ARG_1(elem_t, field)
-#define DEFINE_VECTOR_CONSTRUCTOR_ARGS(elem_t, fields)\
-  DEF_VEC_CTR_ARG_1(elem_t, BOOST_PP_SEQ_HEAD(fields)) \
-  BOOST_PP_SEQ_FOR_EACH(DEF_VEC_CTR_ARG, elem_t, BOOST_PP_SEQ_TAIL(fields))
-
-#define DEF_VEC_CTR_INIT_2(field) field(_##field)
-#define DEF_VEC_CTR_INIT_1(field) DEF_VEC_CTR_INIT_2(field)
-#define DEF_VEC_CTR_ARG_1(elem_t, field) DEF_VEC_CTR_ARG_2(elem_t, field)
-#define DEF_VEC_CTR_INIT(z, _, field) ,DEF_VEC_CTR_INIT_1(field)
-#define DEFINE_VECTOR_CONSTRUCTOR_INIT(fields)\
-  DEF_VEC_CTR_INIT_1(BOOST_PP_SEQ_HEAD(fields)) \
-  BOOST_PP_SEQ_FOR_EACH(DEF_VEC_CTR_INIT, _, BOOST_PP_SEQ_TAIL(fields))
-
-#define DEFINE_VECTOR_CONSTRUCTOR(type, elem_t, fields)\
-  type(DEFINE_VECTOR_CONSTRUCTOR_ARGS(elem_t, fields)) : DEFINE_VECTOR_CONSTRUCTOR_INIT(fields) {}
-
-// We convert to a list because recursive calls to BOOST_PP_SEQ_FOR_EACH don't work
-#define MAKE_VECTOR_TYPE(type, elem_t, fields, operators)\
-  struct type {\
-    DEFINE_VECTOR_CONSTRUCTOR(type, elem_t, fields)\
-    BOOST_PP_SEQ_FOR_EACH(DEFINE_VECTOR_MEMVAR, elem_t, fields)\
-    DEFINE_VECTOR_OPERATIONS(type, fields, operators)\
-  };\
-
-#define VECTOR_XY   (x)(y)
-#define VECTOR_XYZ  (x)(y)(z)
-#define VECTOR_XYZW (x)(y)(z)(w)
-#define VECTOR_RGBA (r)(g)(b)(a)
-
-#define OP_ADD             (+)
-#define OP_ADD_SUB         (+)(-)
-#define OP_ADD_MUL         (+)   (*)
-#define OP_ADD_SUB_MUL     (+)(-)(*)
-#define OP_ADD_SUB_MUL_DIV (+)(-)(*)(/)
-
-//#ifdef MANUAL_STRUCT
-//struct Position2d {
-//  unsigned int x;
-//  unsigned int y;
-//};
-//
-//DEFINE_SELF_BINARY_OPERATOR(Position2d, +, (x)(y))
-//#else
-//MAKE_VECTOR_TYPE(Position2d, unsigned int, VECTOR_XY, OP_ADD)
-//MAKE_VECTOR_TYPE(Offset2d, signed int, VECTOR_XY, OP_ADD)
-//DEFINE_BINARY_OPERATOR(Position2d, Offset2d, +, VECTOR_XY)
-//#endif