Skip to content

Commit

Permalink
feat: 0.4.6 Add support for custom error handlers (#79)
Browse files Browse the repository at this point in the history
* feat: drop ncurses, title features

* feat: add KLS_OOM_Handler, KLS_OOM_default_handler__()

* chore: bump amboso to 2.0.7, invil to 0.2.17

* feat: add OOM_handler field to KLS_Conf

* feat: add KLS_PTRDIFF_MAX_Handler, KLS_PTRDIFF_MAX_default_handler__(), KLS_Err_Handlers

* feat: add KLS_DEFAULT_ERR_HANDLERS macro
  • Loading branch information
jgabaut authored Sep 2, 2024
1 parent f9baf14 commit ec00eda
Show file tree
Hide file tree
Showing 12 changed files with 549 additions and 694 deletions.
6 changes: 1 addition & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ INSTALLER_LOG_FILE = "./installer.log"
PACK_NAME = $(SHARED_LIB)-$(VERSION)-$(OS)-$(MACHINE)

# Source files
demo_SOURCES = src/koliseo.c static/amboso.c static/demo.c
demo_SOURCES = src/koliseo.c static/amboso.c static/demo.c static/kls_banner.c
lib_SOURCES = src/koliseo.c

# Linking rule
Expand All @@ -42,10 +42,6 @@ else
AM_LDFLAGS += -s
endif

if CURSES_BUILD
AM_CFLAGS += -DKOLISEO_HAS_CURSES
endif

if GULP_BUILD
AM_CFLAGS += -DKOLISEO_HAS_GULP
endif
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
+ [Basic example](#basic_example)
+ [Extra features](#extra_features)
+ [Region](#extra_region)
+ [Curses](#extra_curses)
+ [Debug](#extra_debug)
+ [Gulp](#extra_gulp)
+ [List template](#list_template)
+ [Title banner](#extra_title)
+ [Experimental](#extra_exper)
+ [How to use extras](#extra_howto)
+ [Documentation](#docs)
Expand Down Expand Up @@ -106,10 +104,6 @@ int main(void)
- Extra utility functions
- Help you estimate relative memory usage by some particular type of object. May prove useful in some scenarios.

### Curses <a name = "extra_curses"></a>

Utility functions that extend ncurses API to provide debug info.

### Core debug <a name = "extra_debug"></a>

Extra debug for core calls, may be too verbose for some applications.
Expand Down Expand Up @@ -138,10 +132,6 @@ int main(void)

This is inspired by the dynamic array example by [David Priver](#credits).

### Title banner <a name = "extra_title"></a>

Include an ASCII art string to be printed as a title banner.

### Experimental <a name = "extra_exper"></a>

Include some experimental (NOT WELL TESTED. USE WITH CAUTION) functions.
Expand All @@ -155,10 +145,8 @@ int main(void)
The preprocessor macros to enable them manually are:

- Region: `KOLISEO_HAS_REGION`
- Curses: `KOLISEO_HAS_CURSES`
- Debug: `KLS_DEBUG_CORE`
- Gulp: `KOLISEO_HAS_GULP`
- Title banner: `KOLISEO_HAS_TITLE`
- Experimental: `KOLISEO_HAS_EXPER`

## Documentation <a name = "docs"></a>
Expand Down Expand Up @@ -201,9 +189,7 @@ int main(void)
- Run `./configure --enable-debug` to setup the `Makefile` appropriately and build with `-DKLS_DEBUG_CORE` flag.
- By default, enabling debug this way also adds `-DKLS_SETCONF_DEBUG` to the demo build. This preproc guard lets you really debug kls initialisation, by printing logs from inside `kls_set_conf()`.
- Run `./configure --enable-region` to setup the `Makefile` appropriately and build with `-DKOLISEO_HAS_REGION` flag.
- Run `./configure --enable-curses` to setup the `Makefile` appropriately and build with `-DKOLISEO_HAS_CURSES` flag.
- Run `./configure --enable-gulp` to setup the `Makefile` appropriately and build with `-DKOLISEO_HAS_GULP` flag.
- Run `./configure --enable-title` to setup the `Makefile` appropriately and build with `-DKOLISEO_HAS_TITLE` flag.
- Run `./configure --enable-exper` to setup the `Makefile` appropriately and build with `-DKOLISEO_HAS_EXPER` flag.


Expand Down
38 changes: 8 additions & 30 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Define the package name and version
AC_INIT([koliseo], [0.4.5], [[email protected]])
AC_INIT([koliseo], [0.4.6], [[email protected]])

# Verify automake version and enable foreign option
AM_INIT_AUTOMAKE([foreign -Wall])
Expand All @@ -19,10 +19,6 @@ AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [Enable debug build])],
[enable_debug=$enableval],
[enable_debug=no])
AC_ARG_ENABLE([curses],
[AS_HELP_STRING([--enable-curses], [Enable curses functions])],
[enable_curses=$enableval],
[enable_curses=no])
AC_ARG_ENABLE([gulp],
[AS_HELP_STRING([--enable-gulp], [Enable gulp header])],
[enable_gulp=$enableval],
Expand All @@ -41,7 +37,6 @@ AC_ARG_ENABLE([exper],
[enable_exper=no])
AM_CONDITIONAL([LOCATE_BUILD], [test "$enable_locate" = "yes"])
AM_CONDITIONAL([DEBUG_BUILD], [test "$enable_debug" = "yes"])
AM_CONDITIONAL([CURSES_BUILD], [test "$enable_curses" = "yes"])
AM_CONDITIONAL([GULP_BUILD], [test "$enable_gulp" = "yes"])
AM_CONDITIONAL([REGION_BUILD], [test "$enable_region" = "yes"])
AM_CONDITIONAL([TITLE_BUILD], [test "$enable_title" = "yes"])
Expand All @@ -52,15 +47,9 @@ case "${host_os}" in
mingw*)
echo "Building for mingw32: [$host_cpu-$host_vendor-$host_os]"
# mingw32 specific flags
if test "$enable_curses" = "yes"; then
echo "Building with curses header"
build_windows=yes
AC_SUBST([KOLISEO_CFLAGS], ["-I/usr/x86_64-w64-mingw32/include -static -fstack-protector -DNCURSES_STATIC"])
AC_SUBST([KOLISEO_LDFLAGS], ["-L/usr/x86_64-w64-mingw32/lib -lncursesw"])
else
AC_SUBST([KOLISEO_CFLAGS], ["-I/usr/x86_64-w64-mingw32/include -static -fstack-protector"])
AC_SUBST([KOLISEO_LDFLAGS], ["-L/usr/x86_64-w64-mingw32/lib"])
fi
build_windows=yes
AC_SUBST([KOLISEO_CFLAGS], ["-I/usr/x86_64-w64-mingw32/include -static -fstack-protector"])
AC_SUBST([KOLISEO_LDFLAGS], ["-L/usr/x86_64-w64-mingw32/lib"])
AC_SUBST([CCOMP], ["/usr/bin/x86_64-w64-mingw32-gcc"])
AC_SUBST([OS], ["w64-mingw32"])
AC_SUBST([TARGET], ["demo.exe"])
Expand All @@ -70,14 +59,8 @@ case "${host_os}" in
echo "Building for macos: [$host_cpu-$host_vendor-$host_os]"
build_mac=yes
# macOS specific flags
if test "$enable_curses" = "yes"; then
echo "Building with curses header"
AC_SUBST([KOLISEO_LDFLAGS], ["-L/opt/homebrew/opt/ncurses/lib -lncurses"])
AC_SUBST([KOLISEO_CFLAGS], ["-I/opt/homebrew/opt/ncurses/include"])
else
AC_SUBST([KOLISEO_LDFLAGS], [""])
AC_SUBST([KOLISEO_CFLAGS], [""])
fi
AC_SUBST([KOLISEO_LDFLAGS], [""])
AC_SUBST([KOLISEO_CFLAGS], [""])
AC_SUBST([OS], ["darwin"])
AC_SUBST([TARGET], ["demo"])
AC_SUBST([SHARED_LIB], ["libkoliseo.so"])
Expand All @@ -86,12 +69,7 @@ case "${host_os}" in
echo "Building for Linux: [$host_cpu-$host_vendor-$host_os]"
build_linux=yes
# Linux specific flags
if test "$enable_curses" = "yes"; then
echo "Building with curses header"
AC_SUBST([KOLISEO_LDFLAGS], ["-lncurses"])
else
AC_SUBST([KOLISEO_LDFLAGS], [""])
fi
AC_SUBST([KOLISEO_LDFLAGS], [""])
AC_SUBST([KOLISEO_CFLAGS], [""])
AC_SUBST([OS], ["Linux"])
AC_SUBST([TARGET], ["demo"])
Expand All @@ -109,7 +87,7 @@ AM_CONDITIONAL([LINUX_BUILD], [test "$build_linux" = "yes"])
# Set a default version number if not specified externally
AC_ARG_VAR([VERSION], [Version number])
if test -z "$VERSION"; then
VERSION="0.4.5"
VERSION="0.4.6"
fi

# Output variables to the config.h header
Expand Down
2 changes: 1 addition & 1 deletion docs/koliseo.doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = koliseo
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.4.5
PROJECT_NUMBER = 0.4.6

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion invil
Submodule invil updated 7 files
+18 −0 CHANGELOG.md
+127 −33 Cargo.lock
+6 −5 Cargo.toml
+3 −0 README.md
+168 −3 src/core.rs
+4 −4 src/main.rs
+38 −32 src/ops.rs
Loading

0 comments on commit ec00eda

Please sign in to comment.