#ifndef OPT_H
#define OPT_H
/* ---------------------------------------------------------------------
   (c) ED 2000-2004
   Project      : CLIB
   Function     : Lecture des options de la ligne de commande
   Module       : OPT
   File         : OPT.H
   Created      : 12-11-2000
   Modified     : 01-06-2004
   --------------------------------------------------------------------- */

/* ---------------------------------------------------------------------
   Log

   0.0 - 12-11-2000 Created
   1.0 - 12-11-2000 Initial version
   1.1 - 13-11-2000 OPT_scan() parameter 'firstarg' added.
   1.2 - 13-07-2002 LCLint
   1.3 - 01-06-2004  .errno devient .err

   --------------------------------------------------------------------- */

/* ---------------------------------------------------------------------
   Constants
   --------------------------------------------------------------------- */
#include <stddef.h>

typedef enum
{
#define ITEM(a,b) OPT_ERR_##a,
#include "ed/inc/opt_err.itm"
#undef ITEM
   OPT_ERR_NB
}
eOPT_ERR;

/* Callback type */
typedef int fOPT_CB (void *pUser, char const *args);
typedef int fOPT_ERR_CB (void *pUser, char const *args);

/* ---------------------------------------------------------------------
   Structures
   --------------------------------------------------------------------- */
typedef struct
{
   eOPT_ERR err;
   void *pPrivate;
}
sOPT;

/* ---------------------------------------------------------------------
   Data
   --------------------------------------------------------------------- */

/* =====================================================================
   Functions
   ===================================================================== */

/* ---------------------------------------------------------------------
   OPT_sver()
   ---------------------------------------------------------------------
   Returns the "Version" string
   ---------------------------------------------------------------------
   E :
   S : ASCIIZ string pointer
   --------------------------------------------------------------------- */
const char *OPT_sver (void);

/* ---------------------------------------------------------------------
   OPT_sid()
   ---------------------------------------------------------------------
   Returns the "Identification" string
   ---------------------------------------------------------------------
   E :
   S : ASCIIZ string pointer
   --------------------------------------------------------------------- */
const char *OPT_sid (void);

/* ---------------------------------------------------------------------
   OPT_init()
   ---------------------------------------------------------------------
   Creates and initializes the C-object
   ---------------------------------------------------------------------
   E : Max number of options
   E : callback "Erreur"
   E : Contexte utilisateur
   S : Data pointer
   --------------------------------------------------------------------- */
sOPT *OPT_init (size_t const nopt, fOPT_ERR_CB * const pf, void *const pUser);

/* ---------------------------------------------------------------------
   OPT_end()
   ---------------------------------------------------------------------
   Suppresses the C-object
   ---------------------------------------------------------------------
   E : Data pointer
   S :
   --------------------------------------------------------------------- */
void OPT_end (sOPT * const pOpt);

/* ---------------------------------------------------------------------
   OPT_define()
   ---------------------------------------------------------------------

   ---------------------------------------------------------------------
   E : Data pointer
   E : Option string
   E : Function to be called
   E : User context
   S :
   --------------------------------------------------------------------- */
eOPT_ERR OPT_define (sOPT * const pOpt
                     ,const char *const sOption
                     ,fOPT_CB * const pf
                     ,void *const pUser);

/* ---------------------------------------------------------------------
   OPT_scan()
   ---------------------------------------------------------------------
   Scans the options and eventually call the setup functions
   ---------------------------------------------------------------------
   E :
   S : Data pointer
   --------------------------------------------------------------------- */
eOPT_ERR OPT_scan (sOPT * const pOpt
                   ,int const firstarg
                   ,int const argc
                   ,char const **const args);

/* ---------------------------------------------------------------------
   OPT_errno()
   ---------------------------------------------------------------------
   Reads the current error number
   ---------------------------------------------------------------------
   E : Data pointer
   S :
   --------------------------------------------------------------------- */
eOPT_ERR OPT_errno (sOPT const *const pOpt);

#endif /* OPT_H */

/* File generated by 'NEW.EXE' Ver 1.25 (c) ED 1998-2000 */
