summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-08-27 21:07:15 +0200
committerRémi Verschelde <rverschelde@gmail.com>2017-08-27 22:13:45 +0200
commit7ad14e7a3e6f87ddc450f7e34621eb5200808451 (patch)
tree8804d0dd24cc126087462edfbbbf73ed61b56b0e /core
parent37da8155a4500a9386027b4d791a86186bc7ab4a (diff)
Dead code tells no tales
Diffstat (limited to 'core')
-rw-r--r--core/class_db.h137
-rw-r--r--core/dictionary.cpp12
-rw-r--r--core/io/resource_format_binary.cpp48
-rw-r--r--core/math/camera_matrix.cpp14
-rw-r--r--core/math/geometry.h29
-rw-r--r--core/math/math_2d.cpp27
-rw-r--r--core/math/math_2d.h1
-rw-r--r--core/math/math_funcs.cpp5
-rw-r--r--core/math/octree.h23
-rw-r--r--core/math/quat.cpp90
-rw-r--r--core/math/rect3.h38
-rw-r--r--core/math/transform.h30
-rw-r--r--core/math/vector3.cpp45
-rw-r--r--core/message_queue.cpp41
-rw-r--r--core/message_queue.h2
-rw-r--r--core/method_bind.h22
-rw-r--r--core/object.cpp197
-rw-r--r--core/os/input_event.cpp23
-rw-r--r--core/project_settings.cpp40
-rw-r--r--core/reference.cpp41
-rw-r--r--core/reference.h25
-rw-r--r--core/ustring.cpp333
22 files changed, 8 insertions, 1215 deletions
diff --git a/core/class_db.h b/core/class_db.h
index 02ec7e480f..25a5000572 100644
--- a/core/class_db.h
+++ b/core/class_db.h
@@ -181,27 +181,6 @@ public:
static void _add_class() {
_add_class2(T::get_class_static(), T::get_parent_class_static());
-#if 0
- GLOBAL_LOCK_FUNCTION;
-
- StringName name = T::get_class_static();
-
- ERR_FAIL_COND(types.has(name));
-
- types[name]=TypeInfo();
- TypeInfo &ti=types[name];
- ti.name=name;
- ti.inherits=T::get_parent_class_static();
-
- if (ti.inherits) {
-
- ERR_FAIL_COND( !types.has(ti.inherits) ); //it MUST be registered.
- ti.inherits_ptr = &types[ti.inherits];
-
- } else {
- ti.inherits_ptr=NULL;
- }
-#endif
}
template <class T>
@@ -252,102 +231,6 @@ public:
static uint64_t get_api_hash(APIType p_api);
-#if 0
- template<class N, class M>
- static MethodBind* bind_method(N p_method_name, M p_method,
- //default arguments
- ParamDef d1=ParamDef(),
- ParamDef d2=ParamDef(),
- ParamDef d3=ParamDef(),
- ParamDef d4=ParamDef(),
- ParamDef d5=ParamDef()
- ) {
-
- return bind_methodf(METHOD_FLAGS_DEFAULT,p_method_name, p_method, d1,d2,d3,d4,d5);
- }
-
-
-
- template<class N, class M>
- static MethodBind* bind_methodf(uint32_t p_flags, N p_method_name, M p_method,
-
-
- //default arguments
- const ParamDef &d1=ParamDef(),
- const ParamDef &d2=ParamDef(),
- const ParamDef &d3=ParamDef(),
- const ParamDef &d4=ParamDef(),
- const ParamDef &d5=ParamDef()
- ) {
-
- GLOBAL_LOCK_FUNCTION;
-
- MethodDefinition method_name=p_method_name;
-
- MethodBind *bind = create_method_bind(p_method);
- bind->set_name(method_name.name);
- ERR_FAIL_COND_V(!bind,NULL);
-
- String instance_type=bind->get_instance_type();
-
- TypeInfo *type=types.getptr(instance_type);
- if (!type) {
- memdelete(bind);
- ERR_FAIL_COND_V(!type,NULL);
- }
-
- if (type->method_map.has(method_name.name)) {
- memdelete(bind);
- // overloading not supported
- ERR_EXPLAIN("Method already bound: "+instance_type+"::"+method_name.name);
- ERR_FAIL_V(NULL);
- }
- bind->set_argument_names(method_name.args);
- type->method_map[method_name.name]=bind;
-
- Vector<Variant> defvals;
-
-#define PARSE_DEFVAL(m_defval) \
- if (d##m_defval.used) \
- defvals.insert(0, d##m_defval.val); \
- else \
- goto set_defvals;
-
-
- PARSE_DEFVAL(1);
- PARSE_DEFVAL(2);
- PARSE_DEFVAL(3);
- PARSE_DEFVAL(4);
- PARSE_DEFVAL(5);
- set_defvals:
-
- bind->set_default_arguments(defvals);
- bind->set_hint_flags(p_flags);
-
- return bind;
-#undef PARSE_DEFVAL
- }
-#else
-
-#if 0
- template<class N, class M>
- static MethodBind* bind_method(N p_method_name, M p_method,
- //default arguments
- const ParamDef &d1=ParamDef(),
- const ParamDef &d2=ParamDef(),
- const ParamDef &d3=ParamDef(),
- const ParamDef &d4=ParamDef(),
- const ParamDef &d5=ParamDef()
- ) {
-
- MethodDefinition method_name=p_method_name;
-
- MethodBind *bind = create_method_bind(p_method);
-
- return bind_methodfi(METHOD_FLAGS_DEFAULT,bind,method_name,d1,d2,d3,d4,d5); //use static function, much smaller binary usage
- }
-#endif
-
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method) {
@@ -410,26 +293,6 @@ public:
return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, ptr, 6);
}
-#if 0
- template<class N, class M>
- static MethodBind* bind_methodf(uint32_t p_flags, N p_method_name, M p_method,
-
- const ParamDef& d1=ParamDef(),
- const ParamDef& d2=ParamDef(),
- const ParamDef& d3=ParamDef(),
- const ParamDef& d4=ParamDef(),
- const ParamDef& d5=ParamDef()
- ) {
-
- MethodDefinition method_name=p_method_name;
-
- MethodBind *bind = create_method_bind(p_method);
-
- return bind_methodfi(p_flags,bind,method_name,d1,d2,d3,d4,d5); //use static function, much smaller binary usage
- }
-#endif
-
-#endif
template <class M>
static MethodBind *bind_vararg_method(uint32_t p_flags, StringName p_name, M p_method, const MethodInfo &p_info = MethodInfo(), const Vector<Variant> &p_default_args = Vector<Variant>()) {
diff --git a/core/dictionary.cpp b/core/dictionary.cpp
index 9559c45c49..bb2e892951 100644
--- a/core/dictionary.cpp
+++ b/core/dictionary.cpp
@@ -200,17 +200,6 @@ uint32_t Dictionary::hash() const {
Array Dictionary::keys() const {
-#if 0
- Array karr;
- karr.resize(size());
- const Variant *K = NULL;
- int idx = 0;
- while ((K = next(K))) {
- karr[idx++] = (*K);
- }
- return karr;
-#else
-
Array varr;
varr.resize(size());
if (_p->variant_map.empty())
@@ -228,7 +217,6 @@ Array Dictionary::keys() const {
}
return varr;
-#endif
}
Array Dictionary::values() const {
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 22a0088f2c..965d11e414 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1717,54 +1717,6 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant
default: {}
}
}
-#if 0
-Error ResourceFormatSaverBinary::_save_obj(const Object *p_object,SavedObject *so) {
-
- //use classic way
- List<PropertyInfo> property_list;
- p_object->get_property_list( &property_list );
-
- for(List<PropertyInfo>::Element *E=property_list.front();E;E=E->next()) {
-
- if (skip_editor && E->get().name.begins_with("__editor"))
- continue;
- if (E->get().usage&PROPERTY_USAGE_STORAGE || (bundle_resources && E->get().usage&PROPERTY_USAGE_BUNDLE)) {
-
- SavedObject::SavedProperty sp;
- sp.name_idx=get_string_index(E->get().name);
- sp.value = p_object->get(E->get().name);
- _find_resources(sp.value);
- so->properties.push_back(sp);
- }
- }
-
- return OK;
-
-}
-
-
-
-Error ResourceFormatSaverBinary::save(const Object *p_object,const Variant &p_meta) {
-
- ERR_FAIL_COND_V(!f,ERR_UNCONFIGURED);
- ERR_EXPLAIN("write_object should supply either an object, a meta, or both");
- ERR_FAIL_COND_V(!p_object && p_meta.get_type()==Variant::NIL, ERR_INVALID_PARAMETER);
-
- SavedObject *so = memnew( SavedObject );
-
- if (p_object)
- so->type=p_object->get_type();
-
- _find_resources(p_meta);
- so->meta=p_meta;
- Error err = _save_obj(p_object,so);
- ERR_FAIL_COND_V( err, ERR_INVALID_DATA );
-
- saved_objects.push_back(so);
-
- return OK;
-}
-#endif
void ResourceFormatSaverBinaryInstance::save_unicode_string(const String &p_string) {
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index 24004ff849..0512cdd798 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -180,19 +180,7 @@ void CameraMatrix::set_orthogonal(real_t p_size, real_t p_aspect, real_t p_znear
}
void CameraMatrix::set_frustum(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_near, real_t p_far) {
-#if 0
- ///@TODO, give a check to this. I'm not sure if it's working.
- set_identity();
- matrix[0][0]=(2*p_near) / (p_right-p_left);
- matrix[0][2]=(p_right+p_left) / (p_right-p_left);
- matrix[1][1]=(2*p_near) / (p_top-p_bottom);
- matrix[1][2]=(p_top+p_bottom) / (p_top-p_bottom);
- matrix[2][2]=-(p_far+p_near) / ( p_far-p_near);
- matrix[2][3]=-(2*p_far*p_near) / (p_far-p_near);
- matrix[3][2]=-1;
- matrix[3][3]=0;
-#else
real_t *te = &matrix[0][0];
real_t x = 2 * p_near / (p_right - p_left);
real_t y = 2 * p_near / (p_top - p_bottom);
@@ -218,8 +206,6 @@ void CameraMatrix::set_frustum(real_t p_left, real_t p_right, real_t p_bottom, r
te[13] = 0;
te[14] = d;
te[15] = 0;
-
-#endif
}
real_t CameraMatrix::get_z_far() const {
diff --git a/core/math/geometry.h b/core/math/geometry.h
index bba6997012..cd069bd7a3 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -105,7 +105,7 @@ public:
}
static void get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2, Vector3 &c1, Vector3 &c2) {
-#if 1
+
//do the function 'd' as defined by pb. I think is is dot product of some sort
#define d_of(m, n, o, p) ((m.x - n.x) * (o.x - p.x) + (m.y - n.y) * (o.y - p.y) + (m.z - n.z) * (o.z - p.z))
@@ -120,33 +120,6 @@ public:
if (mub > 1) mub = 1;
c1 = p1.linear_interpolate(p2, mua);
c2 = q1.linear_interpolate(q2, mub);
-#else
- //this is broken do not use
- Vector3 u = p2 - p1;
- Vector3 v = q2 - q1;
- Vector3 w = p1 - q1;
- float a = u.dot(u);
- float b = u.dot(v);
- float c = v.dot(v); // always >= 0
- float d = u.dot(w);
- float e = v.dot(w);
- float D = a * c - b * b; // always >= 0
- float sc, tc;
-
- // compute the line parameters of the two closest points
- if (D < CMP_EPSILON) { // the lines are almost parallel
- sc = 0.0;
- tc = (b > c ? d / b : e / c); // use the largest denominator
- } else {
- sc = (b * e - c * d) / D;
- tc = (a * e - b * d) / D;
- }
-
- c1 = w + sc * u;
- c2 = w + tc * v;
-// get the difference of the two closest points
-//Vector dP = w + (sc * u) - (tc * v); // = L1(sc) - L2(tc)
-#endif
}
static real_t get_closest_distance_between_segments(const Vector3 &p_from_a, const Vector3 &p_to_a, const Vector3 &p_from_b, const Vector3 &p_to_b) {
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index ddfa0d424c..c77fe96ff2 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -205,33 +205,6 @@ Vector2 Vector2::clamped(real_t p_len) const {
return v;
}
-Vector2 Vector2::cubic_interpolate_soft(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const {
-#if 0
- k[0] = ((*this) (vi[0] + 1, vi[1], vi[2])) - ((*this) (vi[0],
- vi[1],vi[2])); //fk = a0
- k[1] = (((*this) (vi[0] + 1, vi[1], vi[2])) - ((*this) ((int) (v(0) -
- 1), vi[1],vi[2])))*0.5; //dk = a1
- k[2] = (((*this) ((int) (v(0) + 2), vi[1], vi[2])) - ((*this) (vi[0],
- vi[1],vi[2])))*0.5; //dk+1
- k[3] = k[0]*3 - k[1]*2 - k[2];//a2
- k[4] = k[1] + k[2] - k[0]*2;//a3
-
- //ip = a3(t-tk)³ + a2(t-tk)² + a1(t-tk) + a0
- //
- //a3 = dk + dk+1 - Dk
- //a2 = 3Dk - 2dk - dk+1
- //a1 = dk
- //a0 = fk
- //
- //dk = (fk+1 - fk-1)*0.5
- //Dk = (fk+1 - fk)
-
- real_t dk =
-#endif
-
- return Vector2();
-}
-
Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const {
Vector2 p0 = p_pre_a;
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index 8b7acf514a..d215df8a43 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -113,7 +113,6 @@ struct Vector2 {
_FORCE_INLINE_ static Vector2 linear_interpolate(const Vector2 &p_a, const Vector2 &p_b, real_t p_t);
_FORCE_INLINE_ Vector2 linear_interpolate(const Vector2 &p_b, real_t p_t) const;
Vector2 cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
- Vector2 cubic_interpolate_soft(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
Vector2 slide(const Vector2 &p_normal) const;
Vector2 bounce(const Vector2 &p_normal) const;
diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp
index 7a8489b518..6fb688f16b 100644
--- a/core/math/math_funcs.cpp
+++ b/core/math/math_funcs.cpp
@@ -28,16 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "math_funcs.h"
+
#include "core/os/os.h"
pcg32_random_t Math::default_pcg = { 12047754176567800795ULL, PCG_DEFAULT_INC_64 };
#define PHI 0x9e3779b9
-#if 0
-static uint32_t Q[4096];
-#endif
-
// TODO: we should eventually expose pcg.inc too
uint32_t Math::rand_from_seed(uint64_t *seed) {
pcg32_random_t pcg = { *seed, PCG_DEFAULT_INC_64 };
diff --git a/core/math/octree.h b/core/math/octree.h
index 2b0dc83050..95a67943fd 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -851,28 +851,6 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const Rect3 &p_aabb) {
ERR_FAIL_COND(!E);
Element &e = E->get();
-#if 0
-
- pass++;
- if (!e.aabb.has_no_surface()) {
- _remove_element(&e);
- }
-
- e.aabb=p_aabb;
-
- if (!e.aabb.has_no_surface()) {
- _ensure_valid_root(p_aabb);
-
- _insert_element(&e,root);
- if (use_pairs)
- _element_check_pairs(&e);
-
- }
-
- _optimize();
-
-#else
-
bool old_has_surf = !e.aabb.has_no_surface();
bool new_has_surf = !p_aabb.has_no_surface();
@@ -979,7 +957,6 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const Rect3 &p_aabb) {
}
_optimize();
-#endif
}
template <class T, bool use_pairs, class AL>
diff --git a/core/math/quat.cpp b/core/math/quat.cpp
index e813d93e9f..cebc5b9522 100644
--- a/core/math/quat.cpp
+++ b/core/math/quat.cpp
@@ -139,48 +139,6 @@ Quat Quat::inverse() const {
Quat Quat::slerp(const Quat &q, const real_t &t) const {
-#if 0
-
-
- Quat dst=q;
- Quat src=*this;
-
- src.normalize();
- dst.normalize();
-
- real_t cosine = dst.dot(src);
-
- if (cosine < 0 && true) {
- cosine = -cosine;
- dst = -dst;
- } else {
- dst = dst;
- }
-
- if (Math::abs(cosine) < 1 - CMP_EPSILON) {
- // Standard case (slerp)
- real_t sine = Math::sqrt(1 - cosine*cosine);
- real_t angle = Math::atan2(sine, cosine);
- real_t inv_sine = 1.0 / sine;
- real_t coeff_0 = Math::sin((1.0 - t) * angle) * inv_sine;
- real_t coeff_1 = Math::sin(t * angle) * inv_sine;
- Quat ret= src * coeff_0 + dst * coeff_1;
-
- return ret;
- } else {
- // There are two situations:
- // 1. "rkP" and "q" are very close (cosine ~= +1), so we can do a linear
- // interpolation safely.
- // 2. "rkP" and "q" are almost invedste of each other (cosine ~= -1), there
- // are an infinite number of possibilities interpolation. but we haven't
- // have method to fix this case, so just use linear interpolation here.
- Quat ret = src * (1.0 - t) + dst *t;
- // taking the complement requires renormalisation
- ret.normalize();
- return ret;
- }
-#else
-
Quat to1;
real_t omega, cosom, sinom, scale0, scale1;
@@ -221,7 +179,6 @@ Quat Quat::slerp(const Quat &q, const real_t &t) const {
scale0 * y + scale1 * to1.y,
scale0 * z + scale1 * to1.z,
scale0 * w + scale1 * to1.w);
-#endif
}
Quat Quat::slerpni(const Quat &q, const real_t &t) const {
@@ -241,53 +198,6 @@ Quat Quat::slerpni(const Quat &q, const real_t &t) const {
invFactor * from.y + newFactor * q.y,
invFactor * from.z + newFactor * q.z,
invFactor * from.w + newFactor * q.w);
-
-#if 0
- real_t to1[4];
- real_t omega, cosom, sinom, scale0, scale1;
-
-
- // calc cosine
- cosom = x * q.x + y * q.y + z * q.z
- + w * q.w;
-
-
- // adjust signs (if necessary)
- if ( cosom <0.0 && false) {
- cosom = -cosom;to1[0] = - q.x;
- to1[1] = - q.y;
- to1[2] = - q.z;
- to1[3] = - q.w;
- } else {
- to1[0] = q.x;
- to1[1] = q.y;
- to1[2] = q.z;
- to1[3] = q.w;
- }
-
-
- // calculate coefficients
-
- if ( (1.0 - cosom) > CMP_EPSILON ) {
- // standard case (slerp)
- omega = Math::acos(cosom);
- sinom = Math::sin(omega);
- scale0 = Math::sin((1.0 - t) * omega) / sinom;
- scale1 = Math::sin(t * omega) / sinom;
- } else {
- // "from" and "to" quaternions are very close
- // ... so we can do a linear interpolation
- scale0 = 1.0 - t;
- scale1 = t;
- }
- // calculate final values
- return Quat(
- scale0 * x + scale1 * to1[0],
- scale0 * y + scale1 * to1[1],
- scale0 * z + scale1 * to1[2],
- scale0 * w + scale1 * to1[3]
- );
-#endif
}
Quat Quat::cubic_slerp(const Quat &q, const Quat &prep, const Quat &postq, const real_t &t) const {
diff --git a/core/math/rect3.h b/core/math/rect3.h
index 642595979d..c3a2f5fbfb 100644
--- a/core/math/rect3.h
+++ b/core/math/rect3.h
@@ -189,8 +189,6 @@ Vector3 Rect3::get_endpoint(int p_point) const {
bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) const {
-#if 1
-
Vector3 half_extents = size * 0.5;
Vector3 ofs = position + half_extents;
@@ -206,42 +204,6 @@ bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) co
}
return true;
-#else
- //cache all points to check against!
- // #warning should be easy to optimize, just use the same as when taking the support and use only that point
- Vector3 points[8] = {
- Vector3(position.x, position.y, position.z),
- Vector3(position.x, position.y, position.z + size.z),
- Vector3(position.x, position.y + size.y, position.z),
- Vector3(position.x, position.y + size.y, position.z + size.z),
- Vector3(position.x + size.x, position.y, position.z),
- Vector3(position.x + size.x, position.y, position.z + size.z),
- Vector3(position.x + size.x, position.y + size.y, position.z),
- Vector3(position.x + size.x, position.y + size.y, position.z + size.z),
- };
-
- for (int i = 0; i < p_plane_count; i++) { //for each plane
-
- const Plane &plane = p_planes[i];
- bool all_points_over = true;
- //test if it has all points over!
-
- for (int j = 0; j < 8; j++) {
-
- if (!plane.is_point_over(points[j])) {
-
- all_points_over = false;
- break;
- }
- }
-
- if (all_points_over) {
-
- return false;
- }
- }
- return true;
-#endif
}
bool Rect3::has_point(const Vector3 &p_point) const {
diff --git a/core/math/transform.h b/core/math/transform.h
index 15deeaa8eb..566bf482a9 100644
--- a/core/math/transform.h
+++ b/core/math/transform.h
@@ -154,8 +154,7 @@ _FORCE_INLINE_ Plane Transform::xform_inv(const Plane &p_plane) const {
}
_FORCE_INLINE_ Rect3 Transform::xform(const Rect3 &p_aabb) const {
-/* define vertices */
-#if 1
+ /* define vertices */
Vector3 x = basis.get_axis(0) * p_aabb.size.x;
Vector3 y = basis.get_axis(1) * p_aabb.size.y;
Vector3 z = basis.get_axis(2) * p_aabb.size.z;
@@ -171,31 +170,8 @@ _FORCE_INLINE_ Rect3 Transform::xform(const Rect3 &p_aabb) const {
new_aabb.expand_to(pos + y + z);
new_aabb.expand_to(pos + x + y + z);
return new_aabb;
-#else
-
- Vector3 vertices[8] = {
- Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z),
- Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z),
- Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z),
- Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z),
- Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z),
- Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z),
- Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z),
- Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z)
- };
-
- AABB ret;
-
- ret.pos = xform(vertices[0]);
-
- for (int i = 1; i < 8; i++) {
-
- ret.expand_to(xform(vertices[i]));
- }
-
- return ret;
-#endif
}
+
_FORCE_INLINE_ Rect3 Transform::xform_inv(const Rect3 &p_aabb) const {
/* define vertices */
@@ -222,4 +198,4 @@ _FORCE_INLINE_ Rect3 Transform::xform_inv(const Rect3 &p_aabb) const {
return ret;
}
-#endif
+#endif // TRANSFORM_H
diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp
index 39ef05b78a..144234f4d1 100644
--- a/core/math/vector3.cpp
+++ b/core/math/vector3.cpp
@@ -125,51 +125,6 @@ Vector3 Vector3::cubic_interpolate(const Vector3 &p_b, const Vector3 &p_pre_a, c
return out;
}
-#if 0
-Vector3 Vector3::cubic_interpolate(const Vector3& p_b,const Vector3& p_pre_a, const Vector3& p_post_b,real_t p_t) const {
-
- Vector3 p0=p_pre_a;
- Vector3 p1=*this;
- Vector3 p2=p_b;
- Vector3 p3=p_post_b;
-
- if (true) {
-
- real_t ab = p0.distance_to(p1);
- real_t bc = p1.distance_to(p2);
- real_t cd = p2.distance_to(p3);
-
- //if (ab>bc) {
- if (ab>0)
- p0 = p1+(p0-p1)*(bc/ab);
- //}
-
- //if (cd>bc) {
- if (cd>0)
- p3 = p2+(p3-p2)*(bc/cd);
- //}
- }
-
- real_t t = p_t;
- real_t t2 = t * t;
- real_t t3 = t2 * t;
-
- Vector3 out;
- out.x = 0.5 * ( ( 2.0 * p1.x ) +
- ( -p0.x + p2.x ) * t +
- ( 2.0 * p0.x - 5.0 * p1.x + 4 * p2.x - p3.x ) * t2 +
- ( -p0.x + 3.0 * p1.x - 3.0 * p2.x + p3.x ) * t3 );
- out.y = 0.5 * ( ( 2.0 * p1.y ) +
- ( -p0.y + p2.y ) * t +
- ( 2.0 * p0.y - 5.0 * p1.y + 4 * p2.y - p3.y ) * t2 +
- ( -p0.y + 3.0 * p1.y - 3.0 * p2.y + p3.y ) * t3 );
- out.z = 0.5 * ( ( 2.0 * p1.z ) +
- ( -p0.z + p2.z ) * t +
- ( 2.0 * p0.z - 5.0 * p1.z + 4 * p2.z - p3.z ) * t2 +
- ( -p0.z + 3.0 * p1.z - 3.0 * p2.z + p3.z ) * t3 );
- return out;
-}
-#endif
Vector3::operator String() const {
return (rtos(x) + ", " + rtos(y) + ", " + rtos(z));
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index 14b3ba8afb..040fb69805 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -240,47 +240,6 @@ void MessageQueue::statistics() {
}
}
-bool MessageQueue::print() {
-#if 0
- uint32_t read_pos=0;
- while (read_pos < buffer_end ) {
- Message *message = (Message*)&buffer[ read_pos ];
-
- Object *target = ObjectDB::get_instance(message->instance_ID);
- String cname;
- String cfunc;
-
- if (target==NULL) {
- //object was deleted
- //WARN_PRINT("Object was deleted while awaiting a callback")
- //should it print a warning?
- } else if (message->notification>=0) {
-
- // messages don't expect a return value
- cfunc="notification # "+itos(message->notification);
- cname=target->get_type();
-
- } else if (!message->target.empty()) {
-
- cfunc="property: "+message->target;
- cname=target->get_type();
-
-
- } else if (message->target) {
-
- cfunc=String(message->target)+"()";
- cname=target->get_type();
- }
-
-
- read_pos+=sizeof(Message);
- if (message->type!=TYPE_NOTIFICATION)
- read_pos+=sizeof(Variant)*message->args;
- }
-#endif
- return false;
-}
-
int MessageQueue::get_max_buffer_usage() const {
return buffer_max_used;
diff --git a/core/message_queue.h b/core/message_queue.h
index 575132bb46..193d2b6907 100644
--- a/core/message_queue.h
+++ b/core/message_queue.h
@@ -33,6 +33,7 @@
#include "object.h"
#include "os/mutex.h"
#include "os/thread_safe.h"
+
class MessageQueue {
_THREAD_SAFE_CLASS_
@@ -85,7 +86,6 @@ public:
Error push_notification(Object *p_object, int p_notification);
Error push_set(Object *p_object, const StringName &p_prop, const Variant &p_value);
- bool print();
void statistics();
void flush();
diff --git a/core/method_bind.h b/core/method_bind.h
index 738d4166e0..f6cae6f34d 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -252,28 +252,6 @@ public:
_FORCE_INLINE_ int get_argument_count() const { return argument_count; };
-#if 0
- _FORCE_INLINE_ Variant call_safe(const Variant** p_args,int p_arg_count, Variant::CallError& r_error) {
-
- r_error.error=Variant::CallError::CALL_OK;
- check_call( p_args, &errorarg );
- if (!err)
- return call(p_object, VARIANT_ARG_PASS );
-
- VARIANT_ARGPTRS
- String errstr;
- String methodname = get_instance_type()+"::"+name;
- if (err==CALL_ERROR_ARGUMENT_TYPE) {
- errstr="Invalid Argument to call: '"+methodname+"'. Cannot convert argument "+itos(errorarg+1)+" from "+Variant::get_type_name(get_argument_type(errorarg))+" to "+Variant::get_type_name(argptr[errorarg]->get_type())+".";
- }
- if (err==CALL_ERROR_EXTRA_ARGUMENT) {
- errstr="Invalid call. Member function '"+methodname+"' takes "+itos(get_argument_count())+" argument, but argument "+itos(errorarg+1)+" was received.";
- }
-
- ERR_PRINT(errstr.ascii().get_data());
- return Variant();
- }
-#endif
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Variant::CallError &r_error) = 0;
#ifdef PTRCALL_ENABLED
diff --git a/core/object.cpp b/core/object.cpp
index 99e9554e88..b220dc0563 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -342,35 +342,6 @@ void Object::get_valid_parents_static(List<String> *p_parents) {
}
void Object::_get_valid_parents_static(List<String> *p_parents) {
}
-#if 0
-//old style set, deprecated
-
-void Object::set(const String& p_name, const Variant& p_value) {
-
- _setv(p_name,p_value);
-
- /*
- if (!_use_builtin_script())
- return;
- */
-
- bool success;
- ClassDB::set_property(this,p_name,p_value,success);
- if (success) {
- return;
- }
-
- if (p_name=="__meta__") {
- metadata=p_value;
- } else if (p_name=="script") {
- set_script(p_value);
- } else if (script_instance) {
- script_instance->set(p_name,p_value);
- }
-
-
-}
-#endif
void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid) {
@@ -489,34 +460,6 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const {
}
}
-#if 0
-//old style get, deprecated
-Variant Object::get(const String& p_name) const {
-
- Variant ret=_getv(p_name);
- if (ret.get_type()!=Variant::NIL)
- return ret;
-
- bool success;
- ClassDB::get_property(const_cast<Object*>(this),p_name,ret,success);
- if (success) {
- return ret;
- }
-
- if (p_name=="__meta__")
- return metadata;
- else if (p_name=="script")
- return script;
-
- if (script_instance) {
- return script_instance->get(p_name);
- }
-
- return Variant();
-
-}
-#endif
-
void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) const {
if (script_instance && p_reversed) {
@@ -596,22 +539,6 @@ Variant Object::_call_deferred_bind(const Variant **p_args, int p_argcount, Vari
return Variant();
}
-#if 0
-Variant Object::_call_bind(const StringName& p_name, const Variant& p_arg1, const Variant& p_arg2, const Variant& p_arg3, const Variant& p_arg4) {
-
- ERR_FAIL_COND_V(p_argcount<1,Variant());
-
- return call(p_name, p_arg1, p_arg2, p_arg3, p_arg4);
-};
-
-
-
-
-void Object::_call_deferred_bind(const StringName& p_name, const Variant& p_arg1, const Variant& p_arg2, const Variant& p_arg3, const Variant& p_arg4) {
-
- call_deferred(p_name, p_arg1, p_arg2, p_arg3, p_arg4);
-};
-#endif
#ifdef DEBUG_ENABLED
static bool _test_call_error(const StringName &p_func, const Variant::CallError &error) {
@@ -764,54 +691,6 @@ Variant Object::callv(const StringName &p_method, const Array &p_args) {
}
Variant Object::call(const StringName &p_name, VARIANT_ARG_DECLARE) {
-#if 0
- if (p_name==CoreStringNames::get_singleton()->_free) {
-#ifdef DEBUG_ENABLED
- if (cast_to<Reference>()) {
- ERR_EXPLAIN("Can't 'free' a reference.");
- ERR_FAIL_V(Variant());
- }
-#endif
- //must be here, must be before everything,
- memdelete(this);
- return Variant();
- }
-
- VARIANT_ARGPTRS;
-
- int argc=0;
- for(int i=0;i<VARIANT_ARG_MAX;i++) {
- if (argptr[i]->get_type()==Variant::NIL)
- break;
- argc++;
- }
-
- Variant::CallError error;
-
- Variant ret;
-
- if (script_instance) {
- ret = script_instance->call(p_name,argptr,argc,error);
- if (_test_call_error(p_name,error))
- return ret;
- }
-
- MethodBind *method=ClassDB::get_method(get_type_name(),p_name);
-
- if (method) {
-
-
- Variant ret = method->call(this,argptr,argc,error);
- if (_test_call_error(p_name,error))
- return ret;
-
- return ret;
- } else {
-
- }
-
- return Variant();
-#else
VARIANT_ARGPTRS;
@@ -826,52 +705,9 @@ Variant Object::call(const StringName &p_name, VARIANT_ARG_DECLARE) {
Variant ret = call(p_name, argptr, argc, error);
return ret;
-
-#endif
}
void Object::call_multilevel(const StringName &p_name, VARIANT_ARG_DECLARE) {
-#if 0
- if (p_name==CoreStringNames::get_singleton()->_free) {
-#ifdef DEBUG_ENABLED
- if (cast_to<Reference>()) {
- ERR_EXPLAIN("Can't 'free' a reference.");
- ERR_FAIL();
- return;
- }
-#endif
- //must be here, must be before everything,
- memdelete(this);
- return;
- }
-
- VARIANT_ARGPTRS;
-
- int argc=0;
- for(int i=0;i<VARIANT_ARG_MAX;i++) {
- if (argptr[i]->get_type()==Variant::NIL)
- break;
- argc++;
- }
-
- Variant::CallError error;
-
- if (script_instance) {
- script_instance->call(p_name,argptr,argc,error);
- _test_call_error(p_name,error);
-
- }
-
- MethodBind *method=ClassDB::get_method(get_type_name(),p_name);
-
- if (method) {
-
- method->call(this,argptr,argc,error);
- _test_call_error(p_name,error);
-
- }
-
-#else
VARIANT_ARGPTRS;
@@ -884,8 +720,6 @@ void Object::call_multilevel(const StringName &p_name, VARIANT_ARG_DECLARE) {
//Variant::CallError error;
call_multilevel(p_name, argptr, argc);
-
-#endif
}
Variant Object::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
@@ -1130,22 +964,6 @@ struct _ObjectSignalDisconnectData {
StringName method;
};
-#if 0
-void Object::_emit_signal(const StringName& p_name,const Array& p_pargs){
-
- Variant args[VARIANT_ARG_MAX];
-
- int count = p_pargs.size();
-
- for(int i=0;i<count;i++) {
- args[i]=p_pargs[i];
- }
-
- emit_signal(p_name,VARIANT_ARGS_FROM_ARRAY(args));
-}
-
-#endif
-
Variant Object::_emit_signal(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -1314,21 +1132,7 @@ void Object::_add_user_signal(const String &p_name, const Array &p_args) {
add_user_signal(mi);
}
-#if 0
-void Object::_emit_signal(const StringName& p_name,const Array& p_pargs){
-
- Variant args[VARIANT_ARG_MAX];
- int count = p_pargs.size();
-
- for(int i=0;i<count;i++) {
- args[i]=p_pargs[i];
- }
-
- emit_signal(p_name,VARIANT_ARGS_FROM_ARRAY(args));
-}
-
-#endif
Array Object::_get_signal_list() const {
List<MethodInfo> signal_list;
@@ -1342,6 +1146,7 @@ Array Object::_get_signal_list() const {
return ret;
}
+
Array Object::_get_signal_connection_list(const String &p_signal) const {
List<Connection> conns;
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 314fdefef4..88037859aa 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -28,11 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "input_event.h"
+
#include "input_map.h"
#include "os/keyboard.h"
-/**
- *
- */
void InputEvent::set_id(uint32_t p_id) {
id = p_id;
@@ -99,25 +97,6 @@ bool InputEvent::is_action_type() const {
return false;
}
-#if 0
-if (String(p_method) == "is_action" && p_argidx == 0) {
-
- List<PropertyInfo> pinfo;
- ProjectSettings::get_singleton()->get_property_list(&pinfo);
-
- for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
- const PropertyInfo &pi = E->get();
-
- if (!pi.name.begins_with("input/"))
- continue;
-
- String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
- result.insert("\"" + name + "\"");
- }
-
-} else
-#endif
-
void InputEvent::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_id", "id"), &InputEvent::set_id);
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 645c1390c6..ce1d7918db 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -733,46 +733,6 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
}
return OK;
-
-#if 0
- Error err = file->open(dst_file,FileAccess::WRITE);
- if (err) {
- memdelete(file);
- ERR_EXPLAIN("Couldn't save project.godot");
- ERR_FAIL_COND_V(err,err)
- }
-
-
- for(Map<String,List<String> >::Element *E=props.front();E;E=E->next()) {
-
- if (E!=props.front())
- file->store_string("\n");
-
- if (E->key()!="")
- file->store_string("["+E->key()+"]\n\n");
- for(List<String>::Element *F=E->get().front();F;F=F->next()) {
-
- String key = F->get();
- if (E->key()!="")
- key=E->key()+"/"+key;
- Variant value;
-
- if (p_custom.has(key))
- value=p_custom[key];
- else
- value = get(key);
-
- file->store_string(F->get()+"="+_encode_variant(value)+"\n");
-
- }
- }
-
- file->close();
- memdelete(file);
-
-
- return OK;
-#endif
}
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) {
diff --git a/core/reference.cpp b/core/reference.cpp
index 936da899ca..bb70628cbe 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -124,44 +124,3 @@ void WeakRef::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_ref"), &WeakRef::get_ref);
}
-#if 0
-
-Reference * RefBase::get_reference_from_ref(const RefBase &p_base) {
-
- return p_base.get_reference();
-}
-void RefBase::ref_inc(Reference *p_reference) {
-
- p_reference->refcount.ref();
-}
-bool RefBase::ref_dec(Reference *p_reference) {
-
- bool ref = p_reference->refcount.unref();
- return ref;
-}
-
-Reference *RefBase::first_ref(Reference *p_reference) {
-
- if (p_reference->refcount.ref()) {
-
- // this may fail in the scenario of two threads assigning the pointer for the FIRST TIME
- // at the same time, which is never likely to happen (would be crazy to do)
- // so don't do it.
-
- if (p_reference->refcount_init.get()>0) {
- p_reference->refcount_init.unref();
- p_reference->refcount.unref(); // first referencing is already 1, so compensate for the ref above
- }
-
- return p_reference;
- } else {
-
- return 0;
- }
-
-}
-char * RefBase::get_refptr_data(const RefPtr &p_refptr) const {
-
- return p_refptr.data;
-}
-#endif
diff --git a/core/reference.h b/core/reference.h
index 1fd2a55d2c..5fe8296314 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -59,21 +59,6 @@ public:
~Reference();
};
-#if 0
-class RefBase {
-protected:
- void ref_inc(Reference *p_reference);
- bool ref_dec(Reference *p_reference);
- Reference *first_ref(Reference *p_reference);
- Reference * get_reference_from_ref(const RefBase &p_base);
- virtual Reference * get_reference() const=0;
- char * get_refptr_data(const RefPtr &p_refptr) const;
-public:
-
- virtual ~RefBase() {}
-};
-#endif
-
template <class T>
class Ref {
@@ -151,20 +136,10 @@ public:
return refptr;
};
-#if 0
- // go to RefPtr
- operator RefPtr() const {
-
- return get_ref_ptr();
- }
-#endif
-
-#if 1
operator Variant() const {
return Variant(get_ref_ptr());
}
-#endif
void operator=(const Ref &p_from) {
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 77eeda13ee..ee07c7b11b 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -1252,66 +1252,7 @@ String String::utf8(const char *p_utf8, int p_len) {
return ret;
};
-#if 0
-_FORCE_INLINE static int parse_utf8_char(const char *p_utf8,unsigned int *p_ucs4,int p_left) { //return len
-
-
- int len=0;
-
-/* Determine the number of characters in sequence */
- if ((*p_utf8 & 0x80)==0)
- len=1;
- else if ((*p_utf8 & 0xE0)==0xC0)
- len=2;
- else if ((*p_utf8 & 0xF0)==0xE0)
- len=3;
- else if ((*p_utf8 & 0xF8)==0xF0)
- len=4;
- else if ((*p_utf8 & 0xFC)==0xF8)
- len=5;
- else if ((*p_utf8 & 0xFE)==0xFC)
- len=6;
- else
- return -1; //invalid UTF8
-
- if (len>p_left)
- return -1; //not enough space
-
- if (len==2 && (*p_utf8&0x1E)==0) {
- //printf("overlong rejected\n");
- return -1; //reject overlong
- }
-
- /* Convert the first character */
-
- unsigned int unichar=0;
-
- if (len == 1)
- unichar=*p_utf8;
- else {
-
- unichar=(0xFF >> (len +1)) & *p_utf8;
- for (int i=1;i<len;i++) {
-
- if ((p_utf8[i] & 0xC0) != 0x80) {
- //printf("invalid utf8\n");
- return -1; //invalid utf8
- }
- if (unichar==0 && i==2 && ((p_utf8[i] & 0x7F) >> (7 - len)) == 0) {
- //printf("no overlong\n");
- return -1; //no overlong
- }
- unichar = (unichar << 6) | (p_utf8[i] & 0x3F);
- }
- }
-
- *p_ucs4=unichar;
-
- return len;
-
-}
-#endif
bool String::parse_utf8(const char *p_utf8, int p_len) {
#define _UNICERROR(m_err) print_line("unicode error: " + String(m_err));
@@ -1998,94 +1939,6 @@ double String::to_double(const char *p_str) {
#else
return built_in_strtod<char>(p_str);
#endif
-#if 0
-#if 0
-
-
- return atof(p_str);
-#else
- if (!p_str[0])
- return 0;
-///@todo make more exact so saving and loading does not lose precision
-
- double integer=0;
- double decimal=0;
- double decimal_mult=0.1;
- double sign=1.0;
- double exp=0;
- double exp_sign=1.0;
- int reading=READING_SIGN;
-
- const char *str=p_str;
-
- while(*str && reading!=READING_DONE) {
-
- CharType c=*(str++);
- switch(reading) {
- case READING_SIGN: {
- if (c>='0' && c<='9')
- reading=READING_INT;
- // let it fallthrough
- else if (c=='-') {
- sign=-1.0;
- reading=READING_INT;
- break;
- } else if (c=='.') {
- reading=READING_DEC;
- break;
- } else {
- break;
- }
- }
- case READING_INT: {
-
- if (c>='0' && c<='9') {
-
- integer*=10;
- integer+=c-'0';
- } else if (c=='.') {
- reading=READING_DEC;
- } else if (c=='e') {
- reading=READING_EXP;
- } else {
- reading=READING_DONE;
- }
-
- } break;
- case READING_DEC: {
-
- if (c>='0' && c<='9') {
-
- decimal+=(c-'0')*decimal_mult;
- decimal_mult*=0.1;
- } else if (c=='e') {
- reading=READING_EXP;
- } else {
- reading=READING_DONE;
- }
-
- } break;
- case READING_EXP: {
-
- if (c>='0' && c<='9') {
-
- exp*=10.0;
- exp+=(c-'0');
- } else if (c=='-' && exp==0) {
- exp_sign=-1.0;
- } else if (exp_sign>=0 && c=='+') {
- //redundant...
- exp_sign=1.0;
- } else {
- reading=READING_DONE;
- }
- } break;
- }
- }
-
- return sign*(integer+decimal)*Math::pow(10,exp_sign*exp);
-#endif
-#endif
}
float String::to_float() const {
@@ -2096,100 +1949,6 @@ float String::to_float() const {
double String::to_double(const CharType *p_str, const CharType **r_end) {
return built_in_strtod<CharType>(p_str, (CharType **)r_end);
-#if 0
-#if 0
- //ndef NO_USE_STDLIB
- return wcstod(p_str,p_len<0?NULL:p_str+p_len);
-#else
- if (p_len==0 || !p_str[0])
- return 0;
-///@todo make more exact so saving and loading does not lose precision
-
- double integer=0;
- double decimal=0;
- double decimal_mult=0.1;
- double sign=1.0;
- double exp=0;
- double exp_sign=1.0;
- int reading=READING_SIGN;
-
- const CharType *str=p_str;
- const CharType *limit=&p_str[p_len];
-
- while(reading!=READING_DONE && str!=limit) {
-
- CharType c=*(str++);
- switch(reading) {
- case READING_SIGN: {
- if (c>='0' && c<='9')
- reading=READING_INT;
- // let it fallthrough
- else if (c=='-') {
- sign=-1.0;
- reading=READING_INT;
- break;
- } else if (c=='.') {
- reading=READING_DEC;
- break;
- } else if (c==0) {
- reading=READING_DONE;
- break;
- } else {
- break;
- }
- }
- case READING_INT: {
-
- if (c>='0' && c<='9') {
-
- integer*=10;
- integer+=c-'0';
- } else if (c=='.') {
- reading=READING_DEC;
- } else if (c=='e' || c=='E') {
- reading=READING_EXP;
- } else {
- reading=READING_DONE;
- }
-
- } break;
- case READING_DEC: {
-
- if (c>='0' && c<='9') {
-
- decimal+=(c-'0')*decimal_mult;
- decimal_mult*=0.1;
- } else if (c=='e' || c=='E') {
- reading=READING_EXP;
- } else {
- reading=READING_DONE;
- }
-
- } break;
- case READING_EXP: {
-
- if (c>='0' && c<='9') {
-
- exp*=10.0;
- exp+=(c-'0');
- } else if (c=='-' && exp==0) {
- exp_sign=-1.0;
- } else if (exp_sign>=0 && c=='+') {
- //redundant...
- exp_sign=1.0;
- } else {
- reading=READING_DONE;
- }
- } break;
- }
- }
-
- if (r_end)
- *r_end=str-1;
-
- return sign*(integer+decimal)*Math::pow(10,exp_sign*exp);
-#endif
-#endif
}
int64_t String::to_int(const CharType *p_str, int p_len) {
@@ -2252,98 +2011,6 @@ double String::to_double() const {
#else
return built_in_strtod<CharType>(c_str());
#endif
-#if 0
-#ifndef NO_USE_STDLIB
-
- return atof(utf8().get_data());
-#else
-
- double integer=0;
- double decimal=0;
- double decimal_mult=0.1;
- double sign=1.0;
- double exp=0;
- double exp_sign=1.0;
- int reading=READING_SIGN;
-
- const CharType *str=&operator[](0);
-
- while(*str && reading!=READING_DONE) {
-
- CharType c=*(str++);
- switch(reading) {
- case READING_SIGN: {
- if (c>='0' && c<='9')
- reading=READING_INT;
- // let it fallthrough
- else if (c=='-') {
- sign=-1.0;
- reading=READING_INT;
- break;
- } else if (c=='.') {
- reading=READING_DEC;
- break;
- } else {
- break;
- }
- }
- case READING_INT: {
-
- if (c>='0' && c<='9') {
-
- integer*=10;
- integer+=c-'0';
- } else if (c=='.') {
- reading=READING_DEC;
- } else if (c=='e') {
- reading=READING_EXP;
- } else {
- reading=READING_DONE;
- }
-
- } break;
- case READING_DEC: {
-
- if (c>='0' && c<='9') {
-
- decimal+=(c-'0')*decimal_mult;
- decimal_mult*=0.1;
- } else if (c=='e') {
- reading=READING_EXP;
- } else {
- reading=READING_DONE;
- }
-
- } break;
- case READING_EXP: {
-
- if (c>='0' && c<='9') {
-
- exp*=10.0;
- exp+=(c-'0');
- } else if (c=='-' && exp==0) {
- exp_sign=-1.0;
- } else if (exp_sign>=0 && c=='+') {
- //redundant...
- exp_sign=1.0;
- } else {
- reading=READING_DONE;
- }
- } break;
- }
- }
-
- return sign*(integer+decimal)*Math::pow(10,exp_sign*exp);
-#endif
-#if 0
-
-
- double ret=sign*(integer+decimal)*Math::pow(10,exp_sign*exp);
-
- print_line(*this +" == "+rtos(ret));
- return ret;
-#endif
-#endif
}
bool operator==(const char *p_chr, const String &p_str) {