Skip to content

Commit 567f514

Browse files
authored
Merge pull request #8 from fraya/master
Create basic library structure Co-authored-by: @cgay
2 parents 1d9ee8b + e672849 commit 567f514

20 files changed

+382
-23
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/build-and-test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and test
2+
3+
on:
4+
push:
5+
# all branches
6+
pull_request:
7+
# all branches
8+
9+
# This enables the Run Workflow button on the Actions tab.
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Install Opendylan
20+
uses: dylan-lang/install-opendylan@v3
21+
22+
- name: Add zlib dev dependency
23+
run: sudo apt-get install -y zlib1g-dev
24+
25+
- name: Download dependencies
26+
run: dylan update
27+
28+
- name: Build tests
29+
run: dylan build zlib-test-suite
30+
31+
- name: Run tests
32+
run: _build/bin/zlib-test-suite --progress none --report surefire > _build/TEST-zlib.xml
33+
34+
- name: Publish Test Report
35+
if: success() || failure()
36+
uses: mikepenz/action-junit-report@v4
37+
with:
38+
report_paths: '**/_build/TEST-*.xml'

.github/workflows/build-docs.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and deploy documentation
2+
3+
on:
4+
push:
5+
# all branches
6+
paths:
7+
- 'documentation/**'
8+
9+
# This enables the Run Workflow button on the Actions tab.
10+
workflow_dispatch:
11+
12+
# https://github.com/JamesIves/github-pages-deploy-action#readme
13+
permissions:
14+
contents: write
15+
16+
# Set DYLAN environment variable to GITHUB_WORKSPACE so packages are
17+
# installed in ../../_packages relative to documentation's Makefile
18+
env:
19+
DYLAN: ${{ github.workspace }}
20+
21+
jobs:
22+
23+
build-and-deploy:
24+
runs-on: ubuntu-latest
25+
steps:
26+
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Check links
31+
uses: addnab/docker-run-action@v3
32+
with:
33+
image: ghcr.io/fraya/dylan-docs
34+
options: -v ${{ github.workspace }}/documentation:/docs
35+
run: make linkcheck
36+
37+
- name: Build docs with Furo theme
38+
uses: addnab/docker-run-action@v3
39+
with:
40+
image: ghcr.io/fraya/dylan-docs
41+
options: -v ${{ github.workspace }}/documentation:/docs
42+
run: make html
43+
44+
- name: Upload html artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: zlib-doc-html
48+
path: documentation/build/html/
49+
50+
- name: Bypassing Jekyll on GH Pages
51+
run: sudo touch documentation/build/html/.nojekyll
52+
53+
- name: Deploy documents to GH pages
54+
uses: JamesIves/github-pages-deploy-action@v4
55+
with:
56+
folder: documentation/build/html

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Development directories
2+
3+
/_build/
4+
/_packages/
5+
/registry/
6+
7+
# Backup files
8+
9+
*~
10+
11+
/documentation/build/

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2024 dylan-hackers
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
“Software”), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Zlib
2+
====
3+
4+
Opendylan binding around Zlib library.
5+
6+
Building
7+
--------
8+
9+
Install development libraries
10+
11+
.. code-block:: console
12+
13+
$ sudo apt install zlib1g-dev
14+
15+
Download dependencies:
16+
17+
.. code-block:: console
18+
19+
$ dylan update
20+
21+
Build:
22+
23+
.. code-block:: console
24+
25+
$ dylan build --all
26+
27+
Run tests:
28+
29+
.. code-block:: console
30+
31+
$ _build/bin/zlib-test-suite

documentation/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

documentation/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

documentation/source/conf.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- General configuration ---------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
8+
9+
import sys, os
10+
sys.path.insert(0, os.path.abspath('../../_packages/sphinx-extensions/current/src/sphinxcontrib'))
11+
12+
import dylan.themes as dylan_themes
13+
extensions = ['dylan.domain']
14+
15+
templates_path = ['_templates']
16+
exclude_patterns = []
17+
18+
primary_domain = 'dylan'
19+
20+
21+
# -- Project information -----------------------------------------------------
22+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
23+
24+
project = 'Zlib'
25+
copyright = '2024, Dylan Hackers'
26+
author = 'Dylan Hackers'
27+
release = '0.1.0'
28+
29+
# -- Options for HTML output -------------------------------------------------
30+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
31+
32+
html_theme = 'furo'
33+
html_static_path = ['_static']

documentation/source/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Welcome to Zlib's documentation!
2+
================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
:caption: Contents:
7+
:hidden:
8+
9+
reference
10+
11+
This is the beginning of a binding to the `Zlib
12+
<https://www.zlib.net/>`_ library.
13+
14+
Indices and tables
15+
==================
16+
17+
* :ref:`genindex`

documentation/source/reference.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Reference
2+
=========
3+
4+
.. current-library:: zlib
5+
.. current-module:: zlib
6+
7+
Utility functions
8+
-----------------
9+
10+
These functions are implemented on top of the basic zlib
11+
stream-oriented functions. To simplify the interface, some default
12+
options are assumed (compression level and memory usage).
13+
14+
15+
.. function:: compress
16+
17+
Compress a string.
18+
19+
:signature: compress *string* => (compressed-string)
20+
21+
:parameter string: String to compress. An instance of :drm:`<string>`
22+
:value compressed-string: An instance of :drm:`<string>`
23+
24+
:description:
25+
26+
Compress the source string into a new string. If there is a problem
27+
in the compression process it raises an error.
28+
29+
:example:
30+
31+
.. code-block:: dylan
32+
33+
let compressed = compress("Hello");

dylan-package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"dependencies": [ ],
3+
"dev-dependencies": [
4+
"testworks",
5+
"sphinx-extensions"
6+
],
7+
"description": "Bindings to Zlib library",
8+
"name": "zlib",
9+
"version": "0.1.0",
10+
"url": "https://github.com/dylan-lang/zlib",
11+
"keywords": [ "zlib", "binding" ],
12+
"contact": "dylan-lang@google.com",
13+
"license": "MIT",
14+
"license-url": "https://opensource.org/license/mit"
15+
}

library.dylan

Lines changed: 0 additions & 13 deletions
This file was deleted.

source/library.dylan

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module: dylan-user
2+
3+
define library zlib
4+
use common-dylan;
5+
use c-ffi;
6+
7+
export
8+
zlib,
9+
zlib-impl;
10+
end library;
11+
12+
define module zlib
13+
create
14+
compress;
15+
end module;
16+
17+
define module zlib-impl
18+
use common-dylan;
19+
use c-ffi;
20+
21+
use zlib;
22+
23+
export
24+
zlib-compress,
25+
zlib-compress-bound;
26+
end module;

main.dylan renamed to source/zlib.dylan

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module: zlib
1+
module: zlib-impl
22
33
define C-function zlib-compress
44
parameter destination :: <C-string>;
@@ -26,7 +26,3 @@ define function compress (string :: <string>)
2626
result;
2727
end if;
2828
end;
29-
/*
30-
define variable foobar = "foobar";
31-
format-out("%= => %=\n", foobar, compress(foobar));
32-
*/

source/zlib.lid

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Library: zlib
2+
Target-Type: dll
3+
C-Libraries: -lz
4+
Files: library
5+
zlib

0 commit comments

Comments
 (0)