diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9554ac0..651ad85 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
# Change Log
+## 0.3.0 (2023-06-13) {#0.3.0}
+
+Features
+
+- Support MacOS (X64 and ARM64)
+- Change `CROSS_DB_XXX` to `CROSS_XXX`
+
+Bug Fixes
+
+- `cross_dbTblCreate` flags `CROSS_DB_RBTREE` doesn't create Primary Key Index type correctly
+
+
## 0.2.0 (2023-06-07) {#0.2.0}
Features
@@ -9,6 +21,7 @@ Features
Bug Fixes
+
## 0.1.0 (2023-06-03) {#0.1.0}
- **Initial release**
diff --git a/crossdb.h b/crossdb.h
index cbd83db..ae23614 100644
--- a/crossdb.h
+++ b/crossdb.h
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2022-2023 CrossDB.ORG. All rights reserved.
+ *
+ * https://crossdb.org
+ * https://github.com/crossdb-org/crossdb
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __CROSS_DB_H__
#define __CROSS_DB_H__
@@ -141,31 +160,31 @@ typedef struct cross_field_t {
/* DB DDL flags
*/
-// DB Storage mode, default is CROSS_DB_ONDISK
-#define CROSS_DB_ONDISK (0<<0) // DB is on persistent disk, survive with power cycle
-#define CROSS_DB_RAMDISK (1<<0) // DB is on ramdisk/tmpfs/ramfs, survive with process restart, lose after power cycle
-#define CROSS_DB_INMEM (2<<0) // DB is in memory, survie when process is runnig, lose after process terminates
+// DB Storage mode, default is CROSS_ONDISK
+#define CROSS_ONDISK (0<<0) // DB is on persistent disk, survive with power cycle
+#define CROSS_RAMDISK (1<<0) // DB is on ramdisk/tmpfs/ramfs, survive with process restart, lose after power cycle
+#define CROSS_INMEM (2<<0) // DB is in memory, survie when process is runnig, lose after process terminates
-// DB Access mode, default is CROSS_DB_EXCLUSIVE
-#define CROSS_DB_EXCLUSIVE (0<<2) // DB is used exclusively by single process
-#define CROSS_DB_SHARED (1<<2) // DB is shared by multiple processes
+// DB Access mode, default is CROSS_EXCLUSIVE
+#define CROSS_EXCLUSIVE (0<<2) // DB is used exclusively by single process
+#define CROSS_SHARED (1<<2) // DB is shared by multiple processes
-// DB Lock mode, default is CROSS_DB_AUTOLOCK
-#define CROSS_DB_AUTOLOCK (0<<3) // DB will do lock automatically
-//#define CROSS_DB_NOLOCK (1<<3) // TBD: User is responsible for call locking APIs
+// DB Lock mode, default is CROSS_AUTOLOCK
+#define CROSS_AUTOLOCK (0<<3) // DB will do lock automatically
+//#define CROSS_NOLOCK (1<<3) // TBD: User is responsible for call locking APIs
-#define CROSS_DB_OPEN (1<<4) // don't create if not exist
+#define CROSS_OPEN (1<<4) // don't create if not exist
// Index Type
-#define CROSS_DB_HASH (0<<8) // hash index
-#define CROSS_DB_RBTREE (1<<8) // rbtree index
+#define CROSS_HASH (0<<8) // hash index
+#define CROSS_RBTREE (1<<8) // rbtree index
// Unique index
-#define CROSS_DB_UNIQUE (1<<11) // unique index
+#define CROSS_UNIQUE (1<<11) // unique index
/* DB DML flags
*/
-#define CROSS_DB_REUSE (1<<16) // reuse handle
+#define CROSS_REUSE (1<<16) // reuse handle
/******************************************************************************
diff --git a/examples/build.sh b/examples/build.sh
index 6f97b5f..9225c8a 100644
--- a/examples/build.sh
+++ b/examples/build.sh
@@ -8,9 +8,17 @@
name=`echo $1|cut -f1 -d.`
if [ -e libcrossdb.so ]; then
+ # Linux/FreeBSD
echo Build $1 -> $name.bin
- $CC -o $name.bin -Wall -O2 $1 -I.. libcrossdb.so -lpthread -ldl
+ $CC -o $name.bin -Wall -O2 $1 -I.. ./libcrossdb.so -lpthread -ldl
elif [ -e crossdb.dll ]; then
+ # Windows MINGW
echo Build $1 -> $name.exe
$CC -o $name.exe -Wall -O2 $1 -I.. crossdb.dll
+elif [ -e libcrossdb.dylib ]; then
+ # MacOS
+ $CC -o x64-$name.bin -arch x86_64 -Wall -O2 $1 -I.. ./libcrossdb.dylib
+ $CC -o arm64e-$name.bin -arch arm64e -Wall -O2 $1 -I.. ./libcrossdb.dylib
+ lipo -create -output $name.bin x64-$name.bin arm64e-$name.bin
+ rm -f x64-$name.bin arm64e-$name.bin
fi
diff --git a/examples/tutorial.c b/examples/tutorial.c
index 91198d7..2d3ebcc 100644
--- a/examples/tutorial.c
+++ b/examples/tutorial.c
@@ -205,7 +205,7 @@ int main ()
// Reuse cursor to get routes where nexthop=10.1.2.254
route.nexthop = IP4ADDR(10,1,2,254);
- count = cross_dbQueryRows (hRtTbl, &hCursor, "nexthop", &route, CROSS_DB_REUSE);
+ count = cross_dbQueryRows (hRtTbl, &hCursor, "nexthop", &route, CROSS_REUSE);
EXPECT (count, 2, " Query nexthop=10.1.2.254 routes");
while (CROSS_OK == cross_cursorGetNextRow (hCursor, &route, 0)) {
DUMP_ROUTE (" route: ", route);
@@ -213,7 +213,7 @@ int main ()
// Reuse cursor to get routes where nexthop!=10.1.2.254
route.nexthop = IP4ADDR(10,1,2,254);
- count = cross_dbQueryRows (hRtTbl, &hCursor, "nexthop!=", &route, CROSS_DB_REUSE);
+ count = cross_dbQueryRows (hRtTbl, &hCursor, "nexthop!=", &route, CROSS_REUSE);
EXPECT (count, 1, " Query nexthop!=10.1.2.254 routes");
while (CROSS_OK == cross_cursorGetNextRow (hCursor, &route, 0)) {
DUMP_ROUTE (" route: ", route);