Alien-Judy

 view release on metacpan or  search on metacpan

src/judy-1.0.5/test/jbgraph  view on Meta::CPAN

        esac
	shift
    done

# The rest of the command line parameters are files:

    # If FILES is already set, leave it alone, else set it.
    # This is necessary due running getopt twice, to support parameters
    # embedded in the data files.
    if [ "${FILES}" = "" ]; then
        FILES="${FILES} ${*}" 		# May result in a blank, " ".
       if [ "${FILES}" = " " ]; then    # If blank, " ", make it empty.
	   FILES=""			# Make FILES empty again.
       fi
        ${v}echo "${C}.${0}:  FILES=${FILES}"
    fi

# Set default options, if no applicable plot options were set.
    COL_CTR="${#COL[*]}"		# Columns were turned on.
    ${v}echo "COL_CTR=${COL_CTR}, COL=${COL[*]}"

    if [ "${COL_CTR}" = "0" ]; then		# Option not set
	${v}echo "${C}.${0}:  Setting default options."
	FUNCTION__getopt -c2 -c4	# Set default, if no options set.
    fi
    if [ "${OPT_C}" = "-C" ] ||		# If -C or -P, ensure -S.
       [ "${OPT_P}" = "-P" ]; then
	if [ "${OPT_S}" != "-S" ]; then
        FUNCTION__getopt -S		# -S save files.
        fi
    fi

# Save a shar copy of this script, if -S and -v are both on.
# Turned off, may be useful later.

#    if [ ! -z "${OPT_S}" ] &&		# -S save files.
#       [ "${OPT_v}" = "-v" ]; then	# -v verbose mode.
#            ${v}echo "${C}.${0}:  start of shar of script"
#	    shar -b ${C_PATH} >>${COMMAND}.shar
#            ${v}echo "${C}.${0}:  end   of shar of script\n"
#    fi

    ${v}echo "${C}.${0}:  completed at `date`\n"	# end of function
} # FUNCTION__getopt()			# Use function getopt.

FUNCTION_gnuplot_init()			# Initialize gnuplot command file.
{
# INITIALIZE GNU_CMDFILE
#
# - Pass options to gnuplot.
# - Some options for gnuplot are set here (logscale, autoscale).

    ${v}echo "${C}.${0}:  beginning at `date`"	# beginning of function
  {
    echo "# ${C_PATH} ${*}"
    echo "# gnuplot ${GNU_GEOMETRY} ${GNU_CMDFILE}"
    if [ "${OPT_L}" = "-L" ]; then	# -L set logscale axis
        echo "set logscale ${OPT_L_xaxis}${OPT_L_yaxis}"
    fi
    echo "set autoscale xy"
    echo "set data style lines"
    if [ ! -z "${OPT_G}" ]; then	# Turn on grids.
        echo "set grid"
    fi

# Naming convention... build some kind of TITLE name, if none given.

    TITLE="${TITLE:-JUDY BENCHMARK:  $CMD_LINE }" # Set default.

    echo "set title  \"${TITLE}\"  0,0 "
    if [ "${xRANGE}" != "" ]; then
        echo "set xrange `FUNCTION_units ${xRANGE}`"
	XLABEL="${XLABEL} ${xRANGE}"
    fi
    if [ "${yRANGE}" != "" ]; then
        echo "set yrange `FUNCTION_units ${yRANGE}`"
	YLABEL="${YLABEL} ${yRANGE}"
    fi
    echo "set xlabel \"${XLABEL}\" 0,0"
    echo "set ylabel \"${YLABEL}\" 0,0"
    echo "set label \"${XLOG}\" at  1,1"
  } >> ${GNU_CMDFILE}

    ${v}echo "${C}.${0}:  completed at `date`\n"	# end of function
} # FUNCTION_gnuplot_init()		# Initialize gnuplot command file.

FUNCTION_gnuplot_plot()			# Plot these files.
{
# FORMAT THE PLOT AND REPLOT COMMANDS
# 
# - output to GNU_CMDFILE.

    ${v}echo "${C}.${0}:  beginning at `date`"	# beginning of function
    ${v}echo "${C}.${0}:  FILES=${*}"

    Fgp_PARM="${*}"			# Save what was passed in.
    Fgp_FILES=""			# Initialize list of good files.
    for i in ${Fgp_PARM}
    do
        if [ -r "$i" ]; then		# Check that files are readable.
            Fgp_FILES="${Fgp_FILES} ${i}" # Extend the list of good files.
	else
            echo "${C}.${0}:  WARNING:  file: ${i} cannot be read, ignored."
        fi
    done

    let j=1
    while [ ${j} -lt ${#CHA[*]} ]	# For each type of plot.
    do
        for i in ${Fgp_FILES}		# For each file.
        do
	    CMN="${COL[$j]}"
            if [ ! -z "${CMN}" ]; then
	      {
		MSG="`basename ${i}`"
		if [ "${OPT_H}" = "-H" ]; then
		    echo "${FIRST}plot \"${i}\" using 1:${CMN} t \"${CHA[${CMN}]} ${MSG}\""
		elif [ "${OPT_NH}" = "-NH" ]; then
		    echo "${FIRST}plot \"${i}\" using 1:${CMN} t \"${MSG}\""
		fi
	      } >> ${GNU_CMDFILE}



( run in 0.649 second using v1.01-cache-2.11-cpan-e1769b4cff6 )