- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# lc.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 2004-2005, Swedish Institute of Computer Science.
    00003  * All rights reserved.
    00004  *
    00005  * Redistribution and use in source and binary forms, with or without
    00006  * modification, are permitted provided that the following conditions
    00007  * are met:
    00008  * 1. Redistributions of source code must retain the above copyright
    00009  *    notice, this list of conditions and the following disclaimer.
    00010  * 2. Redistributions in binary form must reproduce the above copyright
    00011  *    notice, this list of conditions and the following disclaimer in the
    00012  *    documentation and/or other materials provided with the distribution.
    00013  * 3. Neither the name of the Institute nor the names of its contributors
    00014  *    may be used to endorse or promote products derived from this software
    00015  *    without specific prior written permission.
    00016  *
    00017  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
    00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
    00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    00027  * SUCH DAMAGE.
    00028  *
    00029  * This file is part of the protothreads library.
    00030  *
    00031  * Author: Adam Dunkels <adam@sics.se>
    00032  *
    00033  * $Id: lc.h,v 1.2 2005/02/24 10:36:59 adam Exp $
    00034  */
    00035
    00036 /**
    00037  * \addtogroup pt
    00038  * @{
    00039  */
    00040
    00041 /**
    00042  * \defgroup lc Local continuations
    00043  * @{
    00044  *
    00045  * Local continuations form the basis for implementing protothreads. A
    00046  * local continuation can be <i>set</i> in a specific function to
    00047  * capture the state of the function. After a local continuation has
    00048  * been set can be <i>resumed</i> in order to restore the state of the
    00049  * function at the point where the local continuation was set.
    00050  *
    00051  *
    00052  */
    00053
    00054 /**
    00055  * \file lc.h
    00056  * Local continuations
    00057  * \author
    00058  * Adam Dunkels <adam@sics.se>
    00059  *
    00060  */
    00061
    00062 #ifdef DOXYGEN
    00063 /**
    00064  * Initialize a local continuation.
    00065  *
    00066  * This operation initializes the local continuation, thereby
    00067  * unsetting any previously set continuation state.
    00068  *
    00069  * \hideinitializer
    00070  */
    00071 #define LC_INIT(lc)
    00072
    00073 /**
    00074  * Set a local continuation.
    00075  *
    00076  * The set operation saves the state of the function at the point
    00077  * where the operation is executed. As far as the set operation is
    00078  * concerned, the state of the function does <b>not</b> include the
    00079  * call-stack or local (automatic) variables, but only the program
    00080  * counter and such CPU registers that needs to be saved.
    00081  *
    00082  * \hideinitializer
    00083  */
    00084 #define LC_SET(lc)
    00085
    00086 /**
    00087  * Resume a local continuation.
    00088  *
    00089  * The resume operation resumes a previously set local continuation, thus
    00090  * restoring the state in which the function was when the local
    00091  * continuation was set. If the local continuation has not been
    00092  * previously set, the resume operation does nothing.
    00093  *
    00094  * \hideinitializer
    00095  */
    00096 #define LC_RESUME(lc)
    00097
    00098 /**
    00099  * Mark the end of local continuation usage.
    00100  *
    00101  * The end operation signifies that local continuations should not be
    00102  * used any more in the function. This operation is not needed for
    00103  * most implementations of local continuation, but is required by a
    00104  * few implementations.
    00105  *
    00106  * \hideinitializer
    00107  */
    00108 #define LC_END(lc)
    00109
    00110 /**
    00111  * \var typedef lc_t;
    00112  *
    00113  * The local continuation type.
    00114  *
    00115  * \hideinitializer
    00116  */
    00117 #endif /* DOXYGEN */
    00118
    00119 #ifndef __LC_H__
    00120 #define __LC_H__
    00121
    00122
    00123 #ifdef LC_INCLUDE
    00124 #include LC_INCLUDE
    00125 #else
    00126 #include "lc-switch.h"
    00127 #endif /* LC_INCLUDE */
    00128
    00129 #endif /* __LC_H__ */
    00130
    00131 /** @} */
    00132 /** @} */