Main Page
Classes
Files
File List
File Members
auxlib
formula-calc
include
formula-calc.h
Go to the documentation of this file.
1
// Simple mathematical formula processing library
2
// Written by Atsushi Watanabe
3
// Intelligent Robot Laboratory, University of Tsukuba
4
//
5
// Copyright 2011 Atsushi Watanabe, All rights reserved.
6
//
7
// Redistribution and use in source and binary forms, with or without
8
// modification, are permitted provided that the following conditions are met:
9
//
10
// * Redistributions of source code must retain the above copyright notice, this
11
// list of conditions and the following disclaimer.
12
// * Redistributions in binary form must reproduce the above copyright notice,
13
// this list of conditions and the following disclaimer in the documentation
14
// and/or other materials provided with the distribution.
15
//
16
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
17
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19
// EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27
#ifndef FORMULA_CALC_H
28
#define FORMULA_CALC_H
29
30
#ifdef __cplusplus
31
// clang-format off
32
extern
"C"
33
{
34
// clang-format on
35
#endif // __cplusplus
36
37
#include <stdio.h>
38
39
enum
rpf_type_t
40
{
41
TYPE_VALUE
,
42
TYPE_MATH
,
43
TYPE_VARIABLE
,
44
TYPE_OP
,
45
TYPE_MAX
,
46
TYPE_RPF
,
47
TYPE_START
48
};
49
50
struct
rpf_t
51
{
52
enum
rpf_type_t
type
;
53
void
*
value
;
54
struct
rpf_t
*
next
;
55
};
56
57
struct
variables_t
58
{
59
const
char
*
name
;
60
double
*
pointer
;
61
};
62
63
int
formula
(
const
char
*expr,
struct
rpf_t
**rpf,
const
struct
variables_t
*variable);
64
void
formula_free
(
struct
rpf_t
*rpf);
65
double
formula_eval
(
struct
rpf_t
*rpf);
66
struct
rpf_t
*
formula_optimize
(
struct
rpf_t
*rpf);
67
void
formula_print
(FILE *stream,
struct
rpf_t
*rpf);
68
69
#ifdef __cplusplus
70
}
71
#endif // __cplusplus
72
#endif // FORMULA_CALC_H
TYPE_MAX
Definition:
formula-calc.h:45
rpf_t::next
struct rpf_t * next
Definition:
formula-calc.h:54
TYPE_VALUE
Definition:
formula-calc.h:41
TYPE_RPF
Definition:
formula-calc.h:46
rpf_type_t
rpf_type_t
Definition:
formula-calc.h:39
rpf_t::type
enum rpf_type_t type
Definition:
formula-calc.h:52
TYPE_START
Definition:
formula-calc.h:47
formula_optimize
struct rpf_t * formula_optimize(struct rpf_t *rpf)
Definition:
libformula-calc.c:670
formula_eval
double formula_eval(struct rpf_t *rpf)
Definition:
libformula-calc.c:639
TYPE_OP
Definition:
formula-calc.h:44
formula
int formula(const char *expr, struct rpf_t **rpf, const struct variables_t *variable)
Definition:
libformula-calc.c:356
formula_print
void formula_print(FILE *stream, struct rpf_t *rpf)
Definition:
libformula-calc.c:755
rpf_t::value
void * value
Definition:
formula-calc.h:53
TYPE_VARIABLE
Definition:
formula-calc.h:43
rpf_t
Definition:
formula-calc.h:50
variables_t
Definition:
formula-calc.h:57
formula_free
void formula_free(struct rpf_t *rpf)
Definition:
libformula-calc.c:618
TYPE_MATH
Definition:
formula-calc.h:42
variables_t::name
const char * name
Definition:
formula-calc.h:59
variables_t::pointer
double * pointer
Definition:
formula-calc.h:60
yp-spur
Author(s):
autogenerated on Sat May 11 2019 02:08:24