Revision: 75943
http://sourceforge.net/p/brlcad/code/75943
Author: starseeker
Date: 2020-05-26 21:43:58 +0000 (Tue, 26 May 2020)
Log Message:
-----------
In this case we can simplify down to a C header
Modified Paths:
--------------
brlcad/trunk/src/libged/alphanum.h
Modified: brlcad/trunk/src/libged/alphanum.h
===================================================================
--- brlcad/trunk/src/libged/alphanum.h 2020-05-26 20:56:38 UTC (rev 75942)
+++ brlcad/trunk/src/libged/alphanum.h 2020-05-26 21:43:58 UTC (rev 75943)
@@ -1,5 +1,5 @@
-#ifndef ALPHANUM__HPP
-#define ALPHANUM__HPP
+#ifndef ALPHANUM_H
+#define ALPHANUM_H
/*
The Alphanum Algorithm is an improved sorting algorithm for strings
@@ -35,18 +35,14 @@
Source:
https://github.com/facontidavide/PlotJuggler/blob/master/include/PlotJuggler/alphanum.hpp
-Simplified down to the essential sorting comparison of C strings
+This copy has been simplified down to the essential sorting comparison of C
strings
*/
#include "common.h"
+#include <stdlib.h>
+#include <ctype.h>
-#include <cassert>
-#include <functional>
-#include <string>
-#include <sstream>
-#include <cctype>
-
/**
compare l and r with strcmp() semantics, but using
the "Alphanum Algorithm". This function is designed to read
@@ -74,7 +70,7 @@
while((l_char=*l) && (r_char=*r))
{
// check if this are digit characters
- const bool l_digit=isdigit(l_char), r_digit=isdigit(r_char);
+ const int l_digit = isdigit(l_char), r_digit=isdigit(r_char);
// if both characters are digits, we continue in NUMBER mode
if(l_digit && r_digit)
{
@@ -86,7 +82,7 @@
// if only the right character is a digit, we have a result
if(r_digit) return +1;
// compute the difference of both characters
- const int diff=l_char - r_char;
+ const int diff = l_char - r_char;
// if they differ we have a result
if(diff != 0) return diff;
// otherwise process the next characters
@@ -120,15 +116,14 @@
return 0;
}
-
#endif
-
-// Local Variables:
-// tab-width: 8
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: t
-// c-file-style: "stroustrup"
-// End:
-// ex: shiftwidth=4 tabstop=8
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits