Main index | Section 3 | Options |
#include <libxo/xo.h>
To open a marker, call xo_open_marker() or xo_open_marker_h(). The former uses the default handle and the latter accepts a specific handle.
To close a marker, use the xo_close_marker() or xo_close_marker_h() functions.
Each open call must have a matching close call.
In this example, the xo_close_container() call on line [1] will be ignored, since the open marker "outer" will prevent close of any open constructs that precede it. The xo_close_marker() call on line [2] will close the "system" container, since it was opened after the "outer" marker.
Example:xo_open_container("top"); xo_open_marker("outer"); xo_open_container("system"); xo_emit("{:host-name/%s%s%s", hostname, domainname ? "." : "", domainname ?: ""); xo_close_container("top"); /* [1] */ xo_close_marker("outer"); /* [2] */ xo_close_container("top");
In this example, the code whiffles through a list of fish, calling a function to emit details about each fish. The marker "fish-guts" is used to ensure that any constructs opened by the function are closed properly.
for (i = 0; fish[i]; i++) { xo_open_instance("fish"); xo_open_marker("fish-guts"); dump_fish_details(i); xo_close_marker("fish-guts"); }
LIBXO (3) | January 22, 2015 |
Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | Like a classics radio station whose play list spans decades, Unix simultaneously exhibits its mixed and dated heritage. There's Clash-era graphics interfaces; Beatles-era two-letter command names; and systems programs (for example, ps) whose terse and obscure output was designed for slow teletypes; Bing Crosby-era command editing (# and @ are still the default line editing commands), and Scott Joplin-era core dumps. | ” |
— The Unix Haters' handbook |