Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 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 | * Contributors: | |
9 | * Balasko, Jeno | |
10 | * Baranyi, Botond | |
11 | * Forstner, Matyas | |
12 | * Raduly, Csaba | |
13 | * Szabo, Janos Zoltan – initial implementation | |
14 | * Zalanyi, Balazs Andor | |
15 | * | |
16 | ******************************************************************************/ | |
970ed795 EL |
17 | #ifndef _common_pattern_HH |
18 | #define _common_pattern_HH | |
19 | ||
20 | #ifndef __GNUC__ | |
21 | /** If a C compiler other than GCC is used the macro below will substitute all | |
22 | * GCC-specific non-standard attributes with an empty string. */ | |
23 | #ifndef __attribute__ | |
24 | #define __attribute__(arg) | |
25 | #endif | |
26 | #endif | |
27 | ||
28 | /** This is the interface for pattern. This function converts a TTCN-3 | |
29 | * charstring pattern to a POSIX Extended Regular Expression (ERE). | |
30 | * If error occurs, returns a NULL-pointer. It uses the | |
31 | * TTCN_pattern_error() and TTCN_pattern_warning() functions to | |
3abe9331 | 32 | * report errors/warnings. |
33 | * | |
34 | * The function is also used on universal charstring patterns (in UTF-8 format) | |
35 | * during JSON schema generation. In this case the 2nd parameter must be set | |
36 | * to true, so no errors are reported for the extended ASCII characters. */ | |
37 | extern char* TTCN_pattern_to_regexp(const char* p_pattern, bool utf8 = false); | |
970ed795 EL |
38 | |
39 | extern char* TTCN_pattern_to_regexp_uni(const char* p_pattern, | |
40 | int** groups = 0); | |
41 | ||
42 | /* defined elsewhere (can be different in compiler/runtime) */ | |
43 | ||
44 | extern void TTCN_pattern_error(const char *fmt_str, ...) | |
45 | __attribute__ ((__format__ (__printf__, 1, 2))); | |
46 | extern void TTCN_pattern_warning(const char *fmt_str, ...) | |
47 | __attribute__ ((__format__ (__printf__, 1, 2))); | |
48 | ||
49 | #endif /* _common_pattern_HH */ |