Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Examples

dsc.h

Go to the documentation of this file.
00001 /**
00002  * \file
00003  * Declaration of the DSC program description structure.
00004  * \author Adam Dunkels <adam@dunkels.com>
00005  *
00006  */
00007 
00008 /**
00009  * \addtogroup loader
00010  * @{
00011  */
00012 
00013 /**
00014  * \page dsc The program description structure
00015  *
00016  * The Contiki DSC structure is used for describing programs. It
00017  * includes a string describing the program, the name of the program
00018  * file on disk (or a pointer to the programs initialization function
00019  * for systems without disk support), a bitmap icon and a text version
00020  * of the same icon.
00021  *
00022  * The DSC is saved into a file which can be loaded by programs such
00023  * as the "Directory" application which reads all DSC files on disk
00024  * and presents the icons and descriptions in a window.
00025  *
00026  */
00027 
00028 /*
00029  * Copyright (c) 2003, Adam Dunkels.
00030  * All rights reserved. 
00031  *
00032  * Redistribution and use in source and binary forms, with or without 
00033  * modification, are permitted provided that the following conditions 
00034  * are met: 
00035  * 1. Redistributions of source code must retain the above copyright 
00036  *    notice, this list of conditions and the following disclaimer. 
00037  * 2. Redistributions in binary form must reproduce the above
00038  *    copyright notice, this list of conditions and the following
00039  *    disclaimer in the documentation and/or other materials provided
00040  *    with the distribution. 
00041  * 3. The name of the author may not be used to endorse or promote
00042  *    products derived from this software without specific prior
00043  *    written permission.  
00044  *
00045  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
00046  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00047  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00048  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00049  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00050  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00051  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00052  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00053  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00054  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00055  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
00056  *
00057  * This file is part of the Contiki desktop environment
00058  *
00059  * $Id: dsc.h,v 1.1 2006/06/17 22:41:20 adamdunkels Exp $
00060  *
00061  */
00062 #ifndef __DSC_H__
00063 #define __DSC_H__
00064 
00065 #include "ctk/ctk.h"
00066 
00067 /**
00068  * The DSC program description structure.
00069  *
00070  * The DSC structure is used for describing a Contiki program. It
00071  * includes a short textual description of the program, either the
00072  * name of the program on disk, or a pointer to the init() function,
00073  * and an icon for the program.
00074  */
00075 struct dsc {
00076   char *description; /**< A text string containing a one-line
00077                         description of the program */
00078   
00079 #if WITH_LOADER_ARCH
00080   char *prgname;     /**< The name of the program on disk. */
00081 #else /* WITH_LOADER_ARCH */
00082   struct process *process; /**< A pointer to the program's process. */
00083 #endif /* WITH_LOADER_ARCH */
00084   
00085   struct ctk_icon *icon;  /**< A pointer to the ctk_icon structure for
00086                              the DSC. */
00087  
00088 #if WITH_LOADER_ARCH
00089   void *loadaddr;         /**< The loading address of the DSC. Used by
00090                              the LOADER_UNLOAD() function when
00091                              deallocating the memory allocated for the
00092                              DSC when loading it. */
00093 #endif /* WITH_LOADER_ARCH */
00094 };
00095 
00096 /**
00097  * Intantiating macro for the DSC structure.
00098  *
00099  * \param dscname The name of the C variable which is to contain the
00100  * DSC.
00101  *
00102  * \param description A one-line text describing the program.
00103  *
00104  * \param prgname The name of the program on disk.
00105  *
00106  * \param initfunc A pointer to the initialization function of the
00107  * program.
00108  *
00109  * \param icon A pointer to the CTK icon.
00110  */
00111 #if WITH_LOADER_ARCH
00112 #define DSC(dscname, description, prgname, process, icon) \
00113         const struct dsc dscname = {description, prgname, icon}
00114 #else /* WITH_LOADER_ARCH */
00115 #define DSC(dscname, description, prgname, process, icon) \
00116     PROCESS_NAME(process); \
00117     const struct dsc dscname = {description, &process, icon}
00118 #endif /* WITH_LOADER_ARCH */
00119 
00120 #define DSC_HEADER(name) extern struct dsc name;
00121 
00122 #ifndef NULL
00123 #define NULL 0
00124 #endif /* NULL */
00125 
00126 /** @} */
00127 
00128 #endif /* _DSC_H__ */

Generated on Thu Jun 22 17:45:43 2006 for Contiki 2.x by  doxygen 1.4.4