From: regehr Date: Mon, 11 Feb 2008 19:06:42 +0000 (+0000) Subject: First draft at the subset of Deputy annotations we'll support. X-Git-Tag: release_tinyos_2_1_0_0~559 X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=commitdiff_plain;h=82e72e76e91caee6aa2f36f39cb5cc99dfaed6d4;p=tinyos-2.x.git First draft at the subset of Deputy annotations we'll support. 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. --- diff --git a/tos/lib/safe/include/deputy_annots.h b/tos/lib/safe/include/deputy_annots.h new file mode 100644 index 00000000..4667f1fa --- /dev/null +++ b/tos/lib/safe/include/deputy_annots.h @@ -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 index 00000000..2b25e100 --- /dev/null +++ b/tos/lib/safe/include/nesc_annots.h @@ -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") { };