/*****  名前ジェネレータ namegen    *****/
/*****  namegen.h                   *****/



#define TRUE    1
#define FALSE   0

/*  ワード格納バッファ wordbuf のバイト数   */
#define WORDBUF_SIZE            4096

/*  ポインタ格納バッファ ptrbuf の要素数    */
#define PTRBUF_MAX              256

/*  一行として読み込まれる最大バイト数      */
#define READLINE_MAX            256

/*  フィールド数の最大値                    */
#define FIELD_MAX               256


#define PTRBUF_SIZE             sizeof(Ptrbuf)

/*  モード定義                              */
#define DISCARD_LINE        (int)0
#define RESERVE_LINE        (int)1

/*      RAND_MAXが定義されていない処理系では、以下のように定義
#define     RAND_MAX              2147483648
#define     RAND_MAX              32727
 */

/*  エラー番号定義                          */

#define     ERR_HELP                    1
#define     ERR_NAMEFILE_NOT_FOUND      2
#define     ERR_OUT_OF_MEMORY           3
#define     ERR_ILLEGAL_FIELDMAX        4
#define     ERR_ILLEGAL_PROB            5
#define     ERR_UNDEF_PROB              6
#define     ERR_ILLEGAL_CTRL            7
#define     ERR_ILLEGAL_FIELDNUM        8
#define     ERR_UNDEF_WORD              9
#define     ERR_ILLEGAL_NEST            10
#define     ERR_ILLEGAL_INSERT          11


typedef struct ptrbuf {
    char            *ptr[PTRBUF_MAX];   /* ワードへのポインタ配列           */
    struct ptrbuf   *next_p;            /* 次のptrbufへのポインタ           */
} Ptrbuf;


/*  help.c      */
void        help(void);
/*  error.c     */
void        error(int, char*);
/*  prtbuf.c    */
Ptrbuf      *get_ptrbuf(Ptrbuf*);
Ptrbuf      *set_ptr(Ptrbuf*, int*, char*);
/*  wordbuf.c    */
char        *get_wordbuf(void);
/* rd_file.c    */
void        read_namefile(char*, Ptrbuf**, int*, int*, int*, int);
char        *read_nameline(FILE*, int);
/* genname.c   */
void        generate_name(Ptrbuf**, int*, int*, int, int);


