diff --git a/Makefile.cfg b/Makefile.cfg index c27c9f09aef30330e872698b9edab9714af9ee00..ea9473b0220788fc8eaeea5a710c7c7c9b6e40a4 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -88,7 +88,11 @@ JNI := yes # Path of the Java Developement Kit installation # (must be at least version 1.5.0_10) +<<<<<<< HEAD +JDKDIR := /usr/lib/jvm/default-java +======= JDKDIR := /usr/lib/jvm/default-java +>>>>>>> 4a0c4186d3c98f51d0735e21cca5918568a7082b # Path of OpenSSL installation: (always required) OPENSSL_DIR := default diff --git a/compiler2/ttcn3/PatternString.cc b/compiler2/ttcn3/PatternString.cc index a924dadb833e29c64c20f1f8611c127d3629491f..ad8c78fb4888978375f0c34cd02b9c5460ff5a4b 100644 --- a/compiler2/ttcn3/PatternString.cc +++ b/compiler2/ttcn3/PatternString.cc @@ -11,6 +11,7 @@ * Delic, Adam * Forstner, Matyas * Raduly, Csaba + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Zalanyi, Balazs Andor * @@ -279,6 +280,14 @@ namespace Ttcn { if (last_elem) *last_elem->str += p_str; else elems.add(new ps_elem_t(ps_elem_t::PSE_STR, p_str)); } + + void PatternString::addStringUSI(char **usi_str, const size_t size) + { + ustring s = ustring((const char**)usi_str, size); + ps_elem_t *last_elem = get_last_elem(); + if (last_elem) *last_elem->str += s.get_stringRepr_for_pattern().c_str(); + else elems.add(new ps_elem_t(ps_elem_t::PSE_STR, s.get_stringRepr_for_pattern())); + } void PatternString::addRef(Ttcn::Reference *p_ref) { diff --git a/compiler2/ttcn3/PatternString.hh b/compiler2/ttcn3/PatternString.hh index f753151cda1d1c961e4d0708687fe3244bece9e2..70ae58b89bb2bb0f7c925b6bf9f839a135c11774 100644 --- a/compiler2/ttcn3/PatternString.hh +++ b/compiler2/ttcn3/PatternString.hh @@ -11,6 +11,7 @@ * Delic, Adam * Forstner, Matyas * Raduly, Csaba + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Zalanyi, Balazs Andor * @@ -65,6 +66,7 @@ namespace Ttcn { void addChar(char c); void addString(const char *p_str); void addString(const string& p_str); + void addStringUSI(char **usi_str, const size_t size); void addRef(Ttcn::Reference *p_ref); void addRefdCharSet(Ttcn::Reference *p_ref); string get_full_str() const; diff --git a/compiler2/ttcn3/compiler.l b/compiler2/ttcn3/compiler.l index b8eebe8e9648d7c5db6194243f318a545be3c452..4fe0e83c47e444908c438451fe94b2115a3b0609 100644 --- a/compiler2/ttcn3/compiler.l +++ b/compiler2/ttcn3/compiler.l @@ -17,6 +17,7 @@ * Kremer, Peter * Raduly, Csaba * Szabados, Kristof + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Zalanyi, Balazs Andor * @@ -192,10 +193,13 @@ NEWLINE \r|\n|\r\n LINEMARKER {NUMBER}{WHITESPACE}+\"([^\\\"\r\n]|\\[^\r\n])*\" +UID [uU][+]?[0-9A-Fa-f]{1,8} + TITAN "$#&&&(#TITANERRONEOUS$#&&^#% " %x SC_blockcomment SC_cstring %x SC_binstring SC_binstring_bad +%s SC_charkeyword %% /* local variables of yylex() */ @@ -374,7 +378,7 @@ break RETURN(BreakKeyword); call RETURN_DOT(CallOpKeyword); case RETURN(CaseKeyword); catch RETURN_DOT(CatchOpKeyword); -char RETURN(CharKeyword); +char { BEGIN(SC_charkeyword); RETURN(CharKeyword); } charstring RETURN(CharStringKeyword); check RETURN_DOT(CheckOpKeyword); clear RETURN_DOT(ClearOpKeyword); @@ -621,6 +625,18 @@ NULL RETURN(NullValue); current_column++; MD5_Update(&md5_ctx, yytext, yyleng); BEGIN(SC_cstring); +} + +<SC_charkeyword> +{ + {UID} { + yylval.str = mcopystrn(yytext, yyleng); + RETURN_LVAL(Cstring); + } + + [,] { RETURN(*yytext); } + + [)] { BEGIN(INITIAL); RETURN(*yytext); } } <SC_binstring> /* -------- SC_binstring scope -------------- */ diff --git a/compiler2/ttcn3/compiler.y b/compiler2/ttcn3/compiler.y index 9785403005a7f9a78edbbe509ac93327b7899879..194a48e9c2c2c846a1d737d9a6665922e8adc236 100644 --- a/compiler2/ttcn3/compiler.y +++ b/compiler2/ttcn3/compiler.y @@ -21,6 +21,7 @@ * Pandi, Krisztian * Raduly, Csaba * Szabados, Kristof + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Szalai, Gabor * Tatarka, Gabor @@ -241,6 +242,10 @@ static const string anyname("anytype"); Statement **elements; } stmt_list; + struct { + size_t nElements; + const char **elements; + } uid_list; struct { Value *lower; @@ -854,6 +859,7 @@ static const string anyname("anytype"); IdentifierOrAddressKeyword StructFieldRef PredefOrIdentifier %type <string_val> CstringList %type <ustring_val> Quadruple +%type <uid_list> USI UIDlike %type <typetype> PredefinedType %type <portoperationmode> PortOperationMode @@ -1405,6 +1411,9 @@ VarInstance optArrayDef optExtendedFieldReference FriendModuleDef +USI +UIDlike + %destructor { delete $$.lower; @@ -7004,6 +7013,15 @@ CharStringValue: // 478 delete $1; $$->set_location(infile, @$); } +| USI + { + $$ = new Value(Value::V_USTR, new ustring($1.elements, $1.nElements)); + for(size_t i = 0; i < $1.nElements; ++i) { + Free((char*)$1.elements[i]); + } + Free($1.elements); + $$->set_location(infile, @$); + } ; CstringList: @@ -7015,6 +7033,29 @@ CstringList: } ; +USI: + CharKeyword '(' optError UIDlike optError ')' + { + $$ = $4; + } +; + +UIDlike: + Cstring + { + $$.nElements = 1; + $$.elements = (const char**) + Realloc($$.elements, ($$.nElements) * sizeof(*$$.elements)); + $$.elements[$$.nElements-1] = $1; + } +| UIDlike optError ',' optError Cstring { + $$.nElements = $1.nElements + 1; + $$.elements = (const char**) + Realloc($1.elements, ($$.nElements) * sizeof(*$$.elements)); + $$.elements[$$.nElements-1] = $5; + } +; + Quadruple: // 479 CharKeyword '(' optError Group optError ',' optError Plane optError ',' optError Row optError ',' optError Cell optError ')' diff --git a/compiler2/ttcn3/pstring_la.l b/compiler2/ttcn3/pstring_la.l index ff933a1e5833f3e21a9dbf92341b20cb4b6f8e49..da5e3d8b91dca7831febcb0eaad1d1a086c0f540 100644 --- a/compiler2/ttcn3/pstring_la.l +++ b/compiler2/ttcn3/pstring_la.l @@ -12,6 +12,7 @@ * Pandi, Krisztian * Raduly, Csaba * Szabados, Kristof + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * ******************************************************************************/ @@ -82,6 +83,7 @@ IDENTIFIER [A-Za-z][A-Za-z0-9_]* NUMBER 0|([1-9][0-9]*) WS [ \t\r\n\v\f]* NEWLINE \r|\n|\r\n +UID [uU][+]?[0-9A-Fa-f]{1,8} %% /* ***************** rules ************************* */ @@ -344,12 +346,39 @@ if (in_set) { UPDATE_LOCATION(cell_begin, yyleng); } +"\\q"({WS}"{"{WS}({UID}{WS}","{WS})*{UID}{WS}"}") { + //Split UID-s. For example: \q{ U23423 , U+001 } -> [U23423, U+001] + size_t begin = 3; + size_t size = 0; + char ** uids = (char **)Malloc(sizeof(char*)); + while(yytext[begin] != '}'){ + //Find first digit + while(yytext[begin] != 'U' && yytext[begin] != 'u') begin++; + size_t end = begin + 2; + //Find last digit + while(isxdigit(yytext[end])) end++; + size++; + uids = (char**)Realloc(uids, size * sizeof(char*)); + uids[size-1] = mcopystrn(yytext + begin, end-begin); + //Skip whitespaces until the next UID or the end + while(!isxdigit(yytext[end]) && yytext[end] != 'U' && yytext[end] != 'u' && yytext[end] != '}') end++; + UPDATE_LOCATION(begin, end); + begin = end; + } + ps->addStringUSI(uids, size); + //Free + for (size_t i = 0; i < size; ++i) { + Free(uids[i]); + } + Free(uids); +} + "\\q"({WS}"{"[^}]*"}")? { int first_line = current_line, first_column = current_column; UPDATE_LOCATION(0, yyleng); Location loc(current_file, first_line, first_column, current_line, current_column); - loc.error("Invalid quadruple notation: `%s'", yytext); + loc.error("Invalid quadruple or UID-like notation: `%s'", yytext); } "[]" { diff --git a/compiler2/ustring.cc b/compiler2/ustring.cc index 477a9a1138d257043f91912b16959a35521e4583..5669b604e603c3652aa798cd763b5e290b3a051e 100644 --- a/compiler2/ustring.cc +++ b/compiler2/ustring.cc @@ -11,6 +11,7 @@ * Kovacs, Ferenc * Raduly, Csaba * Szabados, Kristof + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Zalanyi, Balazs Andor * @@ -186,6 +187,29 @@ ustring::ustring(const string& s) } } +ustring::ustring(const char** uid, const int n) { + //Init the size for characters + init_struct(n); + for (size_t i = 0; i < val_ptr->n_uchars; ++i) { + const char * uidchar = uid[i]; + size_t offset = 1; //Always starts with u or U + offset = uidchar[1] == '+' ? offset + 1 : offset; //Optional '+' + string chunk = string(uidchar + offset); + //Convert hex to int and get value + Common::int_val_t * val = Common::hex2int(chunk); + Common::Int int_val = val->get_val(); + + //Fill in the quadruple + val_ptr->uchars_ptr[i].group = (int_val >> 24) & 0xFF; + val_ptr->uchars_ptr[i].plane = (int_val >> 16) & 0xFF; + val_ptr->uchars_ptr[i].row = (int_val >> 8) & 0xFF; + val_ptr->uchars_ptr[i].cell = int_val & 0xFF; + + //Free pointer + Free(val); + } +} + void ustring::clear() { if (val_ptr->n_uchars > 0) { diff --git a/compiler2/ustring.hh b/compiler2/ustring.hh index a6fea848ee6a1ba144d5e5aea3759a5f426c4433..e24279210ee01630796ef97bbf5f1f60926380b7 100644 --- a/compiler2/ustring.hh +++ b/compiler2/ustring.hh @@ -12,6 +12,7 @@ * Kovacs, Ferenc * Raduly, Csaba * Szabados, Kristof + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Zalanyi, Balazs Andor * @@ -68,6 +69,9 @@ public: /** Constructs a universal string from \a s. */ ustring(const string& s); + + /** Constructs a universal string from \a uid which contains \a n chars. */ + ustring(const char** uid, const int n); /** Copy constructor */ ustring(const ustring& s) : val_ptr(s.val_ptr) { val_ptr->ref_count++;} diff --git a/core/config_process.l b/core/config_process.l index 35f82f1bbd992b543a98c666b8695c7cd4d4d059..3e111129da3eee89f2c08f5c5eafabf3d200f721 100644 --- a/core/config_process.l +++ b/core/config_process.l @@ -16,6 +16,7 @@ * Pandi, Krisztian * Raduly, Csaba * Szabados, Kristof + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Szalai, Gabor * Zalanyi, Balazs Andor @@ -133,13 +134,15 @@ DNSNAME {HOSTNAME}(\.{HOSTNAME})*\.? /* Example: fe80::c002:37ff:fe6c:0%fastethernet0/0 */ IPV6 [0-9A-Fa-f:.]+(%[0-9A-Za-z]+)? +UID [uU][+]?[0-9A-Fa-f]{1,8} + TTCNSTRINGPARSING "$#&&&(#TTCNSTRINGPARSING$#&&^#% " TTCNSTRINGPARSING_COMPONENT "$#&&&(#TTCNSTRINGPARSING_COMPONENT$#&&^#% " %x SC_commentblock SC_cstring SC_DEFINE %s SC_MODULE_PARAMETERS SC_LOGGING SC_TESTPORT_PARAMETERS SC_EXECUTE SC_GROUPS %s SC_COMPONENTS SC_EXTERNAL_COMMANDS SC_MAIN_CONTROLLER SC_INCLUDE SC_ORDERED_INCLUDE -%s SC_STRING2TTCN_COMPONENT SC_PROFILER +%s SC_STRING2TTCN_COMPONENT SC_PROFILER SC_CHAR_KEYWORD %% @@ -319,7 +322,7 @@ TTCNSTRINGPARSING_COMPONENT "$#&&&(#TTCNSTRINGPARSING_COMPONENT$#&&^#% " {NUMBER} { yylval.int_val = new int_val_t(yytext); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { // return a different token for module parameters so it doesn't conflict with references return MPNumber; } @@ -328,7 +331,7 @@ TTCNSTRINGPARSING_COMPONENT "$#&&&(#TTCNSTRINGPARSING_COMPONENT$#&&^#% " {FLOAT} { yylval.float_val = atof(yytext); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { // return a different token for module parameters so it doesn't conflict with references return MPFloat; } @@ -445,7 +448,7 @@ TTCNSTRINGPARSING_COMPONENT "$#&&&(#TTCNSTRINGPARSING_COMPONENT$#&&^#% " break; default: set_ret_val_cstr(cstring); - if (caller_state == SC_MODULE_PARAMETERS) { + if (caller_state == SC_MODULE_PARAMETERS || caller_state == SC_CHAR_KEYWORD) { // return a different token for module parameters so it doesn't conflict with references return MPCstring; } @@ -502,7 +505,7 @@ TTCNSTRINGPARSING_COMPONENT "$#&&&(#TTCNSTRINGPARSING_COMPONENT$#&&^#% " BEGIN(caller_state); if (caller_state!=SC_DEFINE) { set_ret_val_cstr(cstring); - if (caller_state == SC_MODULE_PARAMETERS) { + if (caller_state == SC_MODULE_PARAMETERS || caller_state == SC_CHAR_KEYWORD) { // return a different token for module parameters so it doesn't conflict with references return MPCstring; } @@ -513,13 +516,25 @@ TTCNSTRINGPARSING_COMPONENT "$#&&&(#TTCNSTRINGPARSING_COMPONENT$#&&^#% " } } +<SC_CHAR_KEYWORD> +{ + {UID} { + yylval.str_val = mcopystrn(yytext, yyleng); + return UIDval; + } + + [,] { return *yytext; } + + [)] { BEGIN(SC_MODULE_PARAMETERS); return *yytext; } +} + /* Section-wide keywords */ <SC_MODULE_PARAMETERS> { NULL return NULLKeyword; null return nullKeyword; -char return CharKeyword; +char { BEGIN(SC_CHAR_KEYWORD); return CharKeyword; } objid return ObjIdKeyword; omit return OmitKeyword; none { @@ -1300,7 +1315,7 @@ LOG_ALL { "this context."); yylval.int_val = new int_val_t((RInt)0); } - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { // return a different token for module parameters so it doesn't conflict with references return MPNumber; } @@ -1332,7 +1347,7 @@ LOG_ALL { "this context."); yylval.float_val = 0.0; } - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { // return a different token for module parameters so it doesn't conflict with references return MPFloat; } @@ -1385,7 +1400,7 @@ LOG_ALL { "this context."); yylval.charstring_val.n_chars = 0; yylval.charstring_val.chars_ptr = memptystr(); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { // return a different token for module parameters so it doesn't conflict with references return MPCstring; } @@ -1405,7 +1420,7 @@ LOG_ALL { yylval.charstring_val.n_chars=0; yylval.charstring_val.chars_ptr=memptystr(); Free(macroname); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { // return a different token for module parameters so it doesn't conflict with references return MPCstring; } @@ -1422,7 +1437,7 @@ LOG_ALL { yylval.charstring_val.chars_ptr=(char*)Malloc(macrolen+1); memcpy(yylval.charstring_val.chars_ptr, macrovalue, macrolen+1); Free(macroname); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { // return a different token for module parameters so it doesn't conflict with references return MPCstring; } @@ -1621,7 +1636,7 @@ LOG_ALL { -. return yytext[0]; +. return yytext[0]; %% diff --git a/core/config_process.y b/core/config_process.y index 6e457bab44c37e16b91bf1bb19f281d6e1c1eca0..cd36e38249bdcfda6262c2dffd2e913888151c26 100644 --- a/core/config_process.y +++ b/core/config_process.y @@ -17,6 +17,7 @@ * Pandi, Krisztian * Raduly, Csaba * Szabados, Kristof + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Szalai, Gabor * Zalanyi, Balazs Andor @@ -143,6 +144,10 @@ string_map_t *config_defines; logging_plugin_t *logging_plugins; logging_param_t logging_params; logging_setting_t logging_param_line; + struct { + size_t nElements; + const char **elements; + } uid_list; } %token ModuleParametersKeyword @@ -210,6 +215,7 @@ string_map_t *config_defines; %token <str_val> HstringMatch "hex string template" %token <str_val> OstringMatch "octet string template" %token <charstring_val> Cstring MPCstring "charstring value" +%token <str_val> UIDval %token DNSName "hostname" /* a single bit */ %token <logseverity_val> LoggingBit @@ -256,6 +262,7 @@ string_map_t *config_defines; %type <universal_charstring_val> UniversalCharstringValue UniversalCharstringFragment %type <universal_char_val> Quadruple +%type <uid_list> USI UIDlike %type <str_val> LoggerPluginId %type <logging_plugins> LoggerPlugin LoggerPluginList @@ -917,6 +924,31 @@ UniversalCharstringValue: $$.n_uchars = 1; $$.uchars_ptr = (universal_char*)Malloc(sizeof(universal_char)); $$.uchars_ptr[0] = $1; +} + | USI +{ + $$.n_uchars = $1.nElements; + $$.uchars_ptr = (universal_char*)Malloc($$.n_uchars * sizeof(universal_char)); + for (int i = 0; i < $$.n_uchars; ++i) { + size_t offset = 1; //Always starts with u or U + offset = $1.elements[i][1] == '+' ? offset + 1 : offset; //Optional '+' + + char* p; + unsigned long int_val = strtoul($1.elements[i] + offset, &p, 16); + if(*p != 0) { + //Error, should not happen + config_process_error_f("Invalid hexadecimal string %s.", $1.elements[i] + offset); + } + + //Fill in the quadruple + $$.uchars_ptr[i].uc_group = (int_val >> 24) & 0xFF; + $$.uchars_ptr[i].uc_plane = (int_val >> 16) & 0xFF; + $$.uchars_ptr[i].uc_row = (int_val >> 8) & 0xFF; + $$.uchars_ptr[i].uc_cell = int_val & 0xFF; + + Free((char*)$1.elements[i]); + } + Free($1.elements); } ; @@ -998,6 +1030,29 @@ Quadruple: } ; +USI: + CharKeyword '(' UIDlike ')' + { + $$ = $3; + } +; + +UIDlike: + UIDval + { + $$.nElements = 1; + $$.elements = (const char**) + Malloc($$.nElements * sizeof(*$$.elements)); + $$.elements[$$.nElements-1] = $1; + } +| UIDlike ',' UIDval { + $$.nElements = $1.nElements + 1; + $$.elements = (const char**) + Realloc($1.elements, ($$.nElements) * sizeof(*$1.elements)); + $$.elements[$$.nElements-1] = $3; + } +; + // character strings outside of the [MODULE_PARAMETERS] section StringValue: Cstring @@ -2126,7 +2181,8 @@ boolean process_config_string(const char *config_string, int string_len) try { reset_configuration_options(); - reset_config_process_lex(NULL); + reset_config_process_lex(NULL); + if (config_process_parse()) error_flag = TRUE; } catch (const TC_Error& TC_error) { diff --git a/mctr2/cli/config_read.l b/mctr2/cli/config_read.l index a1336a607642c02640a72fbeb629ac633cf47b4a..59a8e8f87c2fabcfb1987e6bb1e5f08821604c73 100644 --- a/mctr2/cli/config_read.l +++ b/mctr2/cli/config_read.l @@ -16,6 +16,7 @@ * Pandi, Krisztian * Raduly, Csaba * Szabados, Kristof + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Szalai, Gabor * Zalanyi, Balazs Andor @@ -134,10 +135,12 @@ DNSNAME {HOSTNAME}(\.{HOSTNAME})*\.? /* Example: fe80::c002:37ff:fe6c:0%fastethernet0/0 */ IPV6 [0-9A-Fa-f:.]+(%[0-9A-Za-z]+)? +UID [uU][+]?[0-9A-Fa-f]{1,8} %x SC_blockcomment SC_DEFINE SC_CSTRING SC_ORDERED_INCLUDE %s SC_MODULE_PARAMETERS SC_LOGGING SC_TESTPORT_PARAMETERS SC_EXECUTE SC_GROUPS %s SC_COMPONENTS SC_EXTERNAL_COMMANDS SC_MAIN_CONTROLLER SC_INCLUDE SC_PROFILER +%s SC_CHAR_KEYWORD %% int comment_caller = INITIAL; @@ -350,7 +353,7 @@ IPV6 [0-9A-Fa-f:.]+(%[0-9A-Za-z]+)? {NUMBER} { yylval.int_val = NULL; BN_dec2bn(&yylval.int_val, *yytext == '+' ? yytext + 1 : yytext); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { RETURN(MPNumber); } RETURN(Number); @@ -358,7 +361,7 @@ IPV6 [0-9A-Fa-f:.]+(%[0-9A-Za-z]+)? {FLOAT} { yylval.float_val = atof(yytext); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { RETURN(MPFloat); } RETURN(Float); @@ -397,19 +400,31 @@ IPV6 [0-9A-Fa-f:.]+(%[0-9A-Za-z]+)? {CHARSTRING} { yylval.str_val = mcopystrn(yytext, yyleng); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { RETURN(MPCstring); } RETURN(Cstring); } +<SC_CHAR_KEYWORD> +{ + {UID} { + yylval.str_val = mcopystrn(yytext, yyleng); + RETURN(Cstring); + } + + [,] { RETURN(*yytext); } + + [)] { BEGIN(SC_MODULE_PARAMETERS); RETURN(*yytext); } +} + /* Section-wide keywords */ <SC_MODULE_PARAMETERS> { NULL RETURN(NULLKeyword); null RETURN(nullKeyword); -char RETURN(CharKeyword); +char { BEGIN(SC_CHAR_KEYWORD); RETURN(CharKeyword); } objid RETURN(ObjIdKeyword); omit RETURN(OmitKeyword); none | @@ -756,7 +771,7 @@ WARNING_UNQUALIFIED RETURN(LoggingBit); if (whether_update_buffer()) cfg->config_read_buffer = mputprintf(cfg->config_read_buffer, "%s ", int_val_str); OPENSSL_free(int_val_str); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { return MPNumber; } return Number; @@ -783,7 +798,7 @@ WARNING_UNQUALIFIED RETURN(LoggingBit); Free(macroname); if (whether_update_buffer()) cfg->config_read_buffer = mputprintf(cfg->config_read_buffer, "%f ", yylval.float_val); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { return MPFloat; } return Float; @@ -834,7 +849,7 @@ WARNING_UNQUALIFIED RETURN(LoggingBit); "name `%s'", macroname); yylval.str_val = memptystr(); Free(macroname); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { return MPCstring; } return Cstring; @@ -867,7 +882,7 @@ WARNING_UNQUALIFIED RETURN(LoggingBit); } Free(macroname); yylval.str_val = mcopystr(macrovalue); - if (YY_START == SC_MODULE_PARAMETERS) { + if (YY_START == SC_MODULE_PARAMETERS || YY_START == SC_CHAR_KEYWORD) { return MPCstring; } return Cstring; @@ -981,7 +996,7 @@ WARNING_UNQUALIFIED RETURN(LoggingBit); ":="|"=" RETURN(AssignmentChar); "&=" RETURN(ConcatChar); -. RETURN(yytext[0]); +. RETURN(yytext[0]); <*><<EOF>> { if (expansion_buffer) { @@ -1022,6 +1037,7 @@ static boolean whether_update_buffer() { switch (YY_START) { case SC_MODULE_PARAMETERS: + case SC_CHAR_KEYWORD: case SC_LOGGING: case SC_TESTPORT_PARAMETERS: case SC_EXTERNAL_COMMANDS: diff --git a/mctr2/cli/config_read.y b/mctr2/cli/config_read.y index a43e95dad3b74001e17b948f6a213b0e79682edd..16135a81bc486fe256ef56d4e75177f574a744dc 100644 --- a/mctr2/cli/config_read.y +++ b/mctr2/cli/config_read.y @@ -17,6 +17,7 @@ * Pandi, Krisztian * Raduly, Csaba * Szabados, Kristof + * Szabo, Bence Janos * Szabo, Janos Zoltan – initial implementation * Szalai, Gabor * Zalanyi, Balazs Andor @@ -145,6 +146,7 @@ static void yyprint(FILE *file, int type, const YYSTYPE& value); %token BeginTestCase %token EndTestCase + %token <str_val> Identifier %token ASN1LowerIdentifier "ASN.1 identifier beginning with a lowercase letter" %token MacroRValue @@ -479,6 +481,7 @@ OctetstringValue: UniversalCharstringValue: Quadruple + | USI ; UniversalCharstringFragment: @@ -491,6 +494,15 @@ Quadruple: ParameterExpression ',' ParameterExpression ')' ; +USI: + CharKeyword '(' UIDlike ')' +; + +UIDlike: + Cstring { Free($1); } + | UIDlike ',' Cstring { Free($3); } +; + StringValue: Cstring { $$ = $1; } | StringValue '&' Cstring { diff --git a/regression_test/Makefile b/regression_test/Makefile index e649243a348032fa5e33d531c03a71bd1e5f0530..aa5cfcdf77a7bf8614b948bba2232314a94c951e 100644 --- a/regression_test/Makefile +++ b/regression_test/Makefile @@ -46,7 +46,7 @@ assignmentNotation omitdef anytype RAW implicitMsgEncoding pattern_quadruples \ macros visibility hexstrOper ucharstrOper objidOper CRTR00015758 slider \ XML ipv6 implicitOmit testcase_defparam transparent HQ16404 cfgFile \ all_from lazyEval tryCatch text2ttcn json junitlogger ttcn2json profiler templateOmit \ -customEncoding makefilegen +customEncoding makefilegen uidChars ifdef DYN DIRS += loggerplugin diff --git a/regression_test/uidChars/Makefile b/regression_test/uidChars/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..940f663de83b71563efcbe016cf1bc17f7a986a7 --- /dev/null +++ b/regression_test/uidChars/Makefile @@ -0,0 +1,56 @@ +############################################################################## +# Copyright (c) 2000-2016 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Szabo, Bence Janos +# +############################################################################## +TOPDIR := .. +include $(TOPDIR)/Makefile.regression + +.SUFFIXES: .ttcn .hh +.PHONY: all clean dep run + +TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) + +TTCN3_MODULES = UIDCharsTest.ttcn + +GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) +GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh) +ifdef CODE_SPLIT +GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc)) +endif + +USER_SOURCES = + +OBJECTS = $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o) + +TARGET = UIDCharsTest$(EXESUFFIX) + +all: $(TARGET) + +$(TARGET): $(GENERATED_SOURCES) $(USER_SOURCES) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS) + +$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile + @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi + +compile: $(TTCN3_MODULES) $(ASN1_MODULES) + $(filter-out -Nold -E, $(TTCN3_COMPILER)) $(COMPILER_FLAGS) $^ + touch compile + +clean distclean: + -rm -f $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ + $(GENERATED_SOURCES) *.log Makefile.bak + +dep: $(GENERATED_SOURCES) + makedepend $(CPPFLAGS) $(GENERATED_SOURCES) + +run: $(TARGET) config.cfg + ./$^ + + diff --git a/regression_test/uidChars/UIDCharsTest.ttcn b/regression_test/uidChars/UIDCharsTest.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..5c1ac0989be1e753b4a94dda89ebc266d2ebc478 --- /dev/null +++ b/regression_test/uidChars/UIDCharsTest.ttcn @@ -0,0 +1,93 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Szabo, Bence Janos + * + ******************************************************************************/ +module UIDCharsTest +{ + modulepar universal charstring modpar; + modulepar universal charstring u11; + + type universal charstring MyCharStr1 (char(U+000041, U004353, U+533 ), "xyz") length (1..9); + const MyCharStr1 str := char(U+000041, U004353, U+533); + + type universal charstring MyCharStr2 (char(U011) .. char(U+444FF4)); + const MyCharStr2 str2 := char(U111); + + type universal charstring MyCharStr3 (char(U011) .. char(U+444FF4)) length(2..9); + const MyCharStr3 str3 := char(U11a, U+1f3) & char(U+00113f3); + + type component EmptyCT {} + + testcase tc_chars() runs on EmptyCT { + var universal charstring v_a := char(U+000041); //USI notation for character "A" + var universal charstring v_b := char(U+171); //USI notation for character "ű" + var universal charstring v_c := char(U41); //USI notation for character "A" without leading zeroes + var universal charstring v_d := char(U171,U+00000041); //USI notation for character "ű" and "A" without leading zeroes and + sign notation + var universal charstring v_e := char (U4E2d, U56fD); + var universal charstring v_f := char(U171,U+00000041) & "a" & char(0, 0, 0 , 63) & char(U+003F); + var universal charstring a_exp := "A"; + var universal charstring b_exp := "ű"; + var universal charstring c_exp := "A"; + var universal charstring d_exp := "űA"; + var universal charstring e_exp := "ä¸å›½"; + var universal charstring f_exp := "űAa??"; + + if (match(v_a,a_exp) and + match(v_b,b_exp) and + match(v_c,c_exp) and + match(v_d,d_exp) and + match(v_e,e_exp) and + match(v_f,f_exp)) + { + setverdict(pass,"v_a:",v_a, "v_b:",v_b, "v_c:",v_c,"v_d:",v_d,"v_e:",v_e,"v_f:",v_f); + } + else { + setverdict(fail,"v_a:",v_a, "v_b:",v_b, "v_c:",v_c,"v_d:",v_d,"v_e:",v_e,"v_f:",v_f); + } + } + + testcase tc_pattern() runs on EmptyCT { + var template universal charstring utmp := pattern "[\q{ U23425 }-\q{ U23427 }]"; + var template universal charstring utmp2 := pattern "[\q{ U23425 }-\q{ U23427 }]#(2,5)"; + var template universal charstring utmp3 := pattern "[\q{ U23425, U+23427 }]#(2,5)"; + var charstring u1 := "s"; + var universal charstring exp := char(U+23426 ); + var universal charstring exp_2 := char(U+23426 , U+023425, U23427); + var universal charstring not_exp_2 := char(U+23426 , U+023425, U23429); + var universal charstring exp_3 := char(U+23425 , U+023427, U23427); + + if(match(exp, utmp) and + match(exp_2, utmp2) and + not match(not_exp_2, utmp2) and + match(exp_3, utmp3)){ + setverdict(pass); + }else{ + setverdict(fail); + } + } + + testcase tc_module_param() runs on EmptyCT { + const universal charstring exp := "CDZ"; + if(match(modpar, exp) and + match(u11, exp)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control + { + execute(tc_chars()); + execute(tc_pattern()); + execute(tc_module_param()); + } +} + diff --git a/regression_test/uidChars/compile b/regression_test/uidChars/compile new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/regression_test/uidChars/config.cfg b/regression_test/uidChars/config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..daf2127275bd2acfc6535279dd18eefb8c9b0784 --- /dev/null +++ b/regression_test/uidChars/config.cfg @@ -0,0 +1,19 @@ +############################################################################### +# Copyright (c) 2000-2015 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################### +[LOGGING] +LogFile := "UIDCharTest.log" +FileMask := LOG_ALL +ConsoleMask := TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS + +[EXECUTE] +UIDCharsTest.control + +[MODULE_PARAMETERS] +modpar := char(U0043, U+0044, U+5a) +u11 := char( U+000043, U0044 , U005A ) +