40 return old_swig_lal_do_redirect_stdouterr;
56static int swig_lal_raise_hook(
int sig,
const char *fmt, ...) {
59 (void) vfprintf(stderr, fmt, ap);
61 (void)
fprintf(stderr,
"LALRaise: %s\n", strsignal(sig));
69static void swig_lal_abort_hook(
const char *fmt, ...) {
72 (void) vfprintf(stderr, fmt, ap);
80static void swig_lal_gsl_error_handler(
const char *reason,
const char *
file,
int line,
int errnum) {
81 XLALPrintError(
"GSL function failed: %s (errnum=%i)\n", reason, errnum);
93static int swig_set_error_handler_messages = 0;
96swig_set_nice_error_handlers();
97swig_set_error_handler_messages = 1;
105void swig_set_nice_error_handlers(
void) {
106 if (swig_set_error_handler_messages) {
107 fprintf(stderr,
"*** WARNING: XLAL/LAL/GSL functions will now raise XLAL errors ***\n");
109 gsl_set_error_handler(swig_lal_gsl_error_handler);
121void swig_set_nasty_error_handlers(
void) {
122 if (swig_set_error_handler_messages) {
123 fprintf(stderr,
"*** WARNING: XLAL/LAL/GSL functions will now abort() on error ***\n");
125 gsl_set_error_handler(NULL);
138%define %swig_lal_gsl_vector_matrix(
BASETYPE,
TYPE, NAME)
144 gsl_vector##NAME(
const size_t n) {
145 return gsl_vector##NAME##_calloc(n);
147 gsl_vector##NAME(gsl_vector##NAME *v0) {
148 gsl_vector##NAME *v = gsl_vector##NAME##_alloc(v0->size);
149 gsl_vector##NAME##_memcpy(v, v0);
152 ~gsl_vector##NAME() {
153 %swiglal_struct_call_dtor(gsl_vector##NAME##_free, $self);
156 %swiglal_array_dynamic_size(
size_t, size);
157 %swiglal_array_dynamic_1D(gsl_vector##NAME,
TYPE,
size_t, data, arg1->size, arg1->stride);
163%typemap(in, noblock=1) const gsl_vector
##NAME* (void *argp = 0, int res = 0, gsl_vector##NAME##_view temp, void *temp_data = 0, size_t dims[1] = {0}, int elemalloc = 0) %{
164 res = SWIG_ConvertPtr($input, &argp, $descriptor, 0 | %convertptr_flags);
165 if (!SWIG_IsOK(res)) {
169 res = %swiglal_array_viewin(
TYPE*)(swiglal_no_self(), $input, %as_voidptrptr(&data),
170 sizeof(
TYPE), 1, dims,
171 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
172 $disown | %convertptr_flags);
173 if (!SWIG_IsOK(res)) {
174 temp_data = data = %swiglal_new_array(dims[0],
TYPE);
175 size_t strides[1] = {1};
176 res = %swiglal_array_copyin(
TYPE*)(swiglal_no_self(), $input, %as_voidptr(data), &elemalloc,
177 sizeof(
TYPE), 1, dims, strides,
178 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
179 $disown | %convertptr_flags);
180 if (!SWIG_IsOK(res)) {
181 %argument_fail(res,
"$type", $symname, $argnum);
183 temp = gsl_vector##NAME##_view_array(%reinterpret_cast(data,
BASETYPE*), dims[0]);
187 temp = gsl_vector##NAME##_view_array(%reinterpret_cast(data,
BASETYPE*), dims[0]);
191 %argument_fail(res,
"$type", $symname, $argnum);
194 $1 = %reinterpret_cast(argp, $ltype);
196%typemap(freearg, match=
"in", noblock=1) const gsl_vector
##NAME* %{
197 if (temp_data$argnum) {
205%typemap(in, noblock=1) gsl_vector
##NAME* SWIGLAL_VIEWIN_ARRAY (void *argp = 0, int res = 0, gsl_vector##NAME##_view temp) %{
206 res = SWIG_ConvertPtr($input, &argp, $descriptor, 0 | %convertptr_flags);
207 if (!SWIG_IsOK(res)) {
209 size_t dims[1] = {0};
212 res = %swiglal_array_viewin(
TYPE*)(swiglal_no_self(), $input, %as_voidptrptr(&data),
213 sizeof(
TYPE), 1, dims,
214 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
215 $disown | %convertptr_flags);
216 if (!SWIG_IsOK(res)) {
217 %argument_fail(res,
"$type", $symname, $argnum);
219 temp = gsl_vector##NAME##_view_array(%reinterpret_cast(data,
BASETYPE*), dims[0]);
223 %argument_fail(res,
"$type", $symname, $argnum);
226 $1 = %reinterpret_cast(argp, $ltype);
236%typemap(in, noblock=1) gsl_vector
##NAME* SWIGLAL_COPYINOUT_ARRAY (void *argp = 0, int res = 0, gsl_vector##NAME##_view temp, SWIG_Object input_ref, void *temp_data = 0, size_t dims[1] = {0}, int elemalloc = 0) %{
237 res = SWIG_ConvertPtr($input, &argp, $descriptor, 0 | %convertptr_flags);
238 if (!SWIG_IsOK(res)) {
241 res = %swiglal_array_viewin(
TYPE*)(swiglal_no_self(), $input, %as_voidptrptr(&temp_data),
242 sizeof(
TYPE), 1, dims,
243 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
244 $disown | %convertptr_flags);
246 temp_data = %swiglal_new_array(dims[0],
TYPE);
247 size_t strides[1] = {1};
248 res = %swiglal_array_copyin(
TYPE*)(swiglal_no_self(), $input, %as_voidptr(temp_data), &elemalloc,
249 sizeof(
TYPE), 1, dims, strides,
250 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
251 $disown | %convertptr_flags);
252 if (!SWIG_IsOK(res)) {
253 %argument_fail(res,
"$type", $symname, $argnum);
255 temp = gsl_vector##NAME##_view_array(%reinterpret_cast(temp_data,
BASETYPE*), dims[0]);
259 %argument_fail(res,
"$type", $symname, $argnum);
265 $1 = %reinterpret_cast(argp, $ltype);
267%typemap(argout, match=
"in", noblock=1) gsl_vector
##NAME* SWIGLAL_COPYINOUT_ARRAY %{
268 if (temp_data$argnum) {
269 const size_t dims[1] = {temp$argnum.vector.size};
270 const size_t strides[1] = {1};
272 %append_output(%swiglal_array_copyout(
TYPE*)(swiglal_no_self(), %as_voidptr(temp_data$argnum),
273 sizeof(
TYPE), 1, dims, strides,
274 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
275 SWIG_POINTER_OWN | %newpointer_flags));
277 %append_output(swiglal_get_reference(input_ref$argnum));
280%typemap(freearg, match=
"in", noblock=1) gsl_vector
##NAME* SWIGLAL_COPYINOUT_ARRAY %{
281 if (temp_data$argnum) {
291 gsl_matrix##NAME(
const size_t n1,
const size_t n2) {
292 return gsl_matrix##NAME##_calloc(n1, n2);
294 gsl_matrix##NAME(gsl_matrix##NAME *m0) {
295 gsl_matrix##NAME *
m = gsl_matrix##NAME##_alloc(m0->size1, m0->size2);
296 gsl_matrix##NAME##_memcpy(
m, m0);
299 ~gsl_matrix##NAME() {
300 %swiglal_struct_call_dtor(gsl_matrix##NAME##_free, $self);
303 %swiglal_array_dynamic_size(
size_t, size1);
304 %swiglal_array_dynamic_size(
size_t, size2);
305 %swiglal_array_dynamic_2D(gsl_matrix##NAME,
TYPE,
size_t, data, arg1->size1, arg1->size2, arg1->tda, 1);
311%typemap(in, noblock=1) const gsl_matrix
##NAME* (void *argp = 0, int res = 0, gsl_matrix##NAME##_view temp, void *temp_data = 0, size_t dims[2] = {0, 0}, int elemalloc = 0) %{
312 res = SWIG_ConvertPtr($input, &argp, $descriptor, 0 | %convertptr_flags);
313 if (!SWIG_IsOK(res)) {
317 res = %swiglal_array_viewin(
TYPE*)(swiglal_no_self(), $input, %as_voidptrptr(&data),
318 sizeof(
TYPE), 2, dims,
319 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
320 $disown | %convertptr_flags);
321 if (!SWIG_IsOK(res)) {
322 temp_data = data = %swiglal_new_array(dims[0] * dims[1],
TYPE);
323 size_t strides[2] = {dims[1], 1};
324 res = %swiglal_array_copyin(
TYPE*)(swiglal_no_self(), $input, %as_voidptr(data), &elemalloc,
325 sizeof(
TYPE), 2, dims, strides,
326 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
327 $disown | %convertptr_flags);
328 if (!SWIG_IsOK(res)) {
329 %argument_fail(res,
"$type", $symname, $argnum);
331 temp = gsl_matrix##NAME##_view_array(%reinterpret_cast(data,
BASETYPE*), dims[0], dims[1]);
335 temp = gsl_matrix##NAME##_view_array(%reinterpret_cast(data,
BASETYPE*), dims[0], dims[1]);
339 %argument_fail(res,
"$type", $symname, $argnum);
342 $1 = %reinterpret_cast(argp, $ltype);
344%typemap(freearg, match=
"in", noblock=1) const gsl_matrix
##NAME* %{
345 if (temp_data$argnum) {
353%typemap(in, noblock=1) gsl_matrix
##NAME* SWIGLAL_VIEWIN_ARRAY (void *argp = 0, int res = 0, gsl_matrix##NAME##_view temp) %{
354 res = SWIG_ConvertPtr($input, &argp, $descriptor, 0 | %convertptr_flags);
355 if (!SWIG_IsOK(res)) {
357 size_t dims[2] = {0, 0};
360 res = %swiglal_array_viewin(
TYPE*)(swiglal_no_self(), $input, %as_voidptrptr(&data),
361 sizeof(
TYPE), 2, dims,
362 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
363 $disown | %convertptr_flags);
364 if (!SWIG_IsOK(res)) {
365 %argument_fail(res,
"$type", $symname, $argnum);
367 temp = gsl_matrix##NAME##_view_array(%reinterpret_cast(data,
BASETYPE*), dims[0], dims[1]);
371 %argument_fail(res,
"$type", $symname, $argnum);
374 $1 = %reinterpret_cast(argp, $ltype);
384%typemap(in, noblock=1) gsl_matrix
##NAME* SWIGLAL_COPYINOUT_ARRAY (void *argp = 0, int res = 0, gsl_matrix##NAME##_view temp, SWIG_Object input_ref, void *temp_data = 0, size_t dims[2] = {0, 0}, int elemalloc = 0) %{
385 res = SWIG_ConvertPtr($input, &argp, $descriptor, 0 | %convertptr_flags);
386 if (!SWIG_IsOK(res)) {
389 res = %swiglal_array_viewin(
TYPE*)(swiglal_no_self(), $input, %as_voidptrptr(&temp_data),
390 sizeof(
TYPE), 2, dims,
391 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
392 $disown | %convertptr_flags);
393 if (dims[0] * dims[1] > 0) {
394 temp_data = %swiglal_new_array(dims[0] * dims[1],
TYPE);
395 size_t strides[2] = {dims[1], 1};
396 res = %swiglal_array_copyin(
TYPE*)(swiglal_no_self(), $input, %as_voidptr(temp_data), &elemalloc,
397 sizeof(
TYPE), 2, dims, strides,
398 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
399 $disown | %convertptr_flags);
400 if (!SWIG_IsOK(res)) {
401 %argument_fail(res,
"$type", $symname, $argnum);
403 temp = gsl_matrix##NAME##_view_array(%reinterpret_cast(temp_data,
BASETYPE*), dims[0], dims[1]);
407 %argument_fail(res,
"$type", $symname, $argnum);
413 $1 = %reinterpret_cast(argp, $ltype);
415%typemap(argout, match=
"in", noblock=1) gsl_matrix
##NAME* SWIGLAL_COPYINOUT_ARRAY %{
416 if (temp_data$argnum) {
417 const size_t dims[2] = {temp$argnum.matrix.size1, temp$argnum.matrix.size2};
418 const size_t strides[2] = {dims[1], 1};
420 %append_output(%swiglal_array_copyout(
TYPE*)(swiglal_no_self(), %as_voidptr(temp_data$argnum),
421 sizeof(
TYPE), 2, dims, strides,
422 $typemap(swiglal_dynarr_isptr,
TYPE), $typemap(swiglal_dynarr_tinfo,
TYPE),
423 SWIG_POINTER_OWN | %newpointer_flags));
425 %append_output(swiglal_get_reference(input_ref$argnum));
428%typemap(freearg, match=
"in", noblock=1) gsl_matrix
##NAME* SWIGLAL_COPYINOUT_ARRAY %{
429 if (temp_data$argnum) {
441%swig_lal_gsl_vector_matrix(
short,
short, _short);
442%swig_lal_gsl_vector_matrix(
unsigned short,
unsigned short, _ushort);
443%swig_lal_gsl_vector_matrix(
int,
int, _int);
444%swig_lal_gsl_vector_matrix(
unsigned int,
unsigned int, _uint);
445%swig_lal_gsl_vector_matrix(
long,
long, _long);
446%swig_lal_gsl_vector_matrix(
unsigned long,
unsigned long, _ulong);
451%swig_lal_gsl_vector_matrix(
float,
float, _float);
452%swig_lal_gsl_vector_matrix(
double,
double, );
453%swig_lal_gsl_vector_matrix(
float, gsl_complex_float, _complex_float);
454%swig_lal_gsl_vector_matrix(
double, gsl_complex, _complex);
461#if defined(SWIGPYTHON)
462%pythondynamic tagLIGOTimeGPS;
469%fragment(
"swiglal_specialised_tagLIGOTimeGPS",
"header", fragment=SWIG_AsVal_frag(
double), fragment=SWIG_AsVal_frag(int32_t)) {
470 int swiglal_specialised_tagLIGOTimeGPS(SWIG_Object in,
LIGOTimeGPS *out) {
472 int res = SWIG_AsVal(
double)(in, &val);
473 if (!SWIG_IsOK(res)) {
475 if (PyObject_HasAttrString(in,
"gpsSeconds") && PyObject_HasAttrString(in,
"gpsNanoSeconds")) {
477 res = SWIG_AsVal(int32_t)(PyObject_GetAttrString(in,
"gpsSeconds"), &
gpsSeconds);
478 if (!SWIG_IsOK(res)) {
481 res = SWIG_AsVal(int32_t)(PyObject_GetAttrString(in,
"gpsNanoSeconds"), &
gpsNanoSeconds);
482 if (!SWIG_IsOK(res)) {
495%swiglal_specialised_typemaps(tagLIGOTimeGPS,
"swiglal_specialised_tagLIGOTimeGPS");
505%fragment(
"swiglal_specialised_tagLALUnit",
"header",
506 fragment=
"SWIG_AsCharPtr",
507 fragment=SWIG_AsVal_frag(
double)
510 int swiglal_specialised_tagLALUnit(SWIG_Object in,
LALUnit *out) {
513 int res = SWIG_AsCharPtr(in, &str, &alloc);
514 if (SWIG_IsOK(res)) {
516 res = SWIG_ValueError;
519 if (alloc == SWIG_NEWOBJ) {
522 if (SWIG_IsOK(res)) {
526 res = SWIG_AsVal(
double)(in, &val);
527 if (!SWIG_IsOK(res)) {
531 return SWIG_ValueError;
534 if (modf(log10(val), &pow10) != 0) {
535 return SWIG_ValueError;
537 if (pow10 < INT16_MIN || INT16_MAX < pow10) {
538 return SWIG_ValueError;
545%swiglal_specialised_typemaps(tagLALUnit,
"swiglal_specialised_tagLALUnit");
561%fragment(
"swiglal_specialised_ptr_tagLALDict",
"header",
562 fragment=
"SWIG_AsCharPtr",
563 fragment=SWIG_AsVal_frag(uint16_t),
564 fragment=SWIG_AsVal_frag(int16_t),
565 fragment=SWIG_AsVal_frag(uint32_t),
566 fragment=SWIG_AsVal_frag(int32_t),
567 fragment=SWIG_AsVal_frag(uint64_t),
568 fragment=SWIG_AsVal_frag(int64_t),
569 fragment=SWIG_AsVal_frag(
float),
570 fragment=SWIG_AsVal_frag(
double),
575 int swiglal_specialised_ptr_tagLALDict(SWIG_Object in, LALDict **out) {
576 int res = SWIG_ValueError;
577 char *keyname, *valuestr = 0;
578 int keyalloc, valuealloc = 0;
584 if (!PyDict_Check(in)) {
585 return SWIG_ValueError;
587 PyObject *key, *value;
589 while (PyDict_Next(in, &pos, &key, &value)) {
590 if (!SWIG_IsOK(SWIG_AsCharPtr(key, &keyname, &keyalloc))) {
593 char *keytype = strrchr(keyname,
':');
594 if (keytype == NULL) {
595 keytype = keyname + strlen(keyname);
601#define SWIGLAL_LALDICT_HANDLE_TYPE(LALTYPESTR, LALTYPE, CTYPE, FMT, ...) \
602 if (XLALStringCaseCompare(keytype, LALTYPESTR) == 0) { \
604 if (SWIG_IsOK(SWIG_AsVal(CTYPE)(value, &v))) { \
605 if (XLALDictInsert##LALTYPE##Value(*out, keyname, v) != XLAL_SUCCESS) { \
608 XLALPrintInfo("%s: dict=%p, key=%s, type=%s, value=" FMT "\n", __func__, in, keyname, keytype, __VA_ARGS__); \
622#undef SWIGLAL_LALDICT_GIVEN_TYPE
623 if (SWIG_IsOK(SWIG_AsCharPtr(value, &valuestr, &valuealloc))) {
627 XLALPrintInfo(
"%s: dict=%p, key=%s, type=string, value='%s'\n", __func__, in, keyname, valuestr);
628 if (valuealloc == SWIG_NEWOBJ) {
629 %delete_array(valuestr);
633 XLALPrintInfo(
"%s: dict=%p, key=%s, type=unknown\n", __func__, in, keyname);
637 if (keyalloc == SWIG_NEWOBJ) {
638 %delete_array(keyname);
645 if (!SWIG_IsOK(res)) {
649 if (keyalloc == SWIG_NEWOBJ) {
650 %delete_array(keyname);
652 if (valuealloc == SWIG_NEWOBJ) {
653 %delete_array(valuestr);
657 void swiglal_specialised_ptr_tagLALDict_destroy(LALDict *tmp) {
661%swiglal_specialised_ptr_typemaps(
tagLALDict,
"swiglal_specialised_ptr_tagLALDict");
void XLALDestroyDict(LALDict *dict)
LALDict * XLALCreateDict(void)
int XLALDictInsertStringValue(LALDict *dict, const char *key, const char *string)
int(* lalRaiseHook)(int, const char *,...)
void(* lalAbortHook)(const char *,...)
int XLALPrintInfo(const char *fmt,...)
int XLALPrintError(const char *fmt,...)
unsigned char BOOLEAN
Boolean logical type, see Headers LAL(Atomic)Datatypes.h for more details.
uint64_t UINT8
Eight-byte unsigned integer; on some platforms this is equivalent to unsigned long int instead.
double complex COMPLEX16
Double-precision floating-point complex number (16 bytes total)
double REAL8
Double precision real floating-point number (8 bytes).
int16_t INT2
Two-byte signed integer.
int64_t INT8
Eight-byte signed integer; on some platforms this is equivalent to long int instead.
uint16_t UINT2
Two-byte unsigned integer.
uint32_t UINT4
Four-byte unsigned integer.
float complex COMPLEX8
Single-precision floating-point complex number (8 bytes total)
int32_t INT4
Four-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).
int LALRaise(int sig, const char *fmt,...)
void LALAbort(const char *fmt,...)
int swig_lal_do_redirect_stdouterr
The swig_lal_do_redirect_stdouterr variable turns on standard output/error redirection for all LAL li...
LALUnit * XLALParseUnitString(LALUnit *output, const char *string)
Returns the pointer output upon return or a pointer to newly allocated memory if output was NULL; on ...
const LALUnit lalDimensionlessUnit
dimensionless units
void XLALError(const char *func, const char *file, int line, int errnum)
Routine to set the XLAL error number and invoke the XLAL error handler.
void XLALAbortErrorHandler(const char *func, const char *file, int line, int errnum)
The XLAL error handler that raises SIGABRT.
XLALErrorHandlerType * XLALSetErrorHandler(XLALErrorHandlerType *newHandler)
Sets the error handler to a new handler and returns the old handler.
int XLALSetErrno(int errnum)
Sets the XLAL error number to errnum, returns the new value.
void XLALDefaultErrorHandler(const char *func, const char *file, int line, int errnum)
The default XLAL error handler.
@ XLAL_SUCCESS
Success return value (not an error number)
@ XLAL_EFAILED
Generic failure.
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
Sets GPS time given GPS seconds as a REAL8.
LIGOTimeGPS * XLALGPSSet(LIGOTimeGPS *epoch, INT4 gpssec, INT8 gpsnan)
Sets GPS time given GPS integer seconds and residual nanoseconds.
This structure stores units in the mksA system (plus Kelvin, Strain, and ADC Count).
INT2 powerOfTen
Overall power-of-ten scaling is 10^powerOfTen.
Epoch relative to GPS epoch, see LIGOTimeGPS type for more details.