003 File Manager
Current Path:
/usr/src/contrib/libxo/libxo
usr
/
src
/
contrib
/
libxo
/
libxo
/
📁
..
📄
Makefile.am
(1.9 KB)
📄
add.man.in
(523 B)
📄
gen-wide.sh
(1.01 KB)
📄
libxo.3
(8.18 KB)
📄
libxo.c
(205.77 KB)
📄
xo.h
(18.36 KB)
📄
xo_attr.3
(1.88 KB)
📄
xo_buf.h
(3.54 KB)
📄
xo_create.3
(1.59 KB)
📄
xo_emit.3
(2.92 KB)
📄
xo_emit_err.3
(2 KB)
📄
xo_emit_f.3
(3.27 KB)
📄
xo_encoder.c
(8.97 KB)
📄
xo_encoder.h
(5.46 KB)
📄
xo_err.3
(1.97 KB)
📄
xo_error.3
(1.06 KB)
📄
xo_explicit.h
(2.1 KB)
📄
xo_finish.3
(1.05 KB)
📄
xo_flush.3
(1.01 KB)
📄
xo_format.5
(33.64 KB)
📄
xo_humanize.h
(5.02 KB)
📄
xo_message.3
(2.02 KB)
📄
xo_no_setlocale.3
(1.12 KB)
📄
xo_open_container.3
(4.85 KB)
📄
xo_open_list.3
(4.77 KB)
📄
xo_open_marker.3
(3.22 KB)
📄
xo_options.7
(4.06 KB)
📄
xo_parse_args.3
(3.77 KB)
📄
xo_set_allocator.3
(1.33 KB)
📄
xo_set_flags.3
(3.48 KB)
📄
xo_set_info.3
(2.61 KB)
📄
xo_set_options.3
(944 B)
📄
xo_set_style.3
(1.47 KB)
📄
xo_set_syslog_enterprise_id.3
(1.06 KB)
📄
xo_set_version.3
(1.09 KB)
📄
xo_set_writer.3
(1.48 KB)
📄
xo_syslog.3
(2.32 KB)
📄
xo_syslog.c
(19.3 KB)
📄
xo_wcwidth.h
(13.69 KB)
Editing: xo_open_marker.3
.\" # .\" # Copyright (c) 2015, Juniper Networks, Inc. .\" # All rights reserved. .\" # This SOFTWARE is licensed under the LICENSE provided in the .\" # ../Copyright file. By downloading, installing, copying, or .\" # using the SOFTWARE, you agree to be bound by the terms of that .\" # LICENSE. .\" # Phil Shafer, January 2015 .\" .Dd January 22, 2015 .Dt LIBXO 3 .Os .Sh NAME .Nm xo_open_marker , xo_open_marker_h , xo_close_marker , xo_close_marker_h .Nd prevent and allow closing of open constructs .Sh LIBRARY .Lb libxo .Sh SYNOPSIS .In libxo/xo.h .Ft xo_ssize_t .Fn xo_open_marker "const char *name" .Ft xo_ssize_t .Fn xo_open_marker_h "xo_handle_t *handle" "const char *name" .Ft xo_ssize_t .Fn xo_close_marker "const char *name" .Ft xo_ssize_t .Fn xo_close_marker_h "xo_handle_t *handle" "const char *name" .Sh DESCRIPTION .Nm libxo represents hierarchy using two constructs: .Dq containers and .Dq lists . A marker can be used to affect how open constructs are closed, either by preventing their (implicit or explicit) closure or by forcing their closure. While a marker is open, no other open constructs can be closed. When a marker is closed, all constructs open since the marker was opened will be closed. A marker is used to "freeze" any open constructs. Calls to .Fn xo_close_* functions that would normally close them will be ignored, effectively blocking their closure. However when .Fn xo_close_marker is called, any containers, lists, or leaf-lists open since the matching .Fn xo_open_marker call will be close and the marker discarded. Markers use names which are not user-visible, allowing the caller to choose appropriate internal names. The marker has no value and is not emitted in any form. .Pp To open a marker, call .Fn xo_open_marker or .Fn xo_open_marker_h . The former uses the default handle and the latter accepts a specific handle. .Pp To close a marker, use the .Fn xo_close_marker or .Fn xo_close_marker_h functions. .Pp Each open call must have a matching close call. .Pp In this example, the .Fn 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 .Fn xo_close_marker call on line [2] will close the "system" container, since it was opened after the "outer" marker. .Bd -literal -offset indent -compact 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"); .Ed .Pp 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. .Bd -literal -offset indent for (i = 0; fish[i]; i++) { xo_open_instance("fish"); xo_open_marker("fish-guts"); dump_fish_details(i); xo_close_marker("fish-guts"); } .Ed .Sh SEE ALSO .Xr xo_emit 3 , .Xr libxo 3 .Sh HISTORY The .Nm libxo library first appeared in .Fx 11.0 . .Sh AUTHORS .Nm libxo was written by .An Phil Shafer Aq Mt phil@freebsd.org .
Upload File
Create Folder