-
Notifications
You must be signed in to change notification settings - Fork 0
/
group__sg__expr.html
707 lines (677 loc) · 39.3 KB
/
group__sg__expr.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Sagui library: Math expression evaluator</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="sagui.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Sagui library<span id="projectnumber"> v3.5.0</span>
</div>
<div id="projectbrief">Cross-platform library which helps to develop web servers or frameworks.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<span id="MSearchSelect" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"> </span>
<input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Data Structures</a> |
<a href="#typedef-members">Typedefs</a> |
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">Math expression evaluator<div class="ingroups"><a class="el" href="group__sg__api.html">API reference</a></div></div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsg__expr__extension.html">sg_expr_extension</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsg__expr.html">sg_expr</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsg__expr__argument.html">sg_expr_argument</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gadf83fbc817bb0c4abc917395c6e564dd"><td class="memItemLeft" align="right" valign="top">typedef double(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#gadf83fbc817bb0c4abc917395c6e564dd">sg_expr_func</a>) (void *cls, struct <a class="el" href="structsg__expr__argument.html">sg_expr_argument</a> *args, const char *identifier)</td></tr>
<tr class="separator:gadf83fbc817bb0c4abc917395c6e564dd"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:gaac22dc7f6a4edce2cd8845cc5a0b72f3"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#gaac22dc7f6a4edce2cd8845cc5a0b72f3">sg_expr_err_type</a> { <br />
  <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a681f0c2ee4cdcf062aec934132a8ae00">SG_EXPR_ERR_UNKNOWN</a>
, <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a1fae397a1270e9352f5f5da47b60021f">SG_EXPR_ERR_UNEXPECTED_NUMBER</a>
, <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3ab7d6899d0c1c56d1f2bbf25756e2b8a6">SG_EXPR_ERR_UNEXPECTED_WORD</a>
, <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a5c8570e426ef0d8db7d3efbcec169a1a">SG_EXPR_ERR_UNEXPECTED_PARENS</a>
, <br />
  <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a4867e53159d8f7b1a5d8aa5d801066c2">SG_EXPR_ERR_MISSING_OPERAND</a>
, <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a021db002204e74e2424abb1023923017">SG_EXPR_ERR_UNKNOWN_OPERATOR</a>
, <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3acf24773c6d4be00e44d6afaf95af94cd">SG_EXPR_ERR_INVALID_FUNC_NAME</a>
, <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a0f8fa429097a703d9cc89e01b16552c8">SG_EXPR_ERR_BAD_PARENS</a>
, <br />
  <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a7f0a5897c78168f0632509ade6ea320b">SG_EXPR_ERR_TOO_FEW_FUNC_ARGS</a>
, <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a122a3f8dd7fdb0b5afddd7319d5aeb91">SG_EXPR_ERR_FIRST_ARG_IS_NOT_VAR</a>
, <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a879010d912605d133e2d1a493d63eedf">SG_EXPR_ERR_BAD_VARIABLE_NAME</a>
, <a class="el" href="group__sg__expr.html#ggaac22dc7f6a4edce2cd8845cc5a0b72f3a1e0bf363d3087b94f4a90b206395b94a">SG_EXPR_ERR_BAD_ASSIGNMENT</a>
<br />
}</td></tr>
<tr class="separator:gaac22dc7f6a4edce2cd8845cc5a0b72f3"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga510eeffdf7ce30732f8369e3aa1b6cb2"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#ga510eeffdf7ce30732f8369e3aa1b6cb2">sg_expr_new</a> (void) __attribute__((malloc))</td></tr>
<tr class="separator:ga510eeffdf7ce30732f8369e3aa1b6cb2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga2ac47b719be879f1e19662c3076b12b6"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#ga2ac47b719be879f1e19662c3076b12b6">sg_expr_free</a> (struct <a class="el" href="structsg__expr.html">sg_expr</a> *expr)</td></tr>
<tr class="separator:ga2ac47b719be879f1e19662c3076b12b6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga10c2f1e91cc8ddcb40fa501939a9cfe0"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#ga10c2f1e91cc8ddcb40fa501939a9cfe0">sg_expr_compile</a> (struct <a class="el" href="structsg__expr.html">sg_expr</a> *expr, const char *str, size_t len, struct <a class="el" href="structsg__expr__extension.html">sg_expr_extension</a> *extensions)</td></tr>
<tr class="separator:ga10c2f1e91cc8ddcb40fa501939a9cfe0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga8846fb91e460cc29fafbec7c1ad0566d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#ga8846fb91e460cc29fafbec7c1ad0566d">sg_expr_clear</a> (struct <a class="el" href="structsg__expr.html">sg_expr</a> *expr)</td></tr>
<tr class="separator:ga8846fb91e460cc29fafbec7c1ad0566d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaacec551e0ffe9f39877b7500b5c6d606"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#gaacec551e0ffe9f39877b7500b5c6d606">sg_expr_eval</a> (struct <a class="el" href="structsg__expr.html">sg_expr</a> *expr)</td></tr>
<tr class="separator:gaacec551e0ffe9f39877b7500b5c6d606"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga8427b02662b7f194fc8b656ecf636d9b"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#ga8427b02662b7f194fc8b656ecf636d9b">sg_expr_var</a> (struct <a class="el" href="structsg__expr.html">sg_expr</a> *expr, const char *name, size_t len)</td></tr>
<tr class="separator:ga8427b02662b7f194fc8b656ecf636d9b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf720558ef5a55d0068dd7ab4f9dd5c82"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#gaf720558ef5a55d0068dd7ab4f9dd5c82">sg_expr_set_var</a> (struct <a class="el" href="structsg__expr.html">sg_expr</a> *expr, const char *name, size_t len, double val)</td></tr>
<tr class="separator:gaf720558ef5a55d0068dd7ab4f9dd5c82"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gacc0947d3507b46be2e38ff0bdeae4138"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#gacc0947d3507b46be2e38ff0bdeae4138">sg_expr_arg</a> (struct <a class="el" href="structsg__expr__argument.html">sg_expr_argument</a> *args, int index)</td></tr>
<tr class="separator:gacc0947d3507b46be2e38ff0bdeae4138"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gababbdaf2835daec5b295309205fca28d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#gababbdaf2835daec5b295309205fca28d">sg_expr_near</a> (struct <a class="el" href="structsg__expr.html">sg_expr</a> *expr)</td></tr>
<tr class="separator:gababbdaf2835daec5b295309205fca28d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga0407c5a6ef7ea0ce3936850fbbcc40be"><td class="memItemLeft" align="right" valign="top">enum <a class="el" href="group__sg__expr.html#gaac22dc7f6a4edce2cd8845cc5a0b72f3">sg_expr_err_type</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#ga0407c5a6ef7ea0ce3936850fbbcc40be">sg_expr_err</a> (struct <a class="el" href="structsg__expr.html">sg_expr</a> *expr)</td></tr>
<tr class="separator:ga0407c5a6ef7ea0ce3936850fbbcc40be"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9b4f27b21ed16b435105439bb60a8cfd"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#ga9b4f27b21ed16b435105439bb60a8cfd">sg_expr_strerror</a> (struct <a class="el" href="structsg__expr.html">sg_expr</a> *expr)</td></tr>
<tr class="separator:ga9b4f27b21ed16b435105439bb60a8cfd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga73091f6a5d79448d2e9daa50bf952970"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__sg__expr.html#ga73091f6a5d79448d2e9daa50bf952970">sg_expr_calc</a> (const char *str, size_t len)</td></tr>
<tr class="separator:ga73091f6a5d79448d2e9daa50bf952970"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Mathematical expression evaluator. </p>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="gadf83fbc817bb0c4abc917395c6e564dd" name="gadf83fbc817bb0c4abc917395c6e564dd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadf83fbc817bb0c4abc917395c6e564dd">◆ </a></span>sg_expr_func</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef double(* sg_expr_func) (void *cls, struct <a class="el" href="structsg__expr__argument.html">sg_expr_argument</a> *args, const char *identifier)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Callback signature to specify a function at build time to be executed at run time in a mathematical expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[out]</td><td class="paramname">cls</td><td>User-defined closure. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">args</td><td>Floating-point arguments passed to the function. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">identifier</td><td>Null-terminated string to identify the function. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Floating-point value calculated at build time to be used at run time in a mathematical expression. </dd></dl>
</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="gaac22dc7f6a4edce2cd8845cc5a0b72f3" name="gaac22dc7f6a4edce2cd8845cc5a0b72f3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaac22dc7f6a4edce2cd8845cc5a0b72f3">◆ </a></span>sg_expr_err_type</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__sg__expr.html#gaac22dc7f6a4edce2cd8845cc5a0b72f3">sg_expr_err_type</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Possible error types returned by the mathematical expression evaluator. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a681f0c2ee4cdcf062aec934132a8ae00" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a681f0c2ee4cdcf062aec934132a8ae00"></a>SG_EXPR_ERR_UNKNOWN </td><td class="fielddoc"><p>Error not related to evaluation, e.g. <code>EINVAL</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a1fae397a1270e9352f5f5da47b60021f" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a1fae397a1270e9352f5f5da47b60021f"></a>SG_EXPR_ERR_UNEXPECTED_NUMBER </td><td class="fielddoc"><p>Unexpected number, e.g. <code>"(1+2)3"</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3ab7d6899d0c1c56d1f2bbf25756e2b8a6" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3ab7d6899d0c1c56d1f2bbf25756e2b8a6"></a>SG_EXPR_ERR_UNEXPECTED_WORD </td><td class="fielddoc"><p>Unexpected word, e.g. <code>"(1+2)x"</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a5c8570e426ef0d8db7d3efbcec169a1a" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a5c8570e426ef0d8db7d3efbcec169a1a"></a>SG_EXPR_ERR_UNEXPECTED_PARENS </td><td class="fielddoc"><p>Unexpected parenthesis, e.g. <code>"1(2+3)"</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a4867e53159d8f7b1a5d8aa5d801066c2" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a4867e53159d8f7b1a5d8aa5d801066c2"></a>SG_EXPR_ERR_MISSING_OPERAND </td><td class="fielddoc"><p>Missing expected operand, e.g. <code>"0^+1"</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a021db002204e74e2424abb1023923017" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a021db002204e74e2424abb1023923017"></a>SG_EXPR_ERR_UNKNOWN_OPERATOR </td><td class="fielddoc"><p>Unknown operator, e.g. <code>"(1+2)."</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3acf24773c6d4be00e44d6afaf95af94cd" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3acf24773c6d4be00e44d6afaf95af94cd"></a>SG_EXPR_ERR_INVALID_FUNC_NAME </td><td class="fielddoc"><p>Invalid function name, e.g. <code>"unknownfunc()"</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a0f8fa429097a703d9cc89e01b16552c8" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a0f8fa429097a703d9cc89e01b16552c8"></a>SG_EXPR_ERR_BAD_PARENS </td><td class="fielddoc"><p>Bad parenthesis, e.g. <code>"(1+2"</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a7f0a5897c78168f0632509ade6ea320b" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a7f0a5897c78168f0632509ade6ea320b"></a>SG_EXPR_ERR_TOO_FEW_FUNC_ARGS </td><td class="fielddoc"><p>Too few arguments passed to a macro, e.g. <code>"$()"</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a122a3f8dd7fdb0b5afddd7319d5aeb91" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a122a3f8dd7fdb0b5afddd7319d5aeb91"></a>SG_EXPR_ERR_FIRST_ARG_IS_NOT_VAR </td><td class="fielddoc"><p>First macro argument is not variable, e.g. <code>"$(1)"</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a879010d912605d133e2d1a493d63eedf" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a879010d912605d133e2d1a493d63eedf"></a>SG_EXPR_ERR_BAD_VARIABLE_NAME </td><td class="fielddoc"><p>Bad variable name, e.g. <code>"2.3.4"</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a1e0bf363d3087b94f4a90b206395b94a" name="ggaac22dc7f6a4edce2cd8845cc5a0b72f3a1e0bf363d3087b94f4a90b206395b94a"></a>SG_EXPR_ERR_BAD_ASSIGNMENT </td><td class="fielddoc"><p>Bad assignment, e.g. <code>"2=3"</code>. </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga510eeffdf7ce30732f8369e3aa1b6cb2" name="ga510eeffdf7ce30732f8369e3aa1b6cb2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga510eeffdf7ce30732f8369e3aa1b6cb2">◆ </a></span>sg_expr_new()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct <a class="el" href="structsg__expr.html">sg_expr</a> * sg_expr_new </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new mathematical expression evaluator handle. </p><dl class="section return"><dt>Returns</dt><dd>New mathematical expression evaluator handle. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">NULL</td><td>If no memory space is available and set the <code>errno</code> to <code>ENOMEM</code>. </td></tr>
</table>
</dd>
</dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_expr_full_8c-example.html#a5">example_expr_full.c</a>.</dd>
</dl>
</div>
</div>
<a id="ga2ac47b719be879f1e19662c3076b12b6" name="ga2ac47b719be879f1e19662c3076b12b6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2ac47b719be879f1e19662c3076b12b6">◆ </a></span>sg_expr_free()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void sg_expr_free </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td>
<td class="paramname"><em>expr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Frees the mathematical expression evaluator handle previously allocated by <a class="el" href="group__sg__expr.html#ga510eeffdf7ce30732f8369e3aa1b6cb2">sg_expr_new()</a>. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">expr</td><td>Expression evaluator handle. </td></tr>
</table>
</dd>
</dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_expr_full_8c-example.html#a10">example_expr_full.c</a>.</dd>
</dl>
</div>
</div>
<a id="ga10c2f1e91cc8ddcb40fa501939a9cfe0" name="ga10c2f1e91cc8ddcb40fa501939a9cfe0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga10c2f1e91cc8ddcb40fa501939a9cfe0">◆ </a></span>sg_expr_compile()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int sg_expr_compile </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>str</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct <a class="el" href="structsg__expr__extension.html">sg_expr_extension</a> * </td>
<td class="paramname"><em>extensions</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Compiles a mathematical expression allowing to declare variables, macros and extensions. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">expr</td><td>Mathematical expression instance. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">str</td><td>Null-terminated string with the mathematical expression to be compiled. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>Length of the mathematical expression to be compiled. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">extensions</td><td>Array of extensions to extend the evaluator. </td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The extension array must be terminated by a zeroed item. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">0</td><td>Success. </td></tr>
<tr><td class="paramname">EINVAL</td><td>Invalid argument. </td></tr>
<tr><td class="paramname">ENOENT</td><td>Missing a needed extenssion. </td></tr>
<tr><td class="paramname">EALREADY</td><td>Mathematical expression already compiled. </td></tr>
<tr><td class="paramname">ENOMEM</td><td>Out of memory. </td></tr>
</table>
</dd>
</dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_expr_full_8c-example.html#a6">example_expr_full.c</a>.</dd>
</dl>
</div>
</div>
<a id="ga8846fb91e460cc29fafbec7c1ad0566d" name="ga8846fb91e460cc29fafbec7c1ad0566d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8846fb91e460cc29fafbec7c1ad0566d">◆ </a></span>sg_expr_clear()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int sg_expr_clear </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td>
<td class="paramname"><em>expr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Clears a mathematical expression instance. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">expr</td><td>Mathematical expression instance. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">0</td><td>Success. </td></tr>
<tr><td class="paramname">EINVAL</td><td>Invalid argument. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gaacec551e0ffe9f39877b7500b5c6d606" name="gaacec551e0ffe9f39877b7500b5c6d606"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaacec551e0ffe9f39877b7500b5c6d606">◆ </a></span>sg_expr_eval()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double sg_expr_eval </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td>
<td class="paramname"><em>expr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Evaluates a compiled mathematical expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">expr</td><td>Compiled mathematical expression. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Floating-point value of the evaluated mathematical expression. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">NAN</td><td>If the <b><code class="paramname">expr</code></b> is null and set the <code>errno</code> to <code>EINVAL</code>. </td></tr>
</table>
</dd>
</dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_expr_full_8c-example.html#a7">example_expr_full.c</a>.</dd>
</dl>
</div>
</div>
<a id="ga8427b02662b7f194fc8b656ecf636d9b" name="ga8427b02662b7f194fc8b656ecf636d9b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8427b02662b7f194fc8b656ecf636d9b">◆ </a></span>sg_expr_var()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double sg_expr_var </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the value of a declared variable. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">expr</td><td>Mathematical expression instance. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">name</td><td>Name of the declared variable. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>Length of the variable name. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">NAN</td><td><ul>
<li>If <b><code class="paramname">expr</code></b> or <b><code class="paramname">name</code></b> is null, or <b><code class="paramname">len</code></b> is less than one, and set the <code>errno</code> to <code>EINVAL</code>.</li>
<li>If no memory space is available and set the <code>errno</code> to <code>ENOMEM</code>. </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gaf720558ef5a55d0068dd7ab4f9dd5c82" name="gaf720558ef5a55d0068dd7ab4f9dd5c82"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf720558ef5a55d0068dd7ab4f9dd5c82">◆ </a></span>sg_expr_set_var()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int sg_expr_set_var </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>val</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets a variable to the mathematical expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">expr</td><td>Mathematical expression instance. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">name</td><td>Name for the variable. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>Length of the variable name. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">val</td><td>Value for the variable. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">0</td><td>Success. </td></tr>
<tr><td class="paramname">EINVAL</td><td>Invalid argument. </td></tr>
<tr><td class="paramname">ENOMEM</td><td>Out of memory. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gacc0947d3507b46be2e38ff0bdeae4138" name="gacc0947d3507b46be2e38ff0bdeae4138"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacc0947d3507b46be2e38ff0bdeae4138">◆ </a></span>sg_expr_arg()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double sg_expr_arg </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr__argument.html">sg_expr_argument</a> * </td>
<td class="paramname"><em>args</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>index</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets a function argument by its index. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">args</td><td>Arguments list. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>Argument index. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">NAN</td><td>If the <b><code class="paramname">args</code></b> is null or <b><code class="paramname">index</code></b> is less than zero and set the <code>errno</code> to <code>EINVAL</code>. </td></tr>
</table>
</dd>
</dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_expr_full_8c-example.html#a1">example_expr_full.c</a>.</dd>
</dl>
</div>
</div>
<a id="gababbdaf2835daec5b295309205fca28d" name="gababbdaf2835daec5b295309205fca28d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gababbdaf2835daec5b295309205fca28d">◆ </a></span>sg_expr_near()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int sg_expr_near </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td>
<td class="paramname"><em>expr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the nearby position of an error in the mathematical expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">expr</td><td>Compiled mathematical expression. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">0</td><td>Success. </td></tr>
<tr><td class="paramname">EINVAL</td><td>Invalid argument. </td></tr>
</table>
</dd>
</dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_expr_full_8c-example.html#a9">example_expr_full.c</a>.</dd>
</dl>
</div>
</div>
<a id="ga0407c5a6ef7ea0ce3936850fbbcc40be" name="ga0407c5a6ef7ea0ce3936850fbbcc40be"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0407c5a6ef7ea0ce3936850fbbcc40be">◆ </a></span>sg_expr_err()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__sg__expr.html#gaac22dc7f6a4edce2cd8845cc5a0b72f3">sg_expr_err_type</a> sg_expr_err </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td>
<td class="paramname"><em>expr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the type of an error in the mathematical expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">expr</td><td>Compiled mathematical expression. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Enumerator representing the error type. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">SG_EXPR_ERR_UNKNOWN</td><td>If the <b><code class="paramname">expr</code></b> is null or an unknown error occurred and set the <code>errno</code> to <code>EINVAL</code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga9b4f27b21ed16b435105439bb60a8cfd" name="ga9b4f27b21ed16b435105439bb60a8cfd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9b4f27b21ed16b435105439bb60a8cfd">◆ </a></span>sg_expr_strerror()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char * sg_expr_strerror </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structsg__expr.html">sg_expr</a> * </td>
<td class="paramname"><em>expr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the description of an error in the mathematical expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">expr</td><td>Compiled mathematical expression. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Description of the error as a null-terminated string. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">NULL</td><td>If the <b><code class="paramname">expr</code></b> is null and set the <code>errno</code> to <code>EINVAL</code>. </td></tr>
</table>
</dd>
</dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_expr_full_8c-example.html#a8">example_expr_full.c</a>.</dd>
</dl>
</div>
</div>
<a id="ga73091f6a5d79448d2e9daa50bf952970" name="ga73091f6a5d79448d2e9daa50bf952970"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga73091f6a5d79448d2e9daa50bf952970">◆ </a></span>sg_expr_calc()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double sg_expr_calc </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>str</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the evaluated value of a mathematical expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">str</td><td>Null-terminated string with the mathematical expression to be evaluated. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>Length of the mathematical expression to be evaluated. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">NAN</td><td>If <b><code class="paramname">str</code></b> is null, or <b><code class="paramname">len</code></b> is less than one, and set the <code>errno</code> to <code>EINVAL</code>. </td></tr>
</table>
</dd>
</dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_expr_basic_8c-example.html#a0">example_expr_basic.c</a>.</dd>
</dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Feb 14 2024 15:11:39 for Sagui library by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7
</small></address>
</body>
</html>