Compare commits

..

1 Commits

Author SHA1 Message Date
472f67ffa5 feat: stream-line API and fix minor wrapping errors
* Rename types:
   * `ptr` types have no suffix (e.g. `ClientP` -> `Client`)
   * normal object types hyve a `T` suffix, if needed (e.g. `Port` -> `PortT`)
   * Constants also use CamelCase (UPPER_CASE can still be used).
* Make functions returning an error discardable
* Add missing return types for some functions.

Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
2025-01-20 02:04:43 +01:00
6 changed files with 16 additions and 105 deletions

View File

@ -1,58 +0,0 @@
name: Run tests and build examples
on: [push, pull_request]
env:
nim_version: "2.2.0"
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
#os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out sources
uses: actions/checkout@v4
- name: Nim Runtime Cache
id: cache-nim
uses: actions/cache@v4
with:
path: ".nim_runtime"
key: ${{ runner.os }}-nim-${{ env.nim_version }}
- name: Install Nim
id: install-nim
if: ${{ hashFiles('.nim_runtime/bin/nim*') == '' }}
uses: jiro4989/setup-nim-action@v2
with:
nim-version: ${{ env.nim_version }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set PATH for Unix
if: ${{ runner.os != 'Windows' && steps.install-nim.outcome == 'skipped' }}
shell: bash
run: |
echo "$(pwd)/.nim_runtime/bin" >> "$GITHUB_PATH"
echo "$HOME/.nimble/bin" >> "$GITHUB_PATH"
- name: Set PATH for Windows
if: ${{ runner.os == 'Windows' && steps.install-nim.outcome == 'skipped' }}
shell: pwsh
run: |
echo "$(Get-Location)\.nim_runtime\bin" >> $Env:GITHUB_PATH
mkdir -Force ~\.nimble\bin
(Resolve-Path ~\.nimble\bin).Path >> $Env:GITHUB_PATH
- name: Install dependency packages (jack)
uses: ConorMacBride/install-package@v1
with:
brew: jack pcre
apt: libjack-jackd2-dev libpcre3-dev
choco: jack
- name: Update PATH (Windows)
if: runner.os == 'Windows'
run: Add-Content $env:GITHUB_PATH "C:\Program Files\jack\bin"
- name: Run tests
run: nimble test -y
- name: Build examples (debug)
run: nimble examples_debug
- name: Build examples (release)
run: nimble examples

View File

@ -1,26 +0,0 @@
name: Build and publish API docs
on:
push:
branches:
- master
env:
nim-version: "stable"
nim-src: src/jacket.nim
deploy-dir: .gh-pages
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jiro4989/setup-nim-action@v2
with:
nim-version: ${{ env.nim-version }}
- run: nimble install -y
- run: nimble doc --index:on --project --git.url:https://github.com/${{ github.repository }} --git.commit:master --out:${{ env.deploy-dir }} ${{ env.nim-src }}
- name: "Copy to index.html"
run: cp ${{ env.deploy-dir }}/jacket.html ${{ env.deploy-dir }}/index.html
- name: Deploy documents
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.deploy-dir }}

View File

@ -9,7 +9,7 @@ aka **libjack**.
This software is in *beta status*.
The majority of JACK client API functions have been wrapped and are functional
(see [examples]), but some API parts (e.g. threading) still need wrapping.
(see[examples]), but some API parts (e.g. threading) still need wrapping.
Others, like the server control or the deprecated session API, will probably
not be covered by these bindings. While this project is in beta stage, symbol
names may still be changed and things moved around before the first stable
@ -81,12 +81,12 @@ jackClient.clientClose()
## License
This software is released under the **MIT License**. See the file
This software is released under the *MIT License*. See the file
[LICENSE.md](./LICENSE.md) for more information.
Please note that the JACK client library (libjack), which this project wraps,
is licensed under the [LGPL-2.1]. This wrapper does not statically or
dynamically link to libjack at build time, but only loads it via [dynlib] at
dynamically link to libjack at build time, but only loads it via `dynlib` at
run-time.
Software using this wrapper is, in the opinion of its author, not considered a
@ -97,12 +97,11 @@ professional legal counsel when in doubt.
## Author
**jacket** is written by [Christopher Arndt].
*jacket* is written by [Christopher Arndt].
[C API]: https://jackaudio.org/api/
[Christopher Arndt]: mailto:info@chrisarndt.de
[dynlib]: https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-import
[examples]: ./examples
[JACK]: https://jackaudio.org/
[LGPL-2.1]: https://spdx.org/licenses/LGPL-2.1-or-later.html

View File

@ -1,15 +1,13 @@
import system/ansi_c
export SIG_DFL, SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV
export SIG_DFL, SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM
when not defined(windows):
export SIGPIPE, SIGTERM
export SIGPIPE
var
SIG_IGN* {.importc: "SIG_IGN", header: "<signal.h>".}: cint
SIGHUP* {.importc: "SIGHUP", header: "<signal.h>".}: cint
SIGQUIT* {.importc: "SIGQUIT", header: "<signal.h>".}: cint
else:
const SIGTERM* = cint(15)
type CSighandlerT = proc (a: cint) {.noconv.}

View File

@ -11,9 +11,6 @@ srcDir = "src"
requires "nim >= 1.6.0"
taskrequires "examples", "threading"
taskrequires "examples_debug", "threading"
let examples = @[
"info",
"list_all_properties",

View File

@ -2,17 +2,18 @@
# Possible names/install locations of libjack, according to:
# https://github.com/x42/weakjack/blob/master/weak_libjack.c#L108
when defined(windows):
when sizeof(int) == 4:
const soname = "(|lib)jack.dll"
proc getJackLibName: string =
when system.hostOS == "windows":
when sizeof(int) == 4:
result = "libjack.dll"
else:
result = "libjack64.dll"
elif system.hostOS == "macosx":
result = "(|/usr/local/lib/|/opt/homebrew/lib/|/opt/local/lib/)libjack.dylib"
else:
const soname = "(|lib)jack64.dll"
elif defined(macosx):
const soname = "(|/usr/local/lib/|/opt/homebrew/lib/|/opt/homebrew/opt/jack/lib/|/opt/local/lib/)libjack.dylib"
else:
const soname = "libjack.so.0"
result = "libjack.so.0"
{.push dynlib: soname.}
{.push dynlib: getJackLibName().}
# ------------------------------ Constants --------------------------------