float gsl_ran_gaussian(float sigma);
-string car(string s); // returns first word
-string cdr(string s); // returns all but first word
float matchacl(string acl, string str); // matches str against ACL acl (with entries +foo*, +foo, +*foo, +*foo*, and same with - for forbidding)
-float startsWith(string haystack, string needle);
-float startsWithNocase(string haystack, string needle);
string get_model_datafilename(string mod, float skn, string fil); // skin -1 will return wildcard, mod string_null will also put wildcard there
string get_model_parameters_modelname;
#endif
// used for simplifying ACCUMULATE_FUNCTIONs
-#define SET_FIRST_OR_LAST(input, first, count) if (!input) { input = (first + count); }
-#define SET_FIELD_COUNT(field, first, count) if (!field) { field = (first + count); ++count; }
-#define CHECK_MAX_COUNT(name, max, count, type) if (count > max) { error(strcat("Maximum ", type, " hit: ", #name, ": ", ftos(count), ".\n")); }
+#define SET_FIRST_OR_LAST(input, first, count) \
+ if (!input) { input = (first + count); }
+#define SET_FIELD_COUNT(field, first, count) \
+ if (!field) { field = (first + count); ++count; }
+#define CHECK_MAX_COUNT(name, max, count, type) \
+ if (count > max) { error(strcat("Maximum ", type, " hit: ", #name, ": ", ftos(count), ".\n")); }
#endif
[[deprecated("use true")]][[alias("true")]] const bool TRUE;
[[deprecated("use false")]][[alias("false")]] const bool FALSE;
+#define boolean(value) ((value) != 0)
+
// get true/false value of a string with multiple different inputs
float InterpretBoolean(string input)
{
case "off":
return false;
- default: return stof(input);
+ default: return boolean(stof(input));
}
}
-#define boolean(value) ((value) != 0)
-
#endif
#define MEAN_EVALUATE(prefix) mean_evaluate(self, prefix##_accumulator, prefix##_count, prefix##_mean)
#define MEAN_DECLARE(prefix, m) float prefix##_mean = m; .float prefix##_count, prefix##_accumulator
-/*
-==================
-crandom
-
-Returns a random number between -1.0 and 1.0
-==================
-*/
-float crandom()
-{
- return 2 * (random() - 0.5);
-}
+/** Returns a random number between -1.0 and 1.0 */
+#define crandom() (2 * (random() - 0.5))
/*
return input;
}
-bool startsWith(string haystack, string needle)
-{
- return substring(haystack, 0, strlen(needle)) == needle;
-}
+#define startsWith(haystack, needle) (strstrofs(haystack, needle, 0) == 0)
bool startsWithNocase(string haystack, string needle)
{
return sc;
}
+/** returns first word */
string car(string s)
{
int o = strstrofs(s, " ", 0);
return substring(s, 0, o);
}
+/** returns all but first word */
string cdr(string s)
{
int o = strstrofs(s, " ", 0);
return substring(s, 0, endpos);
}
-bool strhasword(string s, string w)
-{
- return strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0;
-}
+#define strhasword(s, w) (strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0)
int u8_strsize(string s)
{
*/
vector findbetterlocation (vector org, float mindist);
-/*
-==================
-crandom
-
-Returns a random number between -1.0 and 1.0
-==================
-*/
-float crandom (void);
-
/*
==================
Angc used for animations