aboutsummaryrefslogtreecommitdiffhomepage
path: root/libslang/modules/template.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2011-10-14 04:55:05 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2011-10-14 04:55:05 +0200
commit6aa0e0017d7d0cddc006da885946934b06949a91 (patch)
tree66b688ec32e2f91266db760b1762f2a50cc52036 /libslang/modules/template.c
parenta966db5b71328f6adf9dd767e64b322a3bd7ed9c (diff)
downloaderlang-slang-fork-6aa0e0017d7d0cddc006da885946934b06949a91.tar.gz
include libslang-1.4.9 and automatically build it and link erlang-slang against it
few (erlang) people will still have libslang-1.4.9 installed or spend time to get it to link against the driver
Diffstat (limited to 'libslang/modules/template.c')
-rw-r--r--libslang/modules/template.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/libslang/modules/template.c b/libslang/modules/template.c
new file mode 100644
index 0000000..b0b7d60
--- /dev/null
+++ b/libslang/modules/template.c
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <slang.h>
+
+SLANG_MODULE(<MODULE-NAME>);
+
+#define MODULE_MAJOR_VERSION 0
+#define MODULE_MINOR_VERSION 0
+#define MODULE_PATCH_LEVEL 0
+static char *Module_Version_String = "0.0.0";
+#define MODULE_VERSION_NUMBER \
+ (MODULE_MAJOR_VERSION*10000+MODULE_MINOR_VERSION*100+MODULE_PATCH_LEVEL)
+
+/* Define intrinsics here */
+
+static SLang_Intrin_Fun_Type Module_Intrinsics [] =
+{
+ SLANG_END_INTRIN_FUN_TABLE
+};
+
+static SLang_Intrin_Var_Type Module_Variables [] =
+{
+ MAKE_VARIABLE("_<MODULE-NAME>_module_version_string", &Module_Version_String, SLANG_STRING_TYPE, 1),
+ SLANG_END_INTRIN_VAR_TABLE
+};
+
+static SLang_IConstant_Type Module_Constants [] =
+{
+ MAKE_ICONSTANT("_<MODULE-NAME>_module_version", MODULE_VERSION_NUMBER),
+ SLANG_END_ICONST_TABLE
+};
+
+int init_<MODULE-NAME>_module_ns (char *ns_name)
+{
+ SLang_NameSpace_Type *ns = SLns_create_namespace (ns_name);
+ if (ns == NULL)
+ return -1;
+
+ if ((-1 == SLns_add_intrin_fun_table (ns, Module_Intrinsics, NULL))
+ || (-1 == SLns_add_intrin_var_table (ns, Module_Variables, NULL))
+ || (-1 == SLns_add_iconstant_table (ns, Module_Constants, NULL)))
+ return -1;
+
+ return 0;
+}
+
+/* This function is optional */
+void deinit_<MODULE-NAME>_module (void)
+{
+}