Main Page | Data Structures | File List | Data Fields | Globals

popts.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1999-2003 Alex Scott
00003  *
00004  * This library is free software; you can redistribute it and/or modify it
00005  * under the terms of the GNU Library General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or (at
00007  * your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; if not, write to the Free Software Foundation,
00016  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 #include <string.h>
00026 
00027 #include "cuf-global.h"
00028 #include "array.h"
00029 #include "llist.h"
00030 
00031 #ifndef _POPTS_H_
00032 # define _POPTS_H_
00033 
00034 #define DESC_WINDOW_WIDTH               78
00035 #define DESC_COLUMN_START               30
00036 
00037 typedef void (*FuncString2d) (char **);
00038 
00043 typedef enum _OType {
00044         // Regular variables
00045         OBool,                          
00046         OChar,                          
00047         OInt,                           
00048         OLong,                          
00049         OFloat,                         
00050         ODouble,                        
00051         OString,                        
00052 
00053         // Functions
00054         OFuncVoid,                      
00055         OFuncBool,                      
00056         OFuncChar,                      
00057         OFuncInt,                       
00058         OFuncLong,                      
00059         OFuncFloat,                     
00060         OFuncDouble,                    
00061         OFuncString,                    
00062 
00063         // Specialty
00064         OString2d,                      
00065         OFuncString2d,                  
00066         OProgramname                    
00067 } OType;
00068 
00069 /*
00070    NOTE: Weather you add OProgramname or OString2d or OFuncString2d to the
00071      letter or word lists they will always be added to the word list. I
00072      suggest just adding to the word list to skip any extra if statements
00073      that might be nessary.
00074 */
00075 
00080 typedef struct _COption_description {
00081         unsigned int letterid;          // Letter ID for description
00082         unsigned int wordid;            // Word ID for description
00083         char *desc;                     // The description of the option
00084 } COption_description;
00085 
00090 typedef struct _COption_letter {
00091         unsigned int id;                // Letter option ID
00092         OType ot;                       // Option Type
00093         char sl;                        // Search Leter
00094         void *var;                      // Variable
00095 } COption_letter;
00096 
00101 typedef struct _COption_word {
00102         unsigned int id;                // Word Option ID
00103         OType ot;                       // Option Type
00104         char *sw;                       // Search Word
00105         void *var;                      // Variable
00106 } COption_word;
00107 
00108 
00109 /*** Public Functions ***/
00110 
00111 void popts_init (void);
00112 void popts_description_add (unsigned int letterid, unsigned int wordid,
00113                             char *desc);
00114 unsigned int popts_letter_add (char sl, OType ot, void *var);
00115 unsigned int popts_word_add (char *sw, OType ot, void *var);
00116 void popts_help_add (void);
00117 void popts_descriptions_print (void);
00118 int popts_parse (int argc, char **argv);
00119 void popts_done (void);
00120 
00121 #endif /* _POPTS_H_ */

Generated on Fri Jun 4 18:35:18 2004 for cuf by doxygen 1.3.6