177704Seric/*
277704Seric * Copyright (c) 1997 - 2001 Kungliga Tekniska H��gskolan
377704Seric * (Royal Institute of Technology, Stockholm, Sweden).
477704Seric * All rights reserved.
577704Seric *
677704Seric * Redistribution and use in source and binary forms, with or without
777704Seric * modification, are permitted provided that the following conditions
877704Seric * are met:
977704Seric *
1077704Seric * 1. Redistributions of source code must retain the above copyright
1177704Seric *    notice, this list of conditions and the following disclaimer.
1277704Seric *
1377704Seric * 2. Redistributions in binary form must reproduce the above copyright
1477704Seric *    notice, this list of conditions and the following disclaimer in the
1577704Seric *    documentation and/or other materials provided with the distribution.
1677704Seric *
1777704Seric * 3. Neither the name of the Institute nor the names of its contributors
1877704Seric *    may be used to endorse or promote products derived from this software
1977704Seric *    without specific prior written permission.
2077704Seric *
2177704Seric * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
2277704Seric * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2377704Seric * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2477704Seric * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
2577704Seric * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2677704Seric * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2777704Seric * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2877704Seric * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2977704Seric * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3077704Seric * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3177704Seric * SUCH DAMAGE.
3277704Seric */
3377704Seric
3477704Seric/* $Id$ */
3577704Seric
3677704Seric#ifndef __PARSE_UNITS_H__
3777704Seric#define __PARSE_UNITS_H__
3877704Seric
3977704Seric#include <stdio.h>
4077704Seric#include <stddef.h>
4177704Seric
4277704Seric#ifndef ROKEN_LIB_FUNCTION
4377704Seric#ifdef _WIN32
4477704Seric#define ROKEN_LIB_FUNCTION
4577704Seric#define ROKEN_LIB_CALL     __cdecl
4677704Seric#else
4777704Seric#define ROKEN_LIB_FUNCTION
4877704Seric#define ROKEN_LIB_CALL
4977704Seric#endif
5077704Seric#endif
5177704Seric
5277704Sericstruct units {
5377704Seric    const char *name;
5477704Seric    unsigned mult;
5577704Seric};
5677704Seric
5777704SericROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
5877704Sericparse_units (const char *s, const struct units *units,
5977704Seric	     const char *def_unit);
6077704Seric
6177704SericROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
6277704Sericprint_units_table (const struct units *units, FILE *f);
6377704Seric
6477704SericROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
6577704Sericparse_flags (const char *s, const struct units *units,
6677704Seric	     int orig);
6777704Seric
6877704SericROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
6977704Sericunparse_units (int num, const struct units *units, char *s, size_t len);
7077704Seric
7177704SericROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
7277704Sericunparse_units_approx (int num, const struct units *units, char *s,
7377704Seric		      size_t len);
7477704Seric
7577704SericROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
7677704Sericunparse_flags (int num, const struct units *units, char *s, size_t len);
7777704Seric
7877704SericROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
7977704Sericprint_flags_table (const struct units *units, FILE *f);
8077704Seric
8177704Seric#endif /* __PARSE_UNITS_H__ */
8277704Seric