added: `Date.start_of_month()` and `Date.end_of_month()`
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 20 Nov 2023 02:24:56 +0000 (20:24 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 20 Nov 2023 02:24:56 +0000 (20:24 -0600)
build.sh
core/time/date.onyx
misc/vscode/package.json
settings.sh

index 9cf73655d14777594c1ee04433f617aabae2feb2..d6ea7e014bc5e498ce267ccd1fbc7d92f79aa873 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 
 DIST_DIR="./dist"
-ONYX_INSTALL_DIR="$HOME/.onyx"
 
 compile_all() {
     if [ "$ONYX_RUNTIME_LIBRARY" = "ovmwasm" ]; then
@@ -73,6 +72,8 @@ compress_all() {
 }
 
 install_all() {
+    [ -z ${ONYX_INSTALL_DIR+x} ] && echo "Please set ONYX_INSTALL_DIR to install Onyx." && exit 1
+
     package_all
 
     echo "Installing to $ONYX_INSTALL_DIR"
index aea4ba857e0ff846cc601115a57b0c4eabe86084..48ea2e00d8f4b475cf947782cd83b82c01c74e30 100644 (file)
@@ -88,6 +88,22 @@ Date :: struct {
         return dig % 7;
     }
 
+    start_of_month :: (d: Date) -> Date {
+        return .{
+            year = d.year,
+            month = d.month,
+            day = 1,
+        };
+    }
+
+    end_of_month :: (d: Date) -> Date {
+        return .{
+            year = d.year,
+            month = d.month,
+            day = Date.month_durations[d.month],
+        };
+    }
+
     is_before :: (d1, d2: Date) -> bool {
         if d1.year  != d2.year  do return d1.year  < d2.year;
         if d1.month != d2.month do return d1.month < d2.month;
index 2cc129f16826c22fc2b25df9763c42f01f4022e8..a7511f1491c27165399a3b51b4e33e2293e028d6 100644 (file)
@@ -1,9 +1,9 @@
 {
-    "name": "onyx",
-    "displayName": "Onyx",
+    "name": "onyxlang",
+    "displayName": "Onyx Programming Language",
     "description": "Onyx syntax highlighting and debugger support.",
     "version": "0.1.8",
-    "publisher": "brendanfh",
+    "publisher": "onyxlang",
     "license": "BSD-2-Clause",
     "engines": {
         "vscode": "^1.75.0"
index f6c48ca2dc4ed48efd3913cf5a52895d42c89347..d203f02057f3a4ef134a93adf3c8b903b85a45e1 100644 (file)
@@ -1,4 +1,7 @@
 
+# Where Onyx will be installed from the "./build.sh install" command.
+export ONYX_INSTALL_DIR="$HOME/.onyx"
+
 # The compiler to use. Only GCC and TCC have been tested.
 export ONYX_CC='gcc'