From 72609030308371263ad72b916820ec199c68761a Mon Sep 17 00:00:00 2001 From: Der Teufel Date: Sun, 6 Feb 2022 13:00:29 +0100 Subject: [PATCH] Initial commit; Licence, init-lib, zigmod init --- .gitattributes | 6 ++++++ .gitignore | 3 +++ LICENSE | 21 +++++++++++++++++++++ README.md | 0 build.zig | 17 +++++++++++++++++ src/main.zig | 10 ++++++++++ zig.mod | 6 ++++++ 7 files changed, 63 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 build.zig create mode 100644 src/main.zig create mode 100644 zig.mod diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..cc14183 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +* text=auto +*.zig text eol=lf +zig.mod text eol=lf +zigmod.* text eol=lf +zig.mod linguist-language=YAML +zig.mod gitlab-language=yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7196971 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +zig-* +.zigmod +deps.zig diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c487b89 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Krzysztof Wolicki + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..0f0673a --- /dev/null +++ b/build.zig @@ -0,0 +1,17 @@ +const std = @import("std"); + +pub fn build(b: *std.build.Builder) void { + // Standard release options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. + const mode = b.standardReleaseOptions(); + + const lib = b.addStaticLibrary("zig-simplio", "src/main.zig"); + lib.setBuildMode(mode); + lib.install(); + + const main_tests = b.addTest("src/main.zig"); + main_tests.setBuildMode(mode); + + const test_step = b.step("test", "Run library tests"); + test_step.dependOn(&main_tests.step); +} diff --git a/src/main.zig b/src/main.zig new file mode 100644 index 0000000..ecfeade --- /dev/null +++ b/src/main.zig @@ -0,0 +1,10 @@ +const std = @import("std"); +const testing = std.testing; + +export fn add(a: i32, b: i32) i32 { + return a + b; +} + +test "basic add functionality" { + try testing.expect(add(3, 7) == 10); +} diff --git a/zig.mod b/zig.mod new file mode 100644 index 0000000..0729e96 --- /dev/null +++ b/zig.mod @@ -0,0 +1,6 @@ +id: yaa9f1mgy8u7pbql7oxxxwqyyn5a6qgerugywo2wqdro4n8l +name: zig-simplio +main: src/main.zig +license: MIT +description: Algol68 inspired IO library for Zig +dependencies: