Merge branch 'master' into tmaster
3
Makefile
@ -96,7 +96,8 @@ UTILS_DIRS := \
|
||||
${TRICK_HOME}/trick_source/trick_utils/comm \
|
||||
${TRICK_HOME}/trick_source/trick_utils/shm \
|
||||
${TRICK_HOME}/trick_source/trick_utils/math \
|
||||
${TRICK_HOME}/trick_source/trick_utils/units
|
||||
${TRICK_HOME}/trick_source/trick_utils/units \
|
||||
${TRICK_HOME}/trick_source/trick_utils/unicode
|
||||
UTILS_OBJS := $(addsuffix /object_$(TRICK_HOST_CPU)/*.o ,$(UTILS_DIRS))
|
||||
|
||||
# filter out the directories that make their own libraries
|
||||
|
16
autoconf/configure.ac
Normal file → Executable file
@ -121,6 +121,15 @@ AC_DEFUN([AX_GTEST_HOME],[
|
||||
[AC_CHECK_HEADER(gtest/gtest.h, [GTEST_HOME="/usr"], [GTEST_HOME=""])]
|
||||
)
|
||||
AC_SUBST([GTEST_HOME])
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_SWIG_BIN],[
|
||||
AC_ARG_WITH([swig],
|
||||
AS_HELP_STRING([--with-swig@<:@=DIR@:>@], [path of directory containing the SWIG executable.]),
|
||||
SWIG_BIN="$withval",
|
||||
SWIG_BIN=/bin:/usr/bin:/usr/local/bin:/sw/bin
|
||||
)
|
||||
AC_SUBST([SWIG_BIN])
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_UDUNITS_HOME],[
|
||||
@ -244,13 +253,12 @@ AC_PATH_PROG(PERL, perl, noperl)
|
||||
AS_IF([test "$ac_cv_path_PERL" = "noperl"],AC_MSG_ERROR([could not find perl]),[])
|
||||
AC_PATH_PROG(PYTHON, python${PYTHON_VERSION}, nopython)
|
||||
AS_IF([test "$ac_cv_path_PYTHON" = "nopython"],AC_MSG_ERROR([could not find python]),[])
|
||||
AC_PATH_PROG(SWIG, swig, noswig, "/bin:/usr/bin:/usr/local/bin:/sw/bin")
|
||||
AS_IF([test "$ac_cv_path_SWIG" = "noswig"],AC_MSG_ERROR([could not find swig]),[])
|
||||
AC_PATH_PROG(GNUPLOT, gnuplot, nognuplot)
|
||||
AS_IF([test "$ac_cv_path_GNUPLOT" = "nognuplot"],AC_MSG_NOTICE([could not find gnuplot]),[])
|
||||
|
||||
AX_SWIG_BIN([])
|
||||
AC_PATH_PROG(SWIG, swig, noswig, $SWIG_BIN)
|
||||
AS_IF([test "$ac_cv_path_SWIG" = "noswig"],AC_MSG_ERROR([could not find swig]),[])
|
||||
AX_JAVA
|
||||
|
||||
dnl look for libraries and headers we need to compile
|
||||
AC_PATH_X
|
||||
AS_IF([test "$no_x" = "yes"],AC_MSG_ERROR([could not find Xwindows development libraries and/or headers]),[])
|
||||
|
89
bin/trick-CP
@ -6,6 +6,8 @@
|
||||
use File::Basename ;
|
||||
use Cwd ;
|
||||
use Cwd 'abs_path';
|
||||
use Pod::Usage ;
|
||||
use Pod::Text ;
|
||||
|
||||
$trick_bin = dirname(abs_path($0)) ;
|
||||
$trick_home = dirname($trick_bin) ;
|
||||
@ -21,6 +23,8 @@ foreach $argnum (0 .. $#ARGV) {
|
||||
$makefileAddArgs = $makefileAddArgs . " debug ";
|
||||
} elsif ($arg =~ /-t/ ) {
|
||||
$makefileAddArgs = $makefileAddArgs . " test ";
|
||||
} elsif($arg=~ /-h/ ) {
|
||||
pod2usage(-sections => "NAME|SYNOPSIS|DESCRIPTION|OPTIONS|FILES", -verbose => 99) ;
|
||||
} else {
|
||||
$ENV{TRICK_CPFLAGS} .= " $arg" ;
|
||||
}
|
||||
@ -45,6 +49,81 @@ if ( -f "S_define" ) {
|
||||
print "S_define does not exist" ;
|
||||
exit 1 ;
|
||||
}
|
||||
|
||||
# trick-CP help message
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
trick-CP - Trick Configuration Processor
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
trick-CP [OPTION]...
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
trick-CP is the Trick environment Configuration Processor. trick-CP
|
||||
parses the simulation definition file, S_define, searching for math
|
||||
models to include in the simulation. trick-CP will search for the math
|
||||
models within the search paths included in TRICK_CFLAGS and
|
||||
TRICK_CXXFLAGS environment variables. trick-CP will generate code to
|
||||
call math models listed in the S_define file and will generate a make‐
|
||||
file to build these math models.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<-g> | B<--debug>
|
||||
|
||||
Print the S_define file as it is processed by trick-CP. (This
|
||||
may help the user find problems with his/her simulation configu‐
|
||||
ration).
|
||||
|
||||
=item B<-h> | B<--help>
|
||||
|
||||
Print the trick-CP help message (this message)
|
||||
|
||||
=item B<-o> | B<--outfile> I<FILE_NAME>
|
||||
|
||||
Send CP output to FILE_NAME
|
||||
|
||||
=item B<-p> | B<--no-python>
|
||||
|
||||
Exclude python input processor from simulation.
|
||||
|
||||
=item B<-t>
|
||||
|
||||
Create a unit test simulation where TRICK_UNIT_TEST is defined during compilation
|
||||
|
||||
=item B<-v> | B<--verbose>
|
||||
|
||||
Set the verbose level. Valid entries are 0-3
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<build/S_source.cpp>
|
||||
|
||||
The simulation-specific executive source code file.
|
||||
|
||||
=item B<build/S_library_list>
|
||||
|
||||
The simulation-specific object code link list file.
|
||||
|
||||
=item B<S_default.dat>
|
||||
|
||||
The simulation-specific default initialization data file.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
__END__
|
||||
# CP found at SUB_TRICK_BIN
|
||||
|
||||
@ -100,6 +179,7 @@ ICG:
|
||||
$(PRINT_ICG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh
|
||||
|
||||
|
||||
force_ICG:
|
||||
$(PRINT_ICG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -f -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh
|
||||
@ -135,6 +215,11 @@ convert_swig: build/S_library_swig
|
||||
S_define_exp:
|
||||
$(TRICK_CC) -E -C -xc++ ${TRICK_SFLAGS} $(TRICK_SYSTEM_SFLAGS) S_define > $@
|
||||
|
||||
# prints the value of a makefile variable, example invocation "make print-TRICK_CXXFLAGS"
|
||||
# This rule is used by trick-config
|
||||
print-%:
|
||||
@echo '$*=$($*)'
|
||||
|
||||
help:
|
||||
@echo -e "\
|
||||
Simulation make options:\n\
|
||||
@ -142,7 +227,8 @@ Simulation make options:\n\
|
||||
make sie - Builds the S_sie.resource file.\n\
|
||||
make clean - Removes all object files in simulation directory\n\
|
||||
make spotless - Performs a clean\n\
|
||||
make apocalypse - Performs a clean"
|
||||
make apocalypse - Performs a clean\n\
|
||||
make print-<variable> - Prints a makefile or environment variable"
|
||||
|
||||
CLEAN_TARGETS = tidy clean spotless distclean apocalypse
|
||||
ifeq ($(findstring ${MAKECMDGOALS},$(CLEAN_TARGETS)),)
|
||||
@ -189,4 +275,3 @@ distclean: clean
|
||||
|
||||
apocalypse: clean
|
||||
@echo "[31mI love the smell of napalm in the morning[0m"
|
||||
|
||||
|
@ -26,7 +26,7 @@ sub print_prefix() {
|
||||
|
||||
# Run a special rule in Makefile.sim that prints the value of the environment variable we request
|
||||
sub print_makefile_var($) {
|
||||
open(README, "make -f $ENV{TRICK_HOME}/share/trick/makefiles/Makefile.sim print-@_ | ") or
|
||||
open(README, "make -f $ENV{TRICK_HOME}/share/trick/makefiles/Makefile.trickconfig print-@_ | ") or
|
||||
die "Couldn't fork $!\n" ;
|
||||
while (<README>) {
|
||||
/=(.*)/ && print "$1\n" ;
|
||||
|
108
configure
vendored
@ -660,8 +660,9 @@ ac_ct_JAVA_CC
|
||||
JAVA_CC_FLAGS
|
||||
JAVA_CC
|
||||
USE_JAVA
|
||||
GNUPLOT
|
||||
SWIG
|
||||
SWIG_BIN
|
||||
GNUPLOT
|
||||
PYTHON
|
||||
PERL
|
||||
CURL
|
||||
@ -732,6 +733,7 @@ SHELL'
|
||||
ac_subst_files=''
|
||||
ac_user_opts='
|
||||
enable_option_checking
|
||||
with_swig
|
||||
enable_java
|
||||
with_x
|
||||
with_llvm
|
||||
@ -1385,6 +1387,7 @@ Optional Features:
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
||||
--with-swig[=DIR] path of directory containing the SWIG executable.
|
||||
--with-x use the X Window System
|
||||
--with-llvm[=DIR] LLVM root directory
|
||||
--with-zlib=DIR root directory path of zlib installation [defaults to
|
||||
@ -2397,6 +2400,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -4082,51 +4087,6 @@ fi
|
||||
if test "$ac_cv_path_PYTHON" = "nopython"; then :
|
||||
as_fn_error $? "could not find python" "$LINENO" 5
|
||||
fi
|
||||
# Extract the first word of "swig", so it can be a program name with args.
|
||||
set dummy swig; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_SWIG+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $SWIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
as_dummy=""/bin:/usr/bin:/usr/local/bin:/sw/bin""
|
||||
for as_dir in $as_dummy
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
test -z "$ac_cv_path_SWIG" && ac_cv_path_SWIG="noswig"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
SWIG=$ac_cv_path_SWIG
|
||||
if test -n "$SWIG"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5
|
||||
$as_echo "$SWIG" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
if test "$ac_cv_path_SWIG" = "noswig"; then :
|
||||
as_fn_error $? "could not find swig" "$LINENO" 5
|
||||
fi
|
||||
# Extract the first word of "gnuplot", so it can be a program name with args.
|
||||
set dummy gnuplot; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
@ -4174,6 +4134,61 @@ $as_echo "$as_me: could not find gnuplot" >&6;}
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-swig was given.
|
||||
if test "${with_swig+set}" = set; then :
|
||||
withval=$with_swig; SWIG_BIN="$withval"
|
||||
else
|
||||
SWIG_BIN=/bin:/usr/bin:/usr/local/bin:/sw/bin
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Extract the first word of "swig", so it can be a program name with args.
|
||||
set dummy swig; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_SWIG+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $SWIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $SWIG_BIN
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
test -z "$ac_cv_path_SWIG" && ac_cv_path_SWIG="noswig"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
SWIG=$ac_cv_path_SWIG
|
||||
if test -n "$SWIG"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5
|
||||
$as_echo "$SWIG" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
if test "$ac_cv_path_SWIG" = "noswig"; then :
|
||||
as_fn_error $? "could not find swig" "$LINENO" 5
|
||||
fi
|
||||
|
||||
# Check whether --enable-java was given.
|
||||
if test "${enable_java+set}" = set; then :
|
||||
enableval=$enable_java; if test "x$enable_java" = xyes; then :
|
||||
@ -4388,7 +4403,6 @@ $as_echo "no" >&6; }
|
||||
|
||||
fi
|
||||
|
||||
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
|
@ -36,13 +36,13 @@ namespace Trick {
|
||||
public:
|
||||
/** Details the manner in which this run exited. */
|
||||
enum ExitStatus {
|
||||
INCOMPLETE, /**< not completed */
|
||||
COMPLETE, /**< completed with no errors */
|
||||
CORED, /**< core dumped */
|
||||
TIMEDOUT, /**< timed out */
|
||||
NO_PERM, /**< could not write output files */
|
||||
BAD_INPUT, /**< problem parseing monte carlo input */
|
||||
UNKNOWN /**< unrecognized return code */
|
||||
MC_RUN_INCOMPLETE, /**< not completed */
|
||||
MC_RUN_COMPLETE, /**< completed with no errors */
|
||||
MC_RUN_DUMPED_CORE, /**< core dumped */
|
||||
MC_RUN_TIMED_OUT, /**< timed out */
|
||||
MC_CANT_CREATE_OUTPUT_DIR, /**< could not write output files */
|
||||
MC_PROBLEM_PARSING_INPUT, /**< problem parseing monte carlo input */
|
||||
MC_UNRECOGNIZED_RETURN_CODE /**< unrecognized return code */
|
||||
};
|
||||
|
||||
/** Unique identifier sequentially assigned, starting at zero, by the master. */
|
||||
@ -73,7 +73,7 @@ namespace Trick {
|
||||
num_tries(0),
|
||||
start_time(0),
|
||||
end_time(0),
|
||||
exit_status(INCOMPLETE) {}
|
||||
exit_status(MC_RUN_INCOMPLETE) {}
|
||||
|
||||
};
|
||||
|
||||
@ -93,23 +93,23 @@ namespace Trick {
|
||||
public:
|
||||
/** Operational state. */
|
||||
enum State {
|
||||
UNINITIALIZED, /**< newly created */
|
||||
INITIALIZING, /**< starting up */
|
||||
READY, /**< awaiting new run */
|
||||
RUNNING, /**< processing a run */
|
||||
STOPPING, /**< stopping after current run */
|
||||
STOPPED, /**< not accepting new runs */
|
||||
FINISHED, /**< completed all runs */
|
||||
UNRESPONSIVE_RUNNING, /**< timed out and in a running state */
|
||||
UNRESPONSIVE_STOPPING, /**< timed out and in a stopping state */
|
||||
DISCONNECTED /**< lost connection */
|
||||
MC_UNINITIALIZED, /**< newly created */
|
||||
MC_INITIALIZING, /**< starting up */
|
||||
MC_READY, /**< awaiting new run */
|
||||
MC_RUNNING, /**< processing a run */
|
||||
MC_STOPPING, /**< stopping after current run */
|
||||
MC_STOPPED, /**< not accepting new runs */
|
||||
MC_FINISHED, /**< completed all runs */
|
||||
MC_UNRESPONSIVE_RUNNING, /**< timed out and in a running state */
|
||||
MC_UNRESPONSIVE_STOPPING, /**< timed out and in a stopping state */
|
||||
MC_DISCONNECTED /**< lost connection */
|
||||
};
|
||||
|
||||
/** Master-to-slave commands. */
|
||||
enum Command {
|
||||
PROCESS_RUN, /**< process a new run */
|
||||
SHUTDOWN, /**< kill any executing run, call shutdown jobs, and shutdown cleanly */
|
||||
DIE /**< kill any executing run, do not call shutdown jobs, and exit */
|
||||
MC_PROCESS_RUN, /**< process a new run */
|
||||
MC_SHUTDOWN, /**< kill any executing run, call shutdown jobs, and shutdown cleanly */
|
||||
MC_DIE /**< kill any executing run, do not call shutdown jobs, and exit */
|
||||
};
|
||||
|
||||
/** Unique identifier assigned by the master. */
|
||||
@ -166,7 +166,7 @@ namespace Trick {
|
||||
*/
|
||||
MonteSlave(std::string name = "localhost") :
|
||||
id(0),
|
||||
state(UNINITIALIZED),
|
||||
state(MC_UNINITIALIZED),
|
||||
port(0),
|
||||
current_run(NULL),
|
||||
num_dispatches(0),
|
||||
@ -248,10 +248,10 @@ namespace Trick {
|
||||
public:
|
||||
/** Verbosity of message reporting. */
|
||||
enum Verbosity {
|
||||
NONE, /**< report no messages */
|
||||
ERROR, /**< report error messages */
|
||||
INFORMATIONAL, /**< report error and informational messages, no warning messages */
|
||||
ALL /**< report all messages (error, informational & warning) */
|
||||
MC_NONE, /**< report no messages */
|
||||
MC_ERROR, /**< report error messages */
|
||||
MC_INFORMATIONAL, /**< report error and informational messages, no warning messages */
|
||||
MC_ALL /**< report all messages (error, informational & warning) */
|
||||
};
|
||||
|
||||
/** Options to be passed to the slave sim. */
|
||||
|
@ -51,7 +51,13 @@ int checkpoint_map_ik_id(STL & in_map , std::string object_name , std::string va
|
||||
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
||||
|
||||
if ( cont_size > 0 ) {
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status )) ;
|
||||
std::string type_string ;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "_keys[" << cont_size << "]" ;
|
||||
keys = (typename STL::key_type *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
@ -61,7 +67,12 @@ int checkpoint_map_ik_id(STL & in_map , std::string object_name , std::string va
|
||||
|
||||
var_declare.str("") ;
|
||||
var_declare.clear() ;
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "_data[" << cont_size << "]" ;
|
||||
items = (typename STL::mapped_type *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
@ -111,7 +122,13 @@ int checkpoint_map_ik_sd(STL & in_map , std::string object_name , std::string va
|
||||
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
||||
|
||||
if ( cont_size > 0 ) {
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status )) ;
|
||||
std::string type_string ;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "_keys[" << cont_size << "]" ;
|
||||
keys = (typename STL::key_type *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
@ -187,7 +204,13 @@ int checkpoint_map_sk_id(STL & in_map , std::string object_name , std::string va
|
||||
|
||||
var_declare.str("") ;
|
||||
var_declare.clear() ;
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
std::string type_string ;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "_data[" << cont_size << "]" ;
|
||||
items = (typename STL::mapped_type *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
|
@ -34,7 +34,13 @@ int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name
|
||||
SECOND * second = nullptr ;
|
||||
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
||||
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*first).name(), 0, 0, &status )) ;
|
||||
std::string type_string ;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*first).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "_first[1]" ;
|
||||
first = (FIRST *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
@ -44,7 +50,12 @@ int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name
|
||||
|
||||
var_declare.str("") ;
|
||||
var_declare.clear() ;
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*second).name(), 0, 0, &status )) ;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*second).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "_second[1]" ;
|
||||
second = (SECOND *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
@ -68,8 +79,13 @@ int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name
|
||||
FIRST * first = nullptr ;
|
||||
std::string * second = nullptr ;
|
||||
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
||||
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*first).name(), 0, 0, &status )) ;
|
||||
std::string type_string;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*first).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "_first[1]" ;
|
||||
first = (FIRST *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
@ -111,7 +127,13 @@ int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name
|
||||
|
||||
var_declare.str("") ;
|
||||
var_declare.clear() ;
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*second).name(), 0, 0, &status )) ;
|
||||
std::string type_string;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*second).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "_second[1]" ;
|
||||
second = (SECOND *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
|
@ -43,7 +43,13 @@ int checkpoint_stl(std::queue<ITEM_TYPE,_Sequence> & in_stl , std::string object
|
||||
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
||||
|
||||
if ( cont_size > 0 ) {
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
std::string type_string;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "[" << cont_size << "]" ;
|
||||
items = (ITEM_TYPE *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
@ -116,7 +122,13 @@ int checkpoint_stl(std::priority_queue<ITEM_TYPE, _Container, _Compare> & in_stl
|
||||
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
||||
|
||||
if ( cont_size > 0 ) {
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
std::string type_string;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "[" << cont_size << "]" ;
|
||||
items = (ITEM_TYPE *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
|
@ -46,7 +46,13 @@ int checkpoint_sequence_i(STL & in_stl , std::string object_name , std::string v
|
||||
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
||||
|
||||
if ( cont_size > 0 ) {
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
std::string type_string;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "[" << cont_size << "]" ;
|
||||
items = (typename STL::value_type *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
|
@ -40,7 +40,13 @@ int checkpoint_stl(std::stack<ITEM_TYPE,_Sequence> & in_stl , std::string object
|
||||
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
||||
|
||||
if ( cont_size > 0 ) {
|
||||
std::string type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
std::string type_string;
|
||||
try {
|
||||
type_string = stl_type_name_convert(abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status )) ;
|
||||
} catch (const std::bad_typeid& e) {
|
||||
message_publish(1, "Error, having difficulty checkpointing %s.%s\n", object_name.c_str(), var_name.c_str()) ;
|
||||
return 0 ;
|
||||
}
|
||||
var_declare << type_string << " "
|
||||
<< object_name << "_" << var_name << "[" << cont_size << "]" ;
|
||||
items = (ITEM_TYPE *)TMM_declare_var_s(var_declare.str().c_str()) ;
|
||||
|
@ -6,12 +6,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
long long clock_time() ;
|
||||
long long clock_wall_time() ;
|
||||
long long clock_time(void) ;
|
||||
long long clock_wall_time(void) ;
|
||||
long long clock_reset(long long ref) ;
|
||||
int clock_spin(long long ref) ;
|
||||
int clock_set_reference(long long ref) ;
|
||||
double clock_get_rt_clock_ratio() ;
|
||||
double clock_get_rt_clock_ratio(void) ;
|
||||
int clock_set_rt_clock_ratio(double in_rt_clock_ratio) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -22,17 +22,17 @@ extern "C" {
|
||||
|
||||
int command_line_args_process_sim_args(int argc , char ** argv) ;
|
||||
|
||||
int command_line_args_get_argc() ;
|
||||
char ** command_line_args_get_argv() ;
|
||||
const char * command_line_args_get_output_dir() ;
|
||||
const char * command_line_args_get_user_output_dir() ;
|
||||
const char * command_line_args_get_input_file() ;
|
||||
int command_line_args_get_argc(void) ;
|
||||
char ** command_line_args_get_argv(void) ;
|
||||
const char * command_line_args_get_output_dir(void) ;
|
||||
const char * command_line_args_get_user_output_dir(void) ;
|
||||
const char * command_line_args_get_input_file(void) ;
|
||||
|
||||
const char * command_line_args_get_default_dir() ;
|
||||
const char * command_line_args_get_cmdline_name() ;
|
||||
const char * command_line_args_get_default_dir(void) ;
|
||||
const char * command_line_args_get_cmdline_name(void) ;
|
||||
|
||||
int output_dir_timestamped_on() ;
|
||||
int output_dir_timestamped_off() ;
|
||||
int output_dir_timestamped_on(void) ;
|
||||
int output_dir_timestamped_off(void) ;
|
||||
|
||||
void set_output_dir(const char* output_directory);
|
||||
|
||||
@ -42,7 +42,7 @@ void set_output_dir(const char* output_directory);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <string>
|
||||
std::string & command_line_args_get_input_file_ref() ;
|
||||
std::string & command_line_args_get_input_file_ref(void) ;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -8,14 +8,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int dr_remove_files() ;
|
||||
int dr_enable() ;
|
||||
int dr_disable() ;
|
||||
int dr_remove_files(void) ;
|
||||
int dr_enable(void) ;
|
||||
int dr_disable(void) ;
|
||||
int dr_enable_group( const char * in_name ) ;
|
||||
int dr_disable_group( const char * in_name ) ;
|
||||
int dr_record_now_group( const char * in_name ) ;
|
||||
int dr_set_max_file_size ( uint64_t bytes ) ;
|
||||
void remove_all_data_record_groups() ;
|
||||
void remove_all_data_record_groups(void) ;
|
||||
int set_max_size_record_group (const char * in_name, uint64_t bytes ) ;
|
||||
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int debug_pause_on() ;
|
||||
int debug_pause_off() ;
|
||||
int debug_signal() ;
|
||||
int debug_pause_on(void) ;
|
||||
int debug_pause_off(void) ;
|
||||
int debug_signal(void) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
/*
|
||||
PURPOSE: (link list)
|
||||
ICG: (No)
|
||||
*/
|
||||
|
||||
/*********** doubly linked list types *************/
|
||||
|
@ -6,8 +6,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int echo_jobs_on() ;
|
||||
int echo_jobs_off() ;
|
||||
int echo_jobs_on(void) ;
|
||||
int echo_jobs_off(void) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -12,31 +12,31 @@ extern "C" {
|
||||
// Convenience functions for backwards compatibility that, dolphins willing, will one day be removed.
|
||||
|
||||
void sim_control_panel_set_enabled(int enabled);
|
||||
int sim_control_panel_get_enabled();
|
||||
int sim_control_panel_get_enabled(void);
|
||||
void sim_control_panel_auto_exit_set_enabled(int enabled);
|
||||
void trick_view_set_enabled(int enabled);
|
||||
int trick_view_get_enabled();
|
||||
int trick_view_get_enabled(void);
|
||||
void malfunctions_trick_view_set_enabled(int enabled);
|
||||
int malfunctions_trick_view_get_enabled();
|
||||
int malfunctions_trick_view_get_enabled(void);
|
||||
void monte_monitor_set_enabled(int enabled);
|
||||
int monte_monitor_get_enabled();
|
||||
int monte_monitor_get_enabled(void);
|
||||
void stripchart_set_enabled(int enabled);
|
||||
int stripchart_get_enabled();
|
||||
int stripchart_get_enabled(void);
|
||||
void sim_control_panel_set_startup_command(const char *command);
|
||||
const char *sim_control_panel_get_startup_command();
|
||||
const char *sim_control_panel_get_startup_command(void);
|
||||
void trick_view_set_startup_command(const char *command);
|
||||
const char *trick_view_get_startup_command();
|
||||
const char *trick_view_get_startup_command(void);
|
||||
void malfunctions_trick_view_set_startup_command(const char *command);
|
||||
const char *malfunctions_trick_view_get_startup_command();
|
||||
const char *malfunctions_trick_view_get_startup_command(void);
|
||||
void monte_monitor_set_startup_command(const char *command);
|
||||
const char *monte_monitor_get_startup_command();
|
||||
const char *monte_monitor_get_startup_command(void);
|
||||
void stripchart_set_startup_command(const char *command);
|
||||
const char *stripchart_get_startup_command();
|
||||
void sim_control_panel_launch();
|
||||
void trick_view_launch();
|
||||
void malfunctions_trick_view_launch();
|
||||
void monte_monitor_launch();
|
||||
void stripchart_launch();
|
||||
const char *stripchart_get_startup_command(void);
|
||||
void sim_control_panel_launch(void);
|
||||
void trick_view_launch(void);
|
||||
void malfunctions_trick_view_launch(void);
|
||||
void monte_monitor_launch(void);
|
||||
void stripchart_launch(void);
|
||||
void trick_view_set_cycle_period(double period);
|
||||
void trick_view_add_auto_load_file(const char *file);
|
||||
|
||||
|
@ -93,4 +93,7 @@
|
||||
#include "trick/rand_generator.h"
|
||||
#include "trick/units_conv.h"
|
||||
|
||||
#include "trick/lqueue.h"
|
||||
#include "trick/lstack.h"
|
||||
|
||||
#endif
|
||||
|
@ -6,8 +6,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int frame_log_on() ;
|
||||
int frame_log_off() ;
|
||||
int frame_log_on(void) ;
|
||||
int frame_log_off(void) ;
|
||||
int frame_log_set_max_samples(int num) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1,4 +1,6 @@
|
||||
/***************** queue functions ***************/
|
||||
/*
|
||||
PURPOSE: (queue functions)
|
||||
*/
|
||||
|
||||
#ifndef LQUEUE_H
|
||||
#define LQUEUE_H
|
||||
@ -13,7 +15,7 @@ extern "C" {
|
||||
|
||||
typedef struct _LQUEUE
|
||||
{
|
||||
DLLIST list; /* implementing queue using a linked-list */
|
||||
DLLIST list; /* -- implementing queue using a linked-list */
|
||||
}LQUEUE;
|
||||
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
/************** stack functions *****************/
|
||||
/*
|
||||
PURPOSE: (stack functions)
|
||||
*/
|
||||
|
||||
#ifndef LSTACK_H
|
||||
#define LSTACK_H
|
||||
@ -12,7 +14,7 @@ extern "C" {
|
||||
|
||||
typedef struct _LSTACK
|
||||
{
|
||||
DLLIST list; /* implementing the stack using a list */
|
||||
DLLIST list; /* -- implementing the stack using a list */
|
||||
}LSTACK;
|
||||
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int ms_master_enable() ;
|
||||
int ms_master_disable() ;
|
||||
int ms_master_enable(void) ;
|
||||
int ms_master_disable(void) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ void mc_set_enabled(int enabled);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_enabled
|
||||
*/
|
||||
int mc_get_enabled();
|
||||
int mc_get_enabled(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -33,13 +33,13 @@ void mc_set_dry_run(int dry_run);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_dry_run
|
||||
*/
|
||||
int mc_get_dry_run();
|
||||
int mc_get_dry_run(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc is_slave
|
||||
*/
|
||||
int mc_is_slave();
|
||||
int mc_is_slave(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -51,7 +51,7 @@ void mc_set_localhost_as_remote(int localhost_as_remote);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_localhost_as_remote
|
||||
*/
|
||||
int mc_get_localhost_as_remote();
|
||||
int mc_get_localhost_as_remote(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -63,7 +63,7 @@ void mc_set_custom_slave_dispatch(int custom_slave_dispatch);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_custom_slave_dispatch
|
||||
*/
|
||||
int mc_get_custom_slave_dispatch();
|
||||
int mc_get_custom_slave_dispatch(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -75,7 +75,7 @@ void mc_set_timeout(double timeout);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_timeout
|
||||
*/
|
||||
double mc_get_timeout();
|
||||
double mc_get_timeout(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -87,7 +87,7 @@ void mc_set_max_tries(unsigned int max_tries);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_max_tries
|
||||
*/
|
||||
unsigned int mc_get_max_tries();
|
||||
unsigned int mc_get_max_tries(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -105,13 +105,13 @@ void mc_set_slave_sim_options(const char *slave_sim_options);
|
||||
* @relates Trick::MonteCarlo
|
||||
* get #Trick::MonteCarlo::slave_sim_options
|
||||
*/
|
||||
const char *mc_get_slave_sim_options();
|
||||
const char *mc_get_slave_sim_options(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_user_cmd_string
|
||||
*/
|
||||
const char *mc_get_user_cmd_string();
|
||||
const char *mc_get_user_cmd_string(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -123,7 +123,7 @@ void mc_set_custom_pre_text(const char *custom_pre_text);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_custom_pre_text
|
||||
*/
|
||||
const char *mc_get_custom_pre_text();
|
||||
const char *mc_get_custom_pre_text(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -135,7 +135,7 @@ void mc_set_custom_post_text(const char *custom_post_text);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_custom_post_text
|
||||
*/
|
||||
const char *mc_get_custom_post_text();
|
||||
const char *mc_get_custom_post_text(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -147,7 +147,7 @@ void mc_set_verbosity(int verbosity);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_verbosity
|
||||
*/
|
||||
int mc_get_verbosity();
|
||||
int mc_get_verbosity(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -159,19 +159,19 @@ void mc_set_num_runs(unsigned int num_runs);
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_num_runs
|
||||
*/
|
||||
unsigned int mc_get_num_runs();
|
||||
unsigned int mc_get_num_runs(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_num_results
|
||||
*/
|
||||
unsigned int mc_get_num_results();
|
||||
unsigned int mc_get_num_results(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
* @copydoc get_slave_id
|
||||
*/
|
||||
unsigned int mc_get_slave_id();
|
||||
unsigned int mc_get_slave_id(void);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -213,7 +213,7 @@ void mc_read(char *buffer, int size);
|
||||
* @relates Trick::MonteCarlo
|
||||
* Gets the current run being processed.
|
||||
*/
|
||||
unsigned int mc_get_current_run() ;
|
||||
unsigned int mc_get_current_run(void) ;
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
@ -237,13 +237,13 @@ void mc_set_connection_device_port(int port_number) ;
|
||||
* @relates Trick::MonteCarlo
|
||||
* Gets the port for the listen_device.
|
||||
*/
|
||||
int mc_get_listen_device_port() ;
|
||||
int mc_get_listen_device_port(void) ;
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
* Gets the port for the connection_device.
|
||||
*/
|
||||
int mc_get_connection_device_port() ;
|
||||
int mc_get_connection_device_port(void) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ typedef struct _DLLIST {
|
||||
}DLLIST;
|
||||
|
||||
|
||||
DLLIST* DLL_Create();
|
||||
DLLIST* DLL_Create(void);
|
||||
|
||||
void DLL_Delete(DLLIST*);
|
||||
|
||||
|
@ -13,11 +13,11 @@ int real_time_change_timer(Trick::Timer * in_sleep_timer ) ;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int real_time_enable() ;
|
||||
int real_time_disable() ;
|
||||
int real_time_enable(void) ;
|
||||
int real_time_disable(void) ;
|
||||
int real_time_restart(long long ref_time ) ;
|
||||
int is_real_time() ;
|
||||
const char * real_time_clock_get_name() ;
|
||||
int is_real_time(void) ;
|
||||
const char * real_time_clock_get_name(void) ;
|
||||
int real_time_set_rt_clock_ratio(double in_clock_ratio) ;
|
||||
int real_time_lock_memory(int yes_no) ;
|
||||
|
||||
|
@ -3,10 +3,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void sie_print_xml() ;
|
||||
void sie_class_attr_map_print_xml() ;
|
||||
void sie_enum_attr_map_print_xml() ;
|
||||
void sie_top_level_objects_print_xml() ;
|
||||
void sie_print_xml(void) ;
|
||||
void sie_class_attr_map_print_xml(void) ;
|
||||
void sie_enum_attr_map_print_xml(void) ;
|
||||
void sie_top_level_objects_print_xml(void) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -8,13 +8,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
double get_rettime() ;
|
||||
double get_gmttime() ;
|
||||
double get_mettime() ;
|
||||
double get_rettime(void) ;
|
||||
double get_gmttime(void) ;
|
||||
double get_mettime(void) ;
|
||||
|
||||
GMTTIME * get_rettime_struct() ;
|
||||
GMTTIME * get_gmttime_struct() ;
|
||||
GMTTIME * get_mettime_struct() ;
|
||||
GMTTIME * get_rettime_struct(void) ;
|
||||
GMTTIME * get_gmttime_struct(void) ;
|
||||
GMTTIME * get_mettime_struct(void) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -81,7 +81,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int trick_test_enable() ;
|
||||
int trick_test_enable(void) ;
|
||||
|
||||
int trick_test_set_file_name( const char * in_file_name ) ;
|
||||
|
||||
@ -94,7 +94,7 @@ int trick_test_add_parent(const char * in_test_suite_name,
|
||||
int add_test_result( const char * in_test_suite_name ,
|
||||
const char * in_test_case ,
|
||||
const char * in_failure_string ) ;
|
||||
int call_write_output() ;
|
||||
int call_write_output(void) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
51
include/trick/unicode_utils.h
Normal file
@ -0,0 +1,51 @@
|
||||
#ifndef UNITCODE_UTILS_H
|
||||
#define UNITCODE_UTILS_H
|
||||
#include <stddef.h>
|
||||
|
||||
/* Maintainer: John M. Penn */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Convert Unicode codepoint to UTF-32. Validates that it's a legal unicode value.
|
||||
Returns 1, if successful, 0 otherwise. */
|
||||
size_t ucodepoint_to_utf32(unsigned int codePoint, int32_t *out);
|
||||
|
||||
/* Convert Unicode codepoint to UTF-16.
|
||||
Returns the number of UTF-16 elements (1..2) necessary to represent the codepoint,
|
||||
or 0 on failure.
|
||||
*/
|
||||
size_t ucodepoint_to_utf16(unsigned int codePoint, int16_t (*out)[2]);
|
||||
|
||||
/* Convert Unicode codepoint to UTF-8.
|
||||
Returns the number of UTF_8 elements (1..4) )necessary to represent the codepoint,
|
||||
or 0 on failure.
|
||||
*/
|
||||
size_t ucodepoint_to_utf8(unsigned int codePoint, char (*out)[4]);
|
||||
|
||||
|
||||
|
||||
/* Un-escape C escape sequences, including \u and \U Unicode escape sequences,
|
||||
in an ASCII character array, producing a UTF-8 character array. Return the
|
||||
number of elements in the character string.
|
||||
*/
|
||||
size_t ascii_to_utf8(const char *in, char *out, size_t outSize);
|
||||
|
||||
/* Escape ('\' escape codes) all unicode and non-printable ASCII characters
|
||||
in a UTF-8 character string. Return the number of elements in the character string.
|
||||
*/
|
||||
size_t utf8_to_printable_ascii(const char *in, char *out, size_t outSize);
|
||||
|
||||
/* Convert a UTF-8 character array to a wchar_t array. Supports 16, and 32 bit wchar_t.
|
||||
Return the number of elements in the wchar_t string. */
|
||||
size_t utf8_to_wchar(const char *in, wchar_t *out, size_t outSize);
|
||||
|
||||
/* Convert wchar_t character array to UTF-8. Return the number of elements in
|
||||
the character (utf-8) string.*/
|
||||
size_t wchar_to_utf8(const wchar_t *in, char *out, size_t outSize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -6,16 +6,16 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const char * var_server_get_hostname() ;
|
||||
const char * var_server_get_hostname(void) ;
|
||||
|
||||
unsigned short var_server_get_port() ;
|
||||
unsigned short var_server_get_port(void) ;
|
||||
void var_server_set_port(unsigned short port) ;
|
||||
void var_server_set_source_address(const char * address) ;
|
||||
|
||||
const char * var_server_get_user_tag() ;
|
||||
const char * var_server_get_user_tag(void) ;
|
||||
void var_server_set_user_tag(const char * tag) ;
|
||||
|
||||
int var_server_get_enabled() ;
|
||||
int var_server_get_enabled(void) ;
|
||||
void var_server_set_enabled(int on_off) ;
|
||||
|
||||
int var_server_create_tcp_socket(const char * address, unsigned short port) ;
|
||||
|
@ -16,10 +16,10 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if __Lynx__
|
||||
int wcs_to_ncs_len ();
|
||||
int ncs_to_wcs_len ();
|
||||
int wcs_to_ncs ();
|
||||
int ncs_to_wcs();
|
||||
int wcs_to_ncs_len (void);
|
||||
int ncs_to_wcs_len (void);
|
||||
int wcs_to_ncs (void);
|
||||
int ncs_to_wcs(void);
|
||||
#else
|
||||
#include <stddef.h>
|
||||
#include <wchar.h>
|
||||
|
@ -99,18 +99,18 @@ my $template_var_def = qr/(?:\:\:)?[_A-Za-z][:\w]*\s* # template name
|
||||
/sx ;
|
||||
|
||||
# This list is the list of all STL types to ignore.
|
||||
my %all_stl_names = qw(vector 1 list 1 deque 1 set 1 multiset 1 map 1 multimap 1 hash_set 1
|
||||
my %all_stl_names = qw(vector 1 list 1 deque 1 set 1 multiset 1 map 1 unordered_map 1 multimap 1 hash_set 1
|
||||
hash_multiset 1 hash_map 1 hash_multimap 1 stack 1 queue 1 priority_queue 1 bitset 1 auto_ptr 1
|
||||
array 1
|
||||
std::vector 1 std::list 1 std::deque 1 std::set 1 std::multiset 1 std::map 1 std::multimap 1 std::hash_set 1
|
||||
std::vector 1 std::list 1 std::deque 1 std::set 1 std::multiset 1 std::map 1 std::unordered_map 1 std::multimap 1 std::hash_set 1
|
||||
std::hash_multiset 1 std::hash_map 1 std::hash_multimap 1 std::stack 1 std::queue 1 std::priority_queue 1
|
||||
std::bitset 1 std::auto_ptr 1 pair 1 std::pair 1 std::tr1::shared_ptr 1 std::array 1) ;
|
||||
|
||||
# This is a partial list of STL types to ignore. We do not ignore vector, map, list if we allow STLs
|
||||
my %stl_names = qw(deque 1 set 1 multiset 1 multimap 1 hash_set 1
|
||||
my %stl_names = qw(deque 1 set 1 multiset 1 unordered_map 1 multimap 1 hash_set 1
|
||||
hash_multiset 1 hash_map 1 hash_multimap 1 stack 1 queue 1 priority_queue 1 bitset 1 auto_ptr 1
|
||||
array 1
|
||||
std::deque 1 std::set 1 std::multiset 1 std::multimap 1 std::hash_set 1
|
||||
std::deque 1 std::set 1 std::multiset 1 std::unordered_map 1 std::multimap 1 std::hash_set 1
|
||||
std::hash_multiset 1 std::hash_map 1 std::hash_multimap 1 std::stack 1 std::queue 1 std::priority_queue 1
|
||||
std::bitset 1 std::auto_ptr 1 pair 1 std::pair 1 std::tr1::shared_ptr 1 std::array 1) ;
|
||||
|
||||
|
@ -9,35 +9,42 @@
|
||||
|
||||
EXTERNAL_JARS = \
|
||||
bsaf-1.9.2.jar \
|
||||
itext-2.1.7.jar \
|
||||
jcommon-1.0.23.jar \
|
||||
jfreechart-1.0.19.jar \
|
||||
jfreesvg-2.1.jar \
|
||||
jopt-simple-4.8.jar \
|
||||
junit-4.12.jar \
|
||||
swingx-1.6.1.jar \
|
||||
hamcrest-core-1.3.jar
|
||||
hamcrest-core-1.3.jar \
|
||||
pdfbox-2.0.11.jar \
|
||||
fontbox-2.0.11.jar \
|
||||
commons-logging-1.2.jar
|
||||
|
||||
|
||||
external_jars : ${EXTERNAL_JARS}
|
||||
|
||||
bsaf-1.9.2.jar :
|
||||
curl -O http://repo.maven.apache.org/maven2/org/jdesktop/bsaf/bsaf/1.9.2/bsaf-1.9.2.jar
|
||||
itext-2.1.7.jar :
|
||||
curl -O http://repo.maven.apache.org/maven2/com/lowagie/itext/2.1.7/itext-2.1.7.jar
|
||||
curl --retry 4 -O http://repo.maven.apache.org/maven2/org/jdesktop/bsaf/bsaf/1.9.2/bsaf-1.9.2.jar
|
||||
jcommon-1.0.23.jar :
|
||||
curl -O http://repo.maven.apache.org/maven2/org/jfree/jcommon/1.0.23/jcommon-1.0.23.jar
|
||||
curl --retry 4 -O http://repo.maven.apache.org/maven2/org/jfree/jcommon/1.0.23/jcommon-1.0.23.jar
|
||||
jfreechart-1.0.19.jar :
|
||||
curl -O http://repo.maven.apache.org/maven2/org/jfree/jfreechart/1.0.19/jfreechart-1.0.19.jar
|
||||
curl --retry 4 -O http://repo.maven.apache.org/maven2/org/jfree/jfreechart/1.0.19/jfreechart-1.0.19.jar
|
||||
jfreesvg-2.1.jar :
|
||||
curl -O http://repo.maven.apache.org/maven2/org/jfree/jfreesvg/2.1/jfreesvg-2.1.jar
|
||||
curl --retry 4 -O http://repo.maven.apache.org/maven2/org/jfree/jfreesvg/2.1/jfreesvg-2.1.jar
|
||||
jopt-simple-4.8.jar :
|
||||
curl -O http://repo.maven.apache.org/maven2/net/sf/jopt-simple/jopt-simple/4.8/jopt-simple-4.8.jar
|
||||
curl --retry 4 -O http://repo.maven.apache.org/maven2/net/sf/jopt-simple/jopt-simple/4.8/jopt-simple-4.8.jar
|
||||
junit-4.12.jar:
|
||||
curl -O http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar
|
||||
curl --retry 4 -O http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar
|
||||
swingx-1.6.1.jar :
|
||||
curl -O http://repo.maven.apache.org/maven2/org/swinglabs/swingx/1.6.1/swingx-1.6.1.jar
|
||||
curl --retry 4 -O http://repo.maven.apache.org/maven2/org/swinglabs/swingx/1.6.1/swingx-1.6.1.jar
|
||||
hamcrest-core-1.3.jar :
|
||||
curl -O http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
|
||||
curl --retry 4 -O http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
|
||||
pdfbox-2.0.11.jar :
|
||||
curl --retry 4 -O http://repo.maven.apache.org/maven2/org/apache/pdfbox/pdfbox/2.0.11/pdfbox-2.0.11.jar
|
||||
fontbox-2.0.11.jar :
|
||||
curl --retry 4 -O http://repo.maven.apache.org/maven2/org/apache/pdfbox/fontbox/2.0.11/fontbox-2.0.11.jar
|
||||
commons-logging-1.2.jar :
|
||||
curl --retry 4 -O https://repo1.maven.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
|
||||
|
||||
clean:
|
||||
rm -f ${EXTERNAL_JARS}
|
||||
|
@ -123,7 +123,6 @@ my @all_cfly_files ;
|
||||
my @all_read_only_libs ;
|
||||
my @all_compile_libs ;
|
||||
my %files_by_dir ;
|
||||
my ( $sp_dir , $src_dir , $sp_file , $base_name , $suffix) ;
|
||||
|
||||
my @exclude_dirs ;
|
||||
@exclude_dirs = split /:/ , "$ENV{TRICK_EXCLUDE}:$ENV{TRICK_EXT_LIB_DIRS}";
|
||||
@ -146,45 +145,40 @@ if (scalar @exclude_dirs) {
|
||||
@all_compile_libs = sort (grep !/trick_source/ , @all_compile_libs) ;
|
||||
@all_cfly_files = sort (grep !/^-|trick_source|a$/ , @all_cfly_files) ;
|
||||
|
||||
# split off files by directory
|
||||
foreach ( @all_cfly_files ) {
|
||||
$sp_file = basename($_) ;
|
||||
$_ = abs_path(dirname($_)) ;
|
||||
|
||||
( $sp_dir , $src_dir ) = /(.*?)(?:\/(src))?$/ ;
|
||||
$src_dir .= "/" if ($src_dir ne "") ;
|
||||
($base_name , $suffix) = $sp_file =~ /(.*?)([cfly]$|C$|cc$|cxx$|cpp$|c\+\+$)/ ;
|
||||
|
||||
$files_by_dir{$sp_dir}{src_dir} = $src_dir ;
|
||||
push @{$files_by_dir{$sp_dir}{$suffix}} , $base_name ;
|
||||
sub add_file($) {
|
||||
my ($name, $path, $extension) = fileparse($_[0], qr/\.[^.]*/) ;
|
||||
push @{$files_by_dir{$path}{$extension}} , $name ;
|
||||
}
|
||||
|
||||
# get all of the files required by compiled libraries
|
||||
# compile all files as normal files, we're not going to make a library anymore.
|
||||
foreach $n ( @all_compile_libs ) {
|
||||
my @local_files ;
|
||||
$sp_file = basename($n) ;
|
||||
$sp_dir = dirname($n) ;
|
||||
$sp_dir =~ s/\/object_\$\{TRICK_HOST_CPU\}?$// ;
|
||||
$sp_dir = abs_path($sp_dir) ;
|
||||
$src_dir = ( -e "$sp_dir/src" ) ? "src/" : "" ;
|
||||
$files_by_dir{$sp_dir}{src_dir} = $src_dir ;
|
||||
opendir THISDIR, "$sp_dir/$src_dir" or die "Could not open the directory $sp_dir/$src_dir";
|
||||
@local_files = grep !/^\.\.\./ , readdir THISDIR;
|
||||
@local_files = grep /\.[cfly]$|C$|cc$|cxx$|cpp$|c\+\+$/ , @local_files;
|
||||
foreach $k ( @local_files ) {
|
||||
($base_name , $suffix) = $k =~ /(.*?)([cfly]$|C$|cc$|cxx$|cpp$|c\+\+$)/ ;
|
||||
push @{$files_by_dir{$sp_dir}{$suffix}} , $base_name ;
|
||||
sub add_files_in_directory($) {
|
||||
opendir THISDIR, "$_[0]" or die "Could not open $_[0]" ;
|
||||
my @files = grep !/^\./ , readdir THISDIR ;
|
||||
foreach ( @files ) {
|
||||
add_file($_[0] . "/" . $_) ;
|
||||
}
|
||||
closedir THISDIR ;
|
||||
}
|
||||
|
||||
# split off files by directory
|
||||
foreach ( @all_cfly_files ) {
|
||||
add_file($_);
|
||||
}
|
||||
|
||||
# get all of the files required by compiled libraries
|
||||
# compile all files as normal files, we're not going to make a library anymore.
|
||||
foreach ( @all_compile_libs ) {
|
||||
my $path = abs_path(dirname($_));
|
||||
add_files_in_directory($path) ;
|
||||
$path .= "/src" ;
|
||||
add_files_in_directory($path) if -e "$path" ;
|
||||
}
|
||||
|
||||
# sort and weed out duplicate files
|
||||
foreach $k ( keys %files_by_dir ) {
|
||||
foreach my $directory ( keys %files_by_dir ) {
|
||||
my %temp_hash ;
|
||||
foreach $n ( qw{ c f l y h C cc cxx cpp c++} ) {
|
||||
foreach my $extension ( keys %{$files_by_dir{$directory}} ) {
|
||||
undef %temp_hash ;
|
||||
@{$files_by_dir{$k}{$n}} = sort grep ++$temp_hash{$_} < 2, @{$files_by_dir{$k}{$n}} ;
|
||||
@{$files_by_dir{$directory}{$extension}} = sort grep ++$temp_hash{$_} < 2, @{$files_by_dir{$directory}{$extension}} ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,13 +193,6 @@ foreach $k ( sort keys %files_by_dir ) {
|
||||
}
|
||||
}
|
||||
|
||||
# set the "dir_num" of each directory.
|
||||
foreach $k ( sort keys %files_by_dir ) {
|
||||
$_ = $k ;
|
||||
($files_by_dir{$k}{dir_num} = $_) =~ s#^/## ;
|
||||
$files_by_dir{$k}{dir_num} =~ s/[\/.]/_/g ;
|
||||
}
|
||||
|
||||
my $wd = abs_path(cwd()) ;
|
||||
my $dt = localtime();
|
||||
my ($trick_ver) = get_trick_version() ;
|
||||
@ -256,74 +243,60 @@ build/S_source.d: ;
|
||||
|
||||
" ;
|
||||
|
||||
my %object_files_by_type ;
|
||||
my %model_build_dirs ;
|
||||
# List out all of the object files and put the list in a file that we can pass to the linker.
|
||||
# Passing all of them directly to the linker in the command line can exceed the line limit.
|
||||
open MODEL_LINK_LIST, ">build/model_link_list" or die "Could not open build/model_link_list" ;
|
||||
foreach my $ext ( qw{ c C cc cxx cpp c++ } ) {
|
||||
print MAKEFILE "MODEL_${ext}_OBJECTS :=" ;
|
||||
foreach $k ( sort keys %files_by_dir ) {
|
||||
foreach $f ( @{$files_by_dir{$k}{$ext}} ) {
|
||||
print MAKEFILE " \\\n build$k/$files_by_dir{$k}{src_dir}$f" . "o" ;
|
||||
print MODEL_LINK_LIST "build$k/$files_by_dir{$k}{src_dir}$f" . "o\n" ;
|
||||
|
||||
my %files_by_extension ;
|
||||
foreach my $directory ( keys %files_by_dir ) {
|
||||
foreach my $extension ( grep { /^\.(c|cc|C|cxx|cpp|c\+\+)$/ } keys %{$files_by_dir{$directory}} ) {
|
||||
foreach my $file ( @{$files_by_dir{$directory}{$extension}} ) {
|
||||
push @{$files_by_extension{$extension}} , "build$directory$file.o" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $extension ( keys %files_by_extension ) {
|
||||
print MAKEFILE "MODEL_OBJECTS${extension} :=" ;
|
||||
foreach my $file ( @{$files_by_extension{$extension}} ) {
|
||||
print MAKEFILE " \\\n $file" ;
|
||||
print MODEL_LINK_LIST "$file\n" ;
|
||||
}
|
||||
print MAKEFILE "\n\n"
|
||||
}
|
||||
close MODEL_LINK_LIST ;
|
||||
|
||||
print MAKEFILE "MODEL_OBJECTS :=" ;
|
||||
foreach my $ext ( qw{ c C cc cxx cpp c++ } ) {
|
||||
print MAKEFILE " \${MODEL_${ext}_OBJECTS}" ;
|
||||
foreach my $extension ( keys %files_by_extension ) {
|
||||
print MAKEFILE " \${MODEL_OBJECTS$extension}" ;
|
||||
}
|
||||
|
||||
# Write out the compile rules for each type of file.
|
||||
print MAKEFILE "
|
||||
|
||||
# These targets should have an order-only dependency on their directories, which would require
|
||||
# moving them to a .SECONDEXPANSION section and would complicate the rules. However, these
|
||||
# directories appear to be created as part of the read_lib_deps function, so I'm leaving it out
|
||||
# for now.
|
||||
# We use .SECONDEXPANSION here to allow us to use automatic vairiables in the prerequisite list
|
||||
# in order to add to each target an order-only dependency on its directory.
|
||||
# See https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
|
||||
# and https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html
|
||||
|
||||
\${MODEL_c_OBJECTS} : build/%.o : /%.c | build/%.d
|
||||
.SECONDEXPANSION:" ;
|
||||
|
||||
foreach my $extension ( keys %files_by_extension ) {
|
||||
my $compiler = "TRICK_" . ($extension eq ".c" ? "CC" : "CPPC") ;
|
||||
my $flags = $extension eq ".c" ? "C" : "CXX" ;
|
||||
my $command = "\$($compiler) \$(TRICK_${flags}FLAGS) \$(TRICK_SYSTEM_${flags}FLAGS) -I\$(<D)/../include -MMD -MP -c -o \$\@ \$<" ;
|
||||
print MAKEFILE "
|
||||
|
||||
\${MODEL_OBJECTS$extension} : build/%.o : /%$extension | build/%.d \$\$(dir \$\$\@)
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\@echo \$(TRICK_CC) \$(TRICK_CFLAGS) \$(TRICK_SYSTEM_CFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CC) \$(TRICK_CFLAGS) \$(TRICK_SYSTEM_CFLAGS) -I\$(<D)/../include -MMD -MP -c -o \$\@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
\t\@echo $command >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)$command 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}" ;
|
||||
}
|
||||
|
||||
\${MODEL_cc_OBJECTS} : build/%.o : /%.cc | build/%.d
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
print MAKEFILE "
|
||||
|
||||
\${MODEL_cpp_OBJECTS} : build/%.o : /%.cpp | build/%.d
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
|
||||
\${MODEL_C_OBJECTS} : build/%.o : /%.C | build/%.d
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
|
||||
\${MODEL_cxx_OBJECTS} : build/%.o : /%.cxx | build/%.d
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
|
||||
\${MODEL_c++_OBJECTS} : build/%.o : /%.c++ | build/%.d
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\$(<D)/../include -MMD -MP -c \$< -o \$\@ 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
|
||||
#define compile_rule
|
||||
#build/%.o: /%.\$1
|
||||
#\t\$\$(PRINT_COMPILE)
|
||||
#\t\$\$(ECHO_CMD)\$\$(TRICK_CPPC) \$\$(TRICK_CXXFLAGS) \$\$(TRICK_SYSTEM_CXXFLAGS) -I\$\$(<D)/../include -MMD -MP -c \$\$< -o \$\$@ 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
#endef
|
||||
#
|
||||
#EXTENSIONS := C cc cpp cxx c++
|
||||
#\$(foreach EXTENSION,\$(EXTENSIONS),\$(eval \$(call compile_rule,\$(EXTENSION))))
|
||||
\$(sort \$(dir \$(MODEL_OBJECTS))):
|
||||
\t\@mkdir -p \$\@
|
||||
|
||||
\$(MODEL_OBJECTS:.o=.d): ;
|
||||
|
||||
@ -362,8 +335,14 @@ S_sie.resource: \$(S_MAIN)
|
||||
# write out the override files we have read in
|
||||
open MAKEFILEOVER, ">build/Makefile_overrides" or die "Could not open build/Makefile_overrides" ;
|
||||
foreach $k ( sort keys %files_by_dir ) {
|
||||
# if a particular directory had an override file, save that into memory
|
||||
if (open OV_FILE, "$k/makefile_overrides") {
|
||||
# Look for makefile_overrides in the current directory.
|
||||
# If no such file exists AND this directory is named "src", look for it one level up.
|
||||
# Silly, but baggage we're stuck with.
|
||||
my $makefile_overrides = "${k}makefile_overrides" ;
|
||||
if (not -e $makefile_overrides and $k =~ /\/src\/$/) {
|
||||
$makefile_overrides = dirname($k) . "/makefile_overrides" ;
|
||||
}
|
||||
if (open OV_FILE, $makefile_overrides) {
|
||||
while ( <OV_FILE> ) {
|
||||
s/(#.*)// ;
|
||||
my ($comment) = $1 ;
|
||||
@ -373,25 +352,30 @@ foreach $k ( sort keys %files_by_dir ) {
|
||||
while ( s,/[^/.]+/\.\.,, ) {}
|
||||
s//$comment/ ;
|
||||
if ( s/^objects\s*:\s*// ) {
|
||||
foreach my $ext ( qw{c C cc cxx cpp CPLUSPLUS l y} ) {
|
||||
$files_by_dir{$k}{overrides} .= "\$(MODEL_${ext}_OBJ_$files_by_dir{$k}{dir_num}): $_" ;
|
||||
foreach my $extension ( keys %files_by_extension ) {
|
||||
foreach my $file (@{$files_by_dir{$k}{$extension}}) {
|
||||
$files_by_dir{$k}{overrides} .= "build$k${file}.o \\\n" ;
|
||||
}
|
||||
}
|
||||
$files_by_dir{$k}{overrides} .= ": $_"
|
||||
}
|
||||
elsif ( s/^depend\s*:\s*// ) {
|
||||
$files_by_dir{$k}{overrides} .= "depend_$files_by_dir{$k}{dir_num}: $_" ;
|
||||
}
|
||||
elsif ( s/([cfhy]|C|cc|cxx|cpp|CPLUSPLUS)_objects\s*:\s*// ) {
|
||||
$files_by_dir{$k}{overrides} .= "\$(MODEL_$1_OBJ_$files_by_dir{$k}{dir_num}): $_" ;
|
||||
elsif ( s/(.+)_objects\s*:\s*// ) {
|
||||
if (scalar @{$files_by_dir{$k}{".$1"}}) {
|
||||
foreach my $file (@{$files_by_dir{$k}{".$1"}}) {
|
||||
$files_by_dir{$k}{overrides} .= "build$k$file.o \\\n" ;
|
||||
}
|
||||
$files_by_dir{$k}{overrides} .= ": $_"
|
||||
}
|
||||
}
|
||||
else {
|
||||
$files_by_dir{$k}{overrides} .= $_ ;
|
||||
}
|
||||
}
|
||||
close OV_FILE ;
|
||||
print MAKEFILEOVER "\nMAKEFILE_LIST += $k/makefile_overrides\n" ;
|
||||
print MAKEFILEOVER "\n# Overrides from $k\n\n" ;
|
||||
print MAKEFILEOVER "# Overrides from $makefile_overrides\n" ;
|
||||
print MAKEFILEOVER "MAKEFILE_LIST += $makefile_overrides\n\n" ;
|
||||
print MAKEFILEOVER "$files_by_dir{$k}{overrides}\n" ;
|
||||
print MAKEFILEOVER "\nMAKEFILE_LIST := \$(filter-out $k/makefile_overrides,\$(MAKEFILE_LIST))\n" ;
|
||||
print MAKEFILEOVER "MAKEFILE_LIST := \$(filter-out $makefile_overrides,\$(MAKEFILE_LIST))\n\n" ;
|
||||
}
|
||||
}
|
||||
close MAKEFILEOVER ;
|
||||
|
@ -169,12 +169,12 @@ sub write_makefile_swig() {
|
||||
print PY_LINK_LIST "build/init_swig_modules.o\n" ;
|
||||
print PY_LINK_LIST "build/top.o\n" ;
|
||||
|
||||
print MAKEFILE "SWIG_CFLAGS := -I../include \${PYTHON_INCLUDES} -Wno-shadow -Wno-missing-field-initializers
|
||||
print MAKEFILE "TRICK_SYSTEM_SWIG_CFLAGS := -I../include \${PYTHON_INCLUDES} -Wno-shadow -Wno-missing-field-initializers
|
||||
|
||||
ifeq (\$(IS_CC_CLANG), 1)
|
||||
SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized -Wno-deprecated-register
|
||||
TRICK_SYSTEM_SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized -Wno-deprecated-register
|
||||
else
|
||||
SWIG_CFLAGS += -Wno-unused-but-set-variable
|
||||
TRICK_SYSTEM_SWIG_CFLAGS += -Wno-unused-but-set-variable
|
||||
endif
|
||||
|
||||
ifndef TRICK_VERBOSE_BUILD
|
||||
@ -231,8 +231,8 @@ SWIG_SRC = \$(subst .i,.cpp,\$(SWIG_I)) $swig_src_dir/top.cpp
|
||||
|
||||
\$(SWIG_SRC) : %.cpp: %.i | \$(SWIG_I)
|
||||
\t\$(PRINT_SWIG)
|
||||
\t\@echo \$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -outdir trick -o \$@ \$< >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -outdir trick -o \$@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
\t\@echo \$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -outdir trick -o \$@ \$< >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -outdir trick -o \$@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
|
||||
# SWIG_OBJECTS =================================================================
|
||||
|
||||
@ -240,8 +240,8 @@ SWIG_OBJECTS = \$(subst .cpp,.o,\$(SWIG_SRC)) $swig_src_dir/init_swig_modules.o
|
||||
|
||||
\$(SWIG_OBJECTS): %.o: %.cpp
|
||||
\t\$(PRINT_COMPILE_SWIG)
|
||||
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(SWIG_CFLAGS) -Wno-unused-parameter -c -o \$@ \$< >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(SWIG_CFLAGS) -Wno-unused-parameter -c -o \$@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(TRICK_SWIG_CFLAGS) \$(TRICK_SYSTEM_SWIG_CFLAGS) \$-Wno-unused-parameter -c -o \$@ \$< >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(TRICK_SWIG_CFLAGS) \$(TRICK_SYSTEM_SWIG_CFLAGS) -Wno-unused-parameter -c -o \$@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
|
||||
\$(S_MAIN): \$(SWIG_OBJECTS)
|
||||
|
||||
|
@ -50,7 +50,8 @@ export TRICK_HOST_CPU := $(shell $(TRICK_HOME)/bin/trick-gte TRICK_HOST_CPU)
|
||||
export TRICK_EXEC_LINK_LIBS := ${PTHREAD_LIBS} $(PYTHON_LIB) $(UDUNITS_LDFLAGS) $(PLATFORM_LIBS) -lm -ldl
|
||||
export TRICK_LIBS := ${RPATH} -L${TRICK_LIB_DIR} -ltrick -ltrick_pyip -ltrick_comm -ltrick_math -ltrick_units -ltrick_mm
|
||||
export TRICK_SYSTEM_LDFLAGS := $(TRICK_SYSTEM_LDFLAGS)
|
||||
export SWIG_FLAGS := $(SWIG_FLAGS)
|
||||
export TRICK_SWIG_FLAGS := $(TRICK_SWIG_FLAGS)
|
||||
export TRICK_SWIG_CFLAGS := $(TRICK_SWIG_CFLAGS)
|
||||
|
||||
IO_SRC_DIR := io_src/
|
||||
OBJ_DIR := object_${TRICK_HOST_CPU}
|
||||
|
@ -1,126 +0,0 @@
|
||||
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||
|
||||
ifndef TRICK_VERBOSE_BUILD
|
||||
PRINT_CP = $(info $(call COLOR,Running) configuration_processor)
|
||||
PRINT_ICG = $(info $(call COLOR,Running) ICG)
|
||||
PRINT_S_DEF_DEPS = $(info $(call COLOR,Tracing) S_define)
|
||||
PRINT_CONVERT_SWIG = $(info $(call COLOR,Running) convert_swig)
|
||||
PRINT_MAKEFILE_SRC = $(info $(call COLOR,Writing) Makefile_src)
|
||||
PRINT_MAKEFILE_SWIG = $(info $(call COLOR,Writing) Makefile_swig)
|
||||
endif
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
export TRICK_ICG_EXCLUDE
|
||||
|
||||
# Use /bin/bash as the shell so we can use PIPESTATUS
|
||||
SHELL = /bin/bash
|
||||
|
||||
all test: $(TRICK_STATIC_LIB) S_source.hh \
|
||||
build/Makefile_io_src \
|
||||
build/Makefile_src \
|
||||
build/Makefile_swig \
|
||||
build/convert_swig_last_run
|
||||
@$(MAKE) --no-print-directory -f build/Makefile_src $@ 2>&1 | tee build/MAKE_out ; exit $${PIPESTATUS[0]}
|
||||
|
||||
build:
|
||||
@mkdir $@
|
||||
|
||||
debug: all
|
||||
debug: TRICK_CPFLAGS += --debug
|
||||
|
||||
$(TRICK_STATIC_LIB):
|
||||
$(info Cannot find $@. Please build Trick for this platform.)
|
||||
@exit -1
|
||||
|
||||
# CP creates S_source.hh required for ICG and SWIG processing
|
||||
S_source.hh build/S_define.lib_deps: S_define | build
|
||||
$(PRINT_CP)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/configuration_processor $(TRICK_CPFLAGS)
|
||||
$(PRINT_S_DEF_DEPS)
|
||||
$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_SFLAGS) $(TRICK_SYSTEM_SFLAGS) -M -MT S_source.hh -MF build/S_define.deps -x c++ S_define
|
||||
|
||||
# Automatic and manual ICG rules
|
||||
build/Makefile_io_src: | S_source.hh build
|
||||
$(PRINT_ICG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh
|
||||
|
||||
ICG:
|
||||
$(PRINT_ICG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh
|
||||
|
||||
force_ICG:
|
||||
$(PRINT_ICG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -f -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh
|
||||
|
||||
# Create makefile for source code
|
||||
build/Makefile_src: | build/Makefile_io_src build/S_define.lib_deps
|
||||
$(PRINT_MAKEFILE_SRC)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/make_makefile_src $?
|
||||
|
||||
# Create makefile for SWIG code
|
||||
build/Makefile_swig: | build/Makefile_io_src
|
||||
$(PRINT_MAKEFILE_SWIG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/make_makefile_swig $?
|
||||
|
||||
# Automatic and manual convert_swig rules
|
||||
build/convert_swig_last_run: | build/Makefile_swig
|
||||
$(PRINT_CONVERT_SWIG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS}
|
||||
@touch $@
|
||||
|
||||
convert_swig:
|
||||
$(PRINT_CONVERT_SWIG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS}
|
||||
@touch build/convert_swig_last_run
|
||||
|
||||
# prints the value of a makefile variable, example invocation "make print-TRICK_CXXFLAGS"
|
||||
# This rule is used by trick-config
|
||||
print-%:
|
||||
@echo '$*=$($*)'
|
||||
|
||||
# Force S_define_exp to be remade each time this rule runs
|
||||
.PHONY: S_define_exp
|
||||
|
||||
S_define_exp:
|
||||
$(TRICK_CC) -E -C -xc++ ${TRICK_SFLAGS} $(TRICK_SYSTEM_SFLAGS) S_define > $@
|
||||
|
||||
# Pass these options
|
||||
sie:
|
||||
@if [ -f build/Makefile_src ] ; then $(MAKE) --no-print-directory -f build/Makefile_src $@ ; else echo "No build/Makefile_src found" ; fi
|
||||
|
||||
help:
|
||||
@echo -e "\
|
||||
Simulation make options:\n\
|
||||
make [debug] [TRICK_VERBOSE_BUILD=1] - Makes everything: S_main and S_sie.resource\n\
|
||||
make sie - Builds the S_sie.resource file.\n\
|
||||
make clean - Removes all object files in simulation directory\n\
|
||||
make spotless - Performs a clean\n\
|
||||
make apocalypse - Performs a clean"
|
||||
|
||||
tidy:
|
||||
-rm -f S_source.hh S_sie.resource
|
||||
-rm -f S_main* T_main*
|
||||
-rm -f build/Makefile_*
|
||||
-rm -f S_default.dat
|
||||
|
||||
clean: tidy
|
||||
-rm -f DP_Product/DP_rt_frame DP_Product/DP_rt_itimer
|
||||
-rm -f DP_Product/DP_rt_jobs DP_Product/DP_rt_timeline DP_Product/DP_mem_stats
|
||||
-rm -rf build trick
|
||||
|
||||
spotless: clean
|
||||
|
||||
distclean: clean
|
||||
-rm -f makefile
|
||||
|
||||
apocalypse: distclean
|
||||
@echo "[31mI love the smell of napalm in the morning[0m"
|
||||
|
||||
CLEAN_RULES_DEFINED = 1
|
||||
|
||||
# Dependencies for the above rules generated by configuration_process, ICG, make_makefile and make_makefile_swig
|
||||
-include build/S_define.deps
|
||||
-include build/Makefile_ICG
|
||||
-include build/Makefile_convert_swig
|
||||
-include build/Makefile_src_deps
|
9
share/trick/makefiles/Makefile.trickconfig
Normal file
@ -0,0 +1,9 @@
|
||||
# Utility makefile for trick-config
|
||||
|
||||
|
||||
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||
|
||||
# prints the value of a makefile variable, example invocation "make print-TRICK_CXXFLAGS"
|
||||
# This rule is used by trick-config
|
||||
print-%:
|
||||
@echo '$*=$($*)'
|
@ -70,7 +70,6 @@
|
||||
#
|
||||
# For more information, see:
|
||||
# github.com/nasa/trick/wiki/Trickified-Project-Libraries
|
||||
|
||||
ifndef TRICKIFY_CXX_FLAGS
|
||||
$(error TRICKIFY_CXX_FLAGS must be set)
|
||||
endif
|
||||
@ -80,7 +79,7 @@ TRICKIFY_PYTHON_DIR ?= python
|
||||
TRICK_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../../..)
|
||||
|
||||
ifneq ($(wildcard build),)
|
||||
SWIG_OBJECTS := $(shell tail -n +2 build/S_library_swig)
|
||||
SWIG_OBJECTS := $(shell cat build/S_library_swig)
|
||||
SWIG_OBJECTS := $(addprefix build,$(addsuffix _py.o,$(basename $(SWIG_OBJECTS))))
|
||||
IO_OBJECTS := $(shell find build -name "io_*.cpp")
|
||||
IO_OBJECTS := $(IO_OBJECTS:.cpp=.o)
|
||||
@ -111,7 +110,7 @@ $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT
|
||||
$(info $(call COLOR,Linking) $@)
|
||||
@ld -r -o $@ $^
|
||||
|
||||
$(dir $(TRICKIFY_OBJECT_NAME)) $(TRICKIFY_PYTHON_DIR):
|
||||
$(dir $(TRICKIFY_OBJECT_NAME)) $(TRICKIFY_PYTHON_DIR) build:
|
||||
@mkdir -p $@
|
||||
|
||||
$(IO_OBJECTS): %.o: %.cpp
|
||||
@ -128,10 +127,11 @@ $(SWIG_OBJECTS): %.o: %.cpp
|
||||
|
||||
$(SWIG_OBJECTS:.o=.cpp): %.cpp: %.i | $(TRICKIFY_PYTHON_DIR) $(SWIG_OBJECTS:.o=.i)
|
||||
$(info $(call COLOR,SWIGing) $<)
|
||||
@$(SWIG) $(TRICK_INCLUDE) $(TRICK_DEFINES) $(TRICK_VERSIONS) $(SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -outdir $(TRICKIFY_PYTHON_DIR) -o $@ $<
|
||||
@$(SWIG) $(TRICK_INCLUDE) $(TRICK_DEFINES) $(TRICK_VERSIONS) $(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -outdir $(TRICKIFY_PYTHON_DIR) -o $@ $<
|
||||
|
||||
define create_convert_swig_rule
|
||||
build/%_py.i: /%.$1
|
||||
$$(info $$(call COLOR,Converting) $$<)
|
||||
${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS} $$<
|
||||
endef
|
||||
|
||||
@ -169,7 +169,7 @@ $(foreach EXTENSION,$(EXTENSIONS),$(eval $(call create_convert_swig_rule,$(EXTEN
|
||||
# dependency list. The method is laid out in more detail here:
|
||||
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
|
||||
|
||||
build/S_source.d:
|
||||
build/S_source.d: | $(dir $@)
|
||||
@$(TRICK_HOME)/bin/trick-ICG $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_ICGFLAGS) S_source.hh
|
||||
@$(TRICK_HOME)/$(LIBEXEC)/trick/make_makefile_swig
|
||||
@$(TRICK_CC) -MM -MP -MT $@ -MF $@ $(TRICKIFY_CXX_FLAGS) S_source.hh
|
||||
|
@ -1 +1 @@
|
||||
current_version = "17.2.dev"
|
||||
current_version = "17.4.0"
|
||||
|
51
trick_sims/Ball/README.md
Normal file
@ -0,0 +1,51 @@
|
||||
# Ball Sims
|
||||
|
||||
## SIM\_ball\_L1
|
||||
|
||||
This is a simulation of a ball under the influence of a force field.
|
||||
The force on the ball is of constant magnitude, and always directed
|
||||
toward a fixed point.
|
||||
|
||||
![Picture of Sun](images/Ball_L1.png)
|
||||
|
||||
#### Inputs
|
||||
| Parameter | Units | Default |
|
||||
|:---------------------------- |:-----:|:-------:|
|
||||
| ball.force.input.origin[2] | m | { 0.0, 2.0 } |
|
||||
| ball.force.input.force | N | 8.0 |
|
||||
| ball.state.input.mass | kg | 10.0 |
|
||||
| ball.state.input.speed | m/s | 2.0 |
|
||||
| ball.state.input.elevation | rad | 45 ° x (180/π) |
|
||||
| ball.state.input.position[2] | m | { 5.0, 5.0 } |
|
||||
|
||||
#### Outputs
|
||||
| Parameter | Units |
|
||||
|:--------------------------------- |:-----:|
|
||||
| ball.state.output.position[2] | m |
|
||||
| ball.state.output.velocity[2] | m |
|
||||
| ball.state.output.acceleration[2] | m |
|
||||
|
||||
|
||||
## SIM\_ball\_L2
|
||||
|
||||
This simulation is a derivation of SIM\_ball\_L1. It uses Trick "dynamic-events" to simulate walls, off of which the ball can bounce.
|
||||
|
||||
![Picture of Sun](images/Ball_L2.png)
|
||||
|
||||
#### Inputs
|
||||
*(In addition to those of SIM\_ball\_L1)*
|
||||
These parameters define the coordinates of the walls.
|
||||
|
||||
| Parameter | Units | Default |
|
||||
|:----------------------------------- |:-----:|:-------:|
|
||||
| ball.force.input.floor\_y\_pos | m | -10.0 |
|
||||
| ball.force.input.right_wall\_x\_pos | m | 10.0 |
|
||||
| ball.force.ceiling\_y\_pos | m | 10.0 |
|
||||
| ball.force.left_wall\_x\_pos | m | -10.0 |
|
||||
|
||||
The outputs are the same as those of SIM\_ball\_L1.
|
||||
|
||||
|
||||
## SIM\_ball\_L3
|
||||
|
||||
This simulation is a derivation of SIM\_ball\_L2. The SIM\_ball\_L3 S_define instanciates two ballSimObject's rather than just one.
|
BIN
trick_sims/Ball/images/Ball_L1.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
trick_sims/Ball/images/Ball_L2.png
Normal file
After Width: | Height: | Size: 86 KiB |
@ -1,10 +1,13 @@
|
||||
# SIM\_cannon\_analytic
|
||||
|
||||
---
|
||||
|
||||
This is first of eight Trick-based simulations that one builds in the Trick
|
||||
Tutorial (Section 3). It's purpose is to introduce some of the fundamentals
|
||||
Tutorial (Section 4). It's purpose is to introduce some of the fundamentals
|
||||
of building a Trick simulation.
|
||||
|
||||
Here we simulate the flight of a cannon ball. We want to know the position and velocity of the cannon ball over time, given an initial position, and
|
||||
Here we simulate the flight of a cannon ball. We want to know the position and
|
||||
velocity of the cannon ball over time, given an initial position, and
|
||||
velocity, and subject to the following assumptions and limitations:
|
||||
|
||||
* The **only** force acting on the cannon ball is gravity.
|
||||
@ -14,45 +17,42 @@ velocity, and subject to the following assumptions and limitations:
|
||||
|
||||
![](images/CannonInit.png)
|
||||
|
||||
### Solution
|
||||
## Parameterization
|
||||
The following parameters are given default values in a "default_data" job called
|
||||
**cannon\_default\_data**. Their values can be changed in the **input.py** file.
|
||||
|
||||
This problem has a closed-form solution, so that's what is used.
|
||||
| Name | Sim Variable | Type | Units | Symbol | default |
|
||||
|------------------|------------------------|-----------|---------|:---------------------------------:|---------|
|
||||
| Barrel Angle | dyn.cannon.init\_angle | double | radians | ![theta](images/param_theta.png) | 30*(π/180) |
|
||||
| Speed | dyn.cannon.init\_speed | double | m/s | ![speed](images/param_s.png) | 50.0 |
|
||||
| Gravity | dyn.cannon.g | double | m/s | ![g](images/param_g.png) | 9.81 |
|
||||
| Initial Position | dyn.cannon.pos0 | double[2] | m | ![x_0](images/init_position.png) | ![](images/zero_vector.png) |
|
||||
|
||||
## Initialization
|
||||
The initial velocity is calculated in an "initialization" job.
|
||||
|
||||
| Name | Sim Variable | Type | Units | Calculation |
|
||||
|------------------|:----------------|-----------|-------|-------------------------------|
|
||||
| Initial Velocity | dyn.cannon.vel0 | double[2] | m/s | ![](images/init_velocity.png) |
|
||||
|
||||
## State Propagation
|
||||
For each time-step, the following are calculated in a "scheduled" job. Though acceleration is
|
||||
constant in this simulation, it usually isn't for "F=ma" type simulations.
|
||||
|
||||
| Name | Sim Variable | Type | Units | Calculation |
|
||||
|------------------|:---------------|-----------|-----------|----------------------------------|
|
||||
| Acceleration | dyn.cannon.acc | double[2] | m/s² | ![](images/acceleration.png) |
|
||||
| Velocity(t) | dyn.cannon.vel | double[2] | m/s | ![](images/velocity_fn_of_t.png) |
|
||||
| Position(t) | dyn.cannon.pos | double[2] | m | ![](images/position_fn_of_t.png) |
|
||||
|
||||
## Calculating When the Ball Impacts the Ground.
|
||||
The cannon ball will impact the ground, when y-element of the position vector is zero.
|
||||
|
||||
| Name | Sim Variable | Type | Units | Calculation |
|
||||
|------------------|:----------------------|--------|-------|--------------------------------|
|
||||
| Time of Impact | dyn.cannon.impactTime | double | s | ![](images/time_of_impact.png) |
|
||||
|
||||
<!--
|
||||
Tex: v_{x0}=S\cos\theta
|
||||
t_{\textrm{impact}} = \frac{ -v_{0_y} - \sqrt{v_{0_y}^2 - 2 g x_{0_y} }}{g}
|
||||
-->
|
||||
![](images/init_v_x_0.png)
|
||||
|
||||
<!--
|
||||
Tex: v_{y0}=S\sin\theta
|
||||
-->
|
||||
![](images/init_v_y_0.png)
|
||||
|
||||
![](images/init_a_x.png)
|
||||
|
||||
![](images/init_a_y.png)
|
||||
|
||||
![](images/solution_vx.png)
|
||||
|
||||
![v_{y}(t) = gt +v_{y0}](images/solution_vy.png)
|
||||
|
||||
![](images/solution_x.png)
|
||||
|
||||
![](images/solution_y.png)
|
||||
|
||||
|
||||
The cannon ball will impact the ground, when y(t)=0 at:
|
||||
|
||||
![](images/time_of_impact.png)
|
||||
|
||||
|
||||
### CANNON Object
|
||||
Model Variable | Simulation Variable | Type | Units
|
||||
--------------------------------------------|---------------------|---------|-------
|
||||
![](images/x_0.png), ![](images/y_0.png) | CANNON.pos0[2] |double[2]| m
|
||||
![](images/v_x_0.png), ![](images/v_y_0.png)| CANNON.vel0[2] |double[2]| m/s
|
||||
![\theta](images/param_theta.png) | CANNON.init\_angle |double | r
|
||||
![speed](images/param_s.png) | CANNON.init\_speed |double | m/s
|
||||
![\vec{x}](images/vector_x.png) | CANNON.pos[2] |double[2]| m
|
||||
![\vec{v}](images/vector_v.png) | CANNON.vel[2] |double[2]| m/s
|
||||
|
||||
|
BIN
trick_sims/Cannon/SIM_cannon_analytic/images/acceleration.png
Normal file
After Width: | Height: | Size: 796 B |
Before Width: | Height: | Size: 704 B |
Before Width: | Height: | Size: 718 B |
BIN
trick_sims/Cannon/SIM_cannon_analytic/images/init_position.png
Normal file
After Width: | Height: | Size: 458 B |
Before Width: | Height: | Size: 824 B |
Before Width: | Height: | Size: 844 B |
BIN
trick_sims/Cannon/SIM_cannon_analytic/images/init_velocity.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
trick_sims/Cannon/SIM_cannon_analytic/images/param_g.png
Normal file
After Width: | Height: | Size: 375 B |
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 912 B |
Before Width: | Height: | Size: 873 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 569 B |
Before Width: | Height: | Size: 433 B |
Before Width: | Height: | Size: 586 B |
Before Width: | Height: | Size: 464 B |
Before Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 372 B |
After Width: | Height: | Size: 834 B |
Before Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 409 B |
BIN
trick_sims/Cannon/SIM_cannon_analytic/images/zero_vector.png
Normal file
After Width: | Height: | Size: 483 B |
@ -1,4 +1,4 @@
|
||||
#SIM\_cannon\_jet
|
||||
# SIM\_cannon\_jet
|
||||
|
||||
This simulation is described in the Trick Tutorial, Section 9.
|
||||
|
||||
|
@ -1,15 +1,31 @@
|
||||
# SIM\_cannon\_integ
|
||||
# SIM\_cannon\_numeric
|
||||
|
||||
---
|
||||
|
||||
This is the second in a series example cannon ball simulations that one builds in the Trick Tutorial (Sections 9, 10). It's purpose is to introduce Trick supported numerical methods.
|
||||
|
||||
Rather than using the analytic solutions of SIM\_cannon\_analytic, this simulation uses Trick's numerical integration, and root-finding methods to:
|
||||
|
||||
* Determine the cannon ball state (velocity, position) at each time step, and
|
||||
* Determine when and where the cannon ball impacts the ground.
|
||||
|
||||
The simulation is otherwise the same as SIM\_cannon\_analytic.
|
||||
|
||||
![CannonPicture](images/CannonInit.png)
|
||||
|
||||
### The Simulation
|
||||
## Parameterization
|
||||
Same as in SIM\_cannon\_analytic.
|
||||
|
||||
This is a simulation of a cannon shooting a cannonball. Given the initial position of the cannon ball, the muzzle velocity (speed) of the cannon ball, and the elevation angle of the cannon barrel the simulation computes the cannon ball's trajectory and time of impact with the ground.
|
||||
|
||||
The acceleration of gravity is assumed to be -9.81 m/s<sup>2</sup>.
|
||||
## Initialization
|
||||
Same as in SIM\_cannon\_analytic.
|
||||
|
||||
## State Propagation
|
||||
|
||||
This Trick simulation calculates the cannonball state by numerical integration.
|
||||
Acceleration is calculated in the "derivative" job **cannon\_deriv**. It is then
|
||||
used in "integration" job **cannon\_integ** to calculate the cannonball's velocity and
|
||||
position, using the Trick **integrate** function.
|
||||
|
||||
|
||||
|
||||
|
||||
## When and Where the Ball Impacts the Ground
|
||||
The time and position of impact is determined by the "dynamic\_event" event job
|
||||
**cannon\_impact**, using the Trick **regula_falsi** function.
|
@ -1,7 +1,5 @@
|
||||
execfile("Modified_data/realtime.py")
|
||||
|
||||
dyn_integloop.getIntegrator(trick.Runge_Kutta_4, 5)
|
||||
|
||||
#==========================================
|
||||
# Start the Cannonball Graphics Client
|
||||
#==========================================
|
||||
|
@ -1,5 +1,2 @@
|
||||
|
||||
execfile("Modified_data/realtime.py")
|
||||
execfile("Modified_data/cannon.dr")
|
||||
|
||||
dyn_integloop.getIntegrator(trick.Runge_Kutta_4, 5)
|
||||
|
@ -29,3 +29,7 @@ class CannonSimObject : public Trick::SimObject {
|
||||
CannonSimObject dyn ;
|
||||
|
||||
IntegLoop dyn_integloop (0.01) dyn;
|
||||
|
||||
void create_connections() {
|
||||
dyn_integloop.getIntegrator(Runge_Kutta_4, 5);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 45 KiB |
@ -14,6 +14,7 @@ typedef struct {
|
||||
double pos0[2] ; /* *i m Init position of cannonball */
|
||||
double init_speed ; /* *i m/s Init barrel speed */
|
||||
double init_angle ; /* *i rad Angle of cannon */
|
||||
double g ; /* *i m/s2 acceleration of gravity */
|
||||
|
||||
double acc[2] ; /* m/s2 xy-acceleration */
|
||||
double vel[2] ; /* m/s xy-velocity */
|
||||
|
@ -7,14 +7,14 @@ PURPOSE: ( Analytical Cannon )
|
||||
|
||||
int cannon_analytic( CANNON* C ) {
|
||||
|
||||
C->acc[0] = 0.00;
|
||||
C->acc[1] = -9.81 ;
|
||||
C->acc[0] = 0.0;
|
||||
C->acc[1] = -C->g;
|
||||
C->vel[0] = C->vel0[0] + C->acc[0] * C->time ;
|
||||
C->vel[1] = C->vel0[1] + C->acc[1] * C->time ;
|
||||
C->pos[0] = C->pos0[0] + (C->vel0[0] + (0.5) * C->acc[0] * C->time) * C->time ;
|
||||
C->pos[1] = C->pos0[1] + (C->vel0[1] + (0.5) * C->acc[1] * C->time) * C->time ;
|
||||
if (C->pos[1] < 0.0) {
|
||||
C->impactTime = (- C->vel0[1] - sqrt( C->vel0[1] * C->vel0[1] - 2 * C->pos0[1]))/C->acc[1];
|
||||
C->impactTime = (C->vel0[1] + sqrt( C->vel0[1] * C->vel0[1] - 2 * C->g * C->pos0[1])) / C->g;
|
||||
C->pos[0] = C->impactTime * C->vel0[0];
|
||||
C->pos[1] = 0.0;
|
||||
C->vel[0] = 0.0;
|
||||
|
@ -10,8 +10,7 @@ PURPOSE: (Set the initial data values)
|
||||
/* default data job */
|
||||
int cannon_default_data( CANNON* C ) {
|
||||
|
||||
C->acc[0] = 0.0;
|
||||
C->acc[1] = -9.81;
|
||||
C->g = 9.81;
|
||||
C->init_angle = M_PI/6 ;
|
||||
C->init_speed = 50.0 ;
|
||||
C->pos0[0] = 0.0 ;
|
||||
|
@ -9,8 +9,8 @@ PURPOSE: ( Numeric integration for SIM_cannon_numeric )
|
||||
int cannon_deriv( CANNON* C ) {
|
||||
|
||||
if (!C->impact) {
|
||||
C->acc[0] = 0.00 ;
|
||||
C->acc[1] = -9.81 ;
|
||||
C->acc[0] = 0.0;
|
||||
C->acc[1] = -C->g;
|
||||
C->timeRate = 1.00;
|
||||
}
|
||||
return 0 ;
|
||||
|
@ -35,8 +35,6 @@ GLuint MakeTexture(GLubyte* data , int width, int height) {
|
||||
|
||||
void Satellite_initialize(void) {
|
||||
|
||||
FILE fp;
|
||||
|
||||
capsuleTextureID = MakeTexture(Capsule_texture, CAPSULE_TEXTURE_WIDTH, CAPSULE_TEXTURE_HEIGHT);
|
||||
nozzleTextureID = MakeTexture(Nozzle_texture, NOZZLE_TEXTURE_WIDTH, NOZZLE_TEXTURE_HEIGHT);
|
||||
|
||||
|
@ -28,8 +28,6 @@ void Satellite::get_force_of_gravity ( double* gForceV) {
|
||||
void Satellite::get_Force_and_Torque() {
|
||||
|
||||
double gforcev[3];
|
||||
double thruster_force[3];
|
||||
double thruster_torque[3];
|
||||
|
||||
// Zero force.
|
||||
for (int ii=0; ii<3; ii++) { force[ii] = 0.0; }
|
||||
|
@ -101,7 +101,7 @@ if (os.path.isfile(SunDisplay_path)) :
|
||||
os.system( SunDisplay_cmd);
|
||||
else :
|
||||
print('==================================================================================')
|
||||
print('SunDisplay needs to be built. Please \"cd\" into models/Graphics and type \"make\".')
|
||||
print('SunDisplay needs to be built. Please \"cd\" into models/graphics and type \"make\".')
|
||||
print('==================================================================================')
|
||||
|
||||
trick.stop(86400.0)
|
||||
|
@ -60,12 +60,12 @@ int sun_pred_fast_display(
|
||||
// sprintf(tmp_s," %ls %.6f",S->label_JD, S->JD);
|
||||
// strcat(message,tmp_s);
|
||||
if ( S->label_Azimuth != NULL ) {
|
||||
sprintf(tmp_s," %ls %.3f%lc",S->label_Azimuth, S->solar_azimuth, DEGREE_SIGN);
|
||||
sprintf(tmp_s," %ls %.3f%d",S->label_Azimuth, S->solar_azimuth, DEGREE_SIGN);
|
||||
} else {
|
||||
sprintf(tmp_s," AZIMUTH %.3f%lc", S->solar_azimuth, DEGREE_SIGN);
|
||||
sprintf(tmp_s," AZIMUTH %.3f%d", S->solar_azimuth, DEGREE_SIGN);
|
||||
}
|
||||
strcat(message,tmp_s);
|
||||
sprintf(tmp_s," %ls %.3f%lc",S->label_Elevation, S->solar_elevation, DEGREE_SIGN);
|
||||
sprintf(tmp_s," %ls %.3f%d",S->label_Elevation, S->solar_elevation, DEGREE_SIGN);
|
||||
strcat(message,tmp_s);
|
||||
|
||||
send_hs(stdout,"%s\n",message);
|
||||
|
@ -237,7 +237,6 @@ bool FieldVisitor::VisitFieldDecl( clang::FieldDecl *field ) {
|
||||
if ( !qt.isCanonical() ) {
|
||||
fdes->setNonCanonicalTypeName(qt.getAsString()) ;
|
||||
clang::QualType ct = qt.getCanonicalType() ;
|
||||
std::string tst_string = ct.getAsString() ;
|
||||
if ( debug_level >= 3 ) {
|
||||
std::cout << "\033[33mFieldVisitor VisitFieldDecl: Processing canonical type\033[00m" << std::endl ;
|
||||
ct.dump() ;
|
||||
@ -271,8 +270,6 @@ bool FieldVisitor::ProcessTemplate(std::string in_name , clang::CXXRecordDecl *
|
||||
return false ;
|
||||
}
|
||||
|
||||
size_t pos ;
|
||||
|
||||
// Check to see if we've processed this template before
|
||||
// If not we need to create attributes for this template
|
||||
if ( processed_templates.find(in_name) == processed_templates.end() ) {
|
||||
|
@ -82,7 +82,7 @@ void FindTrickICG::ElIf(clang::SourceLocation Loc, clang::SourceRange ConditionR
|
||||
If(Loc,ConditionRange,ConditionValue) ;
|
||||
}
|
||||
|
||||
#if (LIBCLANG_MAJOR > 3) || ((LIBCLANG_MAJOR == 3) && (LIBCLANG_MINOR >= 5))
|
||||
#if (LIBCLANG_MAJOR > 3) || ((LIBCLANG_MAJOR == 3) && (LIBCLANG_MINOR >= 7))
|
||||
void FindTrickICG::Ifdef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD)
|
||||
#else
|
||||
void FindTrickICG::Ifdef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDirective *MD)
|
||||
@ -109,7 +109,7 @@ void FindTrickICG::Ifdef(clang::SourceLocation Loc, const clang::Token &MacroNam
|
||||
|
||||
}
|
||||
|
||||
#if (LIBCLANG_MAJOR > 3) || ((LIBCLANG_MAJOR == 3) && (LIBCLANG_MINOR >= 5))
|
||||
#if (LIBCLANG_MAJOR > 3) || ((LIBCLANG_MAJOR == 3) && (LIBCLANG_MINOR >= 7))
|
||||
void FindTrickICG::Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD)
|
||||
#else
|
||||
void FindTrickICG::Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDirective *MD)
|
||||
|
@ -24,11 +24,14 @@ class FindTrickICG : public clang::PPCallbacks {
|
||||
#if (LIBCLANG_MAJOR > 3) || ((LIBCLANG_MAJOR == 3) && (LIBCLANG_MINOR >= 5))
|
||||
virtual void If(clang::SourceLocation Loc, clang::SourceRange ConditionRange, clang::PPCallbacks::ConditionValueKind ConditionValue) ;
|
||||
virtual void ElIf(clang::SourceLocation Loc, clang::SourceRange ConditionRange, clang::PPCallbacks::ConditionValueKind ConditionValue) ;
|
||||
virtual void Ifdef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD) ;
|
||||
virtual void Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD) ;
|
||||
#else
|
||||
virtual void If(clang::SourceLocation Loc, clang::SourceRange ConditionRange, bool ConditionValue) ;
|
||||
virtual void ElIf(clang::SourceLocation Loc, clang::SourceRange ConditionRange, bool ConditionValue) ;
|
||||
#endif
|
||||
#if (LIBCLANG_MAJOR > 3) || ((LIBCLANG_MAJOR == 3) && (LIBCLANG_MINOR >= 7))
|
||||
virtual void Ifdef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD) ;
|
||||
virtual void Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD) ;
|
||||
#else
|
||||
virtual void Ifdef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDirective *MD) ;
|
||||
virtual void Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDirective *MD) ;
|
||||
#endif
|
||||
|
@ -383,7 +383,6 @@ void PrintAttributes::printIOMakefile() {
|
||||
std::ofstream io_link_list ;
|
||||
std::ofstream ICG_processed ;
|
||||
std::ofstream ext_lib ;
|
||||
unsigned int ii ;
|
||||
|
||||
// Don't create a makefile if we didn't process any files.
|
||||
if ( out_of_date_io_files.empty() ) {
|
||||
|
@ -97,6 +97,9 @@ int main(int argc, char * argv[]) {
|
||||
ci.getLangOpts().CPlusPlus = true ;
|
||||
ci.getLangOpts().CPlusPlus11 = true ;
|
||||
ci.getLangOpts().CXXOperatorNames = true ;
|
||||
#if (LIBCLANG_MAJOR >= 6)
|
||||
ci.getLangOpts().DoubleSquareBracketAttributes = true ;
|
||||
#endif
|
||||
|
||||
// Create all of the necessary managers.
|
||||
ci.createFileManager();
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||
|
||||
CC = c++
|
||||
CXX = c++
|
||||
DP_CFLAGS = -g -I../..
|
||||
OBJDIR = object_${TRICK_HOST_CPU}
|
||||
LIBDIR = ../../lib_${TRICK_HOST_CPU}
|
||||
@ -23,10 +23,10 @@ endif
|
||||
all: $(ASCII_MAIN)
|
||||
|
||||
$(ASCII_MAIN): $(OBJDIR)/trk2ascii.o
|
||||
$(CC) $(DP_CFLAGS) -o $(ASCII_MAIN) $(OBJDIR)/trk2ascii.o $(DP_LIBS) $(DL_LIB) -lm
|
||||
$(CXX) $(DP_CFLAGS) -o $(ASCII_MAIN) $(OBJDIR)/trk2ascii.o $(DP_LIBS) $(DL_LIB) -lm
|
||||
|
||||
$(OBJDIR)/trk2ascii.o: trk2ascii.cpp | $(OBJDIR)
|
||||
$(CC) $(DP_CFLAGS) -c trk2ascii.cpp -o $(OBJDIR)/trk2ascii.o
|
||||
$(CXX) $(DP_CFLAGS) -c trk2ascii.cpp -o $(OBJDIR)/trk2ascii.o
|
||||
|
||||
clean:
|
||||
rm -f trk2ascii
|
||||
|
@ -17,8 +17,8 @@ void CSV_Formatter::writeDatum(FILE* out_fp, int16_t datum) { fprintf(out_fp,"%
|
||||
void CSV_Formatter::writeDatum(FILE* out_fp, uint16_t datum) { fprintf(out_fp,"%u", datum); }
|
||||
void CSV_Formatter::writeDatum(FILE* out_fp, int32_t datum) { fprintf(out_fp,"%d", datum); }
|
||||
void CSV_Formatter::writeDatum(FILE* out_fp, uint32_t datum) { fprintf(out_fp,"%u", datum); }
|
||||
void CSV_Formatter::writeDatum(FILE* out_fp, int64_t datum) { fprintf(out_fp,"%lld", datum); }
|
||||
void CSV_Formatter::writeDatum(FILE* out_fp, uint64_t datum) { fprintf(out_fp,"%lld", datum); }
|
||||
void CSV_Formatter::writeDatum(FILE* out_fp, int64_t datum) { fprintf(out_fp,"%ld", datum); }
|
||||
void CSV_Formatter::writeDatum(FILE* out_fp, uint64_t datum) { fprintf(out_fp,"%lu", datum); }
|
||||
void CSV_Formatter::writeDatum(FILE* out_fp, float datum) { fprintf(out_fp,"%.7f", datum); }
|
||||
void CSV_Formatter::writeDatum(FILE* out_fp, double datum) { fprintf(out_fp,"%.15g", datum); }
|
||||
const char* CSV_Formatter::extension() { return ".csv"; };
|
||||
|
204
trick_source/data_products/Apps/trkConvert/DocWindow.cpp
Normal file
@ -0,0 +1,204 @@
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QMenuBar>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QWidget>
|
||||
#include <iostream>
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
#include "DocWindow.h"
|
||||
#include "VarTableWidget.h"
|
||||
#include "CSV_Formatter.hh"
|
||||
#include "Varlist_Formatter.hh"
|
||||
|
||||
DocWindow::DocWindow(TRK_DataLog* data_log )
|
||||
: QMainWindow( 0, 0) {
|
||||
|
||||
QTextStream out(stdout);
|
||||
|
||||
foundItemIndex = 0;
|
||||
datalog = data_log;
|
||||
|
||||
// Build the FILE menu
|
||||
|
||||
QMenu *fileMenu = menuBar()->addMenu("&File");
|
||||
|
||||
QAction * fileLoadAction = new QAction( "&Open File...", this );
|
||||
fileLoadAction->setShortcut(tr("CTRL+O"));
|
||||
fileMenu->addAction(fileLoadAction);
|
||||
connect( fileLoadAction, &QAction::triggered , this, &DocWindow::load );
|
||||
|
||||
fileMenu->addSeparator();
|
||||
|
||||
QAction * csvSaveAction = new QAction( "&Export as CSV...", this );
|
||||
fileMenu->addAction(csvSaveAction);
|
||||
connect( csvSaveAction, &QAction::triggered, this, &DocWindow::saveAsCSV );
|
||||
|
||||
QAction * varListSaveAction = new QAction( "&Export as Variable List...", this );
|
||||
fileMenu->addAction(varListSaveAction);
|
||||
connect( varListSaveAction, &QAction::triggered, this, &DocWindow::saveAsVarList );
|
||||
|
||||
// Build the EDIT menu
|
||||
|
||||
QMenu *editMenu = menuBar()->addMenu("&Edit");
|
||||
|
||||
QAction * editSelectAction = new QAction( "&Select All", this );
|
||||
editSelectAction->setShortcut(tr("CTRL+A"));
|
||||
editMenu->addAction(editSelectAction);
|
||||
connect( editSelectAction, &QAction::triggered, this, &DocWindow::checkAll );
|
||||
|
||||
QAction * editClearAction = new QAction( "&Clear All", this );
|
||||
editMenu->addAction(editClearAction);
|
||||
connect( editClearAction, &QAction::triggered, this, &DocWindow::unCheckAll );
|
||||
|
||||
// Build the search interface.
|
||||
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
|
||||
QPushButton *backward = new QPushButton(QChar(0x25C0), this);
|
||||
hbox->addWidget(backward);
|
||||
connect( backward, &QPushButton::released, this, &DocWindow::findAgainBackward);
|
||||
|
||||
QPushButton *forward = new QPushButton(QChar(0x25B6), this);
|
||||
hbox->addWidget(forward);
|
||||
connect( forward, &QPushButton::released, this, &DocWindow::findAgainForward);
|
||||
|
||||
searchLineEdit = new QLineEdit;
|
||||
searchLineEdit->setPlaceholderText("Search Pattern");
|
||||
hbox->addWidget(searchLineEdit);
|
||||
connect(searchLineEdit, SIGNAL(returnPressed()), this, SLOT(find()));
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout();
|
||||
|
||||
// Build the Table Widget that displays the variable names, types, and units.
|
||||
varTable = new VarTableWidget(this);
|
||||
|
||||
int recordCount = datalog->parameterCount();
|
||||
for (int ii = 0; ii < recordCount; ii++) {
|
||||
varTable->addRecord( Qt::Checked,
|
||||
datalog->parameterName(ii),
|
||||
datalog->parameterType(ii),
|
||||
datalog->parameterUnits(ii));
|
||||
}
|
||||
|
||||
vbox->addWidget(varTable);
|
||||
vbox->addLayout(hbox);
|
||||
|
||||
QWidget *window = new QWidget;
|
||||
window->setLayout(vbox);
|
||||
|
||||
setCentralWidget(window);
|
||||
}
|
||||
|
||||
void DocWindow::load() {
|
||||
|
||||
QString newFileName;
|
||||
|
||||
newFileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Data File"), ".", tr("Data Files (*.trk)"));
|
||||
|
||||
QFileInfo trkFileInfo( newFileName);
|
||||
TRK_DataLog* newdatalog = new TRK_DataLog( trkFileInfo.absoluteFilePath().toStdString());
|
||||
|
||||
if (!newFileName.isEmpty()) {
|
||||
DocWindow* w = new DocWindow(newdatalog);
|
||||
w->setWindowTitle(newFileName);
|
||||
w->resize(800, 500);
|
||||
w->show();
|
||||
}
|
||||
}
|
||||
|
||||
void DocWindow::formattedSave(LogFormatter &formatter) {
|
||||
|
||||
QFileInfo trkFileInfo( datalog->getFileName().c_str());
|
||||
|
||||
QString outFileName = trkFileInfo.canonicalPath();
|
||||
outFileName += "/";
|
||||
outFileName += trkFileInfo.completeBaseName();
|
||||
outFileName += formatter.extension();
|
||||
|
||||
QTextStream out(stdout);
|
||||
out << "outFileName = \"" << outFileName << "\"" << endl;
|
||||
|
||||
int count = varTable->recordCount();
|
||||
for (int index=0 ; index<count ; index++) {
|
||||
if (varTable->isChecked(index)) {
|
||||
datalog->selectParameter(index);
|
||||
} else {
|
||||
datalog->deselectParameter(index);
|
||||
}
|
||||
}
|
||||
|
||||
FILE *fp;
|
||||
if (( fp = fopen(outFileName.toStdString().c_str(), "w") ) != NULL) {
|
||||
datalog->formattedWrite(fp, &formatter);
|
||||
}
|
||||
}
|
||||
|
||||
void DocWindow::saveAsCSV() {
|
||||
CSV_Formatter csv_formatter;
|
||||
formattedSave(csv_formatter);
|
||||
}
|
||||
|
||||
void DocWindow::saveAsVarList() {
|
||||
Varlist_Formatter varlist_formatter;
|
||||
formattedSave(varlist_formatter);
|
||||
}
|
||||
|
||||
void DocWindow::checkAll() {
|
||||
varTable->checkAll();
|
||||
}
|
||||
|
||||
void DocWindow::unCheckAll() {
|
||||
varTable->unCheckAll();
|
||||
}
|
||||
|
||||
void DocWindow::findAgain(int direction) {
|
||||
if (foundItemIndex >= 0) {
|
||||
varTable->unHighLightRecord(foundItemIndex);
|
||||
int count = varTable->recordCount();
|
||||
int startIndex = (count + foundItemIndex + direction) % count;
|
||||
if ((foundItemIndex = textSearch(searchPattern, startIndex, direction)) >= 0) {
|
||||
varTable->scrollToRecord(foundItemIndex);
|
||||
varTable->highLightRecord(foundItemIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DocWindow::findAgainForward() {
|
||||
findAgain(1);
|
||||
}
|
||||
|
||||
void DocWindow::findAgainBackward() {
|
||||
findAgain(-1);
|
||||
}
|
||||
|
||||
void DocWindow::find() {
|
||||
searchPattern = searchLineEdit->text();
|
||||
|
||||
if (foundItemIndex >= 0) {
|
||||
varTable->unHighLightRecord(foundItemIndex);
|
||||
}
|
||||
if ((foundItemIndex = textSearch(searchPattern, 0, 1)) >= 0) {
|
||||
varTable->scrollToRecord(foundItemIndex);
|
||||
varTable->highLightRecord(foundItemIndex);
|
||||
}
|
||||
}
|
||||
|
||||
int DocWindow::textSearch(QString pattern, int startIndex, int direction) {
|
||||
|
||||
QRegExp rx(pattern);
|
||||
int count = varTable->recordCount();
|
||||
int foundIx = -1;
|
||||
for (int i=0 ; i<count ; i++) {
|
||||
int index = (count + startIndex + direction * i) % count;
|
||||
if ((rx.indexIn(datalog->parameterName(index),0)) >= 0) {
|
||||
foundIx = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return foundIx;
|
||||
}
|
40
trick_source/data_products/Apps/trkConvert/DocWindow.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef DOC_WINDOW
|
||||
#define DOC_WINDOW
|
||||
|
||||
#include <QMainWindow>
|
||||
#include "VarTableWidget.h"
|
||||
#include "TRK_DataLog.hh"
|
||||
|
||||
class DocWindow : public QMainWindow {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DocWindow(TRK_DataLog* data_log );
|
||||
~DocWindow(){};
|
||||
|
||||
void formattedSave(LogFormatter &formatter);
|
||||
void textSearch();
|
||||
int textSearch(QString searchText, int startIndex, int direction);
|
||||
void findAgain(int direction);
|
||||
|
||||
private slots:
|
||||
void load();
|
||||
void saveAsCSV();
|
||||
void saveAsVarList();
|
||||
void checkAll();
|
||||
void unCheckAll();
|
||||
void find();
|
||||
|
||||
void findAgainForward();
|
||||
void findAgainBackward();
|
||||
|
||||
private:
|
||||
int foundItemIndex;
|
||||
QString searchPattern;
|
||||
QLineEdit* searchLineEdit;
|
||||
VarTableWidget* varTable;
|
||||
TRK_DataLog* datalog;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,32 @@
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
#include "ParamDescription.hh"
|
||||
|
||||
ParamDescription::ParamDescription(FILE* in_fp) {
|
||||
|
||||
int32_t nameStringLength;
|
||||
if ( fread( &nameStringLength, 1, 4, in_fp) != 4)
|
||||
throw std::runtime_error("fread() failed.");
|
||||
|
||||
parameterName = new char[nameStringLength+1];
|
||||
if ( fread( parameterName, 1, nameStringLength, in_fp) != (size_t)nameStringLength)
|
||||
throw std::runtime_error("fread() failed.");
|
||||
|
||||
parameterName[nameStringLength] = 0;
|
||||
|
||||
int32_t unitsStringLength;
|
||||
if ( fread( &unitsStringLength, 1, 4 , in_fp) != 4)
|
||||
throw std::runtime_error("fread() failed.");
|
||||
|
||||
unitsName = new char[unitsStringLength+1];
|
||||
if ( fread( unitsName, 1, unitsStringLength, in_fp) != (size_t)unitsStringLength)
|
||||
throw std::runtime_error("fread() failed.");
|
||||
|
||||
unitsName[unitsStringLength] = 0;
|
||||
|
||||
if ( fread( &dataType, 1, 4, in_fp) != 4)
|
||||
throw std::runtime_error("fread() failed.");
|
||||
|
||||
if ( fread( &dataSize, 1, 4, in_fp) != 4)
|
||||
throw std::runtime_error("fread() failed.");
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
#ifndef PARAM_DESCRIPTION_H
|
||||
#define PARAM_DESCRIPTION_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct ParamDescription {
|
||||
|
||||
char* parameterName;
|
||||
char* unitsName;
|
||||
int32_t dataType;
|
||||
int32_t dataSize;
|
||||
|
||||
ParamDescription(){}
|
||||
ParamDescription(FILE* fp);
|
||||
};
|
||||
#endif
|
49
trick_source/data_products/Apps/trkConvert/README.md
Normal file
@ -0,0 +1,49 @@
|
||||
# trkConvert
|
||||
|
||||
Convert selected sets of variables in Trick binary data recording files (.trk) to comma separated values (.csv). In the future, more formats may be added as needed.
|
||||
|
||||
## Building trkConvert
|
||||
|
||||
trkConvert requires the [Qt Application Framework](https://www.qt.io).
|
||||
|
||||
When Qt is installed, building the application is as simple as:
|
||||
|
||||
```
|
||||
% qmake
|
||||
% make
|
||||
% cp trkConvert $TRICK_HOME/bin/trkConvert
|
||||
```
|
||||
|
||||
## Running trkConvert
|
||||
|
||||
**% trkConvert [name.trk] &**
|
||||
|
||||
```
|
||||
% trkConvert &
|
||||
```
|
||||
|
||||
![fileSelectDialog](images/fileSelectDialog.png)
|
||||
|
||||
```
|
||||
% trkConvert log_helios.trk &
|
||||
```
|
||||
The resulting window displays the names, data types and units of the variables recorded in the .trk file. The check marks, to the left indicate which variables would be recorded in an exported format.
|
||||
|
||||
![x](images/DocWindow.png)
|
||||
The check boxes can be individually selected and cleared with a mouse-click.
|
||||
They can be collectively selected and cleared from the Edit menu.
|
||||
|
||||
![x](images/DocWindow2.png)
|
||||
|
||||
## Variable Search
|
||||
|
||||
Python-like regular expressions
|
||||
A search pattern is Python-like regular expression that matches any part of a variable name. To search, type the pattern, and press **Return** or **Enter**.
|
||||
|
||||
Subsequent searches for the pattern can be performed using the arrow buttons.
|
||||
|
||||
* Right arror searches forward
|
||||
* Left arrow searches backward.
|
||||
|
||||
## Exporting Selected Values
|
||||
Export selected values to CSV, or other format from the **File** menu.
|
@ -1,16 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h> // Requires C99
|
||||
#include <vector>
|
||||
#include "TRK_DataLog.hh"
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
#include "LogFormatter.hh"
|
||||
#include "CSV_Formatter.hh"
|
||||
#include "Varlist_Formatter.hh"
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
|
||||
typedef enum {
|
||||
TRICK_VOID = 0, /* No type */
|
||||
@ -41,83 +34,38 @@ typedef enum {
|
||||
TRICK_NUMBER_OF_TYPES
|
||||
} TRICK_TYPE ;
|
||||
|
||||
class ReadException: public std::exception {
|
||||
virtual const char* what() const throw() {
|
||||
return "fread() failed.";
|
||||
}
|
||||
} readException;
|
||||
|
||||
/* ================================================================================
|
||||
* CLASS: ParamDescription
|
||||
* ================================================================================
|
||||
*/
|
||||
class ParamDescription {
|
||||
public:
|
||||
char* parameterName;
|
||||
char* unitsName;
|
||||
int32_t dataType;
|
||||
int32_t dataSize;
|
||||
|
||||
ParamDescription(){}
|
||||
ParamDescription(FILE* fp);
|
||||
const char* TypeName[] = {
|
||||
"--0--",
|
||||
"char",
|
||||
"unsigned char",
|
||||
"--3--",
|
||||
"short",
|
||||
"unsigned short",
|
||||
"int",
|
||||
"unsigned int",
|
||||
"long",
|
||||
"unsigned long",
|
||||
"float",
|
||||
"double",
|
||||
"--12--",
|
||||
"--13--",
|
||||
"long long",
|
||||
"unsigned long long",
|
||||
"--16--",
|
||||
"bool",
|
||||
"--18--",
|
||||
"--19--",
|
||||
"--20--",
|
||||
"--21--",
|
||||
"--22--",
|
||||
"--23--",
|
||||
"--24--"
|
||||
};
|
||||
|
||||
ParamDescription::ParamDescription(FILE* in_fp){
|
||||
const int TRK_DataLog::LittleEndian = 1;
|
||||
const int TRK_DataLog::BigEndian = 2;
|
||||
|
||||
int32_t nameStringLength;
|
||||
if ( fread( &nameStringLength, 1, 4, in_fp) != 4) throw readException;
|
||||
|
||||
parameterName = new char[nameStringLength+1];
|
||||
if ( fread( parameterName, 1, nameStringLength, in_fp) != (size_t)nameStringLength) throw readException;
|
||||
parameterName[nameStringLength] = 0;
|
||||
|
||||
int32_t unitsStringLength;
|
||||
if ( fread( &unitsStringLength, 1, 4 , in_fp) != 4) throw readException;
|
||||
|
||||
unitsName = new char[unitsStringLength+1];
|
||||
if ( fread( unitsName, 1, unitsStringLength, in_fp) != (size_t)unitsStringLength) throw readException;
|
||||
unitsName[unitsStringLength] = 0;
|
||||
|
||||
if ( fread( &dataType, 1, 4, in_fp) != 4) throw readException;
|
||||
if ( fread( &dataSize, 1, 4, in_fp) != 4) throw readException;
|
||||
}
|
||||
|
||||
/* ================================================================================
|
||||
* CLASS: DataLog
|
||||
* ================================================================================
|
||||
*/
|
||||
class DataLog {
|
||||
|
||||
public:
|
||||
std::string fileName;
|
||||
FILE* in_fp;
|
||||
int version;
|
||||
int endianness;
|
||||
uint32_t N_params;
|
||||
fpos_t dataPosition;
|
||||
int dataRecordSize;
|
||||
char* dataRecord;
|
||||
|
||||
static const int LittleEndian;
|
||||
static const int BigEndian;
|
||||
|
||||
std::vector<ParamDescription*> paramDescriptions;
|
||||
std::vector<int> paramOffsets;
|
||||
std::vector<bool> paramSelected;
|
||||
|
||||
DataLog(){}
|
||||
DataLog(std::string fileName);
|
||||
void selectAllParameters();
|
||||
void selectParameter(unsigned int index);
|
||||
void selectParameter(const char * paramName);
|
||||
void deselectParameter(unsigned int index);
|
||||
void formattedWrite(FILE* out_fp, LogFormatter* formatter);
|
||||
};
|
||||
|
||||
const int DataLog::LittleEndian = 1;
|
||||
const int DataLog::BigEndian = 2;
|
||||
|
||||
DataLog::DataLog(std::string file_name) {
|
||||
TRK_DataLog::TRK_DataLog(std::string file_name) {
|
||||
|
||||
fileName = file_name;
|
||||
in_fp = fopen(fileName.c_str(), "rb");
|
||||
@ -125,7 +73,8 @@ DataLog::DataLog(std::string file_name) {
|
||||
if (in_fp != NULL) {
|
||||
|
||||
char trick_header_string[11];
|
||||
if (fread( trick_header_string, 1, 10, in_fp) != 10) throw readException;
|
||||
if (fread( trick_header_string, 1, 10, in_fp) != 10)
|
||||
throw std::runtime_error("fread() failed.");
|
||||
trick_header_string[10] = 0;
|
||||
|
||||
if (!strncmp( trick_header_string, "Trick-", 6)) {
|
||||
@ -147,7 +96,8 @@ DataLog::DataLog(std::string file_name) {
|
||||
fprintf (stderr, "Trick header error. Endianness should be \"L\" or \"B\".");
|
||||
}
|
||||
|
||||
if (fread( &N_params, 1, 4, in_fp) != 4) throw readException;
|
||||
if (fread( &N_params, 1, 4, in_fp) != 4)
|
||||
throw std::runtime_error("fread() failed.");
|
||||
|
||||
dataRecordSize = 0;
|
||||
for (int ii = 0 ; ii < (int)N_params ; ii++ ) {
|
||||
@ -174,19 +124,49 @@ DataLog::DataLog(std::string file_name) {
|
||||
}
|
||||
}
|
||||
|
||||
void DataLog::selectAllParameters() {
|
||||
std::string TRK_DataLog::getFileName() const {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
int TRK_DataLog::parameterCount() const {
|
||||
return (int)N_params;
|
||||
}
|
||||
|
||||
const char* TRK_DataLog::parameterName(unsigned int n) const {
|
||||
if (n < N_params)
|
||||
return paramDescriptions[n]->parameterName;
|
||||
else
|
||||
return "BadIndex";
|
||||
}
|
||||
|
||||
const char* TRK_DataLog::parameterUnits(unsigned int n) const {
|
||||
if (n < N_params)
|
||||
return paramDescriptions[n]->unitsName;
|
||||
else
|
||||
return "BadIndex";
|
||||
}
|
||||
|
||||
const char* TRK_DataLog::parameterType(unsigned int n) const {
|
||||
if (n < N_params)
|
||||
return TypeName[ paramDescriptions[n]->dataType ];
|
||||
else
|
||||
return "BadIndex";
|
||||
}
|
||||
|
||||
|
||||
void TRK_DataLog::selectAllParameters() {
|
||||
for (int ii = 1 ; ii < (int)N_params ; ii++ ) {
|
||||
paramSelected[ii] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void DataLog::selectParameter(unsigned int index) {
|
||||
void TRK_DataLog::selectParameter(unsigned int index) {
|
||||
if ((index > 0) && (index < N_params)) {
|
||||
paramSelected[index] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void DataLog::selectParameter(const char * paramName) {
|
||||
void TRK_DataLog::selectParameter(const char * paramName) {
|
||||
bool found = false;
|
||||
int ii = 1;
|
||||
while ((ii < (int)N_params) && (found == false)) {
|
||||
@ -198,20 +178,21 @@ void DataLog::selectParameter(const char * paramName) {
|
||||
}
|
||||
}
|
||||
|
||||
void DataLog::deselectParameter(unsigned int index) {
|
||||
void TRK_DataLog::deselectParameter(unsigned int index) {
|
||||
if ((index > 0) && (index < N_params)) {
|
||||
paramSelected[index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
void DataLog::formattedWrite(FILE* out_fp, LogFormatter* formatter) {
|
||||
void TRK_DataLog::formattedWrite(FILE* out_fp, LogFormatter* formatter) {
|
||||
|
||||
formatter->writeHeader(out_fp, version, endianness);
|
||||
formatter->writeColumnLabel(out_fp, paramDescriptions[0]->parameterName, paramDescriptions[0]->unitsName);
|
||||
for (int ii = 1; ii < (int)N_params ; ii++) {
|
||||
if (paramSelected[ii])
|
||||
if (paramSelected[ii]) {
|
||||
formatter->writeColumnLabelSeparator(out_fp);
|
||||
formatter->writeColumnLabel(out_fp, paramDescriptions[ii]->parameterName, paramDescriptions[ii]->unitsName);
|
||||
}
|
||||
}
|
||||
|
||||
if ( fsetpos(in_fp, &dataPosition) != 0 ) {
|
||||
@ -276,120 +257,3 @@ void DataLog::formattedWrite(FILE* out_fp, LogFormatter* formatter) {
|
||||
}
|
||||
formatter->writeRecordSeparator(out_fp);
|
||||
}
|
||||
|
||||
static const char *usage_doc[] = {
|
||||
"----------------------------------------------------------------------------",
|
||||
" trkConvert - ",
|
||||
" ",
|
||||
" USAGE: trkConvert -help ",
|
||||
" trkConvert [-csv|-varlist] [-o <outfile>] <trk_file_name> ",
|
||||
" Options: ",
|
||||
" -help Print this message and exit. ",
|
||||
" -csv (the default) Generates a comma-separated value (CSV) file from ",
|
||||
" a Trick binary data file. CSV files are a common ",
|
||||
" means of sharing data between applications. ",
|
||||
" -varlist Generates a list of the names of the variables ",
|
||||
" the are recorded in the Trick binary data file. ",
|
||||
"----------------------------------------------------------------------------"};
|
||||
#define N_USAGE_LINES (sizeof(usage_doc)/sizeof(usage_doc[0]))
|
||||
|
||||
void print_doc(char *doc[], int nlines) {
|
||||
int i;
|
||||
for (i=0; i < nlines; i++) {
|
||||
std::cerr << doc[i] << '\n';
|
||||
}
|
||||
std::cerr.flush();
|
||||
}
|
||||
|
||||
void usage() {
|
||||
print_doc((char **)usage_doc,N_USAGE_LINES);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
std::string programName = argv[0];
|
||||
std::string trkFilePath;
|
||||
std::string trkBaseName;
|
||||
std::string outputName;
|
||||
FILE *fp;
|
||||
|
||||
CSV_Formatter csv_formatter;
|
||||
LogFormatter* logFormatter = &csv_formatter; // default formatter.
|
||||
Varlist_Formatter varlist_formatter;
|
||||
|
||||
if (argc <= 1 ) {
|
||||
std::cerr << programName << ": No arguments were supplied.\n";
|
||||
std::cerr.flush();
|
||||
usage();
|
||||
exit(1);
|
||||
} else {
|
||||
int i = 1;
|
||||
std::string arg;
|
||||
while ( i < argc ) {
|
||||
arg = argv[i];
|
||||
|
||||
if (arg.find("-") == 0) {
|
||||
if (arg == "-help" | arg == "--help" ) {
|
||||
usage();
|
||||
exit(0);
|
||||
} else if (arg == "-csv") {
|
||||
logFormatter = &csv_formatter;
|
||||
} else if (arg == "-varlist") {
|
||||
logFormatter = &varlist_formatter;
|
||||
} else if (arg == "-o") {
|
||||
i++;
|
||||
if (i<argc) {
|
||||
arg = argv[i];
|
||||
outputName = arg;
|
||||
} else {
|
||||
std::cerr << programName << ": -o option requires a filename." << std::endl;
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
std::cerr << programName << ": Invalid option \"" << arg << "\"." << std::endl;
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
} else if (arg.substr(arg.find_last_of(".")) == ".trk") {
|
||||
size_t pos;
|
||||
std::string trkFileName;
|
||||
trkFilePath = arg;
|
||||
if ((pos = trkFilePath.find_last_of("/")) != std::string::npos) {
|
||||
trkFileName = trkFilePath.substr(pos+1);
|
||||
} else {
|
||||
trkFileName = trkFilePath;
|
||||
}
|
||||
trkBaseName = trkFileName.substr(0, trkFileName.length()-4);
|
||||
} else {
|
||||
std::cerr << programName << ": Invalid argument \"" << arg << "\"." << std::endl;
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (trkFilePath.empty()) {
|
||||
std::cerr << programName << ": Missing .trk filename." << std::endl;
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (outputName.empty()) {
|
||||
|
||||
outputName = trkBaseName + logFormatter->extension();
|
||||
}
|
||||
|
||||
std::cout << programName << ": Input = \"" << trkFilePath << "\"." << std::endl;
|
||||
std::cout << programName << ": Output = \"" << outputName << "\"." << std::endl;
|
||||
|
||||
DataLog* datalog = new DataLog(trkFilePath);
|
||||
datalog->selectAllParameters();
|
||||
|
||||
if (( fp = fopen(outputName.c_str(), "w") ) != NULL) {
|
||||
datalog->formattedWrite(fp, logFormatter);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
49
trick_source/data_products/Apps/trkConvert/TRK_DataLog.hh
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef TRK_DATA_LOG_HH
|
||||
#define TRK_DATA_LOG_HH
|
||||
|
||||
#include <stdio.h> // FILE
|
||||
#include <stdint.h> // Requires C99
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "LogFormatter.hh"
|
||||
#include "ParamDescription.hh"
|
||||
|
||||
class TRK_DataLog {
|
||||
|
||||
public:
|
||||
static const int LittleEndian;
|
||||
static const int BigEndian;
|
||||
|
||||
std::vector<ParamDescription*> paramDescriptions;
|
||||
std::vector<int> paramOffsets;
|
||||
std::vector<bool> paramSelected;
|
||||
|
||||
// Constructors
|
||||
TRK_DataLog(){}
|
||||
TRK_DataLog(std::string fileName);
|
||||
|
||||
std::string getFileName() const;
|
||||
int parameterCount() const;
|
||||
const char* parameterName(unsigned int n) const;
|
||||
const char* parameterUnits(unsigned int n) const;
|
||||
const char* parameterType(unsigned int n) const;
|
||||
|
||||
void selectAllParameters();
|
||||
void selectParameter(unsigned int index);
|
||||
void selectParameter(const char * paramName);
|
||||
void deselectParameter(unsigned int index);
|
||||
void formattedWrite(FILE* out_fp, LogFormatter* formatter);
|
||||
|
||||
private:
|
||||
std::string fileName;
|
||||
FILE* in_fp;
|
||||
int version;
|
||||
int endianness;
|
||||
uint32_t N_params;
|
||||
fpos_t dataPosition;
|
||||
int dataRecordSize;
|
||||
char* dataRecord;
|
||||
};
|
||||
#endif
|
104
trick_source/data_products/Apps/trkConvert/VarTableWidget.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
#include <QTableWidgetItem>
|
||||
#include "VarTableWidget.h"
|
||||
|
||||
VarTableWidget::VarTableWidget (QWidget* parent)
|
||||
: QTableWidget(parent) {
|
||||
|
||||
setRowCount(0);
|
||||
setColumnCount(4);
|
||||
|
||||
QStringList strList;
|
||||
strList << "" << "Name" << "Type" << "Units";
|
||||
setHorizontalHeaderLabels( strList);
|
||||
|
||||
setColumnWidth(0,25);
|
||||
setColumnWidth(1,200);
|
||||
setColumnWidth(2,80);
|
||||
setColumnWidth(3,80);
|
||||
|
||||
setShowGrid(false);
|
||||
}
|
||||
|
||||
void VarTableWidget::addRecord( Qt::CheckState checkState,
|
||||
std::string nameStr,
|
||||
std::string typeStr,
|
||||
std::string unitsStr ) {
|
||||
|
||||
// Consider cloning prototype items, as in this example:
|
||||
// https://stackoverflow.com/questions/15827886/set-default-alignment-for-cells-in-qtablewidget
|
||||
|
||||
int row = rowCount();
|
||||
insertRow(row);
|
||||
|
||||
Qt::ItemFlags flags;
|
||||
|
||||
QTableWidgetItem * const selectItem = new QTableWidgetItem;
|
||||
flags = selectItem->flags();
|
||||
flags &= ~Qt::ItemIsSelectable & ~Qt::ItemIsEditable;
|
||||
if (row != 0) // FIXME: This doesn't seem to work as expected. Row 0 still seems to be user editable.
|
||||
flags |= Qt::ItemIsUserCheckable;
|
||||
selectItem->setFlags(flags);
|
||||
selectItem->setCheckState(checkState);
|
||||
setItem(row, 0, selectItem);
|
||||
|
||||
QTableWidgetItem * const nameItem = new QTableWidgetItem;
|
||||
flags = nameItem->flags();
|
||||
flags &= ~Qt::ItemIsSelectable & ~Qt::ItemIsEditable;
|
||||
nameItem->setFlags(flags);
|
||||
nameItem->setText(nameStr.c_str());
|
||||
setItem(row, 1, nameItem);
|
||||
|
||||
QTableWidgetItem * const typeItem = new QTableWidgetItem;
|
||||
flags = typeItem->flags();
|
||||
flags &= ~Qt::ItemIsSelectable & ~Qt::ItemIsEditable;
|
||||
typeItem->setFlags(flags);
|
||||
typeItem->setTextAlignment(Qt::AlignCenter);
|
||||
typeItem->setText(typeStr.c_str());
|
||||
setItem(row, 2, typeItem);
|
||||
|
||||
QTableWidgetItem * const unitsItem = new QTableWidgetItem;
|
||||
flags = unitsItem->flags();
|
||||
flags &= ~Qt::ItemIsSelectable & ~Qt::ItemIsEditable;
|
||||
unitsItem->setFlags(flags);
|
||||
unitsItem->setTextAlignment(Qt::AlignCenter);
|
||||
unitsItem->setText(unitsStr.c_str());
|
||||
setItem(row, 3, unitsItem);
|
||||
|
||||
}
|
||||
|
||||
void VarTableWidget::highLightRecord(int index) {
|
||||
QBrush brush(Qt::yellow);
|
||||
item(index, 1)->setBackground(brush);
|
||||
}
|
||||
|
||||
void VarTableWidget::unHighLightRecord(int index) {
|
||||
QBrush brush(Qt::white);
|
||||
item(index, 1)->setBackground(brush);
|
||||
}
|
||||
|
||||
void VarTableWidget::scrollToRecord(int index) {
|
||||
scrollToItem(item(index, 0));
|
||||
}
|
||||
|
||||
bool VarTableWidget::isChecked(int index) {
|
||||
return (item(index, 0)->checkState() == Qt::Checked) ? true : false;
|
||||
}
|
||||
|
||||
int VarTableWidget::recordCount() {
|
||||
return rowCount();
|
||||
}
|
||||
|
||||
void VarTableWidget::checkAll() {
|
||||
int num_rows = rowCount();
|
||||
for (int i=0; i<num_rows; i++) {
|
||||
item(i,0)->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
void VarTableWidget::unCheckAll() {
|
||||
int num_rows = rowCount();
|
||||
// Note that we don't clear sys.exec.out.time
|
||||
for (int i=1; i<num_rows; i++) {
|
||||
item(i,0)->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
}
|
25
trick_source/data_products/Apps/trkConvert/VarTableWidget.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef VARIABLE_TABLE_WIDGET_H
|
||||
#define VARIABLE_TABLE_WIDGET_H
|
||||
|
||||
#include <string>
|
||||
#include <QTableWidget> // widgets
|
||||
|
||||
class VarTableWidget : public QTableWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
VarTableWidget(QWidget* parent = 0);
|
||||
|
||||
void addRecord( Qt::CheckState checkState, std::string name, std::string type, std::string units );
|
||||
bool isChecked(int index);
|
||||
int recordCount();
|
||||
void scrollToRecord(int index);
|
||||
void highLightRecord(int index);
|
||||
void unHighLightRecord(int index);
|
||||
|
||||
public slots:
|
||||
void checkAll();
|
||||
void unCheckAll();
|
||||
};
|
||||
#endif
|
BIN
trick_source/data_products/Apps/trkConvert/images/DocWindow.png
Normal file
After Width: | Height: | Size: 157 KiB |