#ifndef H_ED_CI_20050311095427
#define H_ED_CI_20050311095427

#ifdef __cplusplus
extern "C"
{
#endif

/* ---------------------------------------------------------------------
   (c) ED 2005-2006
   Project      : CLIB
   Function     : Command interpretor
   Module       : CI
   File         : ci.h
   Created      : 11-03-2005
   Modified     : 15-05-2006
   --------------------------------------------------------------------- */

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

   1.4 15-05-2006 context parameter added to command calls.
   1.3 15-11-2005 redirectable output added
   1.2 08-05-2005 ci_serr() added
   1.1 11-03-2005 debug 'interpretor()'
   1.0 11-03-2005 Initial version
   0.0 11-03-2005 Created

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

/* macros ============================================================== */
#define CI_CDE_WIDTH 9

/* constants =========================================================== */

#define CI_ADT 0                /* 0 | 1 */

   typedef enum
   {
      CI_OK,

#define ITEM(n_, s_)\
   CI_ERR_##n_,

#include "ed/inc/ci_err.itm"

#undef ITEM

      CI_ERR_NB
   }
   ci_err_e;

/* types =============================================================== */

   typedef int ci_out_f (void *p_user, char const *s);
   typedef int ci_cde_f (int argc, char const **argv, void *p_user);

/* structures ========================================================== */


   typedef struct
   {
      char const *s_cde; /* size is limited */
      char const *s_man; /* no limit */
      ci_cde_f *pf_cde;
   }
   ci_cfg_s;


#if CI_ADT
   typedef struct ci ci_s;
#else
   typedef struct
   {
      ci_out_f *pf;
      void *p_usr;

      ci_cfg_s const *p_cfg;
      size_t nb_cde;
   }
   ci_s;
#endif                          /* ADT */

/* functions =========================================================== */

/* Identification */
   char const *ci_sid (void);
   char const *ci_sver (void);
   char const *ci_serr (ci_err_e err);

#if CI_ADT
/* Dynamic constructor / destructor */
   ci_s *ci_create (void);
   void ci_delete (ci_s * self);
#endif                          /* ADT */

/* Initialisation */
   ci_err_e ci_init (ci_s * self, ci_cfg_s const *p_cfg, size_t nb);
   ci_err_e ci_install_out (ci_s * self
                            ,ci_out_f * pf
                            ,void *p_usr);

/* Input functions */
   ci_err_e ci_in (ci_s * self, char const *sline, void *p_user);

#ifdef __cplusplus
}
#endif

/* ---------------------------------------------------------------------
   Generated by NEW (c) ED 2.4
   Powered by C-code generator (c) ED 2003 1.0
   --------------------------------------------------------------------- */

#endif                          /* guard */
