#ifndef _EXPECT_H
#define _EXPECT_H
#include <stdio.h>
#include <setjmp.h>
#ifndef _TCL
#define _TCL
#ifndef __WIN32__
# if defined(_WIN32) || defined(WIN32)
# define __WIN32__
# endif
#endif
#ifdef __WIN32__
# ifndef STRICT
# define STRICT
# endif
# ifndef USE_PROTOTYPE
# define USE_PROTOTYPE 1
# endif
# ifndef HAS_STDARG
# define HAS_STDARG 1
# endif
# ifndef USE_PROTOTYPE
# define USE_PROTOTYPE 1
# endif
# ifndef USE_TCLALLOC
# define USE_TCLALLOC 1
# endif
#endif
#ifdef MAC_TCL
# ifndef HAS_STDARG
# define HAS_STDARG 1
# endif
# ifndef USE_TCLALLOC
# define USE_TCLALLOC 1
# endif
# ifndef NO_STRERROR
# define NO_STRERROR 1
# endif
#endif
#define VERBATIM(x) x
#ifdef _MSC_VER
# define STRINGIFY(x) STRINGIFY1(x)
# define STRINGIFY1(x) #x
# define JOIN(a,b) JOIN1(a,b)
# define JOIN1(a,b) a##b
#else
# ifdef RESOURCE_INCLUDED
# define STRINGIFY(x) STRINGIFY1(x)
# define STRINGIFY1(x) #x
# define JOIN(a,b) JOIN1(a,b)
# define JOIN1(a,b) a##b
# else
# ifdef __STDC__
# define STRINGIFY(x) #x
# define JOIN(a,b) a##b
# else
# define STRINGIFY(x) "x"
# define JOIN(a,b) VERBATIM(a)VERBATIM(b)
# endif
# endif
#endif
#ifndef RESOURCE_INCLUDED
#ifndef BUFSIZ
#include <stdio.h>
#endif
#if defined(__STDC__) || defined(HAS_STDARG)
# include <stdarg.h>
# define TCL_VARARGS(type, name) (type name, ...)
# define TCL_VARARGS_DEF(type, name) (type name, ...)
# define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
#else
# include <varargs.h>
# ifdef __cplusplus
# define TCL_VARARGS(type, name) (type name, ...)
# define TCL_VARARGS_DEF(type, name) (type va_alist, ...)
# else
# define TCL_VARARGS(type, name) ()
# define TCL_VARARGS_DEF(type, name) (va_alist)
# endif
# define TCL_VARARGS_START(type, name, list) \
(va_start(list), va_arg(list, type))
#endif
#ifdef STATIC_BUILD
# define DLLIMPORT
# define DLLEXPORT
#else
# if defined(__WIN32__) && (defined(_MSC_VER) || (defined(__GNUC__) && defined(__declspec)))
# define DLLIMPORT __declspec(dllimport)
# define DLLEXPORT __declspec(dllexport)
# else
# define DLLIMPORT
# define DLLEXPORT
# endif
#endif
#undef TCL_STORAGE_CLASS
#ifdef BUILD_tcl
# define TCL_STORAGE_CLASS DLLEXPORT
#else
# ifdef USE_TCL_STUBS
# define TCL_STORAGE_CLASS
# else
# define TCL_STORAGE_CLASS DLLIMPORT
# endif
#endif
#undef _ANSI_ARGS_
#undef CONST
#if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) || defined(USE_PROTOTYPE)
# define _USING_PROTOTYPES_ 1
# define _ANSI_ARGS_(x) x
# define CONST const
#else
# define _ANSI_ARGS_(x) ()
# define CONST
#endif
#ifdef __cplusplus
# define EXTERN extern "C" TCL_STORAGE_CLASS
#else
# define EXTERN extern TCL_STORAGE_CLASS
#endif
#ifndef __WIN32__
#ifndef VOID
# ifdef __STDC__
# define VOID void
# else
# define VOID char
# endif
#endif
#else
#ifndef VOID
#define VOID void
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
#endif
#endif
#ifndef NULL
#define NULL 0
#endif
typedef struct Tcl_RegExp_ *Tcl_RegExp;
#ifdef TCL_MEM_DEBUG
# define Tcl_Alloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
# define Tcl_Free(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
# define Tcl_Realloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
# define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
# define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
# define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
#else
# if USE_TCLALLOC
# define ckalloc(x) Tcl_Alloc(x)
# define ckfree(x) Tcl_Free(x)
# define ckrealloc(x,y) Tcl_Realloc(x,y)
# else
# define ckalloc(x) malloc(x)
# define ckfree(x) free(x)
# define ckrealloc(x,y) realloc(x,y)
# endif
# define Tcl_DumpActiveMemory(x)
# define Tcl_ValidateAllMemory(x,y)
#endif
#define Tcl_Ckalloc Tcl_Alloc
#define Tcl_Ckfree Tcl_Free
#define Tcl_Ckrealloc Tcl_Realloc
#define Tcl_Return Tcl_SetResult
#define Tcl_TildeSubst Tcl_TranslateFileName
#define Tcl_Panic panic
#define Tcl_PanicVA panicVA
#endif
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
#endif
#ifndef _REGEXP
#define _REGEXP 1
#ifdef BUILD_tcl
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLEXPORT
#endif
#define NSUBEXP 20
typedef struct regexp {
char *startp[NSUBEXP];
char *endp[NSUBEXP];
char regstart;
char reganch;
char *regmust;
int regmlen;
char program[1];
} regexp;
EXTERN regexp *TclRegComp _ANSI_ARGS_((char *exp));
EXTERN int TclRegExec _ANSI_ARGS_((regexp *prog, char *string, char *start));
EXTERN void TclRegSub _ANSI_ARGS_((regexp *prog, char *source, char *dest));
EXTERN void exp_TclRegError _ANSI_ARGS_((char *msg));
EXTERN char *TclGetRegError _ANSI_ARGS_((void));
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
#endif
#include "expect_comm.h"
enum exp_type {
exp_end = 0,
exp_glob,
exp_exact,
exp_regexp,
exp_compiled,
exp_null,
exp_bogus
};
struct exp_case {
char *pattern;
regexp *re;
enum exp_type type;
int value;
};
EXTERN char *exp_buffer;
EXTERN char *exp_buffer_end;
EXTERN char *exp_match;
EXTERN char *exp_match_end;
EXTERN int exp_match_max;
EXTERN int exp_timeout;
EXTERN int exp_full_buffer;
EXTERN int exp_remove_nulls;
EXTERN int exp_pty_timeout;
EXTERN int exp_pid;
EXTERN int exp_autoallocpty;
EXTERN int exp_pty[2];
EXTERN char *exp_pty_slave_name;
EXTERN char *exp_stty_init;
EXTERN int exp_ttycopy;
EXTERN int exp_ttyinit;
EXTERN int exp_console;
#ifdef HAVE_SIGLONGJMP
EXTERN sigjmp_buf exp_readenv;
#else
EXTERN jmp_buf exp_readenv;
#endif
EXTERN int exp_reading;
#define EXP_ABORT 1
#define EXP_RESTART 2
EXTERN int exp_is_debugging;
EXTERN int exp_loguser;
EXTERN void (*exp_close_in_child)();
EXTERN void exp_slave_control _ANSI_ARGS_((int,int));
EXTERN int exp_logfile_all;
EXTERN FILE *exp_debugfile;
EXTERN FILE *exp_logfile;
extern void exp_debuglog _ANSI_ARGS_(TCL_VARARGS(char *,fmt));
extern void exp_errorlog _ANSI_ARGS_(TCL_VARARGS(char *,fmt));
EXTERN int exp_disconnect _ANSI_ARGS_((void));
EXTERN FILE *exp_popen _ANSI_ARGS_((char *command));
EXTERN void (*exp_child_exec_prelude) _ANSI_ARGS_((void));
#ifndef EXP_DEFINE_FNS
EXTERN int exp_spawnl _ANSI_ARGS_(TCL_VARARGS(char *,file));
EXTERN int exp_expectl _ANSI_ARGS_(TCL_VARARGS(int,fd));
EXTERN int exp_fexpectl _ANSI_ARGS_(TCL_VARARGS(FILE *,fp));
#endif
EXTERN int exp_spawnv _ANSI_ARGS_((char *file, char *argv[]));
EXTERN int exp_expectv _ANSI_ARGS_((int fd, struct exp_case *cases));
EXTERN int exp_fexpectv _ANSI_ARGS_((FILE *fp, struct exp_case *cases));
EXTERN int exp_spawnfd _ANSI_ARGS_((int fd));
#endif