This file is indexed.

/usr/share/gtk-doc/html/libgwyddion/libgwyddion-GwyExpr.html is in libgwyddion20-doc 2.50-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GwyExpr: Gwyddion Library Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="Gwyddion Library Reference Manual">
<link rel="up" href="index.html" title="Gwyddion Library Reference Manual">
<link rel="prev" href="GwyFDCurvePreset.html" title="GwyFDCurvePreset">
<link rel="next" href="GwySIUnit.html" title="GwySIUnit">
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#libgwyddion-GwyExpr.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
<td><a accesskey="p" href="GwyFDCurvePreset.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GwySIUnit.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="libgwyddion-GwyExpr"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libgwyddion-GwyExpr.top_of_page"></a>GwyExpr</span></h2>
<p>GwyExpr — Arithmetic expression parser and evaluator</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libgwyddion-GwyExpr.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Quarks.html#GQuark"><span class="returnvalue">GQuark</span></a>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-error-quark" title="gwy_expr_error_quark ()">gwy_expr_error_quark</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="returnvalue">GwyExpr</span></a> *
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-new" title="gwy_expr_new ()">gwy_expr_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-free" title="gwy_expr_free ()">gwy_expr_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-evaluate" title="gwy_expr_evaluate ()">gwy_expr_evaluate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-compile" title="gwy_expr_compile ()">gwy_expr_compile</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-resolve-variables" title="gwy_expr_resolve_variables ()">gwy_expr_resolve_variables</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-get-variables" title="gwy_expr_get_variables ()">gwy_expr_get_variables</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Basic-Types.html#gdouble"><span class="returnvalue">gdouble</span></a>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-execute" title="gwy_expr_execute ()">gwy_expr_execute</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-vector-execute" title="gwy_expr_vector_execute ()">gwy_expr_vector_execute</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-define-constant" title="gwy_expr_define_constant ()">gwy_expr_define_constant</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-undefine-constant" title="gwy_expr_undefine_constant ()">gwy_expr_undefine_constant</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-get-expression" title="gwy_expr_get_expression ()">gwy_expr_get_expression</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libgwyddion-GwyExpr.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgwyddion-GwyExpr.html#GWY-EXPR-ERROR:CAPS" title="GWY_EXPR_ERROR">GWY_EXPR_ERROR</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="libgwyddion-GwyExpr.html#GwyExprError" title="enum GwyExprError">GwyExprError</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr">GwyExpr</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libgwyddion-GwyExpr.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;libgwyddion/gwyddion.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="libgwyddion-GwyExpr.description"></a><h2>Description</h2>
<p><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> is an expression evaluator, more precisely parser, compiler, and
evaluator. A new <a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> can be created with <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-new" title="gwy_expr_new ()"><code class="function">gwy_expr_new()</code></a>, then it can be
used to evaluate any number of expressions; when it's no longer needed, it
should be destroyed with <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-free" title="gwy_expr_free ()"><code class="function">gwy_expr_free()</code></a>.</p>
<p>Expression syntax is described in</p>
<a class="ulink" href="http://gwyddion.net/documentation/user-guide/expression-syntax.html" target="_top">Gwyddion user guide</a>.
<p>Simple arithmetic expressions without variables can be directly evaluated
with <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-evaluate" title="gwy_expr_evaluate ()"><code class="function">gwy_expr_evaluate()</code></a>.</p>
<p>Expression with variables have to be compiled first with <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-compile" title="gwy_expr_compile ()"><code class="function">gwy_expr_compile()</code></a>.
Then either <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-resolve-variables" title="gwy_expr_resolve_variables ()"><code class="function">gwy_expr_resolve_variables()</code></a> or <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-get-variables" title="gwy_expr_get_variables ()"><code class="function">gwy_expr_get_variables()</code></a> can be
used to obtain information what variables are present in the expression and
at which positions (variables are referenced by position, not name during
final evaluation because of effieiency reasons). Subsequent evaluation with
variable substitution is performed by <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-execute" title="gwy_expr_execute ()"><code class="function">gwy_expr_execute()</code></a>. It is also
possible to evaluate expression on each item of value arrays with
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-vector-execute" title="gwy_expr_vector_execute ()"><code class="function">gwy_expr_vector_execute()</code></a>.</p>
<p>One-shot evaluation of expressions without variables is easy:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GwyExpr</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">expr</span><span class="symbol">;</span>
<span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">err </span><span class="symbol">=</span><span class="normal"> <a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="usertype">gdouble</span><span class="normal"> result</span><span class="symbol">;</span>

<span class="normal">expr </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="#gwy-expr-new">gwy_expr_new</a></span><span class="symbol">();</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="function"><a href="#gwy-expr-evaluate">gwy_expr_evaluate</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"1+2"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">result</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">err</span><span class="symbol">))</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">    </span><span class="comment">/* Handle compilation error */</span>
<span class="cbracket">}</span>
<span class="function"><a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="symbol">(</span><span class="string">"The result: %g</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> result</span><span class="symbol">);</span>
<span class="function"><a href="#gwy-expr-free">gwy_expr_free</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>One-shot evaluation of expressions with known variables can be performed by
defining them as constants beforehand:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GwyExpr</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">expr</span><span class="symbol">;</span>
<span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">err </span><span class="symbol">=</span><span class="normal"> <a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="usertype">gdouble</span><span class="normal"> result</span><span class="symbol">;</span>

<span class="comment">/* Create expression and define variables as constants */</span>
<span class="normal">expr </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="#gwy-expr-new">gwy_expr_new</a></span><span class="symbol">();</span>
<span class="function"><a href="#gwy-expr-define-constant">gwy_expr_define_constant</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"x"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">3.0</span><span class="symbol">,</span><span class="normal"> <a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="function"><a href="#gwy-expr-define-constant">gwy_expr_define_constant</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"y"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">4.0</span><span class="symbol">,</span><span class="normal"> <a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="comment">/* Evaluate expression */</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="function"><a href="#gwy-expr-evaluate">gwy_expr_evaluate</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"hypot x,y"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">result</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">err</span><span class="symbol">))</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">    </span><span class="comment">/* Handle compilation error */</span>
<span class="cbracket">}</span>
<span class="function"><a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="symbol">(</span><span class="string">"The result: %g</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> result</span><span class="symbol">);</span>

<span class="function"><a href="#gwy-expr-free">gwy_expr_free</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>When the same expression is evaluated multiple times with different
variable values and the variables are again from some known set, the
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-resolve-variables" title="gwy_expr_resolve_variables ()"><code class="function">gwy_expr_resolve_variables()</code></a> should be used (if the repeated evaluation
happens over items of some arrays, <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-vector-execute" title="gwy_expr_vector_execute ()"><code class="function">gwy_expr_vector_execute()</code></a> is more
efficient and usually simplier to use too):</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>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</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GwyExpr</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">expr</span><span class="symbol">;</span>
<span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">err </span><span class="symbol">=</span><span class="normal"> <a href="http://developer.gnome.org/doc/API/2.0/gtk/glibglib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="keyword">const</span><span class="normal"> <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar">gchar</a> </span><span class="symbol">*</span><span class="keyword">const</span><span class="normal"> var_names</span><span class="symbol">[]</span><span class="normal"> </span><span class="symbol">=</span><span class="normal"> </span><span class="cbracket">{</span><span class="normal"> </span><span class="string">"lambda"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"theta"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"psi"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"d"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"k"</span><span class="normal"> </span><span class="cbracket">}</span><span class="symbol">;</span>
<span class="keyword">const</span><span class="normal"> </span><span class="usertype">gdouble</span><span class="normal"> var_values1</span><span class="symbol">[]</span><span class="normal"> </span><span class="symbol">=</span><span class="normal"> </span><span class="cbracket">{</span><span class="normal"> </span><span class="number">300.0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">0.09</span><span class="symbol">,</span><span class="normal"> </span><span class="number">2.0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">52.3</span><span class="symbol">,</span><span class="normal"> </span><span class="number">1.43</span><span class="normal"> </span><span class="cbracket">}</span><span class="symbol">;</span>
<span class="keyword">const</span><span class="normal"> </span><span class="usertype">gdouble</span><span class="normal"> var_values2</span><span class="symbol">[]</span><span class="normal"> </span><span class="symbol">=</span><span class="normal"> </span><span class="cbracket">{</span><span class="normal"> </span><span class="number">400.0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">0.12</span><span class="symbol">,</span><span class="normal"> </span><span class="number">2.0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">54.1</span><span class="symbol">,</span><span class="normal"> </span><span class="number">1.44</span><span class="normal"> </span><span class="cbracket">}</span><span class="symbol">;</span>
<span class="usertype">guint</span><span class="normal"> var_positions</span><span class="symbol">[</span><span class="function"><a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#G-N-ELEMENTS:CAPS">G_N_ELEMENTS</a></span><span class="symbol">(</span><span class="normal">var_names</span><span class="symbol">)];</span>
<span class="usertype">gdouble</span><span class="normal"> vars</span><span class="symbol">[</span><span class="function"><a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#G-N-ELEMENTS:CAPS">G_N_ELEMENTS</a></span><span class="symbol">(</span><span class="normal">var_names</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">+</span><span class="normal"> </span><span class="number">1</span><span class="symbol">];</span>
<span class="usertype">guint</span><span class="normal"> i</span><span class="symbol">;</span>

<span class="comment">/* Create expression and define constant pi */</span>
<span class="normal">expr </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="#gwy-expr-new">gwy_expr_new</a></span><span class="symbol">();</span>
<span class="function"><a href="#gwy-expr-define-constant">gwy_expr_define_constant</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"pi"</span><span class="symbol">,</span><span class="normal"> <a href="/usr/share/gtk-doc/html/glibglib-Numerical-Definitions.html#G-PI:CAPS">G_PI</a></span><span class="symbol">,</span><span class="normal"> <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="comment">/* Compile expression */</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="function"><a href="#gwy-expr-compile">gwy_expr_compile</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"2*pi/lambda*d*sin theta"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">err</span><span class="symbol">))</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">    </span><span class="comment">/* Handle compilation error */</span>
<span class="cbracket">}</span>

<span class="comment">/* Resolve variables */</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="#gwy-expr-resolve-variables">gwy_expr_resolve_variables</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#G-N-ELEMENTS:CAPS">G_N_ELEMENTS</a></span><span class="symbol">(</span><span class="normal">var_names</span><span class="symbol">),</span>
<span class="normal">                               var_names</span><span class="symbol">,</span><span class="normal"> var_positions</span><span class="symbol">))</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">    </span><span class="comment">/* Expression contains unknown variables */</span>
<span class="cbracket">}</span>

<span class="comment">/* Evaluate first set */</span>
<span class="keyword">for</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">i </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span><span class="normal"> i </span><span class="symbol">&lt;</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#G-N-ELEMENTS:CAPS">G_N_ELEMENTS</a></span><span class="symbol">(</span><span class="normal">var_names</span><span class="symbol">);</span><span class="normal"> i</span><span class="symbol">++)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">    vars</span><span class="symbol">[</span><span class="normal">var_positions</span><span class="symbol">[</span><span class="normal">i</span><span class="symbol">]]</span><span class="normal"> </span><span class="symbol">=</span><span class="normal"> var_values1</span><span class="symbol">[</span><span class="normal">i</span><span class="symbol">];</span>
<span class="cbracket">}</span>
<span class="function"><a href="/usr/share/gtk-doc/html/glibglib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="symbol">(</span><span class="string">"First result: %g</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="#gwy-expr-execute">gwy_expr_execute</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">,</span><span class="normal"> vars</span><span class="symbol">));</span>

<span class="comment">/* Evaluate second set */</span>
<span class="keyword">for</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">i </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span><span class="normal"> i </span><span class="symbol">&lt;</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#G-N-ELEMENTS:CAPS">G_N_ELEMENTS</a></span><span class="symbol">(</span><span class="normal">var_names</span><span class="symbol">);</span><span class="normal"> i</span><span class="symbol">++)</span>
<span class="normal">    vars</span><span class="symbol">[</span><span class="normal">var_positions</span><span class="symbol">[</span><span class="normal">i</span><span class="symbol">]]</span><span class="normal"> </span><span class="symbol">=</span><span class="normal"> var_values2</span><span class="symbol">[</span><span class="normal">i</span><span class="symbol">];</span>
<span class="function"><a href="/usr/share/gtk-doc/html/glibglib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="symbol">(</span><span class="string">"Second result: %g</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="#gwy-expr-execute">gwy_expr_execute</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">,</span><span class="normal"> vars</span><span class="symbol">));</span>

<span class="function"><a href="#gwy-expr-free">gwy_expr_free</a></span><span class="symbol">(</span><span class="normal">expr</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>The most general case is when the variables are from a large set (or
completely arbitrary).  Then it is best to get the list of variables with
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-get-variables" title="gwy_expr_get_variables ()"><code class="function">gwy_expr_get_variables()</code></a> and supply only values of variables that
are actually present in the expression.</p>
</div>
<div class="refsect1">
<a name="libgwyddion-GwyExpr.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gwy-expr-error-quark"></a><h3>gwy_expr_error_quark ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glibglib-Quarks.html#GQuark"><span class="returnvalue">GQuark</span></a>
gwy_expr_error_quark (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Returns error domain for expression parsin and evaluation.</p>
<p>See and use <a class="link" href="libgwyddion-GwyExpr.html#GWY-EXPR-ERROR:CAPS" title="GWY_EXPR_ERROR"><code class="literal">GWY_EXPR_ERROR</code></a>.</p>
<div class="refsect3">
<a name="gwy-expr-error-quark.returns"></a><h4>Returns</h4>
<p> The error domain.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-new"></a><h3>gwy_expr_new ()</h3>
<pre class="programlisting"><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="returnvalue">GwyExpr</span></a> *
gwy_expr_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a new expression evaluator.</p>
<div class="refsect3">
<a name="gwy-expr-new.returns"></a><h4>Returns</h4>
<p> A newly created expression evaluator.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-free"></a><h3>gwy_expr_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gwy_expr_free (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>);</pre>
<p>Frees all memory used by an expression evaluator.</p>
<div class="refsect3">
<a name="gwy-expr-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-evaluate"></a><h3>gwy_expr_evaluate ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gwy_expr_evaluate (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>,
                   <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *text</code></em>,
                   <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> *result</code></em>,
                   <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Error-Reporting.html#GError"><span class="type">GError</span></a> **err</code></em>);</pre>
<p>Evaulates an arithmetic expression.</p>
<div class="refsect3">
<a name="gwy-expr-evaluate.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>text</p></td>
<td class="parameter_description"><p>String containing the expression to evaluate.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>Location to store result to.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>err</p></td>
<td class="parameter_description"><p>Location to store compilation or evaluation error to, or <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
Errors from <a class="link" href="libgwyddion-GwyExpr.html#GwyExprError" title="enum GwyExprError"><span class="type">GwyExprError</span></a> domain can occur.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gwy-expr-evaluate.returns"></a><h4>Returns</h4>
<p> <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if evaluation failed.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-compile"></a><h3>gwy_expr_compile ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gwy_expr_compile (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>,
                  <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *text</code></em>,
                  <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Error-Reporting.html#GError"><span class="type">GError</span></a> **err</code></em>);</pre>
<p>Compiles an expression for later execution.</p>
<p>This function is useful for expressions with variables.  For normal
arithmetic expressions it's easier to use <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-evaluate" title="gwy_expr_evaluate ()"><code class="function">gwy_expr_evaluate()</code></a>.</p>
<div class="refsect3">
<a name="gwy-expr-compile.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>text</p></td>
<td class="parameter_description"><p>String containing the expression to compile.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>err</p></td>
<td class="parameter_description"><p>Location to store compilation or evaluation error to, or <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
Errors from <a class="link" href="libgwyddion-GwyExpr.html#GwyExprError" title="enum GwyExprError"><span class="type">GwyExprError</span></a> domain can occur.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gwy-expr-compile.returns"></a><h4>Returns</h4>
<p> <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if compilation failed.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-resolve-variables"></a><h3>gwy_expr_resolve_variables ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>
gwy_expr_resolve_variables (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>,
                            <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint"><span class="type">guint</span></a> n</code></em>,
                            <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> * const *names</code></em>,
                            <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint"><span class="type">guint</span></a> *indices</code></em>);</pre>
<p>Finds positions of variables in an expression.</p>
<div class="refsect3">
<a name="gwy-expr-resolve-variables.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>The length of <em class="parameter"><code>names</code></em>
and <em class="parameter"><code>indices</code></em>
arrays.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>names</p></td>
<td class="parameter_description"><p>List of variable names to get positions of.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>indices</p></td>
<td class="parameter_description"><p>Array to store variable positions to.  The positions are the same
as in <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-execute" title="gwy_expr_execute ()"><code class="function">gwy_expr_execute()</code></a>.  Variables not present in the expression
are assigned (reserved) position 0.  This allows to safely
substitute values of all variables before execution wthout caring
which variables are actually present.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gwy-expr-resolve-variables.returns"></a><h4>Returns</h4>
<p> The number of remaining, unresolved variables in <em class="parameter"><code>expr</code></em>
.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-get-variables"></a><h3>gwy_expr_get_variables ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
gwy_expr_get_variables (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>,
                        <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> ***names</code></em>);</pre>
<p>Get the number, names, and indices of unresolved identifiers in <em class="parameter"><code>expr</code></em>
.</p>
<p>It is an error to call this function after an unsuccessful compilation.</p>
<p>If you only care about variables from a prefedined set, that is if any
unknown variable is an error, it's easier to use
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-resolve-variables" title="gwy_expr_resolve_variables ()"><code class="function">gwy_expr_resolve_variables()</code></a>.</p>
<p>The position of each variable in <em class="parameter"><code>names</code></em>
 corresponds to the position of its
value in <em class="parameter"><code>values</code></em>
 array in <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-execute" title="gwy_expr_execute ()"><code class="function">gwy_expr_execute()</code></a> call.  Namely, the first item
in the array is always reserved and do not correspond to any variable.</p>
<div class="refsect3">
<a name="gwy-expr-get-variables.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>names</p></td>
<td class="parameter_description"><p>Location to store pointer to array of variable names to (may be
<a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to get just number of variables).  The string array returned
in this argument in owned by <em class="parameter"><code>expr</code></em>
and is valid only until next
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-compile" title="gwy_expr_compile ()"><code class="function">gwy_expr_compile()</code></a>, <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-evaluate" title="gwy_expr_evaluate ()"><code class="function">gwy_expr_evaluate()</code></a>, or <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-free" title="gwy_expr_free ()"><code class="function">gwy_expr_free()</code></a>
call.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gwy-expr-get-variables.returns"></a><h4>Returns</h4>
<p> The length of array stored to <em class="parameter"><code>names</code></em>
.  This is the number of
variables plus one (for the first reserved item).
On failure, 0 is returned.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-execute"></a><h3>gwy_expr_execute ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gdouble"><span class="returnvalue">gdouble</span></a>
gwy_expr_execute (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>,
                  <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> *values</code></em>);</pre>
<p>Executes a compiled expression with variables, substituting given values.</p>
<div class="refsect3">
<a name="gwy-expr-execute.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>values</p></td>
<td class="parameter_description"><p>Array with variable values.  Its zeroth item is always unused.
Variable list can be obtained by <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-get-variables" title="gwy_expr_get_variables ()"><code class="function">gwy_expr_get_variables()</code></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gwy-expr-execute.returns"></a><h4>Returns</h4>
<p> The result.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-vector-execute"></a><h3>gwy_expr_vector_execute ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gwy_expr_vector_execute (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>,
                         <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint"><span class="type">guint</span></a> n</code></em>,
                         <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> **data</code></em>,
                         <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> *result</code></em>);</pre>
<p>Executes a compiled expression on each item of data arrays.</p>
<div class="refsect3">
<a name="gwy-expr-vector-execute.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>The lenght of <em class="parameter"><code>result</code></em>
and of <em class="parameter"><code>data</code></em>
member arrays, that is vector length.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>An array of arrays of length <em class="parameter"><code>n</code></em>
.  The arrays correspond to expression
variables in <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-execute" title="gwy_expr_execute ()"><code class="function">gwy_expr_execute()</code></a>.  Zeroth array can be <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>An array of length <em class="parameter"><code>n</code></em>
to store computation results to.  It may be
one of those in <em class="parameter"><code>data</code></em>
.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-define-constant"></a><h3>gwy_expr_define_constant ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gwy_expr_define_constant (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>,
                          <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
                          <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> value</code></em>,
                          <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Error-Reporting.html#GError"><span class="type">GError</span></a> **err</code></em>);</pre>
<p>Defines a symbolic constant.</p>
<p>Note the definition does not affect already compiled expression, you have
to recompile it (and eventually re-resolve variables).</p>
<div class="refsect3">
<a name="gwy-expr-define-constant.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>Name of constant to define.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>Constant numeric value.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>err</p></td>
<td class="parameter_description"><p>Location to store error to, or <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
Only <a class="link" href="libgwyddion-GwyExpr.html#GWY-EXPR-ERROR-CONSTANT-NAME:CAPS"><code class="literal">GWY_EXPR_ERROR_CONSTANT_NAME</code></a> error from <a class="link" href="libgwyddion-GwyExpr.html#GwyExprError" title="enum GwyExprError"><span class="type">GwyExprError</span></a> domain can
occur.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gwy-expr-define-constant.returns"></a><h4>Returns</h4>
<p> <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if definition failed.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-undefine-constant"></a><h3>gwy_expr_undefine_constant ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gwy_expr_undefine_constant (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>,
                            <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>);</pre>
<p>Undefines a symbolic constant.</p>
<p>Note the definition removal does not affect already compiled expression,
you have to recompile it (and eventually re-resolve variables).</p>
<div class="refsect3">
<a name="gwy-expr-undefine-constant.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>Name of constant to undefine.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gwy-expr-undefine-constant.returns"></a><h4>Returns</h4>
<p> <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if there was such a constant and was removed, <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>
otherwise.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gwy-expr-get-expression"></a><h3>gwy_expr_get_expression ()</h3>
<pre class="programlisting">const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
gwy_expr_get_expression (<em class="parameter"><code><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> *expr</code></em>);</pre>
<p>Gets the expression string.</p>
<div class="refsect3">
<a name="gwy-expr-get-expression.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>expr</p></td>
<td class="parameter_description"><p>An expression evaluator.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gwy-expr-get-expression.returns"></a><h4>Returns</h4>
<p> The last string passed to <a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-evaluate" title="gwy_expr_evaluate ()"><code class="function">gwy_expr_evaluate()</code></a> or
<a class="link" href="libgwyddion-GwyExpr.html#gwy-expr-compile" title="gwy_expr_compile ()"><code class="function">gwy_expr_compile()</code></a>.  It is owned by <em class="parameter"><code>expr</code></em>
and must not be modified
or freed.</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="libgwyddion-GwyExpr.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GWY-EXPR-ERROR:CAPS"></a><h3>GWY_EXPR_ERROR</h3>
<pre class="programlisting">#define GWY_EXPR_ERROR gwy_expr_error_quark()
</pre>
<p>Error domain for expression parsing and evaluation. Errors in this domain
will be from the <a class="link" href="libgwyddion-GwyExpr.html#GwyExprError" title="enum GwyExprError"><span class="type">GwyExprError</span></a> enumeration. See <a href="/usr/share/gtk-doc/html/glibglib-Error-Reporting.html#GError"><span class="type">GError</span></a> for information on
error domains.</p>
</div>
<hr>
<div class="refsect2">
<a name="GwyExprError"></a><h3>enum GwyExprError</h3>
<p>Error codes returned by expression parsing and execution.</p>
<div class="refsect3">
<a name="GwyExprError.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-CLOSING-PARENTHESIS:CAPS"></a>GWY_EXPR_ERROR_CLOSING_PARENTHESIS</p></td>
<td class="enum_member_description">
<p>A closing parenthesis is missing.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-EMPTY:CAPS"></a>GWY_EXPR_ERROR_EMPTY</p></td>
<td class="enum_member_description">
<p>Expression is empty.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-EMPTY-PARENTHESES:CAPS"></a>GWY_EXPR_ERROR_EMPTY_PARENTHESES</p></td>
<td class="enum_member_description">
<p>A parentheses pair contain nothing
                                   inside.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-GARBAGE:CAPS"></a>GWY_EXPR_ERROR_GARBAGE</p></td>
<td class="enum_member_description">
<p>An symbol unexpectedly managed to survive.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-INVALID-ARGUMENT:CAPS"></a>GWY_EXPR_ERROR_INVALID_ARGUMENT</p></td>
<td class="enum_member_description">
<p>Function or operator argument is not a
                                  value.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-INVALID-TOKEN:CAPS"></a>GWY_EXPR_ERROR_INVALID_TOKEN</p></td>
<td class="enum_member_description">
<p>Expression contains an invalid token.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-MISSING-ARGUMENT:CAPS"></a>GWY_EXPR_ERROR_MISSING_ARGUMENT</p></td>
<td class="enum_member_description">
<p>Function or operator arguments is missing.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-NOT-EXECUTABLE:CAPS"></a>GWY_EXPR_ERROR_NOT_EXECUTABLE</p></td>
<td class="enum_member_description">
<p>Compiled stack is not executable.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-OPENING-PARENTHESIS:CAPS"></a>GWY_EXPR_ERROR_OPENING_PARENTHESIS</p></td>
<td class="enum_member_description">
<p>An opening parenthesis is missing.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-STRAY-COMMA:CAPS"></a>GWY_EXPR_ERROR_STRAY_COMMA</p></td>
<td class="enum_member_description">
<p>A comma at the start or end of list.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-UNRESOLVED-IDENTIFIERS:CAPS"></a>GWY_EXPR_ERROR_UNRESOLVED_IDENTIFIERS</p></td>
<td class="enum_member_description">
<p>Expression contains unresolved
                                        identifiers.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GWY-EXPR-ERROR-CONSTANT-NAME:CAPS"></a>GWY_EXPR_ERROR_CONSTANT_NAME</p></td>
<td class="enum_member_description">
<p>Constant name is invalid.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GwyExpr"></a><h3>GwyExpr</h3>
<pre class="programlisting">typedef struct _GwyExpr GwyExpr;</pre>
<p><a class="link" href="libgwyddion-GwyExpr.html#GwyExpr" title="GwyExpr"><span class="type">GwyExpr</span></a> is an opaque data structure and should be only manipulated with the
functions below.</p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.19</div>
</body>
</html>