root/library/bdm/base/libconfig/lib/scanctx.h @ 706

Revision 706, 2.0 kB (checked in by smidl, 15 years ago)

eol-native

  • Property svn:eol-style set to native
Line 
1/* ----------------------------------------------------------------------------
2   libconfig - A library for processing structured configuration files
3   Copyright (C) 2005-2009  Mark A Lindner
4
5   This file is part of libconfig.
6
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public License
9   as published by the Free Software Foundation; either version 2.1 of
10   the License, or (at your option) any later version.
11
12   This library is distributed in the hope that it will be useful, but
13   WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   Lesser General Public License for more details.
16
17   You should have received a copy of the GNU Library General Public
18   License along with this library; if not, see
19   <http://www.gnu.org/licenses/>.
20   ----------------------------------------------------------------------------
21*/
22
23#ifndef __libconfig_scanctx_h
24#define __libconfig_scanctx_h
25
26#include "libconfig.h"
27#include "strbuf.h"
28
29#include <stdio.h>
30#include <sys/types.h>
31
32#define MAX_INCLUDE_DEPTH 10
33
34struct scan_context
35{
36  config_t *config;
37  const char *top_filename;
38  const char *files[MAX_INCLUDE_DEPTH];
39  void *buffers[MAX_INCLUDE_DEPTH];
40  FILE *streams[MAX_INCLUDE_DEPTH];
41  int depth;
42  strbuf_t string;
43  const char **filenames;
44  unsigned int num_filenames;
45};
46
47extern void scanctx_init(struct scan_context *ctx, const char *top_filename);
48extern const char **scanctx_cleanup(struct scan_context *ctx,
49                                    unsigned int *num_filenames);
50
51extern FILE *scanctx_push_include(struct scan_context *ctx, void *prev_buffer,
52                                  const char **error);
53extern void *scanctx_pop_include(struct scan_context *ctx);
54
55#define scanctx_append_string(C, S)             \
56  strbuf_append(&((C)->string), (S))
57
58extern char *scanctx_take_string(struct scan_context *ctx);
59
60extern const char *scanctx_current_filename(struct scan_context *ctx);
61
62#endif /* __libconfig_scanctx_h */
Note: See TracBrowser for help on using the browser.