yuwen sun
/
TouchSensorMT_2
Homework2_3Multithreads_YuwenSun
lc-addrlabels.h@0:edab293d7652, 2010-11-30 (annotated)
- Committer:
- sun831011
- Date:
- Tue Nov 30 22:19:29 2010 +0000
- Revision:
- 0:edab293d7652
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sun831011 | 0:edab293d7652 | 1 | /* |
sun831011 | 0:edab293d7652 | 2 | * Copyright (c) 2004-2005, Swedish Institute of Computer Science. |
sun831011 | 0:edab293d7652 | 3 | * All rights reserved. |
sun831011 | 0:edab293d7652 | 4 | * |
sun831011 | 0:edab293d7652 | 5 | * Redistribution and use in source and binary forms, with or without |
sun831011 | 0:edab293d7652 | 6 | * modification, are permitted provided that the following conditions |
sun831011 | 0:edab293d7652 | 7 | * are met: |
sun831011 | 0:edab293d7652 | 8 | * 1. Redistributions of source code must retain the above copyright |
sun831011 | 0:edab293d7652 | 9 | * notice, this list of conditions and the following disclaimer. |
sun831011 | 0:edab293d7652 | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
sun831011 | 0:edab293d7652 | 11 | * notice, this list of conditions and the following disclaimer in the |
sun831011 | 0:edab293d7652 | 12 | * documentation and/or other materials provided with the distribution. |
sun831011 | 0:edab293d7652 | 13 | * 3. Neither the name of the Institute nor the names of its contributors |
sun831011 | 0:edab293d7652 | 14 | * may be used to endorse or promote products derived from this software |
sun831011 | 0:edab293d7652 | 15 | * without specific prior written permission. |
sun831011 | 0:edab293d7652 | 16 | * |
sun831011 | 0:edab293d7652 | 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND |
sun831011 | 0:edab293d7652 | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
sun831011 | 0:edab293d7652 | 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
sun831011 | 0:edab293d7652 | 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE |
sun831011 | 0:edab293d7652 | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
sun831011 | 0:edab293d7652 | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
sun831011 | 0:edab293d7652 | 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
sun831011 | 0:edab293d7652 | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
sun831011 | 0:edab293d7652 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
sun831011 | 0:edab293d7652 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
sun831011 | 0:edab293d7652 | 27 | * SUCH DAMAGE. |
sun831011 | 0:edab293d7652 | 28 | * |
sun831011 | 0:edab293d7652 | 29 | * This file is part of the Contiki operating system. |
sun831011 | 0:edab293d7652 | 30 | * |
sun831011 | 0:edab293d7652 | 31 | * Author: Adam Dunkels <adam@sics.se> |
sun831011 | 0:edab293d7652 | 32 | * |
sun831011 | 0:edab293d7652 | 33 | * $Id: lc-addrlabels.h,v 1.4 2006/06/03 11:29:43 adam Exp $ |
sun831011 | 0:edab293d7652 | 34 | */ |
sun831011 | 0:edab293d7652 | 35 | |
sun831011 | 0:edab293d7652 | 36 | /** |
sun831011 | 0:edab293d7652 | 37 | * \addtogroup lc |
sun831011 | 0:edab293d7652 | 38 | * @{ |
sun831011 | 0:edab293d7652 | 39 | */ |
sun831011 | 0:edab293d7652 | 40 | |
sun831011 | 0:edab293d7652 | 41 | /** |
sun831011 | 0:edab293d7652 | 42 | * \file |
sun831011 | 0:edab293d7652 | 43 | * Implementation of local continuations based on the "Labels as |
sun831011 | 0:edab293d7652 | 44 | * values" feature of gcc |
sun831011 | 0:edab293d7652 | 45 | * \author |
sun831011 | 0:edab293d7652 | 46 | * Adam Dunkels <adam@sics.se> |
sun831011 | 0:edab293d7652 | 47 | * |
sun831011 | 0:edab293d7652 | 48 | * This implementation of local continuations is based on a special |
sun831011 | 0:edab293d7652 | 49 | * feature of the GCC C compiler called "labels as values". This |
sun831011 | 0:edab293d7652 | 50 | * feature allows assigning pointers with the address of the code |
sun831011 | 0:edab293d7652 | 51 | * corresponding to a particular C label. |
sun831011 | 0:edab293d7652 | 52 | * |
sun831011 | 0:edab293d7652 | 53 | * For more information, see the GCC documentation: |
sun831011 | 0:edab293d7652 | 54 | * http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html |
sun831011 | 0:edab293d7652 | 55 | * |
sun831011 | 0:edab293d7652 | 56 | */ |
sun831011 | 0:edab293d7652 | 57 | |
sun831011 | 0:edab293d7652 | 58 | #ifndef __LC_ADDRLABELS_H__ |
sun831011 | 0:edab293d7652 | 59 | #define __LC_ADDRLABELS_H__ |
sun831011 | 0:edab293d7652 | 60 | |
sun831011 | 0:edab293d7652 | 61 | /** \hideinitializer */ |
sun831011 | 0:edab293d7652 | 62 | typedef void * lc_t; |
sun831011 | 0:edab293d7652 | 63 | |
sun831011 | 0:edab293d7652 | 64 | #define LC_INIT(s) s = NULL |
sun831011 | 0:edab293d7652 | 65 | |
sun831011 | 0:edab293d7652 | 66 | #define LC_RESUME(s) \ |
sun831011 | 0:edab293d7652 | 67 | do { \ |
sun831011 | 0:edab293d7652 | 68 | if(s != NULL) { \ |
sun831011 | 0:edab293d7652 | 69 | goto *s; \ |
sun831011 | 0:edab293d7652 | 70 | } \ |
sun831011 | 0:edab293d7652 | 71 | } while(0) |
sun831011 | 0:edab293d7652 | 72 | |
sun831011 | 0:edab293d7652 | 73 | #define LC_CONCAT2(s1, s2) s1##s2 |
sun831011 | 0:edab293d7652 | 74 | #define LC_CONCAT(s1, s2) LC_CONCAT2(s1, s2) |
sun831011 | 0:edab293d7652 | 75 | |
sun831011 | 0:edab293d7652 | 76 | #define LC_SET(s) \ |
sun831011 | 0:edab293d7652 | 77 | do { \ |
sun831011 | 0:edab293d7652 | 78 | LC_CONCAT(LC_LABEL, __LINE__): \ |
sun831011 | 0:edab293d7652 | 79 | (s) = &&LC_CONCAT(LC_LABEL, __LINE__); \ |
sun831011 | 0:edab293d7652 | 80 | } while(0) |
sun831011 | 0:edab293d7652 | 81 | |
sun831011 | 0:edab293d7652 | 82 | #define LC_END(s) |
sun831011 | 0:edab293d7652 | 83 | |
sun831011 | 0:edab293d7652 | 84 | #endif /* __LC_ADDRLABELS_H__ */ |
sun831011 | 0:edab293d7652 | 85 | /** @} */ |