[Tinyos-devel] nesC 1.3.0

David Gay dgay42 at gmail.com
Wed Aug 6 10:43:04 PDT 2008


I'm pleased to announce the release of nesC 1.3.0, which adds support
for the Deputy type-safety annotations to nesC. Deputy
(http://deputy.cs.berkeley.edu) is a system of light-weight
annotations for providing type safety to C (and C-like) languages,
with reasonable overhead.

nesC 1.3.0 should also provide substantially faster compilation,
especially on Windows.

nesC is available in source form from
http://sourceforge.net/project/showfiles.php?group_id=56288. Debian,
Fedora and Cygwin packages will follow soon.

David Gay

Changes in nesC 1.3.0
=====================
- C preprocessor is integrated into nesC, which should significantly speed
  up compilation (esp. on Windows)

- support for the Deputy type-safety-for-C system (see
  deputy.cs.berkeley.edu). To use Deputy, you add type annotations to
  your nesC code, then compile with the -fnesc-deputy flag. A bunch of
  small changes to nesC support the use of deputy.

  Flags to nescc:
  -fnesc-deputy: use Deputy in this compilation. You need to have
   a version of Deputy customized for use with nesC installed for
   this to work.
  -fnesc-deputy-args: extra arguments to pass to Deputy.
  -fnesc-default-safe/-fnesc-default-unsafe: the default safety for
   C functions and nesC modules (with no option specified,
   -fnesc-default-unsafe is assumed)

  Type annotations: NONULL, COUNT(...), etc (see the Deputy-for-nesC
  documentation for full details), which are actually macros which
  expand to nesC attributes (@nonnull(), @count(...), etc. Using macros
  allows Deputy-annotated code to be used with earlier versions of nesC.

  Type annotations in nesdoc comments: to reduce clutter for non-Deputy
  users, Deputy's annotations can be placed within a nesdoc comment
  rather than in a function signature (which then looks like a regular
  C signature):
    /** ... @param 'int *@count(n) x' x is an array of n ints ... */
    void f(int *x, int n);
  is the same as
    void f(int *@count(n) x, int n);
  Macros can be used in the comment, so the above could also be
    /** ... @param 'int *COUNT(n) x' x is an array of n ints ... */
    void f(int *x, int n);
  where COUNT(expr) expands to @count(expr).

- internal support (in nesc1) for Deputy based on @deputy_scope() and
  @macro("NAME") attributes, and a -fnesc-genprefix=<line> option.

- @macro() and -fnesc-genprerix= may be useful in other contexts too:
  if a nesC attribute declaration has an @macro() attribute:
    struct @myattr @macro("MYMACRO") { int x; char *y; };
  then uses of @myattr in nesC source are output as calls to MYMACRO in
  nesC's intermediate C output. For instance
    int x @myattr(23, "fun");
  becomes
    int x MYMACRO(23, "fun");
  The -fnesc-genprefix=<line> adds <line> to the start of the generated C
  output, e.g., it could be a #define definition for MYMACRO, or a
  #include of a file with appropriate definitions.

- wide strings in XML output now show up as arrays of bytes (and follow
  the target's byte-level representation of wide strings)

- ability to process a C file through nesC (this provides support in C for
  external types, atomic statements and unique), as follows:
    nescc <options> -x nesc <filename>.c
  This forces nescc to pass the C file <filename>.c through the nesC compiler
  (normally it would be sent to the regular C compiler), which will process
  the nesC extensions and then compile the generated C code with the regular
  C compiler (or whatever compiler was specified with -fnesc-gcc=...)

- inside a module, you can now write void f(void) or void f() interchangeably


More information about the Tinyos-devel mailing list