File: sf_error.pxd

package info (click to toggle)
python-scipy 1.1.0-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 93,828 kB
  • sloc: python: 156,854; ansic: 82,925; fortran: 80,777; cpp: 7,505; makefile: 427; sh: 294
file content (40 lines) | stat: -rw-r--r-- 1,230 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*-cython-*-

cdef extern from "sf_error.h":
    ctypedef enum sf_error_t:
        OK "SF_ERROR_OK"
        SINGULAR "SF_ERROR_SINGULAR"
        UNDERFLOW "SF_ERROR_UNDERFLOW"
        OVERFLOW "SF_ERROR_OVERFLOW"
        SLOW "SF_ERROR_SLOW"
        LOSS "SF_ERROR_LOSS"
        NO_RESULT "SF_ERROR_NO_RESULT"
        DOMAIN "SF_ERROR_DOMAIN"
        ARG "SF_ERROR_ARG"
        OTHER "SF_ERROR_OTHER"

    ctypedef enum sf_action_t:
        IGNORE "SF_ERROR_IGNORE"
        WARN "SF_ERROR_WARN"
        RAISE "SF_ERROR_RAISE"

    char **sf_error_messages
    void error "sf_error" (char *func_name, sf_error_t code, char *fmt, ...) nogil
    void check_fpe "sf_error_check_fpe" (char *func_name) nogil
    void set_action "sf_error_set_action" (sf_error_t code, sf_action_t action) nogil
    sf_action_t get_action "sf_error_get_action" (sf_error_t code) nogil


cdef inline int _sf_error_test_function(int code) nogil:
    """Function that can raise every sf_error category for testing
    purposes.

    """
    cdef sf_error_t sf_error_code
    
    if code < 0 or code >= 10:
        sf_error_code = OTHER
    else:
        sf_error_code = <sf_error_t>code
    error('_err_test_function', sf_error_code, NULL)
    return 0