Przeglądaj źródła

define marks to mark what to export/import during definition/declaration

tcheukueppo 2 lat temu
rodzic
commit
4a6a87e744
7 zmienionych plików z 52 dodań i 36 usunięć
  1. 52 36
      src/ma_conf.h
  2. 0 0
      src/ma_lex.c
  3. 0 0
      src/ma_lex.h
  4. 0 0
      src/ma_obj.c
  5. 0 0
      src/ma_obj.h
  6. 0 0
      src/ma_vm.c
  7. 0 0
      src/ma_vm.h

+ 52 - 36
src/mconf.h → src/ma_conf.h

@@ -13,8 +13,8 @@
  * configuration); or because they are seldom changed.
  */
 
-#ifndef mconf_h
-#define mconf_h
+#ifndef ma_conf_h
+#define ma_conf_h
 
 #define <limits.h>
 #define <stddef.h>
@@ -22,21 +22,22 @@
 /* $$Version and authors */
 
 /* Maat version components */
-#define MT_MAJOR_VERSION  1
-#define MT_MINOR_VERSION  0
-#define MT_PATCH_VERSION  0
+#define MA_MAJOR_VERSION  1
+#define MA_MINOR_VERSION  0
+#define MA_PATCH_VERSION  0
 
 /* String form of the version */
-#define MT_VERSION  MT_MAJOR_VERSION "." MT_MINOR_VERSION
-#define MT_PATCH    MT_VERSION "." MT_PATCH_VERSION
+#define MA_VERSION  MA_MAJOR_VERSION "." MA_MINOR_VERSION
 
-/* Some patches after releasing Maat version $MT_VERSION$ */
-#define MT_PATCH_NUM  ((10 * MT_MAJOR_VERSION + MT_MINOR_VERSION) * 100 + MT_PATCH_VERSION)
+/* Some patches after releasing Maat version $MA_VERSION$ */
+#define MA_PATCH    MA_VERSION "." MA_PATCH_VERSION
+#define MA_PATCH_NUM  ((10 * MA_MAJOR_VERSION + MA_MINOR_VERSION) * 100 + MA_PATCH_VERSION)
 
-#define MT_COPYRIGHT  "Maat " MT_PATCH  " Copyright (C) 2023 Maat.cm, PanLab.africa"
-#define MT_AUTHORS    "Kueppo Tcheukam J. W."
+#define MA_COPYRIGHT  "Maat " MA_PATCH  " Copyright (C) 2023 Maat.cm, PanLab.africa"
+#define MA_AUTHORS    "Kueppo Tcheukam J. W."
 
-#define MAAT  maat MT_VERSION
+/* Bin file name */
+#define MAAT  maat MA_VERSION
 
 /*
  * $$Configuring dir separator and default paths for Maat and external libs
@@ -51,49 +52,49 @@
  * then '!' would probably expand to 'C:\\Program Files\Maat\'. We make sure multiple
  * versions of Maat can co-exist within expanded '!'.
  */
-#if !defined(MT_CLIB_DEFAULT_PATH)
-#define MT_CLIB_DEFAULT_PATH  "!\\" MT_VERSION "\\lib\\",
+#if !defined(MA_CLIB_DEFAULT_PATH)
+#define MA_CLIB_DEFAULT_PATH  "!\\" MA_VERSION "\\lib\\",
 #endif
 
-#if !defined(MT_MTLIB_DEFAULT_PATH)
-#define MT_MTLIB_DEFAULT_PATH \
-   "!\\" MT_VERSION "\\share\\", \
-   "!\\" MT_VERSION "\\maat\\",
+#if !defined(MA_MTLIB_DEFAULT_PATH)
+#define MA_MTLIB_DEFAULT_PATH \
+   "!\\" MA_VERSION "\\share\\", \
+   "!\\" MA_VERSION "\\maat\\",
 #endif
 
 /* For use elsewhere */
-#define MT_DIRSEP "\\"
+#define MA_DIRSEP "\\"
 
 #else
 
-#define MT_LOCAL_ROOT  "/usr/local/"
+#define MA_LOCAL_ROOT  "/usr/local/"
 
-#if !defined(MT_CLIB_DEFAULT_PATH)
-#define MT_CLIB_DEFAULT_PATH MT_LOCAL_ROOT "lib/maat/" MT_VERSION "/",
+#if !defined(MA_CLIB_DEFAULT_PATH)
+#define MA_CLIB_DEFAULT_PATH MA_LOCAL_ROOT "lib/maat/" MA_VERSION "/",
 #endif
 
-#if !defined(MT_MTLIB_DEFAULT_PATH)
-#define MT_MTLIB_DEFAULT_PATH \
-   MT_LOCAL_ROOT "share/maat/" MT_VERSION "/", \
-   "/usr/share/maat/" MT_VERSION "/",
+#if !defined(MA_MTLIB_DEFAULT_PATH)
+#define MA_MTLIB_DEFAULT_PATH \
+   MA_LOCAL_ROOT "share/maat/" MA_VERSION "/", \
+   "/usr/share/maat/" MA_VERSION "/",
 #endif
 
-#define MT_DIRSEP "/"
+#define MA_DIRSEP "/"
 
 #endif
 
 /*
  * $$Macros used to enable some platform specific features. Either
- * MT_IN_LINUX, MT_IN_MACOSX or MT_IN_IOS is defined in the Makefile
+ * MA_IN_LINUX, MA_IN_MACOSX or MA_IN_IOS is defined in the Makefile
  * during the build process.
  *
  * (Linux, SunOS, Solaris, IRIX, FreeBSD, NetBSD, AIX 4.2,
  * HPUX 11, and other linux flavors)
- * if MT_USE_DLOPEN is defined, Maat uses dlopen() from <dlfcn.h>
+ * if MA_USE_DLOPEN is defined, Maat uses dlopen() from <dlfcn.h>
  * to dynamically load libraries.
  *
  * (Windows)
- * if MT_USE_DL_DLL is defined, Maat load libraries using native
+ * if MA_USE_DL_DLL is defined, Maat load libraries using native
  * functions from Windows.
  */
 
@@ -102,13 +103,13 @@
  * Windows, who would want to build Maat on a Windows phone afterall?
  */
 #if defined(_WIN32) && !defined(_WIN32_WCE)
-#define MT_USE_WINDOWS
-#define MT_USE_DL_DLL
+#define MA_USE_WINDOWS
+#define MA_USE_DL_DLL
 #endif
 
-#if defined(MT_IN_LINUX) || defined(MT_IN_LINUX) || defined(MT_IN_IOS)
-#define MT_USE_POSIX
-#define MT_USE_DLOPEN
+#if defined(MA_IN_LINUX) || defined(MA_IN_LINUX) || defined(MA_IN_IOS)
+#define MA_USE_POSIX
+#define MA_USE_DLOPEN
 #endif
 
 /* $$Some macros which acts as utility functions */
@@ -118,7 +119,22 @@
 #define mt_getradixchar() (localeconv()->decimal_point[0])
 #endif
 
-/* $$Marking to be exported and imported entities */
+/* $$Define attributes to mark entities as exported/imported */
 
+#if defined(_WIN32)
+
+#if #define(DEFINE)
+#define MA_API __declspec(dllexport)
+#else
+#define MA_API __declspec(dllimport)
+#endif
+
+#else
+
+#define MA_API /* extern by default */
+
+#endif
 
 /* $$Configuration for adaptive Number type */
+
+#endif

+ 0 - 0
src/ma_lex.c


+ 0 - 0
src/ma_lex.h


+ 0 - 0
src/ma_obj.c


+ 0 - 0
src/ma_obj.h


+ 0 - 0
src/ma_vm.c


+ 0 - 0
src/ma_vm.h