Steven He / Mbed 2 deprecated StringMatchingProtothread

Dependencies:   mbed

Committer:
StevenHe
Date:
Wed Dec 01 04:39:00 2010 +0000
Revision:
0:544b5f6ad832

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
StevenHe 0:544b5f6ad832 1 /*
StevenHe 0:544b5f6ad832 2 * Copyright (c) 2004-2005, Swedish Institute of Computer Science.
StevenHe 0:544b5f6ad832 3 * All rights reserved.
StevenHe 0:544b5f6ad832 4 *
StevenHe 0:544b5f6ad832 5 * Redistribution and use in source and binary forms, with or without
StevenHe 0:544b5f6ad832 6 * modification, are permitted provided that the following conditions
StevenHe 0:544b5f6ad832 7 * are met:
StevenHe 0:544b5f6ad832 8 * 1. Redistributions of source code must retain the above copyright
StevenHe 0:544b5f6ad832 9 * notice, this list of conditions and the following disclaimer.
StevenHe 0:544b5f6ad832 10 * 2. Redistributions in binary form must reproduce the above copyright
StevenHe 0:544b5f6ad832 11 * notice, this list of conditions and the following disclaimer in the
StevenHe 0:544b5f6ad832 12 * documentation and/or other materials provided with the distribution.
StevenHe 0:544b5f6ad832 13 * 3. Neither the name of the Institute nor the names of its contributors
StevenHe 0:544b5f6ad832 14 * may be used to endorse or promote products derived from this software
StevenHe 0:544b5f6ad832 15 * without specific prior written permission.
StevenHe 0:544b5f6ad832 16 *
StevenHe 0:544b5f6ad832 17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
StevenHe 0:544b5f6ad832 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
StevenHe 0:544b5f6ad832 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
StevenHe 0:544b5f6ad832 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
StevenHe 0:544b5f6ad832 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
StevenHe 0:544b5f6ad832 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
StevenHe 0:544b5f6ad832 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
StevenHe 0:544b5f6ad832 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
StevenHe 0:544b5f6ad832 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
StevenHe 0:544b5f6ad832 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
StevenHe 0:544b5f6ad832 27 * SUCH DAMAGE.
StevenHe 0:544b5f6ad832 28 *
StevenHe 0:544b5f6ad832 29 * This file is part of the Contiki operating system.
StevenHe 0:544b5f6ad832 30 *
StevenHe 0:544b5f6ad832 31 * Author: Adam Dunkels <adam@sics.se>
StevenHe 0:544b5f6ad832 32 *
StevenHe 0:544b5f6ad832 33 * $Id: lc-switch.h,v 1.4 2006/06/03 11:29:43 adam Exp $
StevenHe 0:544b5f6ad832 34 */
StevenHe 0:544b5f6ad832 35
StevenHe 0:544b5f6ad832 36 /**
StevenHe 0:544b5f6ad832 37 * \addtogroup lc
StevenHe 0:544b5f6ad832 38 * @{
StevenHe 0:544b5f6ad832 39 */
StevenHe 0:544b5f6ad832 40
StevenHe 0:544b5f6ad832 41 /**
StevenHe 0:544b5f6ad832 42 * \file
StevenHe 0:544b5f6ad832 43 * Implementation of local continuations based on switch() statment
StevenHe 0:544b5f6ad832 44 * \author Adam Dunkels <adam@sics.se>
StevenHe 0:544b5f6ad832 45 *
StevenHe 0:544b5f6ad832 46 * This implementation of local continuations uses the C switch()
StevenHe 0:544b5f6ad832 47 * statement to resume execution of a function somewhere inside the
StevenHe 0:544b5f6ad832 48 * function's body. The implementation is based on the fact that
StevenHe 0:544b5f6ad832 49 * switch() statements are able to jump directly into the bodies of
StevenHe 0:544b5f6ad832 50 * control structures such as if() or while() statmenets.
StevenHe 0:544b5f6ad832 51 *
StevenHe 0:544b5f6ad832 52 * This implementation borrows heavily from Simon Tatham's coroutines
StevenHe 0:544b5f6ad832 53 * implementation in C:
StevenHe 0:544b5f6ad832 54 * http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
StevenHe 0:544b5f6ad832 55 */
StevenHe 0:544b5f6ad832 56
StevenHe 0:544b5f6ad832 57 #ifndef __LC_SWITCH_H__
StevenHe 0:544b5f6ad832 58 #define __LC_SWITCH_H__
StevenHe 0:544b5f6ad832 59
StevenHe 0:544b5f6ad832 60 /* WARNING! lc implementation using switch() does not work if an
StevenHe 0:544b5f6ad832 61 LC_SET() is done within another switch() statement! */
StevenHe 0:544b5f6ad832 62
StevenHe 0:544b5f6ad832 63 /** \hideinitializer */
StevenHe 0:544b5f6ad832 64 typedef unsigned short lc_t;
StevenHe 0:544b5f6ad832 65
StevenHe 0:544b5f6ad832 66 #define LC_INIT(s) s = 0;
StevenHe 0:544b5f6ad832 67
StevenHe 0:544b5f6ad832 68 #define LC_RESUME(s) switch(s) { case 0:
StevenHe 0:544b5f6ad832 69
StevenHe 0:544b5f6ad832 70 #define LC_SET(s) s = __LINE__; case __LINE__:
StevenHe 0:544b5f6ad832 71
StevenHe 0:544b5f6ad832 72 #define LC_END(s) }
StevenHe 0:544b5f6ad832 73
StevenHe 0:544b5f6ad832 74 #endif /* __LC_SWITCH_H__ */
StevenHe 0:544b5f6ad832 75
StevenHe 0:544b5f6ad832 76 /** @} */