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

popts.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cuf-global.h"
#include "array.h"
#include "llist.h"

Go to the source code of this file.

Data Structures

struct  _COption_description
struct  _COption_letter
struct  _COption_word

Typedefs

typedef enum _OType OType
typedef _COption_description COption_description
typedef _COption_letter COption_letter
typedef _COption_word COption_word

Enumerations

enum  _OType {
  OBool,
  OChar,
  OInt,
  OLong,
  OFloat,
  ODouble,
  OString,
  OFuncVoid,
  OFuncBool,
  OFuncChar,
  OFuncInt,
  OFuncLong,
  OFuncFloat,
  OFuncDouble,
  OFuncString,
  OString2d,
  OFuncString2d,
  OProgramname
}

Functions

void popts_init (void)
void popts_description_add (unsigned int letterid, unsigned int wordid, char *desc)
unsigned int popts_letter_add (char sl, OType ot, void *var)
unsigned int popts_word_add (char *sw, OType ot, void *var)
void popts_help_add (void)
void popts_descriptions_print (void)
int popts_parse (int argc, char **argv)
void popts_done (void)


Detailed Description

Command line options parser, v0.3

Typedef Documentation

typedef struct _COption_description COption_description
 

Description:
Option description, only to be modifyed internaly.

typedef struct _COption_letter COption_letter
 

Description:
Option letter, only to be modifyed internaly.

typedef struct _COption_word COption_word
 

Description:
Option word, only to be modifyed internaly.

typedef enum _OType OType
 

Description:
The data type.


Enumeration Type Documentation

enum _OType
 

Description:
The data type.
Enumeration values:
OBool  int
OChar  char
OInt  int
OLong  long
OFloat  float
ODouble  double
OString  char *
OFuncVoid  FuncVoid
OFuncBool  FuncBool
OFuncChar  FuncChar
OFuncInt  FuncInt
OFuncLong  FuncLong
OFuncFloat  FuncFloat
OFuncDouble  FuncDouble
OFuncString  FuncString
OString2d  char **
OFuncString2d  void func (char **)
OProgramname  char *


Function Documentation

void popts_description_add unsigned int  letterid,
unsigned int  wordid,
char *  desc
 

Parameters:
letterid The ID of the letter option.
wordid The ID of the word option.
desc The description to print.
Description:
Adds a description to the list of current descriptions. Descriptions can only span a single letter or word. Though a letter and a word can share a description.

void popts_descriptions_print void   ) 
 

Description:
Prints out the desriptions in alphabetical order of the letter options.

void popts_done void   ) 
 

Description:
Frees the letter, word and description lists.

void popts_help_add void   ) 
 

Description:
Adds the -h and --help options to display the descriptions. Trys to be sane about it.
Note:
if -h or --help is allready assigned this function will not reasign them. If both -h and --help are assigned then nothing is done.

void popts_init void   ) 
 

Description:
Deprecated, do not call this function in new programs.

unsigned int popts_letter_add char  sl,
OType  ot,
void *  var
 

Parameters:
sl The search letter.
ot The expected data type.
var The variable to manipulate.
Return values:
int The ID of the added letter option.
0 On error.
Description:
Appends a letter to the list of letters to search for.

int popts_parse int  argc,
char **  argv
 

Parameters:
argc The number of arguments.
argv The string array of the arguments.
Return values:
#TRUE On successful parse.
#FALSE On failure to parse.
Description:
Parses arguments given from the commad line and maps to the options specified by the letter add word search lists.

unsigned int popts_word_add char *  sw,
OType  ot,
void *  var
 

Parameters:
sw The search word.
ot The expected data type.
var The variable to manipulate.
Return values:
int The ID of the added word option.
0 On error.
Description:
Appends a word to the list of words to search for.


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