Alien-Judy
view release on metacpan or search on metacpan
src/judy-1.0.5/test/jbgraph view on Meta::CPAN
LP_DEV_PARM="-d ${LP_DEV:-$LP_DEV_DEF}" # Printer device parameter.
LP_OPT_PARM="${LP_OPT:-$LP_OPT_DEF}" # Printer option parameters.
echo "${C}.${0}: executing command: "; echo "\n\
echo lp ${LP_DEV_PARM} ${LP_OPT_PARM} ${GNU_PSFILE}"
lp ${LP_DEV_PARM} ${LP_OPT_PARM} ${GNU_PSFILE}
${v}echo "${C}.${0}: completed at `date`\n" # end of function
} # FUNCTION_gnuplot_print() # Print the plot.
FUNCTION_TITLE_COLHEAD() # Set Column headings from file.
{
#
# Parse the TITLE and COLUMN HEADINGS (CHA) from the data, if available.
# Also parse other settable parameters, if available.
#
${v}echo "${C}.${0}: beginning at `date`" # beginning of function
FTC_FILES="${*}" # Local list of file names.
${v}echo "${C}.${0}: FTC_FILES=${FTC_FILES}"
# Choose the first readable file.
unset FTC_FILE # Hold the first readable filename.
for F in ${FTC_FILES} /dev/null # /dev/null ensures there is a file.
do
if [ -r "${F}" ] && # Is this file readable?
[ "${FTC_FILE}" = "" ]; then # We do not have one yet?
FTC_FILE="${F}" # Hold the first readable filename.
fi
done
# If FTC_FILE got set, use it to find TITLE, COLHEAD, XLABEL, YLABEL, et.al.
if [ "${FTC_FILE}" != "" ]; then # Use this file.
# Grab the FIRST TITLE line (head -1) and use it.
TITLE="`grep '^# *TITLE' ${FTC_FILE} | head -1 |
sed -e 's/^# *TITLE *//g'`"
${v}echo "${C}.${0}: TITLE=${TITLE}"
# Grab the FIRST XLABEL line (head -1) and use it.
XLABEL="`grep '^# *XLABEL' ${FTC_FILE} | head -1 |
sed -e 's/^# *XLABEL *//g'`"
${v}echo "${C}.${0}: XLABEL=${XLABEL}"
# Grab the FIRST YLABEL line (head -1) and use it.
YLABEL="`grep '^# *YLABEL' ${FTC_FILE} | head -1 |
sed -e 's/^# *YLABEL *//g'`"
${v}echo "${C}.${0}: YLABEL=${YLABEL}"
# Find each COLHEAD, and put it in the correct CHA[INDEX].
let i=0
while [ ${i} -lt ${#CHA[*]} ] # For each COLHEAD
do
# Grab one COLHEAD line at a time, put it into CHA[].
# Note, "@" not allowed in COLHEAD string.
LINE="`grep \"^#.*COLHEAD\" ${FTC_FILE} | # Find COLHEAD.
sed -e 's/^#.*COLHEAD*//g' \
-e 's/^ *//g' \
-e 's/@//g' | # Remove COLHEAD.
expand | sed -e 's/^0*//g' | # Remove leading zeros.
grep ^${i} | # Find a line matching ${i}.
head -1 `" # Make sure there is only 1.
# Grab the INDEX number, could do numeric check if problems.
INDEX="`echo ${LINE} | cut -d\" \" -f1`" # field 1 is number.
# If INDEX is not empty, save this COLHEAD.
if [ "${INDEX}" != "" ]; then
# Grab the rest of the line and save it into CHA.
REMAINDER="`echo ${LINE} | sed -e \"s@^${INDEX} *@@g\"`"
CHA[${INDEX}]="${REMAINDER}"
${v}echo "${C}.${0}: CHA[${INDEX}]=\"${CHA[${INDEX}]}\""
fi
let i=i+1
done
# GETOPT, pull in options to be set for this data.
GETOPT="`grep '^# *GETOPT' ${FTC_FILE} | head -1 |
sed -e 's/^# *GETOPT *//g'`"
if [ "${GETOPT}" != "" ]; then
FUNCTION__getopt ${GETOPT} # Parse the options.
fi
unset GETOPT
fi
${v}echo "${C}.${0}: completed at `date`\n" # end of function
} # FUNCTION_TITLE_COLHEAD() # Set Column headings from file.
FUNCTION_n() # -n number plot descriptions.
{
# ADD COLUMN NUMBER TO EACH ELEMENT IN CHA:
#
# - This is done for comparing plots, and/or debugging.
${v}echo "${C}.${0}: beginning at `date`" # beginning of function
${v}echo "${C}.${0}: OPT_n=${OPT_n}, # -n number plot descriptions"
let i=0
while [ ${i} -lt ${#CHA[*]} ]
do
CHA[${i}]="${i} ${CHA[${i}]}"
${v}echo "${C}.${0}: CHA[${i}]=\"${CHA[${i}]}\""
let i=i+1
done
${v}echo "${C}.${0}: completed at `date`\n" # end of function
} # FUNCTION_n() # -n number plot descriptions.
FUNCTION_units() # Resolve units.
{
#
# Expand units of the form 1K to 1000, 1M to 1000000, et.al.
# Used to format the gnuplot parameters xRANGE and yRANGE.
# gnuplot data format: "set xrange [1:1000000]"
#
Fu_IN="${1}" # Units in.
echo "["${Fu_IN}"]" |
sed -e "s/[kK]/000/g" | # 1,000
( run in 0.553 second using v1.01-cache-2.11-cpan-5b529ec07f3 )