How to make two lines appear on the same height in RRDtool? - rrdtool

I'm using RRDtool to greate graphs.
Now, this command:
rrdtool graph temp.png \
-w 600 -h 200 \
--zoom 1 \
--title "last 24 hours temperature" \
--vertical-label "temperature (°C)" \
--alt-autoscale \
--alt-y-grid \
--start end-1d \
--force-rules-legend \
--legend-position=south \
--rigid \
--slope-mode \
--font "DEFAULT:12:century schoolbook l" --watermark "$(date '+%F %T %Z')" \
DEF:temperature=temp.rrd:temp:AVERAGE \
GPRINT:temperature:LAST:"Current temp.\: %.2lf°C\r" \
LINE1:temperature\#007070:"Mainboard\l"
Gives me this image:
As you can see, the legend and the text "Current temp.: 42.00°C", do not appear on the same height (baseline).
How can I make those kind of lines appear next to each other, one left floated, the other right floated?

You could try ...
rrdtool graph temp.png \
-w 600 -h 200 \
--zoom 1 \
--title "last 24 hours temperature" \
--vertical-label "temperature (°C)" \
--alt-autoscale \
--alt-y-grid \
--start end-1d \
--force-rules-legend \
--legend-position=south \
--rigid \
--slope-mode \
--font "DEFAULT:12:century schoolbook l" --watermark "$(date '+%F %T %Z')" \
DEF:temperature=temp.rrd:temp:AVERAGE \
LINE1:temperature\#007070:"Mainboard" \
GPRINT:temperature:LAST:"Current temp.\: %.2lf°C\j"
note that I flipped the last two lines around and added \j

Related

how to parse out string in to variables

I want to be able read each line of a file that contains lines that look like: redhat-ubi-ubi7-7.8 where vendor=redhat, product=ubi, image_name=ubi7, tag=7.8 so that I can have these parsed in order to do something like:
while read -r line;
do
vendor=sed/awk
product=sed/awk
image_name=sed/awk
version=sed/awk
echo "Copying $image_name:$version into registry..."
skopeo copy \
docker-archive:/opt/app-root/src/ironbank-images/"$line" \
docker://"$REGISTRY_DOMAIN"/"$vendor"/"$product"/"$image_name":"$version" \
--dest-creds="$REGISTRY_USERNAME":"$REGISTRY_PASSWORD" \
--dest-tls-verify=false
done < "$SYNC_IMAGES"
How can I separate this string out in order to get the desired result for my usecase?
A combination of read's multi-variable feature and bash's IFS would do the trick:
while IFS=- read -r vendor product image_name version;
do
echo "Copying $image_name:$version into registry..."
skopeo copy \
docker-archive:/opt/app-root/src/ironbank-images/"${vendor}-${product}-${image_name}-${version}" \
docker://"$REGISTRY_DOMAIN"/"$vendor"/"$product"/"$image_name":"$version" \
--dest-creds="$REGISTRY_USERNAME":"$REGISTRY_PASSWORD" \
--dest-tls-verify=false
done < "$SYNC_IMAGES"
Just use awk with - as the field separator.
awk -F- -v domain="$REGISTRY_DOMAIN" -v user="$REGISTRY_USER" -v pw="$REGISTRY_PASSWORD" '
{ vendor = $1; product = $2; image_name = $3; version = $4;
printf("echo \"Copying %s:%s into registry\"\n", image_name, version);
printf("skopeo copy docker-archive:/opt/app-root/src/ironbank-images/\"%s\" docker://\"%s\"/\"%s\"/\"%s\"/\"%s\":\"$version\" --dest-creds=\"%s\":\"%s\" --dest-tls-verify=false\n",
domain, vendor, product, image_name, version, user, pw)
}' < "$SYNC_IMAGES" | bash
Just in case you want to use P.E. parameter expansion.
while read -r string; do
vendor=${string%%-*} version=${string##*-} image_name=${string%-*}
product=${image_name#*-} product=${product%-*} image_name=${image_name##*-}
echo "Copying $image_name:$version into registry..."
echo skopeo copy \
docker-archive:/opt/app-root/src/ironbank-images/"${vendor}-${product}-${image_name}-${version}" \
docker://"${REGISTRY_DOMAIN}"/"$vendor"/"$product"/"$image_name":"$version" \
--dest-creds="${REGISTRY_USERNAME}":"${REGISTRY_PASSWORD}" \
--dest-tls-verify=false
done < "$SYNC_IMAGES"

Repeat generation of macro

I would like to generate the following preprocessor pragmas
#pragma blabla column("0030")
#pragma blabla column("0130")
#pragma blabla column("0230")
...
#pragma blabla column("2330")
the hour changing from 0 to 23
Is that possible with BOOST_PP_LOCAL_LIMITS/ITERATE?
Yeah.
#include <boost/preprocessor/repeat.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/comparison/greater.hpp>
#define blabla(z, n, data) \
_Pragma(BOOST_PP_STRINGIZE( \
blabla column( \
BOOST_PP_STRINGIZE( \
BOOST_PP_CAT( \
BOOST_PP_CAT( \
BOOST_PP_IF( \
BOOST_PP_GREATER(n, 9), \
, \
0 \
), \
n \
), \
30 \
) \
) \
) \
))
BOOST_PP_REPEAT(24, blabla, ~)
_Pragma saved us there because there is no way to generate preprocessor directives such as #pragma, however it is very picky about what it accepts. In particular, it doesn't do string concatenation, so _Pragma("some" "thing") does not work, we have to concatenate everything in token-land then stringize as the last step.

AWK: How to exactly match and print multiple words between two keywords in the same line

Consider a text file named "nett" with the following content:
admin#(none):/tmp/home/root# cat nett
BSSID: 00:22:07:29:D4:23 RSSI: -71 dBm Band: 2.4GHz Channel: 1 802.11: b/g/n SSID: Inteno_24 noise: -70
BSSID: 00:19:77:12:97:94 RSSI: -54 dBm Band: 2.4GHz Channel: 1 802.11: b/g/n SSID: AK-Gjester noise: -70
BSSID: 00:19:77:12:97:95 RSSI: -55 dBm Band: 2.4GHz Channel: 1 802.11: b/g/n SSID: AK-Ansatt noise: -70
BSSID: 02:26:16:B2:37:AD RSSI: -73 dBm Band: 2.4GHz Channel: 6 802.11: b/g SSID: Trimble Service (5132555899) noise: -87
BSSID: FA:8F:CA:88:F9:8E RSSI: -45 dBm Band: 2.4GHz Channel: 6 802.11: b/g/n SSID: Chromecast6286 noise: -87
BSSID: 00:22:07:3F:67:6B RSSI: -86 dBm Band: 2.4GHz Channel: 13 802.11: b/g/n SSID: Inteno-676C noise: -87
I am trying to print formatted data from this file to the terminal using awk. This is part of a much longer script. The following script illustrates the problem i need to solve:
#!/bin/sh
awk ' \
{for(i=1;i<=NF;i++)if($i~/SSID:/)printf "%s%s", "BSSID: " $(i+1)} \
{for(i=1;i<=NF;i++)if($i~/Channel:/)printf "%s%s\n", "Kanal: " $(i+1)}' nett
The second line with the Channel: works correctly, awk loops though the line one word at a time searching for the "Channel:" word and then prints the next word with some custom text. There may be a variable number of columns in a line, so targeting a spesific column will not always work in this case.
However, the real problem is the first line. There are two problems here that needs addressing:
1: Since there are both a word "BSSID" and "SSID" then the search pattern needs to be exact. Currently both "BSSID" and "SSID" is matched.
2: The text that i need to print out may in this case be more than one word, like in the fourth line:
BSSID: 02:26:16:B2:37:AD RSSI: -73 dBm Band: 2.4GHz Channel: 6 802.11: b/g SSID: Trimble Service (5132555899) noise: -87
Here I need awk to locate multiple words between SSID: and noise: and print all words.
In the current state of the script I get the output:
BSSID: 02:26:16:B2:37:ADBSSID: TrimbleKanal: 6
Since awk will process the rest of the output correctly, then an pure awk solution to this will be much appreciated. Please note that output lacks spacing in the right places which is done on purpose to make the problem as compact and visible as possible.
Best regards!
Given your posted answer, here is the sensible way to implement the awk part from your question (and the shell print '\n' after it in your answer):
$ cat tst.sh
awk '
BEGIN { FS=": +" }
{
for (i=1;i<=NF;i++) {
value = $i; sub(/ +[^ ]+$/,"",value)
n2v[name] = value
name = $i; sub(/.* /,"",name)
}
printf "SSID: %-32s", n2v["SSID"]
printf "BSSID: %-20s", n2v["BSSID"]
printf "RSSI: %s, ", n2v["RSSI"]
printf "noise: %s dBm ", n2v["noise"]
printf "Kanal: %-2s\n", n2v["Channel"]
}
END { print "" }
' nett
$ ./tst.sh
SSID: Inteno_24 BSSID: 00:22:07:29:D4:23 RSSI: -71 dBm, noise: -70 dBm Kanal: 1
SSID: AK-Gjester BSSID: 00:19:77:12:97:94 RSSI: -54 dBm, noise: -70 dBm Kanal: 1
SSID: AK-Ansatt BSSID: 00:19:77:12:97:95 RSSI: -55 dBm, noise: -70 dBm Kanal: 1
SSID: Trimble Service (5132555899) BSSID: 02:26:16:B2:37:AD RSSI: -73 dBm, noise: -87 dBm Kanal: 6
SSID: Chromecast6286 BSSID: FA:8F:CA:88:F9:8E RSSI: -45 dBm, noise: -87 dBm Kanal: 6
SSID: Inteno-676C BSSID: 00:22:07:3F:67:6B RSSI: -86 dBm, noise: -87 dBm Kanal: 13
$
The above will work with any awk in any OS.
Use gawk capture groups:
$ gawk 'match($0,/^BSSID:\s+(\S+).*Channel:\s+(\S).*SSID:\s+(.*noise:\s+\S+)/,a)\
{print a[1],a[3],a[2]}' nett
Column by column:
$ gawk 'match($0,/BSSID:\s+(\S+)/,a){printf(a[1]" ")}
match($0,/\s+SSID:\s+(.*noise:\s+\S+)/,a){printf a[1]" "}
match($0,/\s+Channel:\s+(\S+)/,a){printf a[1]"\n"}' nett
Note \s+SSID:\s+(.*noise:\s+\S+) will capture everything between SSID and noise columns.
Results
00:22:07:29:D4:23 Inteno_24 noise: -70 1
00:19:77:12:97:94 AK-Gjester noise: -70 1
00:19:77:12:97:95 AK-Ansatt noise: -70 1
02:26:16:B2:37:AD Trimble Service (5132555899) noise: -87 6
FA:8F:CA:88:F9:8E Chromecast6286 noise: -87 6
00:22:07:3F:67:6B Inteno-676C noise: -87 1
Check gawk documentation.
You can use some character index maths to extract the words between SSID and noise in your line 1 problem, and match SSID and BSSID separately. Ugly but it works :-/
#!/bin/sh
awk ' \
{for(i=1;i<=NF;i++)if($i~/BSSID:/)printf "BSSID%s", $(i+1)}
{for(i=1;i<=NF;i++)if($i~/^SSID:/){ s=index($0," SSID");e=index($0," noise"); printf "SSID:%s", substr($0,s+5,e-(s+6))}} \
{for(i=1;i<=NF;i++)if($i~/Channel:/)printf "%s%s\n", "Kanal: ", $(i+1)}' nett
on your input file sample gets me this output
BSSID:: Inteno_24Kanal: 1
BSSID00:19:77:12:97:94BSSID:: AK-GjesterKanal: 1
BSSID00:19:77:12:97:95BSSID:: AK-AnsattKanal: 1
BSSID02:26:16:B2:37:ADBSSID:: Trimble Service (5132555899)Kanal: 6
BSSIDFA:8F:CA:88:F9:8EBSSID:: Chromecast6286Kanal: 6
BSSID00:22:07:3F:67:6BBSSID:: Inteno-676CKanal: 13
gawk
awk 'function w(m){match($0,"\\<"m": ([^ ]*) ",a);return a[1]}{print w("BSSID"),w("SSID"),w("Channel")}' file
00:22:07:29:D4:23 Inteno_24 1
00:19:77:12:97:94 AK-Gjester 1
00:19:77:12:97:95 AK-Ansatt 1
02:26:16:B2:37:AD Trimble 6
FA:8F:CA:88:F9:8E Chromecast6286 6
00:22:07:3F:67:6B Inteno-676C 13
Here is what I ended up with: (all comments, variables and filenames in norwegian). This particular solution can be lookup up by searching for "# Presenter nabonettverk"
#!/bin/sh
# Sletter eventuelle eldre filer
if [ -e linje ] ; then rm linje ; fi
if [ -e temp_assoc ] ; then rm temp_assoc ; fi
if [ -e temp_assoc_dhcp ] ; then rm temp_assoc_dhcp ; fi
if [ -e temp_assoc_static ] ; then rm temp_assoc_static ; fi
if [ -e bssid ] ; then rm bssid ; fi
if [ -e noise ] ; then rm noise ; fi
if [ -e temp_mac ] ; then rm temp_mac ; fi
if [ -e temp_mac2 ] ; then rm temp_mac2 ; fi
if [ -e kabel_dhcp ] ; then rm kabel_dhcp ; fi
if [ -e kabel_statisk ] ; then rm kabel_statisk ; fi
# Presenter linjedata
clear
cat /etc/banner | grep STY
printf '%-72s\n' "============================== LINJE ============================="
adsl info --stats | grep -m 1 -B 1 -i "Bearer:" > linje
adsl info --stats | grep -i mode -m 1 >> linje
adsl info --stats | grep -w -A 3 -i down >> linje
adsl info --stats | grep -m 1 -i hec >> linje
adsl info --stats | grep -A 2 -i "total time" >> linje
adsl info --stats | grep -A 2 -i since >> linje
cat linje
rm linje
# Presenter tilkoblinger
printf '\n%91s\n' "=================================== TILKOBLINGER =========================================="
printf '%-13s\t%-6s%-6s\t%-6s%-6s\t%-6s%-6s\t%-6s%-6s\t%-6s%-6s\n' \
"Grensesnitt:" \
"WLAN:" \
"$(if [ "$(cat /sys/class/net/wl0/operstate)" == "unknown" ] ; then printf '%s' "aktiv" ; fi)" \
"LAN1:" \
"$(if [ "$(cat /sys/class/net/eth4/operstate)" == "up" ] ; then printf '%s' "aktiv" ; else printf '%s' "av" ; fi)" \
"LAN2:" \
"$(if [ "$(cat /sys/class/net/eth3/operstate)" == "up" ] ; then printf '%s' "aktiv" ; else printf '%s' "av" ; fi)" \
"LAN3:" \
"$(if [ "$(cat /sys/class/net/eth2/operstate)" == "up" ] ; then printf '%s' "aktiv" ; else printf '%s' "av" ; fi)" \
"LAN4:" \
"$(if [ "$(cat /sys/class/net/eth1/operstate)" == "up" ] ; then printf '%s' "aktiv" ; else printf '%s' "av" ; fi)"
# Finn antall og type enheter
total=$(brctl showmacs br-lan | grep -v 00:22:07 | grep -v 02:22:07 | tail +2 | wc -l)
wlan=$(wlctl assoclistinfo | tail -n +3 | awk '{print $2}' | wc -l)
kabel=$(( $total-$wlan ))
# Presenter enheter
printf '%-30s\t%-8s%-3s\t%-6s%-3s\t%-8s%-3s\n\n' "Aktive nettverkstilkoblinger:" "Totalt:" "$total" "WLAN:" "$wlan" "Kablet:" "$kabel"
total=
# Dersom trådløs er aktivert
if [ "$(cat /sys/class/net/wl0/operstate)" == "unknown" ]
then
# Hent alle trådløse enheters MAC-adresse
wlctl assoclistinfo | tail -n +3 | awk '{print $2}' > temp_assoc
printf '%s\n' "================================================= WIRELESS =================================================="
# Antennehastighet
wlctl rate > wlrate
# Hent modemets ssid, bakgrunnsstøy og kanal. Presenter resultat.
wlctl status | grep -B 1 -i mode | awk 'NR%2{printf $0" ";next;}1' | awk -F'"' '{print $2}' >> modem_ssid
wlctl status | grep -B 1 -i mode | awk 'NR%2{printf $1" ";next;}1' | awk {'print " Bakgrunnstoy(noise): " $11"dBm, kanal " $14'} >> modem_ssid2
printf '%-6s%-32s%-18s%-9s%s\n' "SSID: " "$(cat modem_ssid)" "Antennehastighet: " "$(cat wlrate)" "$(cat modem_ssid2)"
rm modem_ssid modem_ssid2 wlrate
# Hent andre trådløse nettverk og skriv til bssid (fil) og bakgrunnsstøy til noise (fil) dersom dette finnes
if [ -n "$(wlctl scanresults_summary)" ]
then
wlctl scanresults_summary >> bssid
wlctl scanresults | grep -B 1 -i mode | sed '/^--$/d' | awk 'NR%2{printf $1" ";next;}1' | awk '{for(i=1;i<=NF;i++)if($i~/noise:/)print $(i+1)}' >> noise
else
printf '\n'
# /if [ -n "$(wlctl scanresults_summary)" ]
fi
# List opp nabonettverk. Dersom bssid (fil) finnes, så finnes også noise (fil)
if [ -e bssid ]
then
printf '%s\n' "Andre nettverk ----------------------------------------------------------------------------------------------"
# Flett sammen bssid (fil) og noise (fil) til nett (fil)
exec 6<noise
while read -r line ; do
read -r f2line <&6
echo $line " noise: "$f2line >> nett
done < bssid
exec 6<&-
rm bssid noise
# Presenter nabonettverk
awk ' \
{for(i=1;i<=NF;i++)if($i~/^SSID:/){ s=index($0," SSID");e=index($0," noise"); printf "SSID%-34s", substr($0,s+5,e-(s+6))}} \
{for(i=1;i<=NF;i++)if($i~/BSSID:/)printf "BSSID: %-20s", $(i+1)} \
{for(i=1;i<=NF;i++)if($i~/RSSI:/)printf "RSSI: %s dBm, ", $(i+1)} \
{for(i=1;i<=NF;i++)if($i~/noise:/)printf "noise: %s dBm ", $(i+1)} \
{for(i=1;i<=NF;i++)if($i~/Channel:/)printf "%-7s%-2s\n", "Kanal: ", $(i+1)}' nett
printf '\n'
rm nett
# /if [ -e bssid ]
fi
# Sorter wifi enheter i dhcp og statisk liste
while read enhet; do
if [ -z "$(grep -i $enhet /tmp/dhcp.leases)" ]
then
printf '%s\n' "$enhet" >> temp_assoc_static
else
printf '%s\n' "$enhet" >> temp_assoc_dhcp
fi
done < temp_assoc
rm temp_assoc
# Dersom trådløse maskiner finnes i DHCP-tabellen presenteres disse som dynamisk satte klienter
if [ -e temp_assoc_dhcp ]
then
printf '%s\n' "Klienter (DHCP)----------------------------------------------------------------------------------------------"
while read enhet; do
printf '%-6s%-32s%-5s%-19s%-4s%-16s%-20s%-4s%-3s\n' \
"Navn: " \
"$(cat /tmp/dhcp.leases | grep -i $enhet | awk {'printf $4'})" \
"MAC: " \
"$(cat /tmp/dhcp.leases | grep -i $enhet | awk {'printf $2'})" \
"IP: " \
"$(cat /tmp/dhcp.leases | grep -i $enhet | awk {'printf $3'})" \
"Signalstyrke(RSSI):" \
"$(wlctl rssi $enhet)" \
"dBm"
done < temp_assoc_dhcp
rm temp_assoc_dhcp
fi
# Dersom trådløse maskiner ikke finnes i DHCP-tabellen presenteres disse som statisk satte klienter
if [ -e temp_assoc_static ]
then
printf '%s\n' "Klienter (Statisk) ------------------------------------------------------------------------------------------"
while read enhet; do
printf '%-38s%-5s%-19s%-4s%-16s%-20s%-4s%-3s\n' \
"Statisk (navn ikke synlig)" \
"MAC:" \
"$enhet" \
"IP:" \
"$(grep -i $enhet /proc/net/arp | awk '{print $1}')" \
"Signalstyrke(RSSI):" \
"$(wlctl rssi $enhet)" \
"dBm"
done < temp_assoc_static
rm temp_assoc_static
fi
# /if [ "$(cat /sys/class/net/wl0/operstate)" == "unknown" ]
fi
# Dersom minst en kablet maskin eksisterer
if [ "$kabel" -gt 0 ]
then
# Hent alle MAC-adresser tilkoblet
brctl showmacs br-lan | grep -v 00:22:07 | grep -v 02:22:07 | tail -n +2 | awk '{print $2}' > temp_mac
# Dersom minst en trådløs maskin
if [ "$wlan" -gt 0 ]
then
wlctl assoclistinfo | tail -n +3 | awk '{print $2}' > temp_assoc
# Fjern alle trådløse MAC fra den generelle listen
while read enhet ; do
if [ -z "$(grep -i $enhet temp_assoc)" ]
then
printf '%s\n' "$enhet" >> temp_mac2
fi
done < temp_mac
rm temp_mac
rm temp_assoc
# /if [ "$wlan" -gt 0 ]
fi
# Dersom ingen trådløse klienter bruker vi opprinnelig MAC liste
if ! [ -e temp_mac2 ]
then
mv temp_mac temp_mac2
fi
# Sorter kablede enheter i dhcp og statisk liste
while read enhet; do
if [ -z "$(grep -i $enhet /tmp/dhcp.leases)" ]
then
printf '%s\n' "$enhet" >> kabel_statisk
else
printf '%s\n' "$enhet" >> kabel_dhcp
fi
done < temp_mac2
rm temp_mac2
# Har nå enten liste over dynamisk tildelte klienter eller statisk satte klienter eller begge deler
printf '%-110s\n' "================================================== KABEL ==================================================="
# Presenter kablede dynamiske klienter
if [ -e kabel_dhcp ]
then
printf '%s\n' "Klienter (DHCP)----------------------------------------------------------------------------------------------"
while read enhet ; do
printf '%-6s%-32s%-5s%-19s%-4s%-16s\n' \
"Navn: " \
"$(cat /tmp/dhcp.leases | grep -i $enhet | awk {'printf $4'})" \
"MAC: " \
"""$(cat /tmp/dhcp.leases | grep -i $enhet | awk {'printf $2'})" \
"IP: " \
"$(cat /tmp/dhcp.leases | grep -i $enhet | awk {'printf $3'})"
done < kabel_dhcp
rm kabel_dhcp
# /if [ -e kabel_dhcp ]
fi
# Presenter kablede statiske klienter
if [ -e kabel_statisk ]
then
printf '%s\n' "Klienter (Statisk) ------------------------------------------------------------------------------------------"
while read enhet ; do
printf '%-38s%-5s%-19s%-4s%-16s\n' \
"Statisk (navn ikke synlig)" \
"MAC:" \
"$enhet" \
"IP:" \
"$(grep -i $enhet /proc/net/arp | awk '{print $1}')"
done < kabel_statisk
rm kabel_statisk
# /if [ -e kabel_statisk ]
fi
# /if [ "$kabel" -gt 0 ]
fi
# Opprydding
kabel=
wlan=
printf '\n\n%s\n\n' "WIFI nettverkslisten kan oppdateres manuelt med 'wlctl scan', merk at dette tar 15 sekunder."
Output:
IOP Version: DG150-WU7P2U_STY2.4.11RC1-150127_1608
============================== LINJE =============================
Max: Upstream rate = 1277 Kbps, Downstream rate = 15388 Kbps
Bearer: 0, Upstream rate = 669 Kbps, Downstream rate = 7198 Kbps
Mode: ADSL2+ Annex B
Down Up
SNR (dB): 9.4 19.2
Attn(dB): 40.5 23.2
Pwr(dBm): 19.5 13.1
HEC: 1655 0
Total time = 49 days 16 hours 25 sec
FEC: 10300984 716
CRC: 1238 0
Since Link time = 4 days 14 hours 31 min 17 sec
FEC: 824368 212
CRC: 141 0
=================================== TILKOBLINGER ==========================================
Grensesnitt: WLAN: aktiv LAN1: av LAN2: aktiv LAN3: aktiv LAN4: aktiv
Aktive nettverkstilkoblinger: Totalt: 3 WLAN: 0 Kablet: 3
================================================= WIRELESS ==================================================
SSID: Inteno-859A Antennehastighet: 144 Mbps Bakgrunnstoy(noise): -80dBm, kanal 1
Andre nettverk ----------------------------------------------------------------------------------------------
SSID: Liverpool BSSID: 00:21:29:0C:6E:B8 RSSI: -61 dBm, noise: -78 dBm Kanal: 6
SSID: Liverpool1 BSSID: B8:A3:86:55:C2:9C RSSI: -62 dBm, noise: -78 dBm Kanal: 11
SSID: Kjetil sin Chromecast BSSID: FA:8F:CA:76:98:6A RSSI: -64 dBm, noise: -78 dBm Kanal: 11
================================================== KABEL ===================================================
Klienter (DHCP)----------------------------------------------------------------------------------------------
Navn: * MAC: 00:21:29:0c:6e:b7 IP: 192.168.1.129
Navn: DIR-655 MAC: b8:a3:86:55:c2:9d IP: 192.168.1.113
Klienter (Statisk) ------------------------------------------------------------------------------------------
Statisk (navn ikke synlig) MAC: 00:10:f3:18:c2:9f IP: 192.168.1.20
WIFI nettverkslisten kan oppdateres manuelt med 'wlctl scan', merk at dette tar 15 sekunder.
You can process it in one loop just assign them to variables, this method is also adaptable to other situations. If for instance the order of the data is rearranged this will still handle it as you had before with multiple loops.
#!/bin/sh
awk ' \
{for(i=1;i<=NF;i++) {
if($i~/Channel:/)chan="Kanal: "$(i+1)
if($i~/^SSID:/)ssid="SSID: "$(i+1)
if($i~/^BSSID:/)bssid="BSSID: "$(i+1)
if($i~/^noise:/)noise="noise: "$(i+1)
if($i~/^RSSI:/)rssid="RSSI: "$(i+1)
if ((length(chan)>1) && (length(ssid)>1) && (length(bssid)>1) && (length(noise)>1) && (length(rssid)>1)) {
printf "%-30s %-24s %-10s dBm, %s\n",ssid,bssid,rssid,noise,chan
chan="";ssid="";bssid="";noise="";rssid=""
}
} }' "${1}"
Fyi: I took your test data and cat'd it to itself 20k times. Then ran a test using your solution with multiple loops vs. the above and the result was:
cp awk_test.txt awk_test_tmp.txt; for i in {1..20000}; do cat awk_test_tmp.txt >> awk_test.txt; done
$> time selected_solution.awk awk_test.txt 1>/dev/random
real 0m5.944s
user 0m5.500s
sys 0m0.440s
$> time my.awk awk_test.txt 1>/dev/random
real 0m4.733s
user 0m4.382s
sys 0m0.347s

Alternation in regular expression NOT working (use of pipe symbol | ) to zero in on value types

I did a little reading up and realized the pipe symbol | can be used like "or" logic when matching. I've tried to incorporate this in my following code but it doesn't work in doing some text processing that follows regexp (see snippet code below file format) . First here's my file type (.lib used in chip design)
pin (d) {
direction : input;
nextstate_type : data;
related_ground_pin : vss;
related_power_pin : vcc;
max_transition : 0.4;
capacitance : 0.000719782;
rise_capacitance : 0.000719782;
rise_capacitance_range (0.000462301, 0.000719782);
fall_capacitance : 0.000569233;
fall_capacitance_range (0.000459043, 0.000569233);
timing () {
related_pin : "clk";
timing_type : setup_rising;
rise_constraint (constraint_template_5X5) {
index_1 ("0.01, 0.05, 0.12, 0.2, 0.4");
index_2 ("0.005, 0.025, 0.06, 0.1, 0.3");
index_3 ("0.084, 0.84, 3.36, 8.4, 13.44") ;
values ( \
"5.1,1.2,1.3,1.4,1.5", \
"9.1,2.2,2.3,2.4,2.5", \
"3.1,3.2,3.3,3.4,3.5", \
"4.1,4.2,4.3,4.4,4.5", \
"5.1,5.2,5.3,5.4,5.5", \
"6.1,6.2,6.3,6.4,6.5", \
"7.1,7.2,7.3,7.4,7.5", \
"8.1,8.2,8.3,8.4,8.5", \
"9.1,9.2,9.3,9.4,9.5", \
"10.1,10.2,10.3,10.4,10.5", \
"11.1,11.2,11.3,11.4,11.5", \
"12.1,12.2,12.3,12.4,12.5", \
"13.1,13.2,13.3,13.4,13.5", \
"14.1,14.2,14.3,14.4,14.5", \
"15.1,15.2,15.3,15.4,15.5", \
"16.1,16.2,16.3,16.4,16.5", \
"17.1,17.2,17.3,17.4,17.5", \
"18.1,18.2,18.3,18.4,18.5", \
"19.1,19.2,19.3,19.4,19.5", \
"20.1,20.2,20.3,20.4,20.5", \
"21.1,21.2,21.3,21.4,21.5", \
"22.1,22.2,22.3,22.4,22.5", \
"23.1,23.2,23.3,23.4,23.5", \
"24.1,24.2,24.3,24.4,24.5", \
"25.1,25.2,25.3,25.4,25.5", \
);
}
fall_constraint (constraint_template_5X5) {
index_1 ("0.01, 0.05, 0.12, 0.2, 0.4");
index_2 ("0.005, 0.025, 0.06, 0.1, 0.3");
index_3 ("0.084, 0.84, 3.36, 8.4, 13.44") ;
values ( \
"1.1,1.2,1.3,1.4,1.5", \
"2.1,2.2,2.3,2.4,2.5", \
"3.1,3.2,3.3,3.4,3.5", \
"4.1,4.2,4.3,4.4,4.5", \
"5.1,5.2,5.3,5.4,5.5", \
"6.1,6.2,6.3,6.4,6.5", \
"7.1,7.2,7.3,7.4,7.5", \
"8.1,8.2,8.3,8.4,8.5", \
"9.1,9.2,9.3,9.4,9.5", \
"10.1,10.2,10.3,10.4,10.5", \
"11.1,11.2,11.3,11.4,11.5", \
"12.1,12.2,12.3,12.4,12.5", \
"13.1,13.2,13.3,13.4,13.5", \
"14.1,14.2,14.3,14.4,14.5", \
"15.1,15.2,15.3,15.4,15.5", \
"16.1,16.2,16.3,16.4,16.5", \
"17.1,17.2,17.3,17.4,17.5", \
"18.1,18.2,18.3,18.4,18.5", \
"19.1,19.2,19.3,19.4,19.5", \
"20.1,20.2,20.3,20.4,20.5", \
"21.1,21.2,21.3,21.4,21.5", \
"22.1,22.2,22.3,22.4,22.5", \
"23.1,23.2,23.3,23.4,23.5", \
"24.1,24.2,24.3,24.4,24.5", \
"25.1,25.2,25.3,25.4,25.5", \
);
}
}
}
Ok, so I have to do some text processing (aided by Brad Lanam - user of SO) which is done as follows. The aim of this piece of code is to zero in on the right types of constraints (in my .lib) to do text processing.
set inFile [open "C:/Tcl/official/ref.lib" r]
set inval false
set foundValues 0
set found_setup 0
set found_fall 0
set extract1 0
set extract2 0
set DETECT_END_SYNTAX {\);}
while { [gets $inFile line] >= 0 } {
if { [regexp {setup_rising;} $line] } { set found_setup 1 }
if { [regexp {hold_rising;} $line] } { set found_setup 0 }
if { $found_setup } {
if { [regexp {rise_constraint|fall_constraint} $line] } { set found_fall 1 }
if { $found_fall } {
if {[regexp {values} $line]} {
set foundValues 1
}
if {$foundValues} {
if { [regexp $DETECT_END_SYNTAX $line] } {
if { $inval } {
set inval false
set foundValues 0
set found_fall 0
}
}
}
}
}
}
# { Do text processing after this }
But
if { [regexp {rise_constraint|fall_constraint} $line] }
# Does NOT work
in matching either rise_constraint or fall_constraint to do some regsub commands. My code only ends up processing values for rise_constraint in the modified file written out. I need the values of both constraint types to be changed. Am I doing something wrong in the regexp? Thanks!
Should I just do this:
if { [regexp {rise_constraint} $line] } { set found_fall 1 }
if { [regexp {fall_constraint} $line] } { set found_fall 1 }
Instead of:
if { [regexp {rise_constraint|fall_constraint} $line] } { set found_fall 1 }
Note: found_fall actually will find even the rise_constraint values, it's just a variable.
Reference: tcl text processing - rearrange values in rows and columns based on user defined value
if { [regexp {rise_constraints|fall_constraint} $line] }
Doesn't work because there is no rise_constraints in the lines. There is rise_constraint with no s.
Also, try to better indent your code next time.

Visual C++ compiling error

When compiling these two files I am getting numerous errors. Please help me out.
stchart.cpp
# include "peg.hpp"
# include "stchart.hpp"
# include "stchart_res.hpp"
external PegResourceTable stchart_ResourceTable;
PEGINT gChartData [] = (100, 100, 100, 100, 100, 100, 125, 150, 175, 200,
150, 100, 50, 100, 125, 100, 100, 100);
PEGINT gBukData [] = (100, 100, 100, 100, 100, 100, 100, 100, 125, 100,
100, 120, 140, 160, 180, 200, 150, 100, 50, 125, 100,
100, 125, 150, 125, 100, 100, 100, 100);
/*------------------------------------------------ --------------------------*/
/*------------------------------------------------ --------------------------*/
Strip Chart Window:: Window Strip Chart (PegRect const Rect &,
const PEGUINT titleid):
PegDecoratedWindow (Rect)
(
PEGCOLOR tempColor1, tempColor2, tempColor3;
if (titleid)
(
Add (new PegTitle (titleid));
)
PegRect Chart mClient = Rect;
ChartRect.Bottom = mClient.Height () / 2 to 2;
mpChart = new PegStripChart (Chart Rect, 130, -100, 700, 10, 100);
mpChart-> SetExStyle (mpChart-> GetExStyle () | CS_DRAWYGRID |
CS_DRAWXGRID | CS_DRAWXTICS | CS_DRAWYLABELS |
CS_SCROLLED | / / CS_DUALYTICS | CS_DRAWLINEFILL |
CS_DRAWXLABELS | CS_DUALYTICS | CS_DRAWXLABELS |
CS_DUALYLABELS);
mpChart-> SetExStyle (mpChart-> GetExStyle () & ~ CS_PAGED);
Add (mpChart);
tempColor1 = PegResourceManager:: GetColor (CID_CYAN);
tempColor2 = PegResourceManager:: GetColor (CID_BLUE);
tempColor3 = PegResourceManager:: GetColor (CID_MAGENTA);
mSin = mpChart-> AddLine (tempColor1, tempColor1, tempColor3);
tempColor1 = PegResourceManager:: GetColor (CID_LIGHTGREEN);
tempColor2 = PegResourceManager:: GetColor (CID_GREEN);
tempColor3 = PegResourceManager:: GetColor (CID_RED);
MID-mpChart => AddLine (tempColor1, tempColor1, tempColor3);
mpChart-> SetYLabelScale (200);
ChartRect.Top = ChartRect.Bottom + 4;
ChartRect.Bottom = mClient.Bottom;
mpChart2 = new PegStripChart (Chart Rect, 130, -200, 600, 10, 100);
mpChart2-> SetExStyle (mpChart2-> GetExStyle () | CS_DRAWAGED |
CS_XAXISONZEROY | CS_DRAWXTICS | CS_DRAWXLABELS);
/ / CS_DRAWLINEFILL);
Add (mpChart2);
tempColor1 = PegResourceManager:: GetColor (CID_LIGHTBLUE);
tempColor2 = PegResourceManager:: GetColor (CID_BLUE);
tempColor3 = PegResourceManager:: GetColor (CID_CYAN);
mSin2 = mpChart2-> AddLine (tempColor1, tempColor1, tempColor3);
tempColor1 = PegResourceManager:: GetColor (CID_LIGHTGREEN);
tempColor2 = PegResourceManager:: GetColor (CID_GREEN);
tempColor3 = PegResourceManager:: GetColor (CID_GREEN);
mID2 = mpChart2-> AddLine (tempColor1, tempColor1, tempColor3);
)
/*------------------------------------------------ --------------------------*/
/*------------------------------------------------ --------------------------*/
PEGINT Strip Chart Window:: Message (const PegMessage & mesg)
(
static PEGINT Index = 0, j = 0;
static PEGINT Angle = 0;
switch (Mesg.Type)
(
PM_SHOW case:
PegWindow:: Message (mesg);
SetTimer (1, PEG_ONE_SECOND, 1);
break;
PM_HIDE case:
PegWindow:: Message (mesg);
Kill Timer (1);
break;
PM_TIMER case:
(
if (+ + index> 17)
(
Index = 0;
)
mpChart-> AddData (MID, gChartData [Index]);
if (+ + j> 28)
(
j = 0;
)
mpChart2-> AddData (mID2, gBukData [j]);
if ((Angle + = 10)> 350)
(
Angle = 0;
)
PEGINT Sin, Cos;
PegLookupSinCos (Angle, & Sin, Cos &);
mpChart-> AddData (mSin, (PEGLONG) ((Sin * 125)>> 10) + 400);
mpChart2-> AddData (mSin2, (PEGLONG) ((125 * Cos)>> 10) + 400);
)
default:
(
return (PegWindow:: Message (mesg));
)
)
return 0;
)
/*------------------------------------------------ --------------------------*/
/*------------------------------------------------ --------------------------*/
void PegAppInitialize (PegPresentationManager * pPresentation)
(
PegRect Rect;
Rect.Set (10, 10, 630, 470);
PegResourceManager:: Install Resources From Table (&
stchart_ResourceTable);
Strip Chart Window * pWindow = new Strip Chart Window (Rect, SID_TITLE);
pPresentation-> Add (pWindow);
)
stchart.hpp:
Strip Chart class Window: public PegDecoratedWindow
(
public:
Strip Chart Window (PegRect const Rect &, const PEGUINT titleid);
Strip Chart virtual ~ Window () ()
virtual PEGINT Message (const PegMessage & mesg);
public:
PegStripChart * mpChart;
PegStripChart * mpChart2;
PEGUBYTE mid;
PEGUBYTE mSin;
PEGUBYTE mID2;
PEGUBYTE mSin2;
);
ERRORS:
-------------------- Configuration: stchart - Win32 Debug --------------------
Compiling ...
stchart.cpp
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (29): error C2143: syntax error: missing ',' before '*'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (29): error C2501: 'PegStripChart': missing storage-class or type specifiers
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (29): error C2501: 'mpChart': missing storage-class or type specifiers
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (30): error C2143: syntax error: missing ',' before '*'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (30): error C2501: 'PegStripChart': missing storage-class or type specifiers
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (30): error C2501: 'mpChart2': missing storage-class or type specifiers
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (45): error C2065: 'mpChart': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (45): error C2061: syntax error: identifier 'PegStripChart'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (46): error C2227: left of '-> SetExStyle' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (46): error C2227: left of '-> GetExStyle' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (46): error C2065: 'CS_DRAWYGRID': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (46): error C2065: 'CS_DRAWXGRID': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (47): error C2065: 'CS_DRAWXTICS': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (47): error C2065: 'CS_DRAWYLABELS': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (47): error C2065: 'CS_SCROLLED': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (49): error C2065: 'CS_DUALYTICS': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (49): error C2065: 'CS_DRAWXLABELS': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (50): error C2065: 'CS_DUALYLABELS': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (51): error C2227: left of '-> SetExStyle' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (51): error C2227: left of '-> GetExStyle' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (51): error C2065: 'CS_PAGED': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (56): error C2227: left of '-> AddLine' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (61): error C2227: left of '-> AddLine' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (62): error C2227: left of '-> SetYLabelScale' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (66): error C2065: 'mpChart2': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (66): error C2061: syntax error: identifier 'PegStripChart'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (67): error C2227: left of '-> SetExStyle' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (67): error C2227: left of '-> GetExStyle' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (67): error C2065: 'CS_DRAWAGED': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (68): error C2065: 'CS_XAXISONZEROY': undeclared identifier
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (75): error C2227: left of '-> AddLine' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (80): error C2227: left of '-> AddLine' must point to class / struct / union
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')'
c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.
** stchart.obj - 102 error (s), 0 warning (s) **
It appears that PegStripChart is not declared in any of the files you've shown us and this seems tobe causing the first few errors at least.
Is it declared in peg.hpp?
Pay attention on your switch operator it should be:
switch (Mesg.Type)
(
case PM_SHOW:
PegWindow:: Message (mesg);
SetTimer (1, PEG_ONE_SECOND, 1);
break;
case PM_HIDE:
PegWindow:: Message (mesg);
Kill Timer (1);
break;
.............................
.............................
And you wrote:
switch (Mesg.Type)
(
PM_SHOW case :
PegWindow:: Message (mesg);
SetTimer (1, PEG_ONE_SECOND, 1);
break;
PM_HIDE case :
PegWindow:: Message (mesg);
Kill Timer (1);
break;
........................
.....................
You are using ()'s where you should be using {}'s
e.g, your if-blocks, switch statements, method declarations, etc.