Changeset: 7b19f04132ae for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7b19f04132ae
Modified Files:
        monetdb5/mal/mal_atom.mx
        monetdb5/mal/mal_errors.mx
        monetdb5/mal/mal_exception.mx
        monetdb5/mal/mal_factory.mx
        monetdb5/mal/mal_function.mx
        monetdb5/mal/mal_resolve.mx
Branch: headless
Log Message:

Another sweeping round.


diffs (truncated from 1786 to 300 lines):

diff --git a/monetdb5/mal/mal_atom.mx b/monetdb5/mal/mal_atom.mx
--- a/monetdb5/mal/mal_atom.mx
+++ b/monetdb5/mal/mal_atom.mx
@@ -17,61 +17,6 @@
 All Rights Reserved.
 @
 
-@a M.L.Kersten
-@- User Defined Types
-MonetDB supports an extensible type system to accomodate a wide
-spectrum of database kernels and application needs.
-The type administration keeps track of their properties and
-provides access to the underlying implementations.
-
-MAL recognizes the definition of a new
-type by replacing the @sc{module} keyword with @sc{atom}.
-Atoms definitions require special care, because their definition and 
-properties should be communicated with the kernel library.
-The commands defined in an @sc{atom } block are screened as of interest 
-to the library. 
-
-MonetDB comes with the hardwired types @sc{bit, chr, sht, int, lng, oid, flt, 
-dbl, str} and @sc{bat}, the representation of a bat identifier.
-The kernel code has been optimized to deal with these types efficiently,
-i.e. without unnecessary function call overheads.
-
-A small collection of user-defined @sc{atom} types is shipped with the sysem.
-They implement types considered essential for end-user applications,
-such as @sc{color, date, daytime,  time, timestamp, timezone, blob}, 
-and @sc{inet, url}.
-They are implemented using the type extension mechanism described below.
-As such, they provide examples for future extensions.
-A concrete example is the 'blob' datatype in the MonetDB atom module
-library(see ../modules/atoms/blob.mx)
-
-@- Defining your own types
-For the courageous at heart, you may enter the difficult world
-of extending the kernel library. The easiest way is to derive
-the atom modules from one shipped in the source distributed.
-More involved atomary types require a study of the
-documentation associated with the atom structures (gdk_atoms),
-because you have to develop a handful routines complying with the
-signatures required in the kernel library.
-They are registered upon loading the @sc{atom} module.
-@{
-@-
-The atom registration functions perform the necessary
-type checks, but relies on the user to comply with this signature in
-its C-implementation. The ruler calls are part of a module
-initialization routine.
-@-
-Functions passed to the GDK kernel are not directly accessible
-as MAL routines, because their implementation requires a
-GDK-specific signature. (See GDK documentation)
-They are renamed to an non-parseable function, effectively shielding
-them from the MAL programmer.
-@-
-This feature is of particular interest to system experts. 
-It is not meant for end-users trying to intruduce record- or 
-struct-like objects in the database. They better decompose
-the complex object structure and represent the components in
-different BATs.
 @h
 #ifndef _MAL_ATOM_H
 #define _MAL_ATOM_H
@@ -87,34 +32,73 @@
 mal_export void showAtoms(stream *fd);  /* used in src/mal/mal_debugger.c */
 
 #endif /*  _MAL_ATOM_H*/
-@+
-Every MAL command introduced in an atom module should be checked
-to detect overloading of a predefined function.
-Subsequently, we update the BAT atom structure.
-The function signatures should be parameter-less, which
-enables additional functions with the same name to appear
-as ordinary mal operators.
+@c
+/* Author(s) M.L.Kersten
+ * User Defined Types
+ * MonetDB supports an extensible type system to accomodate a wide
+ * spectrum of database kernels and application needs.
+ * The type administration keeps track of their properties and
+ * provides access to the underlying implementations.
+ * 
+ * MAL recognizes the definition of a new
+ * type by replacing the @sc{module} keyword with @sc{atom}.
+ * Atoms definitions require special care, because their definition and 
+ * properties should be communicated with the kernel library.
+ * The commands defined in an @sc{atom } block are screened as of interest 
+ * to the library. 
+ * 
+ * MonetDB comes with the hardwired types @sc{bit, chr, sht, int, lng, oid, 
flt, 
+ * dbl, str} and @sc{bat}, the representation of a bat identifier.
+ * The kernel code has been optimized to deal with these types efficiently,
+ * i.e. without unnecessary function call overheads.
+ * 
+ * A small collection of user-defined @sc{atom} types is shipped with the 
sysem.
+ * They implement types considered essential for end-user applications,
+ * such as @sc{color, date, daytime,  time, timestamp, timezone, blob}, 
+ * and @sc{inet, url}.
+ * They are implemented using the type extension mechanism described below.
+ * As such, they provide examples for future extensions.
+ * A concrete example is the 'blob' datatype in the MonetDB atom module
+ * library(see ../modules/atoms/blob.mx)
+ * 
+ * Defining your own types
+ * For the courageous at heart, you may enter the difficult world
+ * of extending the kernel library. The easiest way is to derive
+ * the atom modules from one shipped in the source distributed.
+ * More involved atomary types require a study of the
+ * documentation associated with the atom structures (gdk_atoms),
+ * because you have to develop a handful routines complying with the
+ * signatures required in the kernel library.
+ * They are registered upon loading the @sc{atom} module.
+ * 
+ * The atom registration functions perform the necessary
+ * type checks, but relies on the user to comply with this signature in
+ * its C-implementation. The ruler calls are part of a module
+ * initialization routine.
+ *
+ * Functions passed to the GDK kernel are not directly accessible
+ * as MAL routines, because their implementation requires a
+ * GDK-specific signature. (See GDK documentation)
+ * They are renamed to an non-parseable function, effectively shielding
+ * them from the MAL programmer.
+ * 
+ * This feature is of particular interest to system experts. 
+ * It is not meant for end-users trying to intruduce record- or 
+ * struct-like objects in the database. They better decompose
+ * the complex object structure and represent the components in
+ * different BATs.
+ *
+ * Every MAL command introduced in an atom module should be checked
+ * to detect overloading of a predefined function.
+ * Subsequently, we update the BAT atom structure.
+ * The function signatures should be parameter-less, which
+ * enables additional functions with the same name to appear
+ * as ordinary mal operators.
+ * 
+ * A few fields are set only once, at creation time.
+ * They should be implemented with parameter-less functions.
+*/
 
-@-
-A few fields are set only once, at creation time.
-They should be implemented with parameter-less functions.
-@= setItem
-if( idcmp(@1,name) || pci->argc != 1)
-       return 0;
-else{
-       BATatoms[tpe].@2= (* (@4 (*)(void)) pci->fcn)();
-       setAtomName(pci);
-       return 1;
-}
-@-
-
-@= setItemInt
-if( idcmp(@1,name) || pci->argc != 1)
-       return 0;
-       BATatoms[tpe].@2= (*pci->fcn)();
-       setAtomName(pci);
-       return 1;
-@c
 #include "monetdb_config.h"
 #include "mal_utils.h"
 #include "mal_atom.h"
@@ -226,8 +210,11 @@
                } 
                break;
        case 's': 
-               @:setItem("storage",storage,TYPE_int,long)@; 
-               break;
+               if( idcmp("storage",name) || pci->argc != 1) 
+                       return 0; 
+               BATatoms[tpe].storage= (* (long (*)(void)) pci->fcn)(); 
+               setAtomName(pci); 
+               return 1; 
        case 't': 
                if( idcmp("tostr",name)==0 && pci->argc==1){
                        BATatoms[tpe].atomToStr= (int (*)(str *, int *, ptr)) 
pci->fcn;
@@ -243,8 +230,11 @@
                } 
                break;
        case 'v': 
-               @:setItem("varsized",varsized,TYPE_int,long)@  
-               break;
+               if( idcmp("varsized",name) || pci->argc != 1) 
+                       return 0; 
+               BATatoms[tpe].varsized= (* (long (*)(void)) pci->fcn)(); 
+               setAtomName(pci); 
+               return 1; 
        case 'r': 
                if( idcmp("read",name)==0 && pci->argc==1){
                        BATatoms[tpe].atomRead= (void *(*)(void *, stream *, 
size_t)) pci->fcn;
@@ -262,13 +252,13 @@
        }
        return 0;
 }
-@-
-Atoms are constructed incrementally in the kernel using the
-ATOMproperty function. It takes an existing type as a base
-to derive a new one.
-The most tedisous work is to check the signature types of the functions
-acceptable for the kernel.
-@c
+/*
+ * Atoms are constructed incrementally in the kernel using the
+ * ATOMproperty function. It takes an existing type as a base
+ * to derive a new one.
+ * The most tedisous work is to check the signature types of the functions
+ * acceptable for the kernel.
+*/
 
 void malAtomDefinition(str name, int tpe){
        int i;
@@ -299,11 +289,11 @@
                BATatoms[i].storage = i;
        }
 }
-@-
-User defined modules may introduce fixed sized types
-to store information in BATs.
-@c
-int malAtomFixed(int size, int align, char *name)
+
+/* User defined modules may introduce fixed sized types to store information 
in BATs. */
+
+int
+malAtomFixed(int size, int align, char *name)
 {
        int i = 0;
 
@@ -320,7 +310,9 @@
        BATatoms[i].linear = FALSE;
        return i;
 }
-int malAtomSize(int size, int align, char *name)
+
+int
+malAtomSize(int size, int align, char *name)
 {
        int i = 0;
 
@@ -331,7 +323,9 @@
        BATatoms[i].align = align;
        return i;
 }
-int malAtomArray(int tpe, int size){
+
+int
+malAtomArray(int tpe, int size){
        int i;
        char name[IDLENGTH];
        str nme;
@@ -358,7 +352,8 @@
        return i;
 }
 
-void showAtoms(stream *fd){
+void
+showAtoms(stream *fd){
        int i;
        for(i=0;BATatoms[i].name[0] && i<TYPE_any; i++){
                mnstr_printf(fd,"%s", BATatoms[i].name);
@@ -366,4 +361,3 @@
        }
        mnstr_printf(fd,"\n");
 }
-@}
diff --git a/monetdb5/mal/mal_errors.mx b/monetdb5/mal/mal_errors.mx
--- a/monetdb5/mal/mal_errors.mx
+++ b/monetdb5/mal/mal_errors.mx
@@ -17,7 +17,6 @@
 All Rights Reserved.
 @
 
-@f mal_errors
 @h
 /* Author(s): M.L. Kersten
  * The error strings are geared at answering the question "what happened".
diff --git a/monetdb5/mal/mal_exception.mx b/monetdb5/mal/mal_exception.mx
--- a/monetdb5/mal/mal_exception.mx
+++ b/monetdb5/mal/mal_exception.mx
@@ -17,109 +17,6 @@
 All Rights Reserved.
 @
 
-@f mal_exception
-@a F. Groffen, M. Kersten
-@v 1.0
-
-@+ Exception handling
-MAL comes with an exception handling mechanism, similar in style
-as found in modern programming languages.
-Exceptions are considered rare situations that alter
-the flow of control to a place where they can be handled.
-After the exceptional case has been handled the following options exist
-a) continue where it went wrong, b) retry the failed instruction,
-c) leave the block where the exception was handled,
-or d) pass the exception to an enclosing call.
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to