Commit 3abe9331 authored by Elemer Lelik's avatar Elemer Lelik
Browse files

Sync with 5.4.0

parent f99e8b7f
doxygen
Install
Makefile.personal
.cproject
.project
.TITAN*
*.o
*.so
*.so.0
*.so.0.0
*.exe
*.pdf
META-INF
......
###############################################################################
# Copyright (c) 2000-2014 Ericsson Telecom AB
# 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
###############################################################################
# Copyright (c) 2000-2014 Ericsson Telecom AB
# 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
......
###############################################################################
# Copyright (c) 2000-2014 Ericsson Telecom AB
# 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
......@@ -75,20 +75,9 @@ OPENSSL_DIR := default
# Location of libxml2
XMLDIR := default
## ## ## ## ## Variables below are automatically set ## ## ## ## ##
# Flags for the C(++) preprocessor:
# Prevent a warning about yyinput being defined but not used
CPPFLAGS := -DYY_NO_INPUT
ifeq ($(DEBUG), yes)
CPPFLAGS += -DMEMORY_DEBUG -DFATAL_DEBUG
else
CPPFLAGS += -DNDEBUG
endif
# MingW flags need to be passed to the preprocessor during ctags configure
CPPFLAGS += $(MINGW)
# Flags shared between C and C++
COMPILERFLAGS := -Wall
......@@ -100,16 +89,55 @@ COMPILERFLAGS := -Wall
# Flags for the C compiler.
# std=gnu9x shuts up warnings about long long and variadic macros
CCFLAGS = $(COMPILERFLAGS) -std=gnu9x
# Flags for the C++ compiler:
CXXFLAGS = $(COMPILERFLAGS) -Wno-long-long
# The command for maintaining static libraries:
AR := ar
# The command for building the shared libraries:
# It shall be set to either "$(CXX) -G" or "$(CXX) -shared" depending
# on the linker you use.
LD = $(CXX) -shared
# Flags for linking binary executables (e.g. for profiling):
LDFLAGS = $(MINGW)
# The command for removing symbol table from the executables:
STRIP := strip
# Flags for flex:
FLEXFLAGS := -B -s -Cr
# Flags for bison:
BISONFLAGS := -d
# Override common settings with personal preferences if needed
-include $(TOP)/Makefile.personal
## ## ## ## ## Variables below are automatically set ## ## ## ## ##
ifeq ($(DEBUG), yes)
CPPFLAGS += -DMEMORY_DEBUG -DFATAL_DEBUG
else
CPPFLAGS += -DNDEBUG
endif
# MingW flags need to be passed to the preprocessor during ctags configure
CPPFLAGS += $(MINGW)
ifeq ($(DEBUG), yes)
CCFLAGS += -g
CCFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align \
-Wstrict-prototypes
else
ifeq ($(COVERAGE), yes)
CCFLAGS += -O0
else
CCFLAGS += -O2
endif
# Flags for the C++ compiler:
CXXFLAGS = $(COMPILERFLAGS) -Wno-long-long
endif
# Only the default Cygwin compiler can be used for Mingw.
# Its version is 3.4.4, too low.
......@@ -121,9 +149,13 @@ endif
ifeq ($(DEBUG), yes)
CXXFLAGS += -g
CXXFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align
else
ifeq ($(COVERAGE), yes)
CXXFLAGS += -O0
else
CXXFLAGS += -O2
endif
endif
# Flags for the C/C++ compilers to generate dependency list (-M or -MM
# for gcc or clang, -xM or -xM1 for Sun C compiler).
......@@ -137,25 +169,11 @@ CCDEPFLAG := -xM1
CXXDEPFLAG := -xM1
endif
# The command for maintaining static libraries:
AR := ar
# The command for building the shared libraries:
# It shall be set to either "$(CXX) -G" or "$(CXX) -shared" depending
# on the linker you use.
LD = $(CXX) -shared
# Flags for linking binary executables (e.g. for profiling):
LDFLAGS = $(MINGW)
ifeq ($(DEBUG), yes)
LDFLAGS += -g
endif
# The command for removing symbol table from the executables:
STRIP := strip
# Flags for flex:
FLEXFLAGS := -B -s -Cr
ifeq ($(DEBUG), yes)
FLEXFLAGS += -b -p
# FLEXFLAGS += -d
......@@ -165,21 +183,16 @@ else
FLEXFLAGS += -Cfe
endif
# Flags for bison:
BISONFLAGS := -d
ifeq ($(DEBUG), yes)
BISONFLAGS += -t -v
endif
ifeq ($(COVERAGE), yes)
ifneq ($(DEBUG), yes)
$(error TURN ON DEBUG MODE FOR COVERAGE)
else
CPPFLAGS += -DCOVERAGE_BUILD
COMPILERFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -fprofile-arcs -ftest-coverage -lgcov
endif
endif
# Directory which contains the code for POSIX regular expression handling.
# It is needed on platforms where the system's libc does not support POSIX
......@@ -206,8 +219,6 @@ endif
# or installed.
TEXPATH := /usr/local/teTeX2.0.2/bin/sparc-sun-solaris2.8
# Override common settings with personal preferences if needed
-include $(TOP)/Makefile.personal
###########################################################################
# You don't have to alter anything below this line.
......
###############################################################################
# Copyright (c) 2000-2014 Ericsson Telecom AB
# 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
......@@ -79,6 +79,10 @@ V_DEP = $(V_DEP_$(VD))
%.o: %.c
$(V_CC)$(CC) -c $(CPPFLAGS) $(CCFLAGS) $< -o $@
# Special rule for building profmerge files
%.profmerge.o: %.cc
$(V_CXX)$(CXX) -c -DPROF_MERGE $(CPPFLAGS) $(CXXFLAGS) $< -o $@
%.o: %.cc
$(V_CXX)$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
......
......@@ -17,13 +17,13 @@ sudo apt-get install xutils-dev
The following packages may be needed for titan_eclipse/automatic_build:
sudo apt-get install ant xsltproc
2.Clone the titan directory from git into /home/<user_id>/titan
2.Clone the titan directory from git into /home/<user_id>/titan.core
git clone https://github.com/eclipse/titan.core titan
git clone https://github.com/eclipse/titan.core titan.core
3. Configure the build
cd titan
cd titan.core
check that MakefileFOSS.cfg is present and has the following content:
cat MakefileFOSS.cfg
......@@ -37,15 +37,15 @@ Options can be overridden by the content of a file named Makefile.personal whic
adapt to local installation directories, change config options etc.
Below, a small number of typical scenarios are presented.
1) JNI disabled
a) JNI disabled
The JNI interface is used by the Eclipse Titan Executor or by the Java Executor API.
If you don't need them , Titan can be compiled without JNI.
Create ~/titan/Makefile.personal to override settings in Makefile.cfg with the following content:
Create ~/titan.core/Makefile.personal to override settings in Makefile.cfg with the following content:
(replace paths with values relevant to your installation)
TTCN3_DIR := /home/<user id>/titan/Install
TTCN3_DIR := /home/<user id>/titan.core/Install
OPENSSL_DIR := /usr
#JDKDIR := /usr/lib/jvm/java-7-openjdk-amd64
XMLDIR := /usr
......@@ -55,14 +55,14 @@ GEN_PDF := no
2) JNI enabled
b) JNI enabled
install JDK into /home/<user id>/jdk
Create ~/titan/Makefile.personal to override settings in Makefile.cfg with the following content:
Create ~/titan.core/Makefile.personal to override settings in Makefile.cfg with the following content:
(replace paths with values relevant to your installation)
TTCN3_DIR := /home/<user id>/titan/Install
TTCN3_DIR := /home/<user id>/titan.core/Install
OPENSSL_DIR := /usr
JDKDIR := /usr/lib/jvm/java-7-openjdk-amd64
XMLDIR := /usr
......@@ -77,7 +77,7 @@ make
5. Set environment variables
setenv TTCN3_DIR /home/<user id>/titan/Install
setenv TTCN3_DIR /home/<user id>/titan.core/Install
setenv PATH /home/<userid>/titan.core/Install/bin/:${PATH}
setenv LD_LIBRARY_PATH /home/<userid>/titan.core/Install/lib:${LD_LIBRARY_PATH}
......@@ -85,7 +85,7 @@ for csh
or
export TTCN3_DIR=/home/<user id>/titan/Install
export TTCN3_DIR=/home/<user id>/titan.core/Install
export PATH=/home/<userid>/titan.core/Install/bin/:${PATH}
export LD_LIBRARY_PATH=/home/<userid>/titan.core/Install/lib:${LD_LIBRARY_PATH}
......@@ -95,15 +95,16 @@ for bash
make install
This will install Titan into /home/<user id>/titan/Install
This will install Titan into /home/<user id>/titan.core/Install
7. Optionally , run function/regression tests
cd /home/<user id>/titan/function_test
cd /home/<user id>/titan.core/function_test
in the following Makefiles
BER_EncDec/Makefile
XER_EncDec/Makefile
Text_EncDec/Makefile
RAW_EncDec/Makefile
......@@ -116,7 +117,7 @@ make
( or make |& tee outputfile if you want to save the output for verification)
cd /home/<user id>/titan/regression_test
cd /home/<user id>/titan.core/regression_test
make run
( or make run |& tee outputfile if you want to save the output for verification)
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
///////////////////////////////////////////////////////////////////////////////
// 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
///////////////////////////////////////////////////////////////////////////////
#include <cstring>
#include "JSON_Tokenizer.hh"
......@@ -371,3 +379,50 @@ int JSON_Tokenizer::put_next_token(json_token_t p_token, const char* p_token_str
return buf_len - start_len;
}
char* convert_to_json_string(const char* str)
{
char* ret_val = mcopystrn("\"", 1);
// control characters (like \n) cannot be placed in a JSON string, replace
// them with JSON metacharacters
// double quotes and backslashes need to be escaped, too
size_t str_len = strlen(str);
for (size_t i = 0; i < str_len; ++i) {
switch (str[i]) {
case '\n':
ret_val = mputstrn(ret_val, "\\n", 2);
break;
case '\r':
ret_val = mputstrn(ret_val, "\\r", 2);
break;
case '\t':
ret_val = mputstrn(ret_val, "\\t", 2);
break;
case '\f':
ret_val = mputstrn(ret_val, "\\f", 2);
break;
case '\b':
ret_val = mputstrn(ret_val, "\\b", 2);
break;
case '\"':
ret_val = mputstrn(ret_val, "\\\"", 2);
break;
case '\\':
ret_val = mputstrn(ret_val, "\\\\", 2);
break;
default:
if (str[i] < 32 && str[i] > 0) {
// use the JSON \uHHHH notation for other control characters
// (this is just for esthetic reasons, these wouldn't break the JSON
// string format)
ret_val = mputprintf(ret_val, "\\u00%d%c", str[i] / 16,
(str[i] % 16 < 10) ? (str[i] % 16 + '0') : (str[i] % 16 - 10 + 'A'));
}
else {
ret_val = mputc(ret_val, str[i]);
}
break;
}
}
return mputstrn(ret_val, "\"", 1);
}
///////////////////////////////////////////////////////////////////////////////
// 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
///////////////////////////////////////////////////////////////////////////////
#ifndef JSON_TOKENIZER_HH
#define JSON_TOKENIZER_HH
......@@ -155,6 +163,14 @@ public:
// A dummy JSON tokenizer, use when there is no actual JSON document
static JSON_Tokenizer DUMMY_BUFFER;
/** Converts a string into a JSON string by replacing all control characters
* with JSON escape sequences, if available, or with the \uHHHH escape sequence.
* The string is also wrapped inside a set of double quotes and all double quotes
* and backslash characters are double-escaped.
*
* Returns an expstring, that needs to be freed. */
extern char* convert_to_json_string(const char* str);
#endif /* JSON_TOKENIZER_HH */
###############################################################################
# Copyright (c) 2000-2014 Ericsson Telecom AB
# 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment