err.h (1637B)
1 /* 2 * Copyright (c) 2022-2024 lumidify <nobody@lumidify.org> 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef LTKD_ERR_H 18 #define LTKD_ERR_H 19 20 /* WARNING: THIS NEEDS TO BE KEPT IN SYNC WITH THE TABLE IN err.c! */ 21 /* (also, the explicit value setting is redundant, but just in case) */ 22 typedef enum { 23 ERR_NONE = 0, 24 ERR_WIDGET_IN_CONTAINER = 1, 25 ERR_WIDGET_NOT_IN_CONTAINER = 2, 26 ERR_WIDGET_ID_IN_USE = 3, 27 ERR_INVALID_NUMBER_OF_ARGUMENTS = 4, 28 ERR_INVALID_ARGUMENT = 5, 29 ERR_INVALID_INDEX = 6, 30 ERR_INVALID_WIDGET_ID = 7, 31 ERR_INVALID_WIDGET_TYPE = 8, 32 ERR_INVALID_COMMAND = 9, 33 ERR_UNKNOWN = 10, 34 /* widget specific */ 35 ERR_MENU_NOT_SUBMENU = 11, 36 ERR_MENU_ENTRY_CONTAINS_SUBMENU = 12, 37 ERR_GRID_INVALID_POSITION = 13, 38 ERR_INVALID_SEQNUM = 14, 39 } ltkd_errtype; 40 41 typedef struct { 42 ltkd_errtype type; 43 /* corresponding argument, -1 if none */ 44 int arg; 45 } ltkd_error; 46 47 const char *errtype_to_string(ltkd_errtype type); 48 49 #endif /* LTKD_ERR_H */