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
11 * Szabo, Janos Zoltan – initial implementation
14 ******************************************************************************/
18 #include "../Setting.hh"
19 #include "../Identifier.hh"
20 #include "../../common/memory.h"
22 struct textAST_matching_values {
26 bool generated_decode_token;
29 struct textAST_enum_def {
30 Common::Identifier *name;
31 textAST_matching_values value;
34 struct textAST_param_values {
46 TextAST(const TextAST&);
47 TextAST& operator=(const TextAST&);
49 textAST_matching_values *begin_val;
50 textAST_matching_values *end_val;
51 textAST_matching_values *separator_val;
52 textAST_param_values coding_params;
53 textAST_param_values decoding_params;
55 textAST_enum_def **field_params;
56 textAST_matching_values *true_params;
57 textAST_matching_values *false_params;
61 TextAST() { init_TextAST(); }
62 TextAST(const TextAST *other_val);
65 void print_TextAST() const;
66 int get_field_param_index(const Common::Identifier *name);
69 void copy_textAST_matching_values(textAST_matching_values **to,
70 const textAST_matching_values *from);
72 /** Checks for forbidden references within {} and substitutes the escape
73 * sequences of apostrophes ('' and \') and quotation marks("" and \") in
74 * \a decode_token. Returns the result of substitution. Argument \a loc is
75 * used for error reporting. */
76 char *process_decode_token(const char *decode_token,
77 const Common::Location& loc);
79 /** "Encode" the TEXT matching pattern.
81 * @param str TTCN pattern from the TEXT attribute
82 * @param cs true for case sensitive matching, false for case insensitive
83 * @return a newly allocated string whose first character is
84 * 'I' for case sensitive matching, 'N' for case insensitive matching,
85 * or 'F' for fixed string matching.
86 * The rest of the string is the POSIX regexp corresponding to the pattern
87 * in \p str (or a copy of \p str for fixed string matching).
89 * The string must be deallocated by the caller using \b Free()
91 char *make_posix_str_code(const char *str, bool cs);
93 /** Converts a TTCN-3 charstring value to an equivalent TTCN-3 pattern. The
94 * special characters of TTCN-3 patterns are escaped. */
95 extern char *convert_charstring_to_pattern(const char *str);
97 void init_textAST_matching_values(textAST_matching_values *val);