uniprint.h revision 131826
117721Speter/*
217721Speter * Copyright (c) 2001-2003
317721Speter *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
417721Speter * 	All rights reserved.
517721Speter *
632785Speter * Redistribution and use in source and binary forms, with or without
717721Speter * modification, are permitted provided that the following conditions
817721Speter * are met:
917721Speter * 1. Redistributions of source code must retain the above copyright
1017721Speter *    notice, this list of conditions and the following disclaimer.
11128266Speter * 2. Redistributions in binary form must reproduce the above copyright
1217721Speter *    notice, this list of conditions and the following disclaimer in the
1325839Speter *    documentation and/or other materials provided with the distribution.
1417721Speter *
1581404Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1681404Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1781404Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1881404Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1981404Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2081404Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2181404Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2281404Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2381404Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2417721Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2517721Speter * SUCH DAMAGE.
2617721Speter *
2717721Speter * Author: Hartmut Brandt <harti@freebsd.org>
2817721Speter *
2954427Speter * $Begemot: libunimsg/netnatm/msg/uniprint.h,v 1.4 2004/07/08 08:22:08 brandt Exp $
3017721Speter *
3117721Speter * Print utility functions. These are only needed if you want to hook to
3217721Speter * the format of the uni printing routines.
3317721Speter */
3417721Speter#ifndef _NETNATM_MSG_UNIPRINT_H_
3517721Speter#define _NETNATM_MSG_UNIPRINT_H_
3617721Speter
3717721Speter#include <netnatm/msg/uni_config.h>
3817721Speter
3917721Speter/*
4017721Speter * This structure is used to define value->string mappings.
4117721Speter * It must be terminated by a { NULL, 0 } entry.
4217721Speter */
4354427Speterstruct uni_print_tbl {
4454427Speter	const char *name;
4554427Speter	u_int val;
4654427Speter};
4754427Spetervoid uni_print_tbl(const char *_entry, u_int _val,
4854427Speter    const struct uni_print_tbl *_tbl, struct unicx *_cx);
4917721Speter
5017721Speter/* initialize printing. This must be called at the start from each external
5117721Speter * callable printing function. */
5217721Spetervoid uni_print_init(char *_buf, size_t _bufsiz, struct unicx *_cx);
5317721Speter
5417721Speter/* End the current (semantical) line. This takes care of indendation and
55128266Speter * actually print the newline in the appropriate modes. */
5617721Spetervoid uni_print_eol(struct unicx *_cx);
5717721Speter
5817721Speter/* Push or pop a prefix. This takes care of indendation. */
5917721Spetervoid uni_print_push_prefix(const char *_prefix, struct unicx *_cx);
6017721Spetervoid uni_print_pop_prefix(struct unicx *_cx);
6117721Speter
6217721Speter/* Print a flag taking care of the right prefixing */
6317721Spetervoid uni_print_flag(const char *_flag, struct unicx *_cx);
6417721Speter
6517721Speter/* Print an entry taking care of the right prefixing */
6617721Spetervoid uni_print_entry(struct unicx *_cx, const char *_entry,
6717721Speter    const char *_fmt, ...) __printflike(3, 4);
6817721Speter
6917721Speter/* Generic printf */
7054427Spetervoid uni_printf(struct unicx *_cx, const char *_fmt, ...) __printflike(2, 3);
7154427Speter
7254427Speter#endif
7354427Speter