96104b6a4aa88f3ec9bed1a0a0e7df67d8d3c642
[deliverable/titan.core.git] / common / pattern.hh
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
8 #ifndef _common_pattern_HH
9 #define _common_pattern_HH
10
11 #ifndef __GNUC__
12 /** If a C compiler other than GCC is used the macro below will substitute all
13 * GCC-specific non-standard attributes with an empty string. */
14 #ifndef __attribute__
15 #define __attribute__(arg)
16 #endif
17 #endif
18
19 /** This is the interface for pattern. This function converts a TTCN-3
20 * charstring pattern to a POSIX Extended Regular Expression (ERE).
21 * If error occurs, returns a NULL-pointer. It uses the
22 * TTCN_pattern_error() and TTCN_pattern_warning() functions to
23 * report errors/warnings.
24 *
25 * The function is also used on universal charstring patterns (in UTF-8 format)
26 * during JSON schema generation. In this case the 2nd parameter must be set
27 * to true, so no errors are reported for the extended ASCII characters. */
28 extern char* TTCN_pattern_to_regexp(const char* p_pattern, bool utf8 = false);
29
30 extern char* TTCN_pattern_to_regexp_uni(const char* p_pattern,
31 int** groups = 0);
32
33 /* defined elsewhere (can be different in compiler/runtime) */
34
35 extern void TTCN_pattern_error(const char *fmt_str, ...)
36 __attribute__ ((__format__ (__printf__, 1, 2)));
37 extern void TTCN_pattern_warning(const char *fmt_str, ...)
38 __attribute__ ((__format__ (__printf__, 1, 2)));
39
40 #endif /* _common_pattern_HH */
This page took 0.038305 seconds and 4 git commands to generate.