Commit af710487 authored by Elemer Lelik's avatar Elemer Lelik
Browse files

Sync with 5.2.0

parent 4567b25b
******************************************************************************
* 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
******************************************************************************
Cygwin setup
- If Cygwin is installed already, refresh your Cygwin installation
Titan is always build for the newest Cygwin version available.
......
******************************************************************************
* 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
******************************************************************************
Build and install Titan on Linux
1.Install required libraries:
......@@ -108,6 +116,3 @@ These tests might run for half an hour (regr.tests) to two hours (func.tests)
6. Optionally , copy Titan into its' final directory.
From here on, you can continue with the Titan installation guide, see /Install/docs, to set environment variables etc.
......@@ -20,26 +20,26 @@ http://polarsys.org/sites/default/files/custom_uploads/TITAN%20Datasheet%20A4%20
##Binaries and SHA512 checksums for a number of Linux platforms can be downloaded from:
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.1.0-sles10.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.1.0-sles10.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.1.2-sled10.2.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.1.2-sled10.2.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.3-SLED11.1.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.3-SLED11.1.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.1.2-rhel5.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.1.2-rhel5.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-SLED11.1.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-SLED11.1.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-sled11.0.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-sled11.0.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-sles11.1.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-sles11.1.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.4.5-rhel6.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.4.5-rhel6.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.6-ubuntu12.04.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.6-ubuntu12.04.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.8-ubuntu14.04.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.8-ubuntu14.04.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux32-gcc4.1.0-sles10.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux32-gcc4.1.0-sles10.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux32-gcc4.1.2-sled10.2.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux32-gcc4.1.2-sled10.2.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux32-gcc4.3-SLED11.1.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux32-gcc4.3-SLED11.1.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.1.2-rhel5.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.1.2-rhel5.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.3-SLED11.1.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.3-SLED11.1.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.3-sled11.0.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.3-sled11.0.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.3-sles11.1.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.3-sles11.1.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.4.5-rhel6.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.4.5-rhel6.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.6-ubuntu12.04.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.6-ubuntu12.04.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.8-ubuntu14.04.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.2.pl0-linux64-gcc4.8-ubuntu14.04.tgz.sha512
# Related products:
......
# titan.core
TTCN-3 is a standardized, modular language specifically designed for testing.
Eclipse Titan offers a free and open source (FOSS) compiler both for TTCN-3 and for
ASN.1 (Abstract Syntax Notation One).
# Standards page (also including downloadable code):
* http://www.ttcn-3.org/
# Main project page:
* https://projects.eclipse.org/projects/tools.titan
##Introductory video of a presentation about Titan held at EclipseCon 2014:
* https://www.youtube.com/watch?v=2knzZuwzn-Y.
##Titan Datasheet on polarsys.org:
http://polarsys.org/sites/default/files/custom_uploads/TITAN%20Datasheet%20A4%202.1.pdf
##Binaries and SHA512 checksums for a number of Linux platforms can be downloaded from:
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.1.0-sles10.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.1.0-sles10.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.1.2-sled10.2.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.1.2-sled10.2.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.3-SLED11.1.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux32-gcc4.3-SLED11.1.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.1.2-rhel5.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.1.2-rhel5.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-SLED11.1.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-SLED11.1.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-sled11.0.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-sled11.0.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-sles11.1.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.3-sles11.1.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.4.5-rhel6.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.4.5-rhel6.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.6-ubuntu12.04.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.6-ubuntu12.04.tgz.sha512
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.8-ubuntu14.04.tgz
* https://www.eclipse.org/downloads/download.php?file=/titan/ttcn3-5.1.pl0-linux64-gcc4.8-ubuntu14.04.tgz.sha512
# Related products:
## Test Ports:
* https://github.com/eclipse/titan.TestPorts.Common_Components.Abstract_Socket
* https://github.com/eclipse/titan.TestPorts.HTTPmsg
* https://github.com/eclipse/titan.TestPorts.LANL2asp
* https://github.com/eclipse/titan.TestPorts.PCAPasp
* https://github.com/eclipse/titan.TestPorts.PIPEasp
* https://github.com/eclipse/titan.TestPorts.SCTPasp
* https://github.com/eclipse/titan.TestPorts.SIPmsg
* https://github.com/eclipse/titan.TestPorts.SQLasp
* https://github.com/eclipse/titan.TestPorts.TCPasp
* https://github.com/eclipse/titan.TestPorts.TELNETasp
* https://github.com/eclipse/titan.TestPorts.UDPasp
## Protocol Modules:
* https://github.com/eclipse/titan.ProtocolModules.COMMON
* https://github.com/eclipse/titan.ProtocolModules.DHCP
* https://github.com/eclipse/titan.ProtocolModules.DHCPv6
* https://github.com/eclipse/titan.ProtocolModules.DIAMETER_ProtocolModule_Generator
* https://github.com/eclipse/titan.ProtocolModules.DNS
* https://github.com/eclipse/titan.ProtocolModules.ICMP
* https://github.com/eclipse/titan.ProtocolModules.ICMPv6
* https://github.com/eclipse/titan.ProtocolModules.IP
* https://github.com/eclipse/titan.ProtocolModules.RTP
* https://github.com/eclipse/titan.ProtocolModules.RTSP
* https://github.com/eclipse/titan.ProtocolModules.SMPP
* https://github.com/eclipse/titan.ProtocolModules.SMTP
* https://github.com/eclipse/titan.ProtocolModules.SNMP
* https://github.com/eclipse/titan.ProtocolModules.TCP
* https://github.com/eclipse/titan.ProtocolModules.UDP
* https://github.com/eclipse/titan.ProtocolModules.XMPP
******************************************************************************
* 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
******************************************************************************
MinGW setup
(A) Download the MinGW installer from the MinGW site:
http://www.mingw.org/
(B) Follow the install steps found on the MinGW getting started page:
http://www.mingw.org/wiki/getting_started
Select the mingw-gcc-v3 packages because Titan only compiles
with older gcc. If you select the gcc4 packages, then the make process
stops immediately with some error messages. Select the msys packages too.
(C) Check the PATH system variable:
System -> Advanced system settings -> Environment Variables -> Path
The MinGW installation path must be present to use the installed
executables and files. For example:
echo %PATH%
C:\MinGW\bin;C:\MinGW\usr\bin...
(D) Working environment:
Use the <Install folder>\msys\<version>\msys.bat file to start a shell.
Download and extract the Titan source files and folders to a directory,
and create a Makefile.personal in the top directory. Please check the
installation guide and set all the needed variables like TTCN3_DIR. The
MinGW compilation needs a few extra changes in the Makefile.cfg also. Set
the PLATFORM and MINGW values:
PLATFORM := WIN32
MINGW := -DMINGW -mno-cygwin
(E) Compile Titan:
cd titan
make -j
make install
The compiled files will be placed into the ./Install directory.
(F) If the build process stops with a Windows error message saying that some files
are missing, search for the indicated Cygwin package and download it from the Cygwin page.
You can search fast and easily with the Cygwin Package Search tool:
https://cygwin.com/cgi-bin2/package-grep.cgi
Extract the downloaded package into the MinGW installation directory, and
restart the build process.
......@@ -142,6 +142,7 @@ MACRO_REFERENCE_INT \$"{"{WS}{TTCN3IDENTIFIER}{WS}(","{WS}integer{WS})?"}"
}
"["{WS}LOGGING{WS}"]" BEGIN(INITIAL);
"["{WS}PROFILER{WS}"]" BEGIN(INITIAL);
"["{WS}EXECUTE{WS}"]" BEGIN(INITIAL);
"["{WS}EXTERNAL_COMMANDS{WS}"]" BEGIN(INITIAL);
"["{WS}GROUPS{WS}"]" BEGIN(INITIAL);
......
......@@ -10,7 +10,7 @@
/* Version numbers */
#define TTCN3_MAJOR 5
#define TTCN3_MINOR 1
#define TTCN3_MINOR 2
#define TTCN3_PATCHLEVEL 0
//#define TTCN3_BUILDNUMBER 0
......@@ -22,7 +22,7 @@
* TTCN3_VERSION = TTCN3_MAJOR * 1000000 + TTCN3_MINOR * 10000 +
* TTCN3_PATCHLEVEL * 100 + TTCN3_BUILDNUMBER
*/
#define TTCN3_VERSION 50100
#define TTCN3_VERSION 50200
/* A monotonically increasing version number.
* An official release is deemed to have the highest possible build number (99)
......
......@@ -263,17 +263,10 @@ namespace Common {
return versions;
}
void Modules::add_types_to_json_schema(JSON_Tokenizer& json)
void Modules::generate_json_schema(JSON_Tokenizer& json, map<Type*, JSON_Tokenizer>& json_refs)
{
for(size_t i = 0; i < mods_v.size(); ++i) {
mods_v[i]->add_types_to_json_schema(json);
}
}
void Modules::add_func_to_json_schema(map<Type*, JSON_Tokenizer>& json_refs)
{
for(size_t i = 0; i < mods_v.size(); ++i) {
mods_v[i]->add_func_to_json_schema(json_refs);
mods_v[i]->generate_json_schema(json, json_refs);
}
}
......@@ -807,6 +800,12 @@ namespace Common {
mputprintf(effective_module_functions, "%s\"%s\"",
(effective_module_functions ? ", " : ""), get_modid().get_dispname().c_str());
}
if (profiler_enabled && MOD_TTCN == get_moduletype()) {
output->source.static_function_bodies = mputprintf(output->source.static_function_bodies,
"TTCN3_Stack_Depth stack_depth;\n"
"ttcn3_prof.enter_function(\"%s\", 0, \"%s\");\n",
get_filename(), get_modid().get_dispname().c_str());
}
}
output->source.static_function_bodies =
mputstr(output->source.static_function_bodies, output->functions.pre_init);
......@@ -844,6 +843,12 @@ namespace Common {
mputprintf(effective_module_functions, "%s\"%s\"",
(effective_module_functions ? ", " : ""), get_modid().get_dispname().c_str());
}
if (profiler_enabled && MOD_TTCN == get_moduletype()) {
output->source.static_function_bodies = mputprintf(output->source.static_function_bodies,
"TTCN3_Stack_Depth stack_depth;\n"
"ttcn3_prof.enter_function(\"%s\", 0, \"%s\");\n",
get_filename(), get_modid().get_dispname().c_str());
}
}
output->source.static_function_bodies =
mputstr(output->source.static_function_bodies, output->functions.post_init);
......
......@@ -116,14 +116,15 @@ namespace Common {
void generate_code(CodeGenHelper& cgh);
void dump(unsigned level=1) const;
/** Generates JSON schema segments for the types defined in the modules
* and adds them to the JSON schema parameter. */
void add_types_to_json_schema(JSON_Tokenizer& json);
/** Generates JSON schemas containing references to the types defined in the
* modules. Information related to the types' JSON encoding and decoding
* functions is also inserted after the references. */
void add_func_to_json_schema(map<Type*, JSON_Tokenizer>& json_refs);
/** Generates JSON schema segments for the types defined in the modules,
* and references to these types. Information related to the types'
* JSON encoding and decoding functions is also inserted after the references.
*
* @param json JSON document containing the main schema, schema segments for
* the types will be inserted here
* @param json_refs map of JSON documents containing the references and function
* info related to each type */
void generate_json_schema(JSON_Tokenizer& json, map<Type*, JSON_Tokenizer>& json_refs);
};
/**
......@@ -391,15 +392,15 @@ namespace Common {
void generate_code(CodeGenHelper& cgh);
virtual void dump(unsigned level) const;
/** Generates JSON schema segments for the types defined in the module
* and adds them to the JSON schema parameter. */
virtual void add_types_to_json_schema(JSON_Tokenizer&) = 0;
/** Generates JSON schemas containing references to the types that have JSON
* encoding and/or decoding functions declared in the module. Information
* related to these functions is also inserted after the references
* (only for TTCN-3 modules). */
virtual void add_func_to_json_schema(map<Type*, JSON_Tokenizer>&) = 0;
/** Generates JSON schema segments for the types defined in the modules,
* and references to these types. Information related to the types'
* JSON encoding and decoding functions is also inserted after the references.
*
* @param json JSON document containing the main schema, schema segments for
* the types will be inserted here
* @param json_refs map of JSON documents containing the references and function
* info related to each type */
virtual void generate_json_schema(JSON_Tokenizer& json, map<Type*, JSON_Tokenizer>& json_refs) = 0;
};
/**
......
......@@ -298,7 +298,7 @@ namespace Common {
if (++error_count >= max_errors) {
fputs("Maximum number of errors reached, aborting.\n", stderr);
fflush(stderr);
abort();
exit(EXIT_FAILURE);
}
}
......
......@@ -68,7 +68,7 @@ main.cc Real.cc Setting.cc SigParam.cc string.cc subtype.cc Stopwatch.cc \
Type.cc Type_chk.cc Type_codegen.cc TypeCompat.cc \
Typestuff.cc ustring.cc Value.cc Valuestuff.cc XerAttributes.cc subtypestuff.cc CodeGenHelper.cc
MFGEN_SOURCES := makefile.c xpather.cc
MFGEN_SOURCES := makefile.c xpather.cc ProjectGenHelper.cc
TCOV2LCOV_SOURCES := tcov2lcov.cc
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 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 _LIB_GEN_HELPER_HH
#define _LIB_GEN_HELPER_HH
#include <string>
#include <map>
#include <vector>
#include <cstdio>
class ProjectGenHelper;
class ProjectDescriptor {
public:
explicit ProjectDescriptor(const char* name);
~ProjectDescriptor() { cleanUp(); };
const std::string& getProjectName() const { return projectName; }
void setTPDFileName( const char* name);
const std::string& getTPDFileName() const { return tpdFileName; }
void setTargetExecName(const char* name) { targetExecutableName = std::string(name); }
const std::string& getTargetExecName() const { return targetExecutableName; }
void setProjectAbsTpdDir(const char* name) { projectAbsTpdDir = std::string(name); }
const std::string& getProjectAbsTpdDir() const { return projectAbsTpdDir; }
void setProjectAbsWorkingDir(const char* name);
void setProjectWorkingDir(const char* name) { projectWorkingDir = std::string(name); }
const std::string& getProjectAbsWorkingDir() const { return projectAbsWorkingDir; }
const std::string& getProjectWorkingDir() const { return projectWorkingDir; }
void setLinkingStrategy(bool strategy) { dynamicLinked = strategy; }
bool getLinkingStrategy() const { return dynamicLinked; }
void setLibrary(bool isLib) { library = isLib; }
bool isLibrary() const { return library; }
bool isInitialized();
void addToReferencedProjects(const char* refProjName);
void addToRefProjWorkingDirs(const std::string& subProjDir);
bool hasLinkerLibTo(const std::string& refProjName) const;
bool hasLinkerLib(const char* libName) const; // Linker Lib got from TPD
void addToLibSearchPaths(const char* libSearchPath);
void addToLinkerLibs(const char* linkerLibs);
void print();
void cleanUp();
size_t numOfReferencedProjects() const { return referencedProjects.size(); };
size_t numOfRefProjWorkingDirs() const { return refProjWorkingDirs.size(); };
size_t numOfLibSearchPaths() const { return libSearchPaths.size(); };
size_t numOfLinkerLibs() const { return linkerLibraries.size(); };
const std::string& getReferencedProject(size_t index) const
{ return index < referencedProjects.size() ? referencedProjects[index] : emptyString; };
const std::string& getRefProjWorkingDir(size_t index) const
{ return index < refProjWorkingDirs.size() ? refProjWorkingDirs[index] : emptyString; };
const char* getLibSearchPath(const std::string& subProjName) const;
const char* getLibSearchPath(size_t index) const { return libSearchPaths[index].c_str(); };
const char* getLinkerLib(const std::string& subProjName) const;
const char* getLinkerLib(size_t index) const { return linkerLibraries[index].c_str(); };
size_t getLibSearchPathIndex(const std::string& subProjName) const;
void setLibSearchPath(size_t index, const std::string& relPath) { libSearchPaths[index] = relPath; };
void addTtcn3ModuleName(const char* name) { ttcn3ModuleNames.push_back(name); };
bool hasTtcn3ModuleName(const char* moduleName) const;
void addAsn1ModuleName(const char* name) { asn1ModuleNames.push_back(name); };
bool hasAsn1ModuleName(const char* moduleName) const;
void addUserSource(const char* name) { userSources.push_back(name); };
bool hasUserSource(const char* userSourceName) const;
void addUserHeader(const char* name) { userHeaders.push_back(name); };
bool hasUserHeader(const char* userHeaderName) const;
void addTtcn3PP(const char* name) { ttcnPP.push_back(name); };
bool hasTtcn3PP(const char* ttcnPPName) const;
std::string setRelativePathTo(const std::string& absPathTo);
private:
static const std::string emptyString;
std::string projectName;
std::string tpdFileName;
std::string targetExecutableName; //Library or Executable(only the top level)
std::string projectAbsTpdDir;
std::string projectAbsWorkingDir;
std::string projectWorkingDir;
bool library;
bool dynamicLinked;
std::vector<std::string> referencedProjects;
std::vector<std::string> refProjWorkingDirs;
std::vector<std::string> libSearchPaths;
std::vector<std::string> linkerLibraries;
std::vector<std::string> ttcn3ModuleNames;
std::vector<std::string> asn1ModuleNames;
std::vector<std::string> userSources; // *.cc ; *.cpp
std::vector<std::string> userHeaders; // *.hh ; *.h ; *.hpp
std::vector<std::string> ttcnPP; // *.ttcnpp
bool initialized;
};
class ProjectGenHelper {
public:
static ProjectGenHelper &Instance();
~ProjectGenHelper() { cleanUp(); };
void setZflag(bool flag) { Zflag = flag; };
bool getZflag() const { return Zflag; };
void setWflag(bool flag) { Wflag = flag; };
bool getWflag() const { return Wflag; };
void setHflag(bool flag) { Hflag = flag; };
bool getHflag() const { return Hflag; };
void setToplevelProjectName(const char* name);
const std::string& getToplevelProjectName() const { return nameOfTopLevelProject; };
void setRootDirOS(const char* name);
const std::string& getRootDirOS(const char* name);
void addTarget(const char* projName);
void generateRefProjectWorkingDirsTo(const char* projName);
void addTtcn3ModuleToProject(const char* projName, const char* moduleName);
void addAsn1ModuleToProject(const char* projName, const char* moduleName);
void addUserSourceToProject(const char* projName, const char* userSourceName);
void addUserHeaderToProject(const char* projName, const char* userHeaderName);
void addTtcnPPToProject(const char* projName, const char* ttcnPPName);
bool isTtcn3ModuleInLibrary(const char* moduleName) const;
bool isAsn1ModuleInLibrary(const char* moduleName) const;
bool isSourceFileInLibrary(const char* fileName) const;
bool isHeaderFileInLibrary(const char* fileName) const;
bool isTtcnPPFileInLibrary(const char* fileName) const;
ProjectDescriptor* getTargetOfProject(const char* projName);
const ProjectDescriptor* getTargetOfProject(const char* projName) const;
ProjectDescriptor* getProjectDescriptor(const char* targetName); //target_executable_name
std::map<std::string, ProjectDescriptor>::const_iterator getHead() const;
std::map<std::string, ProjectDescriptor>::const_iterator getEnd() const;
size_t numOfLibs() const;
void getExternalLibs(std::vector<const char*>& extLibs);
void getExternalLibSearchPathes(std::vector<const char*>& extLibPathes);
bool hasReferencedProject();
size_t numOfProjects() const { return projs.size();};
bool isCPPSourceFile(const char* fileName) const;
bool isCPPHeaderFile(const char* fileName) const;
bool isTtcnPPFile(const char* fileName) const;
void print();
bool sanityCheck(); // tests if the structure generated from TPDs is consistent
void cleanUp();
private:
ProjectGenHelper();
ProjectGenHelper(const ProjectGenHelper &rhs);
ProjectGenHelper &operator=(const ProjectGenHelper &rhs);
ProjectDescriptor* getProject(const char* projName);
const ProjectDescriptor* getProject(const char* projName) const;
bool DynamicLibraryChecker(const ProjectDescriptor* desc,
bool& found,
char** executableName);
private:
static ProjectGenHelper& intance;
static const std::string emptyString;
std::string nameOfTopLevelProject;
std::string rootDirOS; // make archive needs the top dir on OS level
std::string relPathToRootDirOS;
bool Zflag; // the makefilegen switch wether to use this option at all
bool Wflag; // prefix woring directory
bool Hflag; // hierarchical make structure
std::map<const std::string, ProjectDescriptor> projs;
std::map<const std::string, const ProjectDescriptor*> checkedProjs;
};
#endif // _LIB_GEN_HELPER_HH
......@@ -232,6 +232,12 @@ namespace Common {
mputprintf(effective_module_functions, "%s\"%s\"",
(effective_module_functions ? ", " : ""), entityname);
}
if (profiler_enabled) {
str = mputprintf(str,
"TTCN3_Stack_Depth stack_depth;\n"
"ttcn3_prof.enter_function(\"%s\", %d, \"%s\");\n",
filename, yyloc.first_line, entityname);
}
}
return str;
}
......@@ -242,6 +248,10 @@ namespace Common {
if (include_location_info && !transparency) {
str = mputprintf(str, "current_location.update_lineno(%d);\n",
yyloc.first_line);
if (profiler_enabled) {
str = mputprintf(str, "ttcn3_prof.execute_line(\"%s\", %d);\n",
get_filename(), yyloc.first_line);
}
if (tcov_file_name && in_tcov_files(get_filename())) {
effective_module_lines =
mputprintf(effective_module_lines, "%s%d",
......@@ -544,9 +554,9 @@ namespace Common {
else return false;
}
Type *Scope::get_mtc_system_comptype(bool is_system, bool is_connecting)
Type *Scope::get_mtc_system_comptype(bool is_system)
{
if (parent_scope) return parent_scope->get_mtc_system_comptype(is_system, is_connecting);
if (parent_scope) return parent_scope->get_mtc_system_comptype(is_system);
else return 0;
}
......
......@@ -592,10 +592,9 @@ public:
virtual bool has_ass_withId(const Identifier& p_id);
virtual bool is_valid_moduleid(const Identifier& p_id);
/** Returns the TTCN-3 component type that is associated with
* keywords 'mtc' or 'system'. Returns NULL outside testcase definitions
* (unless it's a 'map' or 'connect' statement block) or if the component type
* cannot be determined. */
virtual Type *get_mtc_system_comptype(bool is_system, bool is_connecting);
* keywords 'mtc' or 'system'. Returns NULL if the component type
* cannot be determined (i.e. outside testcase definitions). */
virtual Type *get_mtc_system_comptype(bool is_system);
/** Checks the 'runs on' clause of definition \a p_ass that it can
* be called from this scope unit. Parameters \a p_loc and \a
* p_what are used in error messages. \a p_what contains "call" or
......
......@@ -573,6 +573,7 @@ namespace Common {
ownertype = OT_UNKNOWN;
owner = 0;
chk_finished = false;
pard_type_instance = false;
}
void Type::clean_up()
......@@ -5204,8 +5205,8 @@ end_ext:
bool Type::hasEncodeAttr(const MessageEncodingType_t encoding_type)
{
if (CT_JSON == encoding_type &&
(is_asn1() || (is_ref() && get_type_refd()->is_asn1()))) {
if (CT_JSON == encoding_type && (implicit_json_encoding
|| is_asn1() || (is_ref() && get_type_refd()->is_asn1()))) {
// ASN.1 types automatically support JSON encoding
return true;
}
......@@ -5573,10 +5574,15 @@ end_ext:
case T_UNIVERSALSTRING:
case T_BMPSTRING:
case T_VERDICT:
case T_NULL:
case T_OID:
case T_ROID:
case T_ANY:
// these basic types support JSON encoding by default
return json_mem.remember(t, ANSWER_YES);
case T_SEQ_T:
case T_SEQ_A:
case T_OPENTYPE:
case T_SET_T:
case T_SET_A:
case T_CHOICE_T:
......@@ -6815,10 +6821,6 @@ end_ext:
string Type::get_dispname() const
{
if (T_REFD == typetype) {
// cannot calculate the display name for referenced types this way
FATAL_ERROR("Type::get_dispname()");
}
string dispname = genname;
size_t pos = 0;
while(pos < dispname.size()) {
......
......@@ -381,6 +381,11 @@ namespace Common {
* Prevents force_raw() from running chk_raw(), chk_text() or chk_json() on unchecked types. */
bool chk_finished;
/** Signifies that this type is an instance of an ASN.1 parameterized type.