/*
** tabcodec.h -- header for tabcodec.c
**
** Tabs Compressor/Expander Package
**
** $Id: tabcodec.h,v 2.1 94/08/09 17:19:55 GF Exp Locker: GF $
**
**************************************************************************
**
** Copyright © 1994 by Gabriele Falcioni. All Rights Reserved.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
** For inquiries, comments, donations, bug reports, write to:
**
** Gabriele Falcioni
** via E. Cialdini, 50
** I-60122 Ancona
** ITALY
**
*/

#ifndef TABCODEC_H
#define TABCODEC_H 1

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

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif

/* --- STRUCTUREs ----------------------------------------------------- */

/*
 * struct TabProcEnv
 *
 * This structure is used by the functions
 * ExpandTabs()/CompressTabs().
 *
 * Use only CreateTabProc()/DeleteTabProc()
 * to create or delete it.
 */

struct TabProcEnv {

	LONG buf_len;

	UBYTE *s_buf;
	UBYTE *d_buf;

	LONG  tab_step;
	UBYTE flags;
	UBYTE pad[3];
};

#define TCDCF_NOSQUOTES	0x01	/* ignore strings enclosed in single quotes */
#define TCDCF_NODQUOTES	0x02	/* ignore strings enclosed in double quotes */
#define TCDCF_NOBKSLASH	0x04	/* ignore backslashes as escape character */

#define TCDCF_NOWARN		0x80	/* suppress warnings about unbalanced strings */

/* --- TAGs ----------------------------------------------------------- */

/* tags for: CreateTabProcEnvA()/CreateTabProcEnv() */

#define TCDCT_BufSize	(TAG_USER+1)	/* (LONG) I/O buffers length in bytes */
#define TCDCT_TabStep	(TAG_USER+2)	/* (LONG) tab step */

#define TCDCT_NoSQuotes	(TAG_USER+10)	/* (BOOL) ignore single quoted strings */
#define TCDCT_NoDQuotes	(TAG_USER+11)	/* (BOOL) ignore double quoted strings */
#define TCDCT_NoBkSlash	(TAG_USER+12)	/* (BOOL) ignore backslash as ESC char */

#define TCDCT_NoWarn		(TAG_USER+20)	/* (BOOL) suppress warnings */

/* --- PROTOTYPEs ----------------------------------------------------- */

struct TabProcEnv *CreateTabProcEnvA(struct TagItem *tl);
struct TabProcEnv * __stdargs CreateTabProcEnv(Tag tag1, ...);
VOID DeleteTabProcEnv(struct TabProcEnv *tpe);

LONG ExpandTabs(struct TabProcEnv *tpe,BPTR infile,BPTR outfile);
LONG CompressTabs(struct TabProcEnv *tpe,BPTR infile,BPTR outfile);

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

#endif /* TABCODEC_H */
