aboutsummaryrefslogtreecommitdiff
path: root/docs/status.rst
blob: 8ac36280ef7b2f13bf0b0d74ba4a6f4cf4fc676c (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Result status codes
===================

This project adopts widely used convention of returning integer encoded status
codes as function results.

Each function, that needs to notify it's execution status (success or error),
returns ``lsp_status_t`` (alias for ``lsp_int8_t``).

Available status codes are:

    * ``LSP_SUCCESS``

        Execution successful.

    * ``LSP_EOF``

        End of file encountered during reading/writing.

    * ``LSP_ERR``

        Generic error (unknown error).

    * ``LSP_ERR_MEM``

        Memory error (usually out of memory).

    * ``LSP_ERR_CTX``

        Context error (usually symbol resolution error).

    * ``LSP_ERR_READ``

        Reader error.

    * ``LSP_ERR_WRITE``

        Writer error.

    * ``LSP_ERR_EVAL``

        Evaluation error.

    * ``LSP_ERR_APPLY``

        Application error.

    * ``LSP_ERR_ARG_COUNT``

        Invalid argument count.

    * ``LSP_ERR_ARG_TYPE``

        Invalid argument type.

    * ``LSP_ERR_ARG_VALUE``

        Invalid argument value.

    * ``LSP_ERR_USER``

        Special status value representing beginning of user status codes.

User has ability to raise user error with ``error`` builtin function. This
error is additionally described with integer value in range [0, 126] and
encoded as status code.


Source code
-----------

status.h
''''''''

.. literalinclude:: ../src_c/status.h
    :language: c