chiark / gitweb /
Use trusty
[nlopt.git] / api / nlopt-internal.h
index d41099fa01d134d2728a3951087e0a3dcedc2f6a..c4d13d11d20abd870eaf0191fdf969fa264d49ee 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2011 Massachusetts Institute of Technology
+/* Copyright (c) 2007-2014 Massachusetts Institute of Technology
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -72,7 +72,9 @@ struct nlopt_opt_s {
      double *dx; /* initial step sizes (length n) for nonderivative algs */
      unsigned vector_storage; /* max subspace dimension (0 for default) */
 
-     double *work; /* algorithm-specific workspace during optimization */
+     void *work; /* algorithm-specific workspace during optimization */
+
+     char *errmsg; /* description of most recent error */
 };
 
 /*********************************************************************/
@@ -88,6 +90,20 @@ extern unsigned nlopt_stochastic_population;
 
 /*********************************************************************/
 
+#define RETURN_ERR(err, opt, msg) do {          \
+    nlopt_set_errmsg(opt, msg);                 \
+    return err;                                 \
+} while (0)
+
+extern const char *nlopt_set_errmsg(nlopt_opt opt, const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 2, 3)))
+#endif
+;
+extern void nlopt_unset_errmsg(nlopt_opt opt);
+
+/*********************************************************************/
+
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif /* __cplusplus */