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.4 2008/10/14 12:46:39 nvt-se 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 #if CTK_CONF_ICONS  
00086   struct ctk_icon *icon;  /**< A pointer to the ctk_icon structure for
00087                              the DSC. */
00088 #endif /* CTK_CONF_ICONS */
00089  
00090 #if WITH_LOADER_ARCH
00091   void *loadaddr;         /**< The loading address of the DSC. Used by
00092                              the LOADER_UNLOAD() function when
00093                              deallocating the memory allocated for the
00094                              DSC when loading it. */
00095 #endif /* WITH_LOADER_ARCH */
00096 };
00097 
00098 /**
00099  * Instantiating macro for the DSC structure.
00100  *
00101  * \param dscname The name of the C variable which is to contain the
00102  * DSC.
00103  *
00104  * \param description A one-line text describing the program.
00105  *
00106  * \param prgname The name of the program on disk.
00107  *
00108  * \param initfunc A pointer to the initialization function of the
00109  * program.
00110  *
00111  * \param icon A pointer to the CTK icon.
00112  */
00113 #if WITH_LOADER_ARCH
00114 #if CTK_CONF_ICONS
00115 #define DSC(dscname, description, prgname, process, icon) \
00116         CLIF const struct dsc dscname = {description, prgname, icon}
00117 #else /* CTK_CONF_ICONS */
00118 #define DSC(dscname, description, prgname, process, icon) \
00119         CLIF const struct dsc dscname = {description, prgname}
00120 #endif /* CTK_CONF_ICONS */
00121 #else /* WITH_LOADER_ARCH */
00122 #if CTK_CONF_ICONS
00123 #define DSC(dscname, description, prgname, process, icon) \
00124     PROCESS_NAME(process); \
00125     const struct dsc dscname = {description, &process, icon}
00126 #else /* CTK_CONF_ICONS */
00127 #define DSC(dscname, description, prgname, process, icon) \
00128     PROCESS_NAME(process); \
00129     const struct dsc dscname = {description, &process}
00130 #endif /* CTK_CONF_ICONS */
00131 #endif /* WITH_LOADER_ARCH */
00132 
00133 #define DSC_HEADER(name) extern struct dsc name
00134 
00135 #ifndef NULL
00136 #define NULL 0
00137 #endif /* NULL */
00138 
00139 /** @} */
00140 
00141 #endif /* _DSC_H__ */

Generated on Mon Apr 11 14:23:33 2011 for Contiki 2.5 by  doxygen 1.6.1