Commit 05b7dc9d authored by Claes Sjofors's avatar Claes Sjofors

Merge branch 'master' of claes@pwrcvs:/data1/git/pwr

parents c1e7610c 2178f665
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <map> #include <map>
#include <sys/socket.h> #include <sys/socket.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_arp.h> // #include <net/if_arp.h>
#include <pthread.h> #include <pthread.h>
#include <float.h> #include <float.h>
......
...@@ -278,7 +278,11 @@ pwr_tStatus time_AtoOPCAscii (pwr_tTime *tp, char *buf, int bufsize) ...@@ -278,7 +278,11 @@ pwr_tStatus time_AtoOPCAscii (pwr_tTime *tp, char *buf, int bufsize)
time_t sec = tp->tv_sec; time_t sec = tp->tv_sec;
tmpTm = localtime(&sec); tmpTm = localtime(&sec);
#if defined OS_CYGWIN
tzone = 0;
#else
tzone = tmpTm->tm_gmtoff / 3600; tzone = tmpTm->tm_gmtoff / 3600;
#endif
strftime(buf, bufsize, "%Y-%m-%dT%H:%M:%S", tmpTm); strftime(buf, bufsize, "%Y-%m-%dT%H:%M:%S", tmpTm);
sprintf(tmpStr, ".%07d%s%02d:00", (int)(tp->tv_nsec / 100), tzone >= 0 ? "+" : "", tzone); sprintf(tmpStr, ".%07d%s%02d:00", (int)(tp->tv_nsec / 100), tzone >= 0 ? "+" : "", tzone);
......
...@@ -110,15 +110,23 @@ int main( int argc, char *argv[]) ...@@ -110,15 +110,23 @@ int main( int argc, char *argv[])
#if defined OS_LINUX #if defined OS_LINUX
char os[] = "OS_LINUX"; char os[] = "OS_LINUX";
char dos[] = "-DOS_LINUX -DOS_POSIX"; char dos[] = "-DOS_LINUX -DOS_POSIX";
char cflags[] = "";
#elif defined OS_MACOS #elif defined OS_MACOS
char os[] = "OS_MACOS"; char os[] = "OS_MACOS";
char dos[] = "-DOS_MACOS -DOS_POSIX"; char dos[] = "-DOS_MACOS -DOS_POSIX";
char cflags[] = "";
#elif defined OS_FREEBSD #elif defined OS_FREEBSD
char os[] = "OS_FREEBSD"; char os[] = "OS_FREEBSD";
char dos[] = "-DOS_FREEBSD -DOS_POSIX"; char dos[] = "-DOS_FREEBSD -DOS_POSIX";
char cflags[] = "";
#elif defined OS_OPENBSD #elif defined OS_OPENBSD
char os[] = "OS_OPENBSD"; char os[] = "OS_OPENBSD";
char dos[] = "-DOS_OPENBSD -DOS_POSIX"; char dos[] = "-DOS_OPENBSD -DOS_POSIX";
char cflags[] = "";
#elif defined OS_CYGWIN
char os[] = "OS_CYGWIN";
char dos[] = "-DOS_CYGWIN -DOS_POSIX";
char cflags[] = "-I/usr/include/tirpc";
#endif #endif
if ( argc < 4) { if ( argc < 4) {
usage(); usage();
...@@ -280,10 +288,10 @@ int main( int argc, char *argv[]) ...@@ -280,10 +288,10 @@ int main( int argc, char *argv[])
dcli_translate_filename( incdir, "$pwr_einc"); dcli_translate_filename( incdir, "$pwr_einc");
switch ( mtype) { switch ( mtype) {
case merge_eMtype_WbBase: case merge_eMtype_WbBase:
snprintf( cmd, sizeof(cmd), "%s -c -I%s %s -o %s %s", pwre_cxx, incdir, dos, ofile, cfile); snprintf( cmd, sizeof(cmd), "%s -c %s -I%s %s -o %s %s", pwre_cxx, cflags, incdir, dos, ofile, cfile);
break; break;
default: default:
snprintf( cmd, sizeof(cmd), "%s -c -I%s %s -o %s %s", pwre_cc, incdir, dos, ofile, cfile); snprintf( cmd, sizeof(cmd), "%s -c %s -I%s %s -o %s %s", pwre_cc, cflags, incdir, dos, ofile, cfile);
} }
if ( arg_verbose) if ( arg_verbose)
printf( "co_merge: %s\n", cmd); printf( "co_merge: %s\n", cmd);
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <fstream> #include <fstream>
#include <sys/socket.h> #include <sys/socket.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_arp.h> // #include <net/if_arp.h>
#include <pthread.h> #include <pthread.h>
#include <unistd.h> #include <unistd.h>
......
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
#
#
function=$1
src_file=$2
systemname=$3
if [ $function == "java_web" ]; then
jarfile="$pwrp_web/pwrp_"$systemname"_web.jar"
if javac -d $pwrp_web -classpath $pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar:$pwr_lib/pwr_jopc.jar:$jarfile $pwrp_pop/$src_file
then
echo "-- $src_file compiled"
if [ ! -e $jarfile ]; then
cd $pwrp_web
jar -cf $jarfile ${src_file%.java}.class
rm ${src_file%.java}.class
else
cd $pwrp_web
jar -uf $jarfile ${src_file%.java}.class
rm ${src_file%.java}.class
fi
files=`ls $pwrp_web/${src_file%.java}\\$*.class 2>&-`
if [ ! -z "$files" ]; then
# echo "Insert in archive $jarfile"
jar -uf $jarfile ${src_file%.java}\$*.class
rm ${src_file%.java}\$*.class
fi
files=`ls $pwrp_pop/*.gif 2>&-`
if [ ! -z "$files" ]; then
cd $pwrp_pop
jar -uf $jarfile *.gif
fi
files=`ls $pwrp_pop/*.jpg 2>&-`
if [ ! -z "$files" ]; then
cd $pwrp_pop
jar -uf $jarfile *.jpg
fi
fi
fi
if [ $function == "java" ]; then
jarfile="$pwrp_lib/pwrp_"$systemname".jar"
jarfileweb="$pwrp_web/pwrp_"$systemname"_web.jar"
if javac -d $pwrp_web -classpath $pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar:$pwr_lib/pwr_jopc.jar:$jarfile $pwrp_pop/$src_file
then
echo "-- $src_file compiled"
if [ ! -e $jarfile ]; then
cd $pwrp_web
jar -cf $jarfile ${src_file%.java}.class
else
cd $pwrp_web
jar -uf $jarfile ${src_file%.java}.class
fi
if [ ! -e $jarfileweb ]; then
cd $pwrp_web
jar -cf $jarfileweb ${src_file%.java}.class
else
cd $pwrp_web
jar -uf $jarfileweb ${src_file%.java}.class
fi
rm ${src_file%.java}.class
files=`ls $pwrp_web/${src_file%.java}\\$*.class 2>&-`
if [ ! -z "$files" ]; then
# echo "Insert in archive $jarfile"
jar -uf $jarfile ${src_file%.java}\$*.class
jar -uf $jarfileweb ${src_file%.java}\$*.class
rm ${src_file%.java}\$*.class
fi
files=`ls $pwrp_pop/*.gif 2>&-`
if [ ! -z "$files" ]; then
cd $pwrp_pop
jar -uf $jarfile *.gif
jar -uf $jarfileweb *.gif
fi
files=`ls $pwrp_pop/*.jpg 2>&-`
if [ ! -z "$files" ]; then
cd $pwrp_pop
jar -uf $jarfile *.jpg
jar -uf $jarfileweb *.jpg
fi
fi
fi
if [ $function == "html" ]; then
cp $pwrp_pop/$src_file $pwrp_web/
fi
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
echo "Here in jop start"
#export LD_LIBRARY_PATH=$pwr_exe
#echo $LD_LIBRARY_PATH
#export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar
java jpwr.jop.JopSpider $1
#!/bin/bash
# Get systemname from bootfile
zero="0000"
nname=`eval uname -n`
nname=${nname%%.*}
bootfile=$pwrp_load/ld_boot_${nname}_${zero:0:4-${#PWR_BUS_ID}}${PWR_BUS_ID}.dat
if [ ! -e "$bootfile" ]; then
echo "Unable to find bootfile: $bootfile"
return;
fi
let i=0
while read line; do
if [ $i -eq 1 ]; then
systemname=$line
break;
fi
let i=$i+1
done < $bootfile
echo $systemname
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar:$pwr_lib/pwr_jopc.jar:$pwr_lib/pwr_bcomp.jar:$pwr_lib/pwr_bcompfc.jar:$pwr_lib/pwr_abb.jar:$pwrp_lib/pwrp_$systemname.jar
export LD_LIBRARY_PATH=$pwr_exe
$jdk/bin/java jpwr.jop.JopOp
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
#
# pwr_cleanup.sh
#
# NOTE! This file removes all IPC objects for the user.
# If you have other program which creates IPC objects,
# then do not use this script
#
# remove semaphores
eval `ipcs -s|grep ^0x|grep "[ \t]$USER[ \t]"|awk '{printf "ipcrm sem %s;", $2}'`
# remove message queues
eval `ipcs -q|grep ^0x|grep "[ \t]$USER[ \t]"|awk '{printf "ipcrm msg %s;", $2}'`
# remove shared memory
eval `ipcs -m|grep ^0x|grep "[ \t]$USER[ \t]"|awk '{printf "ipcrm shm %s;", $2}'`
rm /tmp/pwr*$PWR_BUS_ID
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
pkg_install_func ()
{
pkg_remove_func "force"
if [ $1 == ${1##*/} ]; then
# Add path
pkg="$HOME/$1"
else
pkg=$1
fi
if [ ! -e "$pkg" ]; then
echo "No package $pkg"
exit 1
fi
echo "-- Installing package $1"
cd /tmp
if ! tar -xzf $pkg pkg_unpack.sh; then
echo "Package $1 incomplete"
exit 1
fi
chmod a+x pkg_unpack.sh
./pkg_unpack.sh $pkg
}
pkg_list_func ()
{
if [ -z $1 ]; then
# List installed package
if [ ! -e $pwrp_load/pwr_pkg.dat ]; then
echo "-- No package installed"
exit 1
fi
datfile=$pwrp_load/pwr_pkg.dat
else
# Extract datfile from package
if [ $1 == ${1##*/} ]; then
# Add path
pkg="$HOME/$1"
else
pkg=$1
fi
if [ ! -e $pkg ]; then
echo "-- No such package"
exit 1
fi
echo "-- Opening file $pkg"
cd /tmp
if ! tar -xzf $pkg pwr_pkg.dat; then
echo "Package $1 incomplete"
exit 1
fi
datfile=/tmp/pwr_pkg.dat
fi
{
let printout=0
while read line; do
if [ "$line" = "%Description:" ]; then
printout=1
else
if [ "$line" = "%Files:" ]; then
break
fi
if [ $printout -eq 1 ]; then
echo $line
fi
fi
done
} < $datfile
}
pkg_listfiles_func ()
{
if [ -z $1 ]; then
# List installed package
if [ ! -e $pwrp_load/pwr_pkg.dat ]; then
echo "-- No package installed"
exit 1
fi
datfile=$pwrp_load/pwr_pkg.dat
else
# Extract datfile from package
if [ $1 == ${1##*/} ]; then
# Add path
pkg="$HOME/$1"
else
pkg=$1
fi
if [ ! -e $pkg ]; then
echo "-- No such package"
exit 1
fi
echo "-- Opening file $pkg"
cd /tmp
if ! tar -xzf $pkg pwr_pkg.dat; then
echo "Package $1 incomplete"
exit 1
fi
datfile=/tmp/pwr_pkg.dat
fi
{
let printout=0
while read line date time; do
if [ "$line" = "%Files:" ]; then
printout=1
else
if [ "$line" = "%End:" ]; then
break
fi
if [ $printout -eq 1 ]; then
echo $date $time $line
fi
fi
done
} < $datfile
}
pkg_brief_func ()
{
if [ -z $1 ]; then
# List installed package
if [ ! -e $pwrp_load/pwr_pkg.dat ]; then
echo "-- No package installed"
exit 1
fi
datfile=$pwrp_load/pwr_pkg.dat
{
let printout=0
while read line; do
if [ "$line" = "%Brief:" ]; then
printout=1
else
if [ "$line" = "%Description:" ]; then
break
fi
if [ $printout -eq 1 ]; then
echo $line
fi
fi
done
} < $datfile
else
# Extract datfile from package
for file
do
if [ $file == ${file##*/} ]; then
# Add path
pkg="$HOME/$file"
else
pkg=$file
fi
if [ ! -e $pkg ]; then
echo "-- No such package"
exit 1
fi
dir=`eval pwd`
cd /tmp
if ! tar -xzf $pkg pwr_pkg.dat; then
echo "Package $pkg incomplete"
else
datfile=/tmp/pwr_pkg.dat
{
let printout=0
while read line; do
if [ "$line" = "%Brief:" ]; then
printout=1
else
if [ "$line" = "%Description:" ]; then
break
fi
if [ $printout -eq 1 ]; then
fname=`eval basename $pkg`
echo $fname ${line#Proview package}
fi
fi
done
} < $datfile
rm $datfile
fi
cd $dir
done
fi
}
pkg_dir_func()
{
if [ -z $1 ]; then
allpkg=`ls $HOME/pwrp_pkg_*.tgz`
else
if [ $1 == ${1##*/} ]; then
# Add path
pattern="$HOME/*$1*"
elif [ ${1:0:1} == "/" ]; then
pattern=$1*
else
pattern=*$1*
fi
allpkg=`ls $pattern`
fi
for pkg in $allpkg ; do
if [ -z ${pkg##*pwrp_pkg_*.tgz} ]; then
pkg_brief_func $pkg
fi
done
}
pkg_dirbrief_func()
{
if [ -z "$1" ]; then
allpkg=`ls $HOME/pwrp_pkg_*.tgz`
else
if [ "$1" == "${1##*/}" ]; then
# Add path
pattern="$HOME/*$1*"
elif [ ${1:0:1} == "/" ]; then
pattern=$1*
else
pattern=*$1*
fi
allpkg=`ls $pattern`
fi
for pkg in $allpkg ; do
if [ -z ${pkg##*pwrp_pkg_*.tgz} ]; then
fname=`eval basename $pkg`
ftime=`eval stat $pkg --print=%z | cut -b -19`
# echo $fname $ftime
echo $fname
fi
done
}
pkg_remove_func ()
{
if [ ! -e $pwrp_load/pwr_pkg.dat ]; then
echo "-- No package installed"
return
fi
# Get the name of the current package
{
let found=0
while read line; do
if [ "$line" = "%Package:" ]; then
found=1
else
if [ $found -eq 1 ]; then
pkg=$line
break
fi
fi
done
} < $pwrp_load/pwr_pkg.dat
if [ ! "$1" = "force" ]; then
echo ""
echo -n "Do you wan't to remove package $pkg (y/n) [n] "
read remove_pkg
if [ ! "$remove_pkg" = "y" ]; then
return
fi
fi
echo "-- Removing package $pkg"
{
let removefile=0
while read line date time; do
if [ "$line" = "%Files:" ]; then
removefile=1
else
if [ "$line" = "%End:" ]; then
break
fi
if [ $removefile -eq 1 ]; then
file=`eval echo $line`
#echo "rm $file"
rm $file
fi
fi
done
} < $pwrp_load/pwr_pkg.dat
rm $pwrp_load/pwr_pkg.dat
}
force="no"
while [ -n "$(echo $1 | grep '-')" ]; do
OPTARG=$2
case $1 in
-i ) pkg_install_func $OPTARG ;;
-la ) pkg_list_func $OPTARG ;;
-lf ) pkg_listfiles_func $OPTARG;;
-lp ) shift
pkg_brief_func $@ ;;
-r ) pkg_remove_func ;;
-rf ) force="force"
pkg_remove_func $force ;;
-ld ) pkg_dir_func $OPTARG ;;
-l ) pkg_dirbrief_func "$OPTARG";;
* ) cat <<EOF
usage: pwr_pkg [-i pkg] [-l [pkg]] [-b [pkg]] [-r]
pwr_pkg -i 'pkg' Install package 'pkg'
pwr_pkg -r Remove currently installed package
pwr_pkg -lp ['pkg'] List installed package, or package 'pkg'
pwr_pkg -la ['pkg'] List installed package, or package 'pkg', all info
pwr_pkg -lf ['pkg'] List files in installed package, or package 'pkg'
pwr_pkg -l List all packages
EOF
exit 1
esac
shift
done
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
kill -9 `ps ax | grep "rt_neth_acp" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_neth" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_qmon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_emon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_tmon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_\|/pwr/exe/rs" | awk '{ print $1}'`
kill -9 `ps ax | grep "\[rt_" | awk '{ print $1}'`
kill -9 `ps ax | grep "plc_" | awk '{ print $1}'`
kill -9 `ps ax | grep "jpwr.rt" | awk '{ print $1}'`
kill -9 `ps ax | grep "rs_nmps" | awk '{ print $1}'`
kill -9 `ps ax | grep "rs_remote" | awk '{ print $1}'`
kill -9 `ps ax | grep "sev_server" | awk '{ print $1}'`
kill -9 `ps ax | grep "opc_server" | awk '{ print $1}'`
if [ -u $pwr_exe/rt_ini ]; then
user=`ls -al $pwr_exe/rt_ini | awk '{ print $3}'`
else
user=$USER
fi
echo "User $user"
eval `ipcs -s|grep ^0x|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm sem %s;", $2
}'`
# remove message queues
eval `ipcs -q|grep ^0x|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm msg %s;", $2
}'`
# remove shared memory
eval `ipcs -m|grep ^0x|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm shm %s;", $2
}'`
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
source $pwrp_exe/pwrp_stop.sh
fi
rm /tmp/pwr*$PWR_BUS_ID
#rm -f /tmp/pwr*
#id=`ipcs -s | grep $user | awk '{print $2}'`
#id1=`echo $id | awk '{print $1}'`
#id2=`echo $id | awk '{print $2}'`
#id3=`echo $id | awk '{print $3}'`
#ipcrm sem $id1
#ipcrm sem $id2
#ipcrm sem $id3
#id=`ipcs -q | grep $user | awk '{print $2}'`
#id1=`echo $id | awk '{print $1}'`
#id2=`echo $id | awk '{print $2}'`
#id3=`echo $id | awk '{print $3}'`
#ipcrm msg $id1
#ipcrm msg $id2
#ipcrm msg $id3
This diff is collapsed.
This diff is collapsed.
!** Invisible: Script used by reload.sh to save classvolume versions
!
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
!
!
main()
string v;
string class;
string attr;
int version;
int sts;
int file;
string fname;
string cmd;
int file_open;
printf("\n");
printf("-- ssab_exe:ssab_reload_vol_versions\n");
printf("-- Script to store current classvolume versions\n\n");
fname = "$pwrp_db/reload_vol_versions_" + p1 + ".pwr_com";
fname = translate_filename( fname);
file_open = 0;
v = GetVolumeList();
while( v != "")
class = GetVolumeClass( v);
if ( class == "$ClassVolume" && v != "pwrs" && v != "pwrb" && v != "mps" && v != "NMps" && v != "TLog" && v != "SSAB" && v != "SA")
if ( !file_open)
file = fopen( fname, "w");
if ( !file)
printf("Unable to open file %s\n", fname);
exit(0);
endif
fprintf( file, "printf(\"\\n\");\n");
fprintf( file, "printf(\"-- %s\\n\");\n", fname);
fprintf( file, "printf(\"-- Script to restore current classvolume versions\\n\\n\");\n");
file_open = 1;
endif
attr = v + ":.RtVersion";
version = GetAttribute( attr, sts);
printf( "-- Store version %d of volume '%s'\n", version, v);
fprintf(file, "printf( \"-- Restore version number %d in volume '%s'\\n\");\n", version, v);
fprintf(file, "set volume/volume=%s\n", v);
fprintf(file, "set attr/name=%s:/attr=RtVersion/value=%d/noconf\n", v, version);
fprintf(file, "save\n");
endif
v = GetNextVolume(v);
endwhile
if ( file_open)
fclose(file);
endif
endmain
!** Invisible: Load a backup dumpfile into development data base.
!
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
!
function int usage()
printf( "Script to load backup dumpfile into development database.\n\n");
printf( "pwrc -v 'volumename' @pwr_exe:restore_bck 'nodename' 'dumpfile'\n\n");
printf( "Create a dumpfile on an process station with rt_bck -p\n\n");
endfunction
main()
int dump_file;
int alias_file;
string str;
string dbname;
string volname;
int i;
int j;
int first;
int len;
string start;
string objname;
string attrname;
string db_attrname;
string value;
string answer;
int loaddb;
int export_alias;
string alias_filename;
printf("\n");
if (p1 == "" || p2 == "")
usage();
exit(0);
endif
dump_file = fopen(p2, "r");
if (!dump_file)
printf( "Unable to open dumpfile %s\n", p2);
exit();
endif
loaddb = 0;
ask("Do you want to load values from the dumpfile into the database? (Y/N) ", answer);
if (answer == "y" || answer == "Y")
loaddb = 1;
endif
export_alias = 0;
ask("Do you wan to create an alias-file with values from the dumpfile? (Y/N) ", answer);
if (answer == "y" || answer == "Y")
ask("Alias-file name: ", answer);
alias_file = fopen(answer, "w");
if (!alias_file)
printf( "Unable to open output alias file %s\n", answer);
exit();
endif
export_alias = 1;
alias_filename = answer;
endif
while (fgets(str, dump_file))
start = extract(1, 2, str);
i = strstr(start, "/");
if (!i)
i = strstr(str, ".");
j = strstr(str, " ");
first = 1;
len = i-1;
objname = extract(first, len, str);
first = i+1;
len = j-i-1;
attrname = extract(first, len, str);
first = j+1;
len = strlen(str) - j;
value = extract(first, len, str);
db_attrname = attrname;
if (attrname == "ActualValue")
db_attrname = "InitialValue";
endif
if (loaddb)
set attr/attr='db_attrname'/value="'value'"/name='objname'/noconf/log
endif
if (export_alias)
fprintf(alias_file, "%s_setvalp %s.%s = \"%s\"\n", p1, objname, attrname, value);
endif
endif
endwhile
if (dump_file)
fclose(dump_file);
endif
if (alias_file)
printf("Alias-file created, %s\n", alias_filename);
fclose(alias_file);
endif
if (loaddb)
ask("Do you wan to save the database changes? (Y/N) ", answer);
if (answer == "y" || answer == "Y")
printf("Saving changes...\n");
save
else
printf("Not saving any changes\n");
endif
endif
endmain
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
#
FileName="$1"
Color="$2"
Printer="$pwr_rt_print"
ColorPrinter="$pwr_rt_colorprint"
if [ "$Color" == "1" ]; then
if [ -z "$pwr_rt_colorprint" ]; then
Printer=$pwr_rt_print
else
Printer=$pwr_rt_colorprint
fi
else
if [ -z "$pwr_rt_print" ]; then
Printer=$pwr_rt_colorprint
else
Printer=$pwr_rt_print
fi
fi
if [ -z "$Printer" ]; then
echo "Printer is not defined in env 'pwr_rt_print'"
else
echo "Printing $1"
$Printer $1
fi
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
#
export LD_LIBRARY_PATH=$pwr_exe
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar
#$jdk_home/java jpwr.rt.GdhServer
$jdk_home/java -Djava.library.path=$jdk/lib/i386/client:$jdk/lib/i386:$jdk/../lib/i386:$pwr_exe jpwr.rt.GdhServer
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
#
export LD_LIBRARY_PATH=$pwr_exe
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar
#$jdk_home/java jpwr.rt.HistServer
$jdk_home/java -Djava.library.path=$jdk/lib/i386/client:$jdk/lib/i386:$jdk/../lib/i386:$pwr_exe jpwr.rt.HistServer
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
#
export LD_LIBRARY_PATH=$pwr_exe
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar
$jdk_home/java -Djava.library.path=$jdk/lib/i386/client:$jdk/lib/i386:$jdk/../lib/i386:$pwr_exe jpwr.rt.MhServer
!** Invisible: Include file for io configuration script
!
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
!
!
! Create a signal.
! If the card of the signal does not exist, the card with channels, and signals
! positioned in the reservhierarchy, will be created, and signals and channels
! will be connected.
! If the card already exist the signal will be move from the reservhierarchy
! to the given destination
!
function int ssab_create_signal( string rname, string resname, string chname, string signame, string chan_descr, string chan_ident, string sig_descr)
string cname;
string cardclass;
string type;
int channels;
int i;
int j;
string newname;
string oldname;
string rnam;
string chnam;
string cnam;
string hnam;
string snam;
string chnr_str;
string tnam;
int sts;
! Check if card exist
cname = extract( 1, 4, chname);
chname = toupper( chname);
type = extract( 1, 2, chname);
chnr_str = extract( 5, 2, chname);
cnam=rname + "-" + cname;
if ( type == "DI")
cardclass = "Ssab_DI32D";
channels = 32;
endif
if ( type == "DO")
cardclass = "Ssab_DO32DKS";
channels = 32;
endif
if ( type == "AI")
cardclass = "Ssab_AI32uP";
channels = 32;
endif
if ( type == "AO")
cardclass = "Ssab_AO8uP";
channels = 8;
endif
if ( type == "CO")
cardclass = "Ssab_Co4uP";
channels = 4;
endif
if (!ObjectExist(cnam))
! Create the rack and reservhierarchy if not created
ssab_create_object( rname, "Rack_SSAB");
ssab_create_object( resname, "$PlantHier");
! The card didn't exist, create it
! Create the card
create object/dest="'rname'"/class='cardclass'/name="'cname'"
! Create signalobjects in reserv hierarchy
for ( i = 1; i < channels + 1; i++)
sprintf( rnam, "Reserv_%s%02.2d", cname, i);
sprintf( hnam, "%s-%s", resname, rnam);
if (!ObjectExist(hnam))
create object/dest='resname'/class='type'/name="'rnam'"
sprintf( chnam, "Ch%02.2d", i);
! Connect to channel
set attr/noco/name='hnam'/attr=SigChanCon/value='rname'-'cname'.'chnam'
endif
endfor
endif
! Set description in signal
sprintf( rnam, "Reserv_%s%s", cname, chnr_str);
set attr/noco/name='resname'-'rnam'/attr=Description/value="'sig_descr'"
! Move signal to the final destination
i = strrchr( signame, "-");
if ( i)
i++;
j = i - 2;
hnam = extract( 1, j, signame);
snam = extract( i, 80, signame);
endif
ssab_create_object( hnam, "$PlantHier");
move obj/source='resname'-'rnam'/dest='hnam'/rename="'snam'"
endfunction
!
! Create an object and it's ancestors if they doesn't exist
!
function int ssab_create_object( string name, string class)
int i;
int j;
string parent;
string object;
int sts;
i = strrchr( name, "-");
if ( i)
i++;
j = i - 2;
parent = extract( 1, j, name);
object = extract( i, 80, name);
else
object = name;
parent = "";
endif
if ( !ObjectExist( name))
if ( parent != "")
ssab_create_object( parent, class);
endif
create object/dest="'parent'"/class='class'/name="'object'"
endif
endfunction
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/bin/bash
#
# Proview Open Source Process Control.
# Copyright (C) 2005-2011 SSAB Oxelosund AB.
#
# This file is part of Proview.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/>
#
# Linking Proview statically or dynamically with other modules is
# making a combined work based on Proview. Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
#
# In addition, as a special exception, the copyright holders of
# Proview give you permission to, from the build function in the
# Proview Configurator, combine Proview with modules generated by the
# Proview PLC Editor to a PLC program, regardless of the license
# terms of these modules. You may copy and distribute the resulting
# combined work under the terms of your choice, provided that every
# copy of the combined work is accompanied by a complete copy of
# the source code of Proview (the version used to produce the
# combined work), being distributed under the terms of the GNU
# General Public License plus this exception.
#
#
# Compile a rtt picture
#
# set -o xtrace
name=$1
pgmname=$2
is_rttsys=$3
opsys=$4
# echo $name $pgmname $is_rttsys $opsys
if [ $opsys == "4096" ]; then
# echo "Opsys is cygwin"
if [ $is_rttsys = "0" ]
then
ar_name_pict=${pwrp_lib}/ra_rtt_${pgmname}_pict.a
cc=gcc
cinc="-I$pwr_inc -I$pwrp_rttbld"
cflags="-DOS_CYGWIN -DOS_POSIX -DOS=cygwin -DHW_X86=1 -DPOSIX_SOURCE -DWall -I/usr/include/tirpc"
${cc} -c -o $pwrp_obj/${name}.o $pwrp_rttbld/${name}.c ${cinc} ${cflags}
ar rc ${ar_name_pict} $pwrp_obj/${name}.o
else
# echo "Is rttsys"
ar_name_pict=${pwr_lib}/libpwr_dtt.a
bld_dir=$pwre_broot/$pwre_os/$pwre_hw/bld/lib/dtt
# echo $ar_name $ar_name_pict
cc=gcc
cinc="-I$pwr_inc -I${bld_dir}"
cflags="-DOS_CYGWIN -DOS_POSIX -DOS=cygwin -DHW_X86=1 -DPOSIX_SOURCE -DWall -I/usr/include/tirpc"
${cc} -c -o ${bld_dir}/${name}.o \
${bld_dir}/${name}.c ${cinc} ${cflags}
ar rc ${ar_name_pict} ${bld_dir}/${name}.o
fi
else
echo "Opsys is not cygwin, not yet supported"
# if [ $is_rttsys = "0" ]
# then
# echo "Not rttsys"
# else
# echo "Is rttsys"
# fi
fi
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment