From: Drew Crampsie Date: Mon, 22 Aug 2005 21:15:53 +0000 (-0700) Subject: added lisp-on-lines.lisp X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/commitdiff_plain/da26d00333fa0ced964dc777a00bd917c543e4ed added lisp-on-lines.lisp darcs-hash:20050822211553-5417e-3791a625dbd3777fa7938074d969fa8dd539d94a.gz --- diff --git a/src/lisp-on-lines.lisp b/src/lisp-on-lines.lisp new file mode 100644 index 0000000..7658722 --- /dev/null +++ b/src/lisp-on-lines.lisp @@ -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