[seed] [modules] Begin seed-modules.h, filled with argument-checking macros, etc
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] [modules] Begin seed-modules.h, filled with argument-checking macros, etc
- Date: Sat, 4 Jul 2009 07:53:37 +0000 (UTC)
commit 614ae012babc0da5dd7d6d0474e7f9ea5d9adbec
Author: Tim Horton <hortont svn gnome org>
Date: Sat Jul 4 03:13:30 2009 -0400
[modules] Begin seed-modules.h, filled with argument-checking macros, etc
modules/Makefile.am | 2 ++
modules/seed-module.h | 19 +++++++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/modules/Makefile.am b/modules/Makefile.am
index 3701ce9..766ea24 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -1 +1,3 @@
SUBDIRS = example sqlite canvas Multiprocessing readline os sandbox dbus libxml cairo gtkbuilder gettext mpfr
+
+EXTRA_DIST = seed-module.h
diff --git a/modules/seed-module.h b/modules/seed-module.h
new file mode 100644
index 0000000..1055d5d
--- /dev/null
+++ b/modules/seed-module.h
@@ -0,0 +1,19 @@
+#ifndef _SEED_MODULE_H_
+#define _SEED_MODULE_H_
+
+#include <seed.h>
+
+#define PLURALIZE_ARG_COUNT(c) \
+ ((c == 1) ? #c " argument" : #c " arguments")
+
+#define CHECK_ARG_COUNT(name, argnum) \
+ if ( argument_count != argnum ) \
+ { \
+ char * msg; \
+ asprintf(&msg, "%s expected %s got %Zd", name, \
+ PLURALIZE_ARG_COUNT(argnum), argument_count); \
+ seed_make_exception (ctx, exception, "ArgumentError", "%s", msg); \
+ return seed_make_undefined (ctx); \
+ }
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]