Changeset: 4c027acbd6fd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4c027acbd6fd
Added Files:
monetdb5/mal/mel.h
Modified Files:
monetdb5/mal/CMakeLists.txt
monetdb5/modules/atoms/blob.c
Branch: mbedded
Log Message:
step one of the big mal -> mel
diffs (142 lines):
diff --git a/monetdb5/mal/CMakeLists.txt b/monetdb5/mal/CMakeLists.txt
--- a/monetdb5/mal/CMakeLists.txt
+++ b/monetdb5/mal/CMakeLists.txt
@@ -50,6 +50,7 @@ target_sources(mal
mal_utils.c mal_utils.h
mal_embedded.c mal_embedded.h
mal_private.h
+ mel.h
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/mal_client.h
${CMAKE_CURRENT_SOURCE_DIR}/mal_authorize.h
diff --git a/monetdb5/mal/mel.h b/monetdb5/mal/mel.h
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/mel.h
@@ -0,0 +1,45 @@
+#ifndef _MEL_H_
+#define _MEL_H_
+
+#include <stdbool.h>
+#include <stdio.h>
+
+#define MAX_ARG 8
+
+typedef void* (*fptr)(void*);
+
+typedef struct mel_atom {
+ char *name;
+ char *basetype;
+ fptr tostr;
+ fptr fromstr;
+ fptr cmp;
+ fptr hash;
+ fptr null;
+ fptr read;
+ fptr write;
+ fptr put;
+ fptr del;
+ fptr length;
+ fptr heap;
+} mel_atom;
+
+typedef struct mel_arg {
+ char *name;
+ char *type;
+ bool isbat;
+ bool vargs;
+} mel_arg;
+
+typedef struct mel_func {
+ bool command;
+ char *mod;
+ char *fcn;
+ fptr imp;
+ bool unsafe;
+ char *comment;
+ mel_arg args[MAX_ARG];
+ mel_arg res[MAX_ARG];
+} mel_func;
+
+#endif /* _MEL_H_ */
diff --git a/monetdb5/modules/atoms/blob.c b/monetdb5/modules/atoms/blob.c
--- a/monetdb5/modules/atoms/blob.c
+++ b/monetdb5/modules/atoms/blob.c
@@ -361,3 +361,77 @@ BLOBblob_fromstr(blob **b, const char **
throw(MAL, "blob", GDK_EXCEPTION);
return MAL_SUCCEED;
}
+
+#include "mel.h"
+mel_atom blob_init_atoms[] = {
+ {
+ .name="blob",
+ .tostr=(fptr)&BLOBtostr,
+ .fromstr=(fptr)&BLOBfromstr,
+ .cmp=(fptr)&BLOBcmp,
+ .hash=(fptr)&BLOBhash,
+ .null=(fptr)&BLOBnull,
+ .read=(fptr)&BLOBread,
+ .write=(fptr)&BLOBwrite,
+ .put=(fptr)&BLOBput,
+ .del=(fptr)&BLOBdel,
+ .length=(fptr)&BLOBlength,
+ .heap=(fptr)&BLOBheap,
+ },
+};
+mel_func blob_init_funcs[] = {
+ { .command=true, .mod="blob", .fcn="blob", .imp=(fptr)&BLOBblob_blob,
.unsafe=false,
+ .comment="Noop routine."
+ ,
+ .args={
+ { .name="s", .type="blob", .isbat=false, .vargs=false },
+ }, .res={
+ { .type="blob", .isbat=false, .vargs=false },
+ }
+ },
+ { .command=true, .mod="blob", .fcn="blob", .imp=(fptr)&BLOBblob_fromstr,
.unsafe=false,
+ .args={
+ { .name="s", .type="str", .isbat=false, .vargs=false },
+ }, .res={
+ { .type="blob", .isbat=false, .vargs=false },
+ }
+ },
+ { .command=true, .mod="blob", .fcn="toblob", .imp=(fptr)&BLOBtoblob,
.unsafe=false,
+ .comment="store a string as a blob."
+ ,
+ .args={
+ { .name="v", .type="str", .isbat=false, .vargs=false },
+ }, .res={
+ { .type="blob", .isbat=false, .vargs=false },
+ }
+ },
+ { .command=true, .mod="blob", .fcn="nitems", .imp=(fptr)&BLOBnitems,
.unsafe=false,
+ .comment="get the number of bytes in this blob."
+ ,
+ .args={
+ { .name="b", .type="blob", .isbat=false, .vargs=false },
+ }, .res={
+ { .type="int", .isbat=false, .vargs=false },
+ }
+ },
+ { .command=true, .mod="blob", .fcn="prelude", .imp=(fptr)&BLOBprelude,
.unsafe=false,
+ .args={
+ }, .res={
+ { .type="void", .isbat=false, .vargs=false },
+ }
+ },
+ { .command=true, .mod="calc", .fcn="blob", .imp=(fptr)&BLOBblob_blob,
.unsafe=false,
+ .args={
+ { .name="b", .type="blob", .isbat=false, .vargs=false },
+ }, .res={
+ { .type="blob", .isbat=false, .vargs=false },
+ }
+ },
+ { .command=true, .mod="calc", .fcn="blob", .imp=(fptr)&BLOBblob_fromstr,
.unsafe=false,
+ .args={
+ { .name="s", .type="str", .isbat=false, .vargs=false },
+ }, .res={
+ { .type="blob", .isbat=false, .vargs=false },
+ }
+ },
+};
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list