update source to use our brand new source generator. Update automakes.
[apps/madmutt.git] / lib-lua / madmutt.cpkg
index 610ee92..fd56f52 100644 (file)
@@ -24,6 +24,7 @@
 #include <pwd.h>
 
 #include "../mutt.h"
+@import "base.cpkg"
 
 static char *madmutt_init_shell(void)
 {
@@ -43,55 +44,14 @@ static char *madmutt_init_homedir(void)
     return m_strdup(pw ? pw->pw_dir : (getenv("HOME") ?: "/"));
 }
 
-static const char *madmutt_pwd(void)
-{
-    char path[_POSIX_PATH_MAX];
-    getcwd(path, sizeof(path));
-    return path;
-}
-
-@type bool = {
-    .kind = 'b';
-    .ctype = unsigned : 1;
-};
-
-@type string_t = {
-    .kind  = 's';
-    .ctype = char *;
-    .dtor  = p_delete($$);
-    .ctor  = m_strdup($$);
-};
-
-@type path_t = {
-    .kind  = 's';
-    .ctype = char *;
-    .dtor  = p_delete($$);
-    .ctor  = luaM_pathnew($$);
-};
-
-@type quadopt_t = {
-    .kind  = 'i';
-    .check = luaM_checkquadopt($L, $$);
-    .ctype = unsigned : 2;
-};
-
-@type rx_t = {
-    .kind  = 's';
-    .ctype = rx_t *;
-    .check = luaM_checkrx($L, $$);
-    .push  = ($$)->pattern;
-    .ctor  = luaM_rxnew($$);
-    .dtor  = rx_delete($$);
-};
-
 #if defined(HAVE_QDBM)
-#  define HCACHE_BACKEND "qdbm"
+#  define HCACHE_BACKEND  "qdbm"
 #elif defined(HAVE_GDBM)
-#  define HCACHE_BACKEND "gdbm"
+#  define HCACHE_BACKEND  "gdbm"
 #elif defined(HAVE_DB4)
-#  define HCACHE_BACKEND "db4"
+#  define HCACHE_BACKEND  "db4"
 #else
-#  define HCACHE_BACKEND "unknown"
+#  define HCACHE_BACKEND  NULL
 #endif
 
 @package MCore {
@@ -113,14 +73,21 @@ static const char *madmutt_pwd(void)
     bool      beep     = 1;
     bool      beep_new = 0;
 
-    const string_t pwd(void) = madmutt_pwd();
-} MCore;
+    const string_t pwd(void) {
+        char path[_POSIX_PATH_MAX];
+        getcwd(path, sizeof(path));
+        RETURN(path);
+    };
+};
 
 @package MTransport {
     path_t   sendmail = m_strdup(SENDMAIL " -eom -oi");
 
-    string_t dsn_notify = NULL /* TODO: check it's NULL, hdrs or full */;
-    string_t dsn_return = NULL /* TODO: check it's never, delay, failure, success with ',' */;
-} MTransport;
+    /* TODO: check it's NULL, hdrs or full */
+    string_t dsn_notify = NULL;
+
+    /* TODO: check it's never, delay, failure, success with ',' */
+    string_t dsn_return = NULL;
+};
 
 /* vim:set ft=c: */