Blame dc/dc.h

Packit 70b277
/*
Packit 70b277
 * Header file for dc routines
Packit 70b277
 *
Packit 70b277
 * Copyright (C) 1994, 1997, 1998, 2008
Packit 70b277
 * Free Software Foundation, Inc.
Packit 70b277
 *
Packit 70b277
 * This program is free software; you can redistribute it and/or modify
Packit 70b277
 * it under the terms of the GNU General Public License as published by
Packit 70b277
 * the Free Software Foundation; either version 3, or (at your option)
Packit 70b277
 * any later version.
Packit 70b277
 *
Packit 70b277
 * This program is distributed in the hope that it will be useful,
Packit 70b277
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 70b277
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 70b277
 * GNU General Public License for more details.
Packit 70b277
 *
Packit 70b277
 * You should have received a copy of the GNU General Public License
Packit 70b277
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 70b277
 *
Packit 70b277
 */
Packit 70b277
Packit 70b277
#ifndef DC_DEFS_H
Packit 70b277
#define DC_DEFS_H
Packit 70b277
Packit 70b277
/* 'I' is a command, and bases 17 and 18 are quite
Packit 70b277
 * unusual, so we limit ourselves to bases 2 to 16
Packit 70b277
 */
Packit 70b277
#define DC_IBASE_MAX	16
Packit 70b277
Packit 70b277
#define DC_SUCCESS		0
Packit 70b277
#define DC_DOMAIN_ERROR	1
Packit 70b277
#define DC_FAIL			2	/* generic failure */
Packit 70b277
Packit 70b277
Packit 70b277
#ifndef __STDC__
Packit 70b277
# define DC_PROTO(x)			()
Packit 70b277
# define DC_DECLVOID()			()
Packit 70b277
# define DC_DECLARG(arglist)	arglist
Packit 70b277
# define DC_DECLSEP				;
Packit 70b277
# define DC_DECLEND				;
Packit 70b277
#else /* __STDC__ */
Packit 70b277
# define DC_PROTO(x)			x
Packit 70b277
# define DC_DECLVOID()			(void)
Packit 70b277
# define DC_DECLARG(arglist)	(
Packit 70b277
# define DC_DECLSEP				,
Packit 70b277
# define DC_DECLEND				)
Packit 70b277
#endif /* __STDC__ */
Packit 70b277
Packit 70b277
Packit 70b277
typedef enum {DC_TOSS, DC_KEEP}   dc_discard;
Packit 70b277
typedef enum {DC_NONL, DC_WITHNL} dc_newline;
Packit 70b277
Packit 70b277
Packit 70b277
/* type discriminant for dc_data */
Packit 70b277
typedef enum {DC_UNINITIALIZED, DC_NUMBER, DC_STRING} dc_value_type;
Packit 70b277
Packit 70b277
/* only numeric.c knows what dc_num's *really* look like */
Packit 70b277
typedef struct dc_number *dc_num;
Packit 70b277
Packit 70b277
/* only string.c knows what dc_str's *really* look like */
Packit 70b277
typedef struct dc_string *dc_str;
Packit 70b277
Packit 70b277
Packit 70b277
/* except for the two implementation-specific modules, all
Packit 70b277
 * dc functions only know of this one generic type of object
Packit 70b277
 */
Packit 70b277
typedef struct {
Packit 70b277
	dc_value_type dc_type;	/* discriminant for union */
Packit 70b277
	union {
Packit 70b277
		dc_num number;
Packit 70b277
		dc_str string;
Packit 70b277
	} v;
Packit 70b277
} dc_data;
Packit 70b277
Packit 70b277
Packit 70b277
/* This is dc's only global variable: */
Packit 70b277
extern const char *progname;	/* basename of program invocation */
Packit 70b277
Packit 70b277
#endif /* not DC_DEFS_H */