Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions share/trick/sim_objects/default_trick_sys.sm
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ class VariableServerSimObject : public Trick::SimObject {
// Call variable server initialization for normal sims,
// monte carlo slave sim children, and the monte carlo master.
// monte carlo slave parents do not reach initialization.
{TRK} P0 ("initialization") trick_ret = vs.init() ;
// Note: schedule this after MonteCarlo::execute_monte (which is P1)
// so Monte Carlo slave parents do not reach initialization.
{TRK} P2 ("initialization") trick_ret = vs.init() ;

#ifndef TRICK_NO_MONTE_CARLO
{TRK} ("monte_master_init") trick_ret = vs.init() ;
Expand Down Expand Up @@ -514,7 +516,10 @@ class JSONVariableServerSimObject : public Trick::SimObject {
JSONVariableServerSimObject() {

{TRK} ("default_data") vs.init_listen_device() ;
{TRK} P0 ("initialization") trick_ret = vs.init() ;
// Schedule JSON VS initialization after MonteCarlo::execute_monte (P1)
// to be consistent with VariableServerSimObject so that Monte Carlo
// slave parents do not reach initialization if Monte Carlo is enabled.
{TRK} P2 ("initialization") trick_ret = vs.init() ;
{TRK} ("restart") vs.restart();
{TRK} ("shutdown") vs.cancel_thread() ;

Expand Down
2 changes: 1 addition & 1 deletion trick_source/trick_utils/comm/test_programs/dr_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

#include "../include/tc_proto.h"
#include "trick/tc_proto.h"

#define MAX_FILES 128
typedef struct {
Expand Down
28 changes: 10 additions & 18 deletions trick_source/trick_utils/comm/test_programs/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
# Date: 6/19/00
#####################################################################

-include ${TRICK_HOME}/makefiles/Makefile.common
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib

ifndef TRICK_HOST_CPU
TRICK_HOST_CPU := $(shell trick-gte TRICK_HOST_CPU)
Expand All @@ -21,7 +22,8 @@ endif


CC = cc
FLAGS =
# Default include paths for test builds (can be overridden by environment)
FLAGS ?= -I${TRICK_HOME}/trick_source -I${TRICK_HOME}/include
ifeq ($(TRICK_HOST_TYPE), Darwin)
LIBS =
else
Expand All @@ -36,10 +38,8 @@ endif
## UTILITY DEFINITIONS ##
#####################################################################

LIB_DIR = ../object_$(shell uname -s)
COMM_LIB = ${LIB_DIR}/libtrick_comm.a
STUBS_LIB = ${LIB_DIR}/libtrick_stubs.a
LIBTC_LIB = $(COMM_LIB) $(STUBS_LIB) -lpthread ${LIBS}
COMM_LIB = ${TRICK_LIB_DIR}/libtrick_comm.a
LIBTC_LIB = $(COMM_LIB) -lpthread ${LIBS}


#####################################################################
Expand All @@ -62,9 +62,9 @@ TEST_PRGMS = \
default:
@ if [ "${TRICK_HOME}" != "" ] ; then \
if [ "`uname -s`" = "SunOS" ] ; then \
make -e test "FLAGS=-I${TRICK_HOME}/trick_source -I../include" "LIBS=-lsocket -lnsl" ; \
make -e test "FLAGS=$(FLAGS)" "LIBS=-lsocket -lnsl" ; \
else \
make -e test "FLAGS=-I${TRICK_HOME}/trick_source -I../include" "LIBS=${LIBS}" ; \
make -e test "FLAGS=$(FLAGS)" "LIBS=${LIBS}" ; \
fi \
else \
if [ "`uname -s`" = "SunOS" ] ; then \
Expand Down Expand Up @@ -105,19 +105,11 @@ $(OBJ_DIR)/dr_client: dr_client.c
$(CC) $(FLAGS) -o $@ ${@F}.c $(LIBTC_LIB)

$(COMM_LIB):
@ cd .. ; make STAND_ALONE=1 trick_comm

$(STUBS_LIB):
@ cd .. ; make STAND_ALONE=1 trick_stubs_lib

@echo "Building parent comm library: invoking parent 'trick' target..."
@cd .. && $(MAKE) trick

$(OBJ_DIR)/dr_client: $(COMM_LIB)
$(OBJ_DIR)/dr_client: $(STUBS_LIB)
$(OBJ_DIR)/tc_server: $(COMM_LIB)
$(OBJ_DIR)/tc_server: $(STUBS_LIB)
$(OBJ_DIR)/tc_client: $(COMM_LIB)
$(OBJ_DIR)/tc_client: $(STUBS_LIB)
$(OBJ_DIR)/tc_multi_serv_example: $(COMM_LIB)
$(OBJ_DIR)/tc_multi_client_example: $(COMM_LIB)
$(OBJ_DIR)/tc_multi_serv_example: $(STUBS_LIB)
$(OBJ_DIR)/tc_multi_client_example: $(STUBS_LIB)
3 changes: 1 addition & 2 deletions trick_source/trick_utils/comm/test_programs/tc_client.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

#include "../include/tc_proto.h"
#include "trick/tc_proto.h"

int main( int narg, char** args ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* This program uses trickcomm "tc" routines to create a client that
* connects to a server and writes and reads 10 messages.
*/
#include "trick/tc_proto.h"

#include "../include/tc_proto.h"
#include <string.h>
#include <signal.h>
#include <unistd.h>

void sigint_hndlr( int sig );
void stupid( int sig );
Expand Down
39 changes: 28 additions & 11 deletions trick_source/trick_utils/comm/test_programs/tc_multi_serv_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
* connects to a server and writes and reads 10 messages.
*/

#include "trick/bitfield_proto.h"
#include "trick/tc_proto.h"

#include "../include/attributes.h"
#include "../include/tc_proto.h"
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include <unistd.h>


void sigint_hndlr( int sig );
Expand Down Expand Up @@ -45,63 +47,78 @@ typedef struct {
ATTRIBUTES attrBUFFER[] = {
{ "i1", "int", "--", "",
"Not Specified",
"",
3,5,sizeof(int),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "s1", "short", "--", "",
"Not Specified",
"",
3,3,sizeof(short),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "s2", "short", "--", "",
"Not Specified",
"",
3,3,sizeof(short),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "c1", "char", "--", "",
"Not Specified",
"",
3,0,sizeof(char),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "c2", "char", "--", "",
"Not Specified",
"",
3,0,sizeof(char),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "c3", "char", "--", "",
"Not Specified",
"",
3,0,sizeof(char),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "c4", "char", "--", "",
"Not Specified",
"",
3,0,sizeof(char),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "f1", "float", "--", "",
"Not Specified",
"",
3,9,sizeof(float),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "b1", "int", "--", "",
"Not Specified",
3,11,0,0,0,Language_C,0,
"",
3,11,0,0,0,Language_C,0,
0,(char*)0, 0,{{5,27}} } ,
{ "b2", "int", "--", "",
"Not Specified",
3,11,0,0,0,Language_C,0,
"",
3,11,0,0,0,Language_C,0,
0,(char*)0, 0,{{4,23}} } ,
{ "b3", "int", "--", "",
"Not Specified",
3,11,0,0,0,Language_C,0,
"",
3,11,0,0,0,Language_C,0,
0,(char*)0, 0,{{7,16}} } ,
{ "b4", "int", "--", "",
"Not Specified",
3,11,0,0,0,Language_C,0,
"",
3,11,0,0,0,Language_C,0,
0,(char*)0, 0,{{13,3}} } ,
{ "b5", "int", "--", "",
"Not Specified",
3,11,0,0,0,Language_C,0,
"",
3,11,0,0,0,Language_C,0,
0,(char*)0, 0,{{3,0}} } ,
{ "i2", "int", "--", "",
"Not Specified",
3,5,sizeof(int),0,0,Language_C,0,
"",
3,5,sizeof(int),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "d1", "double", "--", "",
"Not Specified",
3,10,sizeof(double),0,0,Language_C,0,
"",
3,10,sizeof(double),0,0,Language_C,0,
0,(char*)0, 0 } ,
{ "" }
} ;
Expand Down Expand Up @@ -140,7 +157,7 @@ void *continuous_connect(void *in) {
TCDevice* temp_device ;
int status ;

fprintf(stderr,"Starting continuous_connect %d\n", pthread_self());
fprintf(stderr,"Starting continuous_connect %lu\n", (unsigned long)pthread_self());
/* continuously look for and connect to new clients */
while (1) {
temp_device = malloc(sizeof(TCDevice));
Expand Down
2 changes: 1 addition & 1 deletion trick_source/trick_utils/comm/test_programs/tc_server.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "trick/tc_proto.h"

#include "../include/tc_proto.h"
#ifndef __WIN32__
#include <sys/time.h>
#endif
Expand Down
Loading