added lisp-on-lines.lisp
authorDrew Crampsie <drewc@tech.coop>
Mon, 22 Aug 2005 21:15:53 +0000 (14:15 -0700)
committerDrew Crampsie <drewc@tech.coop>
Mon, 22 Aug 2005 21:15:53 +0000 (14:15 -0700)
darcs-hash:20050822211553-5417e-3791a625dbd3777fa7938074d969fa8dd539d94a.gz

src/lisp-on-lines.lisp [new file with mode: 0644]

diff --git a/src/lisp-on-lines.lisp b/src/lisp-on-lines.lisp
new file mode 100644 (file)
index 0000000..7658722
--- /dev/null
@@ -0,0 +1,30 @@
+(in-package :lisp-on-lines)
+
+;;;; *LoL Entry points
+;;;; 
+
+;;;; This file contains the high level functions and macros 
+;;;; that are part of LoL proper, that is to say, not Mewa 
+;;;; or Meta-Model.
+
+;;;; ** Initialisation
+;;;; The following macros are used to initialise a set of database tables as LoL objects.
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (defun generate-initialize-lol-for-table (table)
+    "
+Generates a form that, when evaluated, initialises the given table as an lol object.
+This involves creating a meta-model, a clsql view-class, and the setting up the default attributes for a mewa presentation"
+
+    `(progn 
+      (def-view-class/table ,table)
+      (set-default-attributes (quote ,(meta-model::sql->sym table))))))
+    
+(defmacro initialize-lol-for-table (&rest tables)
+  " expand to a form which initialises TABLES for use with LOL"
+  `(progn
+    ,@(loop for tbl in tables collect (generate-initialize-lol-for-table tbl))
+    (values)))
+
+(defmacro initialize-lol-for-database ()
+  "expands to init-i-f-t using the listing of tables provided by meta-model"
+  `(initialize-lol-for-table ,@(meta-model::list-tables)))
\ No newline at end of file