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
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. */
15 #define __attribute__(arg)
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.
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);
30 extern char* TTCN_pattern_to_regexp_uni(const char* p_pattern,
33 /* defined elsewhere (can be different in compiler/runtime) */
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)));
40 #endif /* _common_pattern_HH */