]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
First draft at the subset of Deputy annotations we'll support.
authorregehr <regehr>
Mon, 11 Feb 2008 19:06:42 +0000 (19:06 +0000)
committerregehr <regehr>
Mon, 11 Feb 2008 19:06:42 +0000 (19:06 +0000)
nesc_annots.h -- This tells nesC how to translate new attributes like
                 @count into the appropriate Deputy macro

deputy_annots.h -- This tells CPP how to translate (our) Deputy macros
                   into the low-level form actually understood by Deputy.

tos/lib/safe/include/deputy_annots.h [new file with mode: 0644]
tos/lib/safe/include/nesc_annots.h [new file with mode: 0644]

diff --git a/tos/lib/safe/include/deputy_annots.h b/tos/lib/safe/include/deputy_annots.h
new file mode 100644 (file)
index 0000000..4667f1f
--- /dev/null
@@ -0,0 +1,6 @@
+#define __DEPUTY_BOUND(__lo,__hi)              __attribute__((bounds((__lo),(__hi))))
+#define __DEPUTY_COUNT(__n)                    _DEPUTY_BOUND(__this, __this + (__n))
+#define __DEPUTY_SINGLE(__n)                   _DEPUTY_COUNT(1)
+#define __DEPUTY_TRUSTED_CAST(__type,__expr)   ((__type)((void * TRUSTED COPYTYPE)(__expr)))
+
+#define TC(__type,__expr)                      __DEPUTY_TRUSTED_CAST(__type,__expr)
diff --git a/tos/lib/safe/include/nesc_annots.h b/tos/lib/safe/include/nesc_annots.h
new file mode 100644 (file)
index 0000000..2b25e10
--- /dev/null
@@ -0,0 +1,3 @@
+struct @bound @deputy_scope() @macro("_DEPUTY_BOUND") { void *lo, *hi; }; 
+struct @count @deputy_scope() @macro("_DEPUTY_COUNT") { int n; }; 
+struct @single @deputy_scope() @macro("_DEPUTY_SINGLE") { };