14ecbd6dmarkm/*
233f661cstas * Copyright (c) 1997 - 2001 Kungliga Tekniska H��gskolan
333f661cstas * (Royal Institute of Technology, Stockholm, Sweden).
433f661cstas * All rights reserved.
54ecbd6dmarkm *
633f661cstas * Redistribution and use in source and binary forms, with or without
733f661cstas * modification, are permitted provided that the following conditions
833f661cstas * are met:
94ecbd6dmarkm *
1033f661cstas * 1. Redistributions of source code must retain the above copyright
1133f661cstas *    notice, this list of conditions and the following disclaimer.
124ecbd6dmarkm *
1333f661cstas * 2. Redistributions in binary form must reproduce the above copyright
1433f661cstas *    notice, this list of conditions and the following disclaimer in the
1533f661cstas *    documentation and/or other materials provided with the distribution.
164ecbd6dmarkm *
1733f661cstas * 3. Neither the name of the Institute nor the names of its contributors
1833f661cstas *    may be used to endorse or promote products derived from this software
1933f661cstas *    without specific prior written permission.
204ecbd6dmarkm *
2133f661cstas * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
2233f661cstas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2333f661cstas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2433f661cstas * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
2533f661cstas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2633f661cstas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2733f661cstas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2833f661cstas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2933f661cstas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3033f661cstas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3133f661cstas * SUCH DAMAGE.
324ecbd6dmarkm */
334ecbd6dmarkm
3433f661cstas/* $Id$ */
354ecbd6dmarkm
364ecbd6dmarkm#ifndef __PARSE_UNITS_H__
374ecbd6dmarkm#define __PARSE_UNITS_H__
384ecbd6dmarkm
394ecbd6dmarkm#include <stdio.h>
404ecbd6dmarkm#include <stddef.h>
414ecbd6dmarkm
4251b6601dfr#ifndef ROKEN_LIB_FUNCTION
4351b6601dfr#ifdef _WIN32
4433f661cstas#define ROKEN_LIB_FUNCTION
4533f661cstas#define ROKEN_LIB_CALL     __cdecl
4651b6601dfr#else
4751b6601dfr#define ROKEN_LIB_FUNCTION
4833f661cstas#define ROKEN_LIB_CALL
4951b6601dfr#endif
5051b6601dfr#endif
5151b6601dfr
524ecbd6dmarkmstruct units {
534ecbd6dmarkm    const char *name;
544ecbd6dmarkm    unsigned mult;
554ecbd6dmarkm};
564ecbd6dmarkm
5733f661cstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
584ecbd6dmarkmparse_units (const char *s, const struct units *units,
594ecbd6dmarkm	     const char *def_unit);
604ecbd6dmarkm
6133f661cstasROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
624ecbd6dmarkmprint_units_table (const struct units *units, FILE *f);
634ecbd6dmarkm
6433f661cstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
654ecbd6dmarkmparse_flags (const char *s, const struct units *units,
664ecbd6dmarkm	     int orig);
674ecbd6dmarkm
6833f661cstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
694ecbd6dmarkmunparse_units (int num, const struct units *units, char *s, size_t len);
704ecbd6dmarkm
7133f661cstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
724ecbd6dmarkmunparse_units_approx (int num, const struct units *units, char *s,
734ecbd6dmarkm		      size_t len);
744ecbd6dmarkm
7533f661cstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
764ecbd6dmarkmunparse_flags (int num, const struct units *units, char *s, size_t len);
774ecbd6dmarkm
7833f661cstasROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
794ecbd6dmarkmprint_flags_table (const struct units *units, FILE *f);
804ecbd6dmarkm
814ecbd6dmarkm#endif /* __PARSE_UNITS_H__ */
82